1 .SILENT: user-is-insane
5 echo "The Makefile build method is deprecated and intended for use only in"; \
6 echo "unusual circumstances. To build openc2e:"; \
8 echo "mkdir build; cd build; cmake ..; make"; \
13 CXXFILES = $(wildcard *.cpp) $(wildcard tools/*.cpp)
14 CFILES = $(wildcard *.c) $(wildcard tools/*.c)
16 SOURCES = $(CXXFILES) $(CFILES)
17 HEADERS = $(wildcard *.h)
18 EVERYTHING = $(SOURCES) $(HEADERS)
20 SOURCEDEPS = $(patsubst %.cpp,.deps/%.dpp,$(CXXFILES)) \
21 $(patsubst %.c,.deps/%.d,$(CFILES))
109 SERIALIZATION = caosVM_ser_real.o
110 SERSTUB = caosVM_ser_stub.o
111 OPENC2E = $(OPENC2E_CORE) $(SERSTUB) main.o
112 OPENC2E_S = $(OPENC2E_CORE) $(SERIALIZATION) main.o
114 DEBUGFLAGS=-ggdb3 -O2
115 CFLAGS += -W -Wall -Wno-conversion -Wno-unused -pthread -D_REENTRANT -DYYERROR_VERBOSE -DOPENAL_SUPPORT
116 XLDFLAGS=$(LDFLAGS) -lboost_program_options-mt -lboost_serialization-mt -lboost_filesystem-mt -lboost_thread-mt -lSDL -lz -lm -lSDL_net -lSDL_gfx -lpthread -lopenal -lalut -lboost_regex-mt
117 COREFLAGS=$(DEBUGFLAGS) -I/usr/include/SDL -I/usr/include/AL -I.
118 XCFLAGS=$(CFLAGS) $(COREFLAGS)
119 XCPPFLAGS=$(COREFLAGS) $(CPPFLAGS) $(CFLAGS)
121 default: user-is-insane openc2e tools/praydumper docs
122 all: openc2e tools/mngtest tools/filetests tools/praydumper docs tools/pathtest tools/memstats tools/wildtest
126 commandinfo.yml: $(wildcard caosVM_*.cpp) parsedocs.pl
127 perl parsedocs.pl $(wildcard caosVM_*.cpp) > commandinfo.yml
129 docs.html: writehtml.pl commandinfo.yml
130 perl writehtml.pl commandinfo.yml > docs.html
132 cmddata.cpp: commandinfo.yml writecmds.pl
133 perl writecmds.pl commandinfo.yml > cmddata.cpp
135 lex.mng.cpp lex.mng.h: mng.l
136 flex -+ --prefix=mng -d -o lex.mng.cpp --header-file=lex.mng.h mng.l
138 catalogue.lex.cpp catalogue.lex.h: catalogue.l catalogue.tab.hpp
139 flex -+ --prefix=catalogue -d -o catalogue.lex.cpp --header-file=catalogue.lex.h catalogue.l
141 mngfile.o: lex.mng.cpp
143 mngparser.tab.cpp mngparser.tab.hpp: mngparser.ypp
144 bison -d --name-prefix=mng mngparser.ypp
146 catalogue.tab.cpp catalogue.tab.hpp: catalogue.ypp
147 bison -d --name-prefix=cata catalogue.ypp
149 lex.yy.cpp lex.yy.h: caos.l
150 flex -+ -d -o lex.yy.cpp --header-file=lex.yy.h --prefix=c2e caos.l
152 lex.c2.cpp lex.c2.h: c2caos.l
153 flex -+ -d -o lex.c2.cpp --header-file=lex.c2.h --prefix=c2 c2caos.l
155 ## lex.yy.h deps aren't detected evidently
156 caosScript.o: lex.yy.h lex.yy.cpp lex.c2.h lex.c2.cpp
158 ## based on automake stuff
160 mkdir -p .deps/`dirname $<` && \
161 $(CXX) $(XCPPFLAGS) -MP -MD -MF .deps/$<.Td -o $@ -c $< && \
162 mv .deps/$<.Td .deps/$<.d
165 mkdir -p .deps/`dirname $<` && \
166 $(CC) $(XCFLAGS) -MP -MD -MF .deps/$<.Td -o $@ -c $< && \
167 mv .deps/$<.Td .deps/$<.d
169 include $(shell find .deps -name '*.d' -type f 2>/dev/null || true)
170 Catalogue.o: catalogue.lex.h catalogue.tab.hpp
171 lex.mng.o: mngparser.tab.hpp
173 Creature_standalone.o: Creature.cpp Creature.o
174 $(CC) $(XCFLAGS) -D_CREATURE_STANDALONE -o $@ -c $<
177 $(CXX) -o $@ $^ $(XLDFLAGS) $(XCXXFLAGS)
179 openc2e_s: $(OPENC2E_S)
180 $(CXX) -o $@ $^ $(XLDFLAGS) $(XCXXFLAGS)
182 tools/filetests: tools/filetests.o genomeFile.o streamutils.o Catalogue.o catalogue.lex.o catalogue.tab.o
183 $(CXX) -o $@ $^ $(XLDFLAGS) $(XCXXFLAGS)
185 tools/praydumper: tools/praydumper.o pray.o
186 $(CXX) -o $@ $^ $(XLDFLAGS) $(XCXXFLAGS)
188 tools/mngtest: tools/mngtest.o mngfile.o mngparser.tab.o lex.mng.o
189 $(CXX) -o $@ $^ $(XLDFLAGS) $(XCXXFLAGS)
191 tools/pathtest: tools/pathtest.o PathResolver.o
192 $(CXX) -o $@ $^ $(XLDFLAGS) $(XCXXFLAGS)
194 tools/wildtest: tools/wildtest.o PathResolver.o
195 $(CXX) -o $@ $^ $(XLDFLAGS) $(XCXXFLAGS)
197 tools/memstats: tools/memstats.o $(OPENC2E_CORE) $(SERSTUB)
198 $(CXX) -o $@ $^ $(XLDFLAGS) $(XCXXFLAGS)
200 tools/serialtest: tools/serialtest.o $(OPENC2E_CORE) $(SERIALIZATION)
201 $(CXX) -o $@ $^ $(XLDFLAGS) $(XCXXFLAGS)
203 tools/braininavat/braininavat: Creature_standalone.o c2eBrain.o streamutils.o genomeFile.o
204 cd tools/braininavat && \
205 (qmake-qt4 || qmake) && \
209 rm -f *.o openc2e openc2e_s filetests praydumper tools/*.o
211 rm -f commandinfo.yml lex.yy.cpp lex.yy.h lex.c2.cpp lex.c2.h lex.mng.cpp lex.mng.h mngparser.tab.cpp mngparser.tab.hpp cmddata.cpp
212 rm -f tools/filetests tools/memstats tools/mngtest tools/pathtest tools/praydumper tools/serialtest
213 rm -f headerdeps.dot headerdeps.png
215 rm -f tools/braininavat/Makefile tools/braininavat/*.o tools/braininavat/moc_*.cpp tools/braininavat/braininavat
216 rm -f catalogue.lex.cpp catalogue.lex.h catalogue.tab.cpp catalogue.tab.hpp docs.html
221 headerdeps.dot: $(wildcard *.h) $(wildcard *.hpp) $(wildcard ser/*.h) mngparser.tab.hpp catalogue.tab.hpp lex.mng.h lex.yy.h catalogue.lex.h
222 tools/depgraph.sh $^ > $@
224 headerdeps.png: headerdeps.dot
227 generated: catalogue.tab.hpp lex.yy.h lex.c2.h mngparser.tab.hpp catalogue.lex.h lex.mng.h docs.html cmddata.cpp
229 .PHONY: clean all dep docs test