main.cpp/physics.h: add some (somewhat icky) compile fixes for OS X
[openc2e.git] / Makefile.legacy
blob63cf088c95ed78f18932ff39b62bd01e42583e6d
1 .SILENT: user-is-insane
3 user-is-insane:
4         ( \
5                 echo "The Makefile build method is deprecated and intended for use only in"; \
6                 echo "unusual circumstances. To build openc2e:"; \
7                 echo; \
8                 echo "mkdir build; cd build; cmake ..; make"; \
9                 echo; \
10                 exit 1; \
11         ) >&2
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))
23 OPENC2E_CORE = \
24         Agent.o \
25         AgentHelpers.o \
26         AgentRef.o \
27         attFile.o \
28         Backend.o \
29         Blackboard.o \
30         blkImage.o \
31         bmpImage.o \
32         bytecode.o \
33         c16Image.o \
34         c2eBrain.o \
35         CallButton.o \
36         Camera.o \
37         caosScript.o \
38         caosVar.o \
39         caosVM_agent.o \
40         caosVM_camera.o \
41         caosVM_compound.o \
42         caosVM_core.o \
43         caosVM_creatures.o \
44         caosVM_debug.o \
45         caosVM_files.o \
46         caosVM_flow.o \
47         caosVM_genetics.o \
48         caosVM_history.o \
49         caosVM_input.o \
50         caosVM_map.o \
51         caosVM_motion.o \
52         caosVM_net.o \
53         caosVM.o \
54         caosVM_ports.o \
55         caosVM_resources.o \
56         caosVM_scripts.o \
57         caosVM_sounds.o \
58         caosVM_time.o \
59         caosVM_variables.o \
60         caosVM_vectors.o \
61         caosVM_vehicles.o \
62         caosVM_world.o \
63         cataloglexer.o \
64         Catalogue.o \
65         catalogue.tab.o \
66         cmddata.o \
67         cobFile.o \
68         CompoundAgent.o \
69         CompoundPart.o \
70         Creature.o \
71         CreatureAgent.o \
72         creaturesImage.o \
73         dialect.o \
74         Engine.o \
75         exceptions.o \
76         fileSwapper.o \
77         genomeFile.o \
78         historyManager.o \
79         imageManager.o \
80         caoslexer.cpp \
81         Lift.o \
82         Map.o \
83         MetaRoom.o \
84         mmapifstream.o \
85         oldBrain.o \
86         OpenALBackend.o \
87         PathResolver.o \
88         physics.o \
89         PointerAgent.o \
90         pray.o \
91         prayManager.o \
92         renderable.o \
93         Room.o \
94         Scriptorium.o \
95         SDLBackend.o \
96         SFCFile.o \
97         SimpleAgent.o \
98         SkeletalCreature.o \
99         sprImage.o \
100         streamutils.o \
101         Vehicle.o \
102         World.o \
103         util.o
105 SERIALIZATION = caosVM_ser_real.o
106 SERSTUB = caosVM_ser_stub.o
107 OPENC2E = $(OPENC2E_CORE) $(SERSTUB) main.o
108 OPENC2E_S = $(OPENC2E_CORE) $(SERIALIZATION) main.o
110 DEBUGFLAGS=-ggdb3 -O2
111 CFLAGS += -W -Wall -Wno-conversion -Wno-unused -pthread -D_REENTRANT -DYYERROR_VERBOSE -DOPENAL_SUPPORT
112 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
113 COREFLAGS=$(DEBUGFLAGS) -I/usr/include/SDL -I/usr/include/AL -I.
114 XCFLAGS=$(CFLAGS) $(COREFLAGS)
115 XCPPFLAGS=$(COREFLAGS) $(CPPFLAGS) $(CFLAGS)
117 default: user-is-insane openc2e tools/praydumper docs
118 all: openc2e tools/filetests tools/praydumper docs tools/pathtest tools/memstats tools/wildtest
120 docs: docs.html
122 commandinfo.yml: $(wildcard caosVM_*.cpp) parsedocs.pl
123         perl parsedocs.pl $(wildcard caosVM_*.cpp) > commandinfo.yml
125 docs.html: writehtml.pl commandinfo.yml
126         perl writehtml.pl commandinfo.yml > docs.html
128 cmddata.cpp: commandinfo.yml writecmds.pl
129         perl writecmds.pl commandinfo.yml > cmddata.cpp
131 #lex.mng.cpp lex.mng.h: mng.l
132 #       flex -+ --prefix=mng -d -o lex.mng.cpp --header-file=lex.mng.h mng.l
134 cataloglexer.cpp: cataloglexer.re2c
135         re2c -o cataloglexer.cpp cataloglexer.re2c
137 caoslexer.cpp: caoslexer.re2c
138         re2c -o caoslexer.cpp caoslexer.re2c
140 mngfile.o: lex.mng.cpp
142 #mngparser.tab.cpp mngparser.tab.hpp: mngparser.ypp
143 #       bison -d --name-prefix=mng mngparser.ypp
145 catalogue.tab.cpp catalogue.tab.hpp: catalogue.ypp
146         bison -d --name-prefix=cata catalogue.ypp
148 ## based on automake stuff
149 %.o: %.cpp
150         mkdir -p .deps/`dirname $<` && \
151         $(CXX) $(XCPPFLAGS) -MP -MD -MF .deps/$<.Td -o $@ -c $< && \
152         mv .deps/$<.Td .deps/$<.d
154 %.o: %.c
155         mkdir -p .deps/`dirname $<` && \
156         $(CC) $(XCFLAGS) -MP -MD -MF .deps/$<.Td -o $@ -c $< && \
157         mv .deps/$<.Td .deps/$<.d
159 include $(shell find .deps -name '*.d' -type f 2>/dev/null || true)
160 Catalogue.o: catalogue.tab.hpp
161 lex.mng.o: mngparser.tab.hpp
163 Creature_standalone.o: Creature.cpp Creature.o
164         $(CC) $(XCFLAGS) -D_CREATURE_STANDALONE -o $@ -c $<
166 openc2e: $(OPENC2E)
167         $(CXX) -o $@ $^ $(XLDFLAGS) $(XCXXFLAGS)
169 openc2e_s: $(OPENC2E_S)
170         $(CXX) -o $@ $^ $(XLDFLAGS) $(XCXXFLAGS)
172 tools/filetests: tools/filetests.o genomeFile.o streamutils.o Catalogue.o catalogue.tab.o util.o cataloglexer.o
173         $(CXX) -o $@ $^ $(XLDFLAGS) $(XCXXFLAGS)
175 tools/praydumper: tools/praydumper.o pray.o
176         $(CXX) -o $@ $^ $(XLDFLAGS) $(XCXXFLAGS)
178 #tools/mngtest: tools/mngtest.o mngfile.o mngparser.tab.o lex.mng.o
179 #       $(CXX) -o $@ $^ $(XLDFLAGS) $(XCXXFLAGS)
181 tools/pathtest: tools/pathtest.o PathResolver.o
182         $(CXX) -o $@ $^ $(XLDFLAGS) $(XCXXFLAGS)
184 tools/wildtest: tools/wildtest.o PathResolver.o
185         $(CXX) -o $@ $^ $(XLDFLAGS) $(XCXXFLAGS)
187 tools/memstats: tools/memstats.o $(OPENC2E_CORE) $(SERSTUB)
188         $(CXX) -o $@ $^ $(XLDFLAGS) $(XCXXFLAGS)
190 tools/serialtest: tools/serialtest.o $(OPENC2E_CORE) $(SERIALIZATION)
191         $(CXX) -o $@ $^ $(XLDFLAGS) $(XCXXFLAGS)
193 tools/braininavat/braininavat: Creature_standalone.o c2eBrain.o streamutils.o genomeFile.o
194         cd tools/braininavat && \
195         (qmake-qt4 || qmake) && \
196         make
198 clean:
199         rm -f *.o openc2e openc2e_s filetests praydumper tools/*.o
200         rm -rf .deps
201         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
202         rm -f tools/filetests tools/memstats tools/mngtest tools/pathtest tools/praydumper tools/serialtest
203         rm -f headerdeps.dot headerdeps.png
204         rm -f .shake/dump.pl
205         rm -f tools/braininavat/Makefile tools/braininavat/*.o tools/braininavat/moc_*.cpp tools/braininavat/braininavat
206         rm -f cataloglexer.cpp caoslexer.cpp catalogue.lex.h catalogue.tab.cpp catalogue.tab.hpp docs.html
208 test: openc2e 
209         perl runtests.pl
211 headerdeps.dot: $(wildcard *.h) $(wildcard *.hpp) $(wildcard ser/*.h) mngparser.tab.hpp catalogue.tab.hpp lex.mng.h lex.yy.h catalogue.lex.h
212         tools/depgraph.sh $^ > $@
214 headerdeps.png: headerdeps.dot
215         dot -Tpng -o $@ $^
217 generated: catalogue.tab.hpp cataloglexer.cpp docs.html cmddata.cpp caoslexer.cpp
219 .PHONY: clean all dep docs test