1
1
# Use C++11
2
- CXXFLAGS + = -std=c++11
2
+ MATPLOTLIBCPP_CXXFLAGS = -std=c++11
3
3
4
4
# Default to using system's default version of python
5
- PYTHON_BIN ?= python
6
- PYTHON_CONFIG := $(PYTHON_BIN ) -config
7
- PYTHON_INCLUDE ?= $(shell $(PYTHON_CONFIG ) --includes)
8
- CXXFLAGS += $(PYTHON_INCLUDE )
9
- LDFLAGS += $(shell $(PYTHON_CONFIG ) --libs)
5
+ PYTHON_BIN := python
6
+ PYTHON_CONFIG := $(PYTHON_BIN ) -config
7
+ PYTHON_INCLUDE ?= $(shell $(PYTHON_CONFIG ) --includes)
8
+ MATPLOTLIBCPP_CXXFLAGS += $(PYTHON_INCLUDE )
9
+ MATPLOTLIBCPP_LDFLAGS += $(shell $(PYTHON_CONFIG ) --libs)
10
+
11
+ # If these checks have false positives, please remove this check and file a github issue.
12
+ $(if $(PYTHON_INCLUDE),,$(error \
13
+ Could not auto-detect python development headers. \
14
+ Please install python-dev or similar, or manually \
15
+ specify PYTHON_INCLUDE=...))
16
+
17
+ # If we have to add 1-2 more of these checks, I'll probably eventually bite the
18
+ # bullet and switch to cmake/autoconf.
19
+ test_matplotlib != $(PYTHON_BIN) -c 'import matplotlib'
20
+ WITH_MATPLOTLIB = $(.SHELLSTATUS )
21
+ $(ifeq $(WITH
10
22
11
23
# Either finds numpy or set -DWITHOUT_NUMPY
12
- CXXFLAGS += $(shell $(PYTHON_BIN ) $(CURDIR ) /numpy_flags.py)
13
- WITHOUT_NUMPY := $(findstring $(CXXFLAGS ) , WITHOUT_NUMPY)
24
+ MATPLOTLIBCPP_CXXFLAGS += $(shell $(PYTHON_BIN ) $(CURDIR ) /numpy_flags.py)
25
+ WITHOUT_NUMPY := $(findstring $(CXXFLAGS ) , WITHOUT_NUMPY)
14
26
15
27
# Examples requiring numpy support to compile
16
28
EXAMPLES_NUMPY := surface
@@ -27,7 +39,10 @@ examples: $(EXAMPLE_TARGETS)
27
39
# Assume every *.cpp file is a separate example
28
40
$(EXAMPLE_TARGETS ) : examples/build/% : examples/% .cpp
29
41
mkdir -p examples/build
30
- $(CXX ) -o $@ $< $(CXXFLAGS ) $(LDFLAGS )
42
+ $(CXX ) -o $@ $< $(MATPLOTLIBCPP_CXXFLAGS ) $( CXXFLAGS ) $(LDFLAGS ) $( MATPLOTLIBCPP_LDFLAGS )
31
43
32
44
clean :
489A
33
45
rm -f ${EXAMPLE_TARGETS}
46
+
47
+ install :
48
+ cp matplotlibcpp.h $(DESTDIR )$(PREFIX ) /include/matplotlibcpp.h
0 commit comments