-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
71 lines (56 loc) · 1.93 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
CPP := g++
CPP_FLAGS := -Wall -Wextra -Werror -Wno-type-limits -Wno-unused-parameter -DTESTLIB_DEBUG -Wno-parentheses -std=c++11 -I. -Ibuild/release -g
LINK_FLAGS := -lboost_unit_test_framework
TEST_CPP_FILES := $(wildcard tests/*.cpp)
TEST_OBJ_FILES := $(TEST_CPP_FILES:%.cpp=build/%.o)
EXAMPLES_CPP_FILES := $(wildcard examples/checkers/*.cpp examples/validators/*.cpp examples/generators/*.cpp)
EXAMPLES_RUN_FILES := $(EXAMPLES_CPP_FILES:%.cpp=build/%.bin)
EXAMPLES_OBJ_FILES := $(EXAMPLES_RUN_FILES:%.bin=%.o)
LIBRARIES := $(wildcard libs/*)
LIBRARIES := $(LIBRARIES:libs/%=%)
RELEASE_FILES := build/release/testlib.hpp build/release/testlib.full.hpp $(LIBRARIES:%=build/release/%.hpp)
default:
@echo Default target disallowed
test: build/test
@echo Run test
@build/test
example: $(EXAMPLES_RUN_FILES)
@echo Run examples
@scripts/runExample.py --files $(EXAMPLES_CPP_FILES)
clean:
@echo clean
@rm -rf build
@rm -rf dist
release: $(RELEASE_FILES) test example
@mkdir -p dist
@echo copying to dist
@cp -r build/release/* dist
build/test: $(TEST_OBJ_FILES)
@echo Build test
@$(CPP) $(TEST_OBJ_FILES) $(LINK_FLAGS) -o build/test
build/release/testlib.hpp: testlib/**
@echo "Make release header"
@mkdir -p build/release
@cp scripts/output_head.txt $@
@scripts/headerSorter.py testlib >> $@
build/release/testlib.full.hpp: testlib/** libs/**
@echo Make full edition
@mkdir -p build/release
@cp scripts/output_head.txt $@
@scripts/headerSorter.py testlib libs >> $@
build/release/%.hpp: libs/%/**
@echo Make $* lib
@mkdir -p build/release
@cp scripts/output_head.txt $@
@scripts/makeLibrary.py libs/$* >> $@
build/%.bin: build/%.o
@echo "Build $*"
@$(CPP) $< $(LINK_FLAGS) -o $@
$(EXAMPLES_OBJ_FILES): $(RELEASE_FILES)
build/%.o: %.cpp
@mkdir -p build/$(*D)
@echo Make dependencies for $*
@$(CPP) -MM -MP -MT build/$*.o $(CPP_FLAGS) $*.cpp -o build/$*.d
@echo "Compile $*"
@$(CPP) $< $(CPP_FLAGS) -c -o $@
-include build/**/*.d