8000 Rearrange Makefile. · rish-singhal/matplotlib-cpp@5adfbe0 · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5adfbe0

Browse files
author
Benno Evers
committed
Rearrange Makefile.
1 parent 1ac91f7 commit 5adfbe0

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

Makefile

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Use C++11
32
CXXFLAGS += -std=c++11
43

@@ -10,19 +9,25 @@ CXXFLAGS += $(PYTHON_INCLUDE)
109
LDFLAGS += $(shell $(PYTHON_CONFIG) --libs)
1110

1211
# Either finds numpy or set -DWITHOUT_NUMPY
13-
CURRENT_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
14-
CXXFLAGS += $(shell $(PYTHON_BIN) $(CURRENT_DIR)/numpy_flags.py)
12+
CXXFLAGS += $(shell $(PYTHON_BIN) $(CURDIR)/numpy_flags.py)
13+
WITHOUT_NUMPY := $(findstring $(CXXFLAGS), WITHOUT_NUMPY)
1514

16-
# Assume every *.cpp file is a separate example
17-
SOURCES ?= $(wildcard examples/*.cpp)
18-
EXECUTABLES := $(foreach exec,$(basename $(SOURCES)),$(exec))
15+
# Examples requiring numpy support to compile
16+
EXAMPLES_NUMPY := surface
17+
EXAMPLES := minimal basic modern animation nonblock xkcd quiver bar fill_inbetween fill update subplot2grid \
18+
$(if WITHOUT_NUMPY,,$(EXAMPLES_NUMPY))
19+
20+
# Prefix every example with 'examples/build/'
21+
EXAMPLE_TARGETS := $(patsubst %,examples/build/%,$(EXAMPLES))
1922

2023
.PHONY: examples
2124

22-
examples: $(EXECUTABLES)
25+
examples: $(EXAMPLE_TARGETS)
2326

24-
$(EXECUTABLES): %: %.cpp
27+
# Assume every *.cpp file is a separate example
28+
$(EXAMPLE_TARGETS): examples/build/%: examples/%.cpp
29+
mkdir -p examples/build
2530
$(CXX) -o $@ $< $(CXXFLAGS) $(LDFLAGS)
2631

2732
clean:
28-
rm -f ${EXECUTABLES}
33+
rm -f ${EXAMPLE_TARGETS}

0 commit comments

Comments
 (0)
0