Makefile 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. # Use C++11
  2. CXXFLAGS += -std=c++11
  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. CXXFLAGS += $(PYTHON_INCLUDE)
  8. LDFLAGS += $(shell $(PYTHON_CONFIG) --libs)
  9. # Either finds numpy or set -DWITHOUT_NUMPY
  10. CXXFLAGS += $(shell $(PYTHON_BIN) $(CURDIR)/numpy_flags.py)
  11. WITHOUT_NUMPY := $(findstring $(CXXFLAGS), WITHOUT_NUMPY)
  12. # Examples requiring numpy support to compile
  13. EXAMPLES_NUMPY := surface
  14. EXAMPLES := minimal basic modern animation nonblock xkcd quiver bar fill_inbetween fill update subplot2grid \
  15. $(if WITHOUT_NUMPY,,$(EXAMPLES_NUMPY))
  16. # Prefix every example with 'examples/build/'
  17. EXAMPLE_TARGETS := $(patsubst %,examples/build/%,$(EXAMPLES))
  18. .PHONY: examples
  19. examples: $(EXAMPLE_TARGETS)
  20. # Assume every *.cpp file is a separate example
  21. $(EXAMPLE_TARGETS): examples/build/%: examples/%.cpp
  22. mkdir -p examples/build
  23. $(CXX) -o $@ $< $(CXXFLAGS) $(LDFLAGS)
  24. clean:
  25. rm -f ${EXAMPLE_TARGETS}