-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
176 lines (130 loc) · 8.09 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
OPENGL_LIBS = -lglut -lGL -lGLU
GUICXX = $(shell wx-config --version=3.0 --cxx)
CLICXX = g++
FLAGS = -std=c++11 -g
GUIFLAGS = -DUSE_GUI `wx-config --version=3.0 --cxxflags`
GUILINKFLAGS = `wx-config --version=3.0 --libs --gl_libs` $(OPENGL_LIBS)
CLISRC = $(wildcard cli/*.cc)
GUISRC = $(wildcard gui/*.cc)
COMSRC = $(wildcard com/*.cc)
LANGSRC = $(wildcard lang/*.cc)
SIMSRC = $(wildcard sim/*.cc)
SRC = $(COMSRC) $(LANGSRC) $(SIMSRC)
G_OBJECTS = $(patsubst %.cc,build/gui/%.o,$(GUISRC) $(SRC))
C_OBJECTS = $(patsubst %.cc,build/cli/%.o,$(CLISRC) $(SRC))
# internationalisation
LANGS = $(wildcard intl/*/mattlang.po)
LANGS_O = $(LANGS:.po=.mo)
G_LANGS = $(wildcard intl/*/mattlab.po) $(LANGS)
G_LANGS_O = $(G_LANGS:.po=.mo)
C_LANGS = $(wildcard intl/*/clisim.po) $(LANGS)
C_LANGS_O = $(C_LANGS:.po=.mo)
%.mo: %.po
msgfmt -o $@ $<
mattlab: $(G_OBJECTS) $(G_LANGS_O)
$(GUICXX) $(FLAGS) -o mattlab $(G_OBJECTS) $(GUILINKFLAGS)
# implementation
.SUFFIXES: .o .cc
#mattlab: $(G_OBJECTS)
# $(GUICXX) $(FLAGS) -o mattlab $(G_OBJECTS) $(GUILINKFLAGS)
clisim: $(C_OBJECTS) $(C_LANGS_O)
$(CXX) $(FLAGS) -o clisim $(C_OBJECTS)
clean:
rm -rf build $(LANGS_O) $(G_LANGS_O) $(C_LANGS_O) *.o mattlab clisim scanner_unittest parser_unittest
depend:
makedepend $(SRC) $(GUISRC) $(CLISRC)
build:
mkdir -p build/cli/cli
mkdir build/cli/com
mkdir build/cli/lang
mkdir build/cli/sim
mkdir -p build/gui/gui
mkdir build/gui/com
mkdir build/gui/lang
mkdir build/gui/sim
build/cli/%.o: %.cc build
$(CLICXX) $(FLAGS) -c $< -o $@
build/gui/%.o: %.cc build
$(GUICXX) $(FLAGS) $(GUIFLAGS) -c $< -o $@
# tests
GTEST_DIR = ../../mcj33/googletest/googletest
GTEST_CPPFLAGS = -isystem $(GTEST_DIR)/include
GTEST_CXXFLAGS = -g -Wall -Wextra -pthread -std=c++11
GTEST_HEADERS = $(GTEST_DIR)/include/gtest/*.h \
$(GTEST_DIR)/include/gtest/internal/*.h
GTEST_SRCS_ = $(GTEST_DIR)/src/*.cc $(GTEST_DIR)/src/*.h $(GTEST_HEADERS)
# For simplicity and to avoid depending on Google Test's
# implementation details, the dependencies specified below are
# conservative and not optimized. This is fine as Google Test
# compiles fast and for ordinary users its source rarely changes.
gtest-all.o : $(GTEST_SRCS_)
g++ $(GTEST_CPPFLAGS) -I$(GTEST_DIR) $(GTEST_CXXFLAGS) -c \
$(GTEST_DIR)/src/gtest-all.cc
gtest_main.o : $(GTEST_SRCS_)
g++ $(GTEST_CPPFLAGS) -I$(GTEST_DIR) $(GTEST_CXXFLAGS) -c \
$(GTEST_DIR)/src/gtest_main.cc
gtest.a : gtest-all.o
$(AR) $(ARFLAGS) $@ $^
gtest_main.a : gtest-all.o gtest_main.o
$(AR) $(ARFLAGS) $@ $^
#unittests
scanner_unittest.o : lang/scanner_unittest.cpp lang/scanner.h
$(CLICXX) $(FLAGS) $(GTEST_CPPFLAGS) $(GTEST_CXXFLAGS) -c lang/scanner_unittest.cpp
scanner_unittest : gtest_main.a scanner_unittest.o build/cli/lang/scanner.o build/cli/com/iposstream.o build/cli/com/cistring.o build/cli/com/names.o build/cli/com/errorhandler.o build/cli/sim/network.o build/cli/sim/devices.o build/cli/com/sourcepos.o
$(CLICXX) $(FLAGS) $(GTEST_CPPFLAGS) $(GTEST_CXXFLAGS) -lpthread $^ -o $@
parser_unittest.o : lang/parser_unittest.cpp lang/parser.h
$(CLICXX) $(FLAGS) $(GTEST_CPPFLAGS) $(GTEST_CXXFLAGS) -c lang/parser_unittest.cpp
parser_unittest : gtest_main.a parser_unittest.o build/cli/lang/parser.o build/cli/com/errorhandler.o build/cli/com/names.o build/cli/com/autocorrect.o build/cli/sim/network.o build/cli/sim/devices.o build/cli/sim/monitor.o build/cli/com/cistring.o build/cli/com/iposstream.o build/cli/com/sourcepos.o
$(CLICXX) $(FLAGS) $(GTEST_CPPFLAGS) $(GTEST_CXXFLAGS) -lpthread $^ -o $@
# DO NOT DELETE
build/cli/com/names.o: com/names.h com/cistring.h
build/cli/lang/scanner.o: com/names.h com/cistring.h com/iposstream.h com/sourcepos.h com/errorhandler.h
build/cli/lang/scanner.o: sim/network.h lang/scanner.h com/formatstring.h
build/cli/sim/network.o: sim/network.h com/names.h com/cistring.h com/sourcepos.h com/errorhandler.h com/formatstring.h
build/cli/lang/parser.o: com/errorhandler.h com/sourcepos.h lang/scanner.h com/iposstream.h com/names.h
build/cli/lang/parser.o: com/cistring.h sim/network.h com/autocorrect.h lang/parser.h sim/devices.h sim/monitor.h
build/cli/lang/parser.o: lang/networkbuilder.h com/formatstring.h
build/cli/sim/monitor.o: sim/monitor.h com/names.h com/cistring.h sim/network.h com/sourcepos.h com/errorhandler.h
build/cli/sim/monitor.o: sim/devices.h
build/cli/sim/devices.o: sim/devices.h com/names.h com/cistring.h sim/network.h com/sourcepos.h com/errorhandler.h
build/cli/com/iposstream.o: com/sourcepos.h com/iposstream.h
build/cli/com/cistring.o: com/cistring.h
build/cli/com/errorhandler.o: com/iposstream.h com/sourcepos.h com/errorhandler.h
build/cli/com/sourcepos.o: com/sourcepos.h
build/cli/com/autocorrect.o: com/names.h com/cistring.h com/autocorrect.h com/formatstring.h
build/cli/lang/networkbuilder.o: lang/parser.h com/names.h com/cistring.h lang/scanner.h com/iposstream.h
build/cli/lang/networkbuilder.o: com/sourcepos.h sim/network.h com/errorhandler.h sim/devices.h sim/monitor.h
build/cli/lang/networkbuilder.o: lang/networkbuilder.h com/autocorrect.h com/formatstring.h com/localestrings.h
build/cli/cli/userint.o: cli/userint.h com/names.h com/cistring.h sim/network.h com/sourcepos.h com/errorhandler.h
build/cli/cli/userint.o: sim/devices.h sim/monitor.h lang/scanner.h com/iposstream.h
build/cli/cli/clisim.o: com/names.h com/cistring.h sim/network.h com/sourcepos.h com/errorhandler.h sim/devices.h
build/cli/cli/clisim.o: sim/monitor.h lang/scanner.h com/iposstream.h lang/parser.h lang/networkbuilder.h
build/cli/cli/clisim.o: cli/userint.h
build/gui/com/names.o: com/names.h com/cistring.h
build/gui/lang/scanner.o: com/names.h com/cistring.h com/iposstream.h com/sourcepos.h com/errorhandler.h
build/gui/lang/scanner.o: sim/network.h lang/scanner.h com/formatstring.h
build/gui/sim/network.o: sim/network.h com/names.h com/cistring.h com/sourcepos.h com/errorhandler.h com/formatstring.h
build/gui/lang/parser.o: com/errorhandler.h com/sourcepos.h lang/scanner.h com/iposstream.h com/names.h
build/gui/lang/parser.o: com/cistring.h sim/network.h com/autocorrect.h lang/parser.h sim/devices.h sim/monitor.h
build/gui/lang/parser.o: lang/networkbuilder.h com/formatstring.h
build/gui/sim/monitor.o: sim/monitor.h com/names.h com/cistring.h sim/network.h com/sourcepos.h com/errorhandler.h
build/gui/sim/monitor.o: sim/devices.h
build/gui/sim/devices.o: sim/devices.h com/names.h com/cistring.h sim/network.h com/sourcepos.h com/errorhandler.h
build/gui/com/iposstream.o: com/sourcepos.h com/iposstream.h
build/gui/com/cistring.o: com/cistring.h
build/gui/com/errorhandler.o: com/iposstream.h com/sourcepos.h com/errorhandler.h
build/gui/com/sourcepos.o: com/sourcepos.h
build/gui/com/autocorrect.o: com/names.h com/cistring.h com/autocorrect.h com/formatstring.h
build/gui/sim/networkbuilder.o: lang/parser.h com/names.h com/cistring.h lang/scanner.h com/iposstream.h
build/gui/sim/networkbuilder.o: com/sourcepos.h sim/network.h com/errorhandler.h sim/devices.h sim/monitor.h
build/gui/sim/networkbuilder.o: lang/networkbuilder.h com/autocorrect.h com/formatstring.h com/localestrings.h
build/gui/gui/gui.o: gui/gui.h gui/rearrangectrl_matt.h com/names.h com/cistring.h sim/devices.h sim/network.h
build/gui/gui/gui.o: com/sourcepos.h com/errorhandler.h sim/monitor.h gui/guicanvas.h lang/scanner.h
build/gui/gui/gui.o: com/iposstream.h lang/parser.h lang/networkbuilder.h gui/guierrordialog.h
build/gui/gui/gui.o: gui/guimonitordialog.h gui/guicanvas.inc
build/gui/gui/guierrordialog.o: gui/guierrordialog.h com/errorhandler.h com/sourcepos.h
build/gui/gui/mattlab.o: gui/mattlab.h com/names.h com/cistring.h sim/devices.h sim/network.h com/sourcepos.h
build/gui/gui/mattlab.o: com/errorhandler.h sim/monitor.h lang/parser.h lang/scanner.h com/iposstream.h
build/gui/gui/mattlab.o: lang/networkbuilder.h gui/gui.h gui/rearrangectrl_matt.h gui/guicanvas.h
build/gui/gui/guimonitordialog.o: gui/guimonitordialog.h sim/network.h com/names.h com/cistring.h
build/gui/gui/guimonitordialog.o: com/sourcepos.h com/errorhandler.h