Makefile 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  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 $(CXXFLAGS), WITHOUT_NUMPY)
  12. # Examples requiring numpy support to compile
  13. EXAMPLES_NUMPY := surface
  14. EXAMPLES := minimal basic modern animation nonblock xkcd quiver bar \
  15. fill_inbetween fill update subplot2grid colorbar \
  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. # Assume every *.cpp file is a separate example
  22. $(EXAMPLE_TARGETS): examples/build/%: examples/%.cpp
  23. mkdir -p examples/build
  24. $(CXX) -o $@ $< $(EXTRA_FLAGS) $(CXXFLAGS) $(LDFLAGS)
  25. clean:
  26. rm -f ${EXAMPLE_TARGETS}