1CPP_COMPILER=g++
2C_COMPILER=gcc
3
4COMMON_CFLAGS=-Wall -Wextra -Werror -pedantic
5
6DEBUG_CFLAGS=-g
7OPT_CFLAGS=-DNDEBUG -O2
8
9C_CFLAGS=$(COMMON_CFLAGS) -std=c99
10CPP03_CFLAGS=$(COMMON_CFLAGS) -std=c++98
11CPP11_CFLAGS=$(COMMON_CFLAGS) -std=c++0x -DGHEAP_CPP11
12
13all: tests perftests ops_count_test
14
15build-tests:
16	$(C_COMPILER) tests.c $(C_CFLAGS) $(DEBUG_CFLAGS) -o tests_c
17	$(CPP_COMPILER) tests.cpp $(CPP03_CFLAGS) $(DEBUG_CFLAGS) -o tests_cpp03
18	$(CPP_COMPILER) tests.cpp $(CPP11_CFLAGS) $(DEBUG_CFLAGS) -o tests_cpp11
19
20tests: build-tests
21	./tests_c
22	./tests_cpp03
23	./tests_cpp11
24
25build-perftests:
26	$(C_COMPILER) perftests.c $(C_CFLAGS) $(OPT_CFLAGS) -o perftests_c
27	$(CPP_COMPILER) perftests.cpp $(CPP03_CFLAGS) $(OPT_CFLAGS) -o perftests_cpp03
28	$(CPP_COMPILER) perftests.cpp $(CPP11_CFLAGS) $(OPT_CFLAGS) -o perftests_cpp11
29
30perftests:
31	./perftests_c
32	./perftests_cpp03
33	./perftests_cpp11
34
35build-ops_count_test:
36	$(CPP_COMPILER) ops_count_test.cpp $(CPP03_CFLAGS) $(OPT_CFLAGS) -o ops_count_test_cpp03
37	$(CPP_COMPILER) ops_count_test.cpp $(CPP11_CFLAGS) $(OPT_CFLAGS) -o ops_count_test_cpp11
38
39ops_count_test:
40	./ops_count_test_cpp03
41	./ops_count_test_cpp11
42
43clean:
44	rm -f ./tests_c
45	rm -f ./tests_cpp03
46	rm -f ./tests_cpp11
47	rm -f ./perftests_c
48	rm -f ./perftests_cpp03
49	rm -f ./perftests_cpp11
50	rm -f ./ops_count_test_cpp03
51	rm -f ./ops_count_test_cpp11
52