Skip to content

Commit 348f8ad

Browse files
committed
cleanup Makefile
1 parent c0e1e0f commit 348f8ad

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

Makefile

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
LIB_BOOST_TEST:=-lboost_unit_test_framework-mt
1+
2+
COMPILE := $(CXX) -I. -Wall -Wextra -g $(CXXFLAGS)
3+
OPTIMIZE := -DNDEBUG -O2
4+
5+
LIB_BOOST_TEST := -lboost_unit_test_framework-mt
26

37
all:
48
@echo This library is a C++ header file only.
@@ -7,16 +11,20 @@ all:
711
mkdir -p .bin
812

913
test: test/test.cpp timsort.hpp .bin
10-
$(CXX) -I. $(LIB_BOOST_TEST) $(CXXFLAGS) -Wall -Wextra $< -o .bin/$@
11-
./.bin/test
14+
$(COMPILE) $(LIB_BOOST_TEST) $< -o .bin/$@
15+
time ./.bin/$@
16+
17+
test-with-optimization: test/test.cpp timsort.hpp .bin
18+
$(COMPILE) $(OPTIMIZE) $(LIB_BOOST_TEST) $< -o .bin/$@
19+
time ./.bin/$@
1220

1321
test-with-std-move: test/test.cpp timsort.hpp .bin
14-
$(CXX) -I. $(LIB_BOOST_TEST) $(CXXFLAGS) -std=c++11 -Wall -Wextra $< -o .bin/$@
15-
./.bin/test
22+
$(COMPILE) $(LIB_BOOST_TEST) -std=c++11 -DENABLE_STD_MOVE $< -o .bin/$@
23+
time ./.bin/$@
1624

1725
bench: example/bench.cpp timsort.hpp .bin
18-
$(CXX) -I. $(CXXFLAGS) -DNDEBUG -O2 -Wall -Wextra $< -o .bin/$@
26+
$(COMPILE) $(OPTIMIZE) $< -o .bin/$@
1927
$(CXX) -v
20-
./.bin/bench
28+
./.bin/$@
2129

2230
.PHONY: test bench

0 commit comments

Comments
 (0)