-
Notifications
You must be signed in to change notification settings - Fork 1
/
Make.rules
74 lines (56 loc) · 1.94 KB
/
Make.rules
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
72
73
74
CXX?=g++-4.8
CXXFLAGS+=-std=c++11 -c -Wall -Wextra -O2 -I$(SRCDIRECTORY)
TESTLDFLAGS+=-lgtest -lgtest_main -pthread
LDFLAGS+=
OBJECTS=$(SOURCES:%.cpp=$(BINDIRECTORY)/$(LOCALDIRECTORY)/%.o)
OBJECTDEPFILES=$(SOURCES:%.cpp=$(BINDIRECTORY)/$(LOCALDIRECTORY)/%.d)
LIBRARY=$(LOCALLIBRARY:%=$(BINDIRECTORY)/$(LOCALDIRECTORY)/%)
TESTOBJECTS=$(TESTSOURCES:.cpp=.o)
TESTEXECUTABLES=$(TESTSOURCES:.cpp=)
TESTTARGETS=$(TESTSOURCES:.cpp=.run)
SRCDIRECTORY=$(PROJECTROOT)/src
BINDIRECTORY=$(PROJECTROOT)/bin
MAINDEPLIBS=$(BINDIRECTORY)/libmain.a
MAINTARGET=$(BINDIRECTORY)/BridgeTCS
all: $(MAINTARGET)
library: $(LIBRARY)
test: $(TESTTARGETS)
$(TESTTARGETS): %.run: %
./$<
clean :
rm -f $(OBJECTS) $(TESTEXECUTABLES) $(TESTOBJECTS) $(LIBRARY) $(OBJECTDEPFILES) $(TESTSOURCES:.cpp=.d)
fulltest :
make -C $(PROJECTROOT) test
make -C $(PROJECTROOT)/src test
make -C $(PROJECTROOT)/src/bridge test
make -C $(PROJECTROOT)/src/viewmodel test
make -C $(PROJECTROOT)/src/ui test
make -C $(PROJECTROOT)/src/ui/text test
fullclean :
make -C $(PROJECTROOT) clean
make -C $(PROJECTROOT)/src clean
make -C $(PROJECTROOT)/src/bridge clean
make -C $(PROJECTROOT)/src/viewmodel clean
make -C $(PROJECTROOT)/src/ui clean
make -C $(PROJECTROOT)/src/ui/text clean
rm -f $(MAINTARGET)
.PHONY : all library test clean fulltest fullclean $(TESTTARGETS)
-include $(OBJECTDEPFILES)
-include $(TESTSOURCES:.cpp=.d)
$(MAINTARGET) : $(MAINDEPLIBS)
$(CXX) $^ -o $@ $(LDFLAGS)
%.o : %.cpp
$(CXX) $(CXXFLAGS) -MMD $< -o $@
$(BINDIRECTORY)/$(LOCALDIRECTORY)/%.o : %.cpp
$(CXX) $(CXXFLAGS) -MMD $< -o $@
$(TESTEXECUTABLES) : % : %.o $(LIBRARY) $(TESTDEPLIBS)
$(CXX) $^ -o $@ $(LDFLAGS) $(TESTLDFLAGS)
$(LIBRARY) : $(OBJECTS) $(LIBDEPLIBS)
rm -f $@
ar crsT $@ $^
$(TESTDEPLIBS) $(LIBDEPLIBS) $(MAINDEPLIBS) : % :
make -C $(@D) $(@F)
$(LOCALLIBRARY) :
make -C $(SRCDIRECTORY)/$(LOCALDIRECTORY)/ library
.PHONY: $(TESTDEPLIBS) $(LIBDEPLIBS) $(MAINDEPLIBS) $(LOCALLIBRARY)
# vim: set filetype=make: