Makefile 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # Use C++11, dont warn on long-to-float conversion
  2. CXXFLAGS += -std=c++11 -Wno-conversion
  3. # Default to using system's default version of python
  4. PYTHON_BIN ?= python
  5. PYTHON_CONFIG := $(PYTHON_BIN)-config
  6. PYTHON_INCLUDE ?= $(shell $(PYTHON_CONFIG) --includes)
  7. EXTRA_FLAGS := $(PYTHON_INCLUDE)
  8. LDFLAGS += $(shell $(PYTHON_CONFIG) --libs)
  9. # Either finds numpy or set -DWITHOUT_NUMPY
  10. EXTRA_FLAGS += $(shell $(PYTHON_BIN) $(CURDIR)/numpy_flags.py)
  11. WITHOUT_NUMPY := $(findstring $(EXTRA_FLAGS), WITHOUT_NUMPY)
  12. # Examples requiring numpy support to compile
  13. EXAMPLES_NUMPY := surface colorbar
  14. EXAMPLES := minimal basic modern animation nonblock xkcd quiver bar \
  15. fill_inbetween fill update subplot2grid lines3d \
  16. $(if $(WITHOUT_NUMPY),,$(EXAMPLES_NUMPY))
  17. # Prefix every example with 'examples/build/'
  18. EXAMPLE_TARGETS := $(patsubst %,examples/build/%,$(EXAMPLES))
  19. .PHONY: examples
  20. examples: $(EXAMPLE_TARGETS)
  21. docs:
  22. doxygen
  23. moxygen doc/xml --noindex -o doc/api.md
  24. # Assume every *.cpp file is a separate example
  25. $(EXAMPLE_TARGETS): examples/build/%: examples/%.cpp matplotlibcpp.h
  26. mkdir -p examples/build
  27. $(CXX) -o $@ $< $(EXTRA_FLAGS) $(CXXFLAGS) $(LDFLAGS)
  28. clean:
  29. rm -f ${EXAMPLE_TARGETS}