Open Source Tomb Raider Engine
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

Makefile 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  1. ###############################################################
  2. # Mongoose <stu7440@westga.edu>
  3. ###############################################################
  4. # + Cleaner clean
  5. # + Add new include tree
  6. # + Add new flags
  7. # + Install/Uninstall
  8. # + Debian and Redhat packaging
  9. # + Lots of misc new features
  10. ###############################################################
  11. BUILD_SELECT=debug
  12. NAME=OpenRaider
  13. NAME_DEB=openraider
  14. MAJOR_VERSION=0
  15. MINOR_VERSION=1
  16. MICRO_VERSION=1
  17. BUILD_ID=20131214
  18. PRE=
  19. VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)$(PRE)
  20. VERSION_DEB=$(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION).$(BUILD_ID)
  21. BUILD_HOST=$(shell uname -s -n -r -m)
  22. ARCH=$(shell uname -m)
  23. #ARCH=i386
  24. UNAME=$(shell uname -s)
  25. ###############################################################
  26. # -DUSING_OPENAL Add OpenAL sound support
  27. # -DMULTITEXTURE Add OpenGL multitexturing
  28. # -DUNICODE_SUPPORT Add unicode/internation keyboard support
  29. # -DUSING_EMITTER_IN_GAME Run particle test in game
  30. BASE_DEFS=$(shell sdl-config --cflags) -Isrc -I/opt/local/include -DSDL_INTERFACE \
  31. -DUSING_OPENGL -DZLIB_SUPPORT -DUSING_EMITTER \
  32. -DUSING_OPENAL -DUSING_MTK_TGA -DUSING_PTHREADS \
  33. -DUSING_HEL -DHAVE_SDL_TTF -DHAVE_OPENGL
  34. BASE_LIBS=$(shell sdl-config --libs) -lz -lstdc++ \
  35. -lpthread -lSDL_ttf
  36. # -DDEBUG_GL
  37. DEBUG_DEFS=-DDEBUG -DEXPERIMENTAL
  38. DEBUG_OBJ=
  39. ###############################################################
  40. # OpenAL, Sound support
  41. BASE_DEFS += -DHAVE_OPENAL
  42. ifeq ($(UNAME),Darwin)
  43. BASE_LIBS += -lalut
  44. BASE_LIBS += -framework OpenAL
  45. BASE_LIBS += -framework OpenGL
  46. BASE_LIBS += -framework GLUT
  47. else
  48. BASE_LIBS += -lopenal
  49. endif
  50. # libferit, File transfer via HTTP/FTP/etc support
  51. LIBFERIT_LIB=/usr/local/lib/libferit.so
  52. LIBFERIT=$(shell if test -e $(LIBFERIT_LIB) > /dev/null; then echo yes; fi)
  53. ifeq ($(LIBFERIT), yes)
  54. BASE_DEFS += -DHAVE_LIBFERIT
  55. BASE_LIBS += -lferit
  56. endif
  57. ###############################################################
  58. TREE_DIR=OpenRaider
  59. BUILD_DEBUG_DIR=bin/debug
  60. BUILD_RELEASE_DIR=bin/release
  61. BUILD_PROF_DIR=bin/prof
  62. BUILD_TEST_DIR=bin/test
  63. BUILD_MEM_DIR=bin/mem
  64. BUILD_INSTALL_DIR=bin/$(BUILD_SELECT)
  65. DEB_DIR=/tmp/$(NAME).deb
  66. # Edited for Debian GNU/Linux.
  67. DESTDIR =
  68. INSTALL_BIN=$(DESTDIR)/usr/games
  69. INSTALL_LIB=$(DESTDIR)/usr/lib
  70. INSTALL_DOC=$(DESTDIR)/usr/share/doc/$(NAME)
  71. INSTALL_SHARE=$(DESTDIR)/usr/share/$(NAME)
  72. INSTALL_INCLUDE=$(DESTDIR)/usr/include
  73. ###############################################################
  74. CC=gcc
  75. BASE_CFLAGS=-Wall $(BASE_DEFS) \
  76. -DVERSION=\"\\\"$(NAME)-$(VERSION)-$(BUILD_ID)\\\"\" \
  77. -DBUILD_HOST=\"\\\"$(BUILD_HOST)\\\"\"
  78. LD_FLAGS=-L/usr/X11/lib -lXmu -lXt -lSM -lICE -lXext -lX11 -lXi \
  79. -lm $(BASE_LIBS)
  80. ifneq ($(UNAME),Darwin)
  81. LD_FLAGS+=-lGL -lGLU
  82. endif
  83. RELEASE_CFLAGS=$(BASE_CFLAGS) -ffast-math -funroll-loops \
  84. -fomit-frame-pointer -fexpensive-optimizations -O2
  85. DEBUG_CFLAGS=$(BASE_CFLAGS) -g -O0 $(DEBUG_DEFS)
  86. ################################################################
  87. DO_CC=$(CC) $(CFLAGS) -o $@ -c $<
  88. DO_SHLIB_CC=$(CC) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
  89. TARGETS=$(BUILDDIR)/$(NAME)
  90. ################################################################
  91. auto: $(BUILD_SELECT)
  92. targets: $(TARGETS)
  93. bundle: release
  94. mkdir -p bin/OpenRaider.app/Contents/MacOS
  95. mkdir -p bin/OpenRaider.app/Contents/Resources/defaults
  96. mkdir -p bin/OpenRaider.app/Contents/Frameworks
  97. cp mac_dist/Info.plist bin/OpenRaider.app/Contents/Info.plist
  98. cp mac_dist/openraider.icns bin/OpenRaider.app/Contents/Resources/openraider.icns
  99. cp mac_dist/OpenRaider bin/OpenRaider.app/Contents/MacOS/OpenRaider
  100. cp bin/release/OpenRaider bin/OpenRaider.app/Contents/MacOS/OpenRaider-bin
  101. cp data/* bin/OpenRaider.app/Contents/Resources/defaults/
  102. cp /opt/local/lib/libalut.0.1.0.dylib bin/OpenRaider.app/Contents/Frameworks/libalut.0.1.0.dylib
  103. cp /opt/local/lib/libSDL_ttf-2.0.0.dylib bin/OpenRaider.app/Contents/Frameworks/libSDL_ttf-2.0.0.dylib
  104. cp /opt/local/lib/libz.1.dylib bin/OpenRaider.app/Contents/Frameworks/libz.1.dylib
  105. cp /opt/local/lib/libSDL-1.2.0.dylib bin/OpenRaider.app/Contents/Frameworks/libSDL-1.2.0.dylib
  106. cp /opt/local/lib/libbz2.1.0.dylib bin/OpenRaider.app/Contents/Frameworks/libbz2.1.0.dylib
  107. cp /opt/local/lib/libfreetype.6.dylib bin/OpenRaider.app/Contents/Frameworks/libfreetype.6.dylib
  108. cp /opt/local/lib/libpng15.15.dylib bin/OpenRaider.app/Contents/Frameworks/libpng15.15.dylib
  109. # OpenRaider-bin
  110. install_name_tool -change /opt/local/lib/libalut.0.1.0.dylib @executable_path/../Frameworks/libalut.0.1.0.dylib bin/OpenRaider.app/Contents/MacOS/OpenRaider-bin
  111. install_name_tool -change /opt/local/lib/libSDL_ttf-2.0.0.dylib @executable_path/../Frameworks/libSDL_ttf-2.0.0.dylib bin/OpenRaider.app/Contents/MacOS/OpenRaider-bin
  112. install_name_tool -change /opt/local/lib/libz.1.dylib @executable_path/../Frameworks/libz.1.dylib bin/OpenRaider.app/Contents/MacOS/OpenRaider-bin
  113. install_name_tool -change /opt/local/lib/libSDL-1.2.0.dylib @executable_path/../Frameworks/libSDL-1.2.0.dylib bin/OpenRaider.app/Contents/MacOS/OpenRaider-bin
  114. install_name_tool -change /opt/X11/lib/libXmu.6.dylib /usr/X11/lib/libXmu.6.dylib bin/OpenRaider.app/Contents/MacOS/OpenRaider-bin
  115. install_name_tool -change /opt/X11/lib/libXt.6.dylib /usr/X11/lib/libXt.6.dylib bin/OpenRaider.app/Contents/MacOS/OpenRaider-bin
  116. install_name_tool -change /opt/X11/lib/libSM.6.dylib /usr/X11/lib/libSM.6.dylib bin/OpenRaider.app/Contents/MacOS/OpenRaider-bin
  117. install_name_tool -change /opt/X11/lib/libICE.6.dylib /usr/X11/lib/libICE.6.dylib bin/OpenRaider.app/Contents/MacOS/OpenRaider-bin
  118. install_name_tool -change /opt/X11/lib/libXext.6.dylib /usr/X11/lib/libXext.6.dylib bin/OpenRaider.app/Contents/MacOS/OpenRaider-bin
  119. install_name_tool -change /opt/X11/lib/libX11.6.dylib /usr/X11/lib/libX11.6.dylib bin/OpenRaider.app/Contents/MacOS/OpenRaider-bin
  120. install_name_tool -change /opt/X11/lib/libXi.6.dylib /usr/X11/lib/libXi.6.dylib bin/OpenRaider.app/Contents/MacOS/OpenRaider-bin
  121. # libSDL-1.2.0.dylib
  122. install_name_tool -change /opt/local/lib/libX11.6.dylib /usr/X11/lib/libX11.6.dylib bin/OpenRaider.app/Contents/Frameworks/libSDL-1.2.0.dylib
  123. install_name_tool -change /opt/local/lib/libXext.6.dylib /usr/X11/lib/libXext.6.dylib bin/OpenRaider.app/Contents/Frameworks/libSDL-1.2.0.dylib
  124. install_name_tool -change /opt/local/lib/libXrandr.2.dylib /usr/X11/lib/libXrandr.2.dylib bin/OpenRaider.app/Contents/Frameworks/libSDL-1.2.0.dylib
  125. install_name_tool -change /opt/local/lib/libXrender.1.dylib /usr/X11/lib/libXrender.1.dylib bin/OpenRaider.app/Contents/Frameworks/libSDL-1.2.0.dylib
  126. # libSDL_ttf-2.0.0.dylib
  127. install_name_tool -change /opt/local/lib/libSDL-1.2.0.dylib @executable_path/../Frameworks/libSDL-1.2.0.dylib bin/OpenRaider.app/Contents/Frameworks/libSDL_ttf-2.0.0.dylib
  128. install_name_tool -change /opt/local/lib/libfreetype.6.dylib @executable_path/../Frameworks/libfreetype.6.dylib bin/OpenRaider.app/Contents/Frameworks/libSDL_ttf-2.0.0.dylib
  129. install_name_tool -change /opt/local/lib/libz.1.dylib @executable_path/../Frameworks/libz.1.dylib bin/OpenRaider.app/Contents/Frameworks/libSDL_ttf-2.0.0.dylib
  130. install_name_tool -change /opt/local/lib/libbz2.1.0.dylib @executable_path/../Frameworks/libbz2.1.0.dylib bin/OpenRaider.app/Contents/Frameworks/libSDL_ttf-2.0.0.dylib
  131. # libfreetype.6.dylib
  132. install_name_tool -change /opt/local/lib/libz.1.dylib @executable_path/../Frameworks/libz.1.dylib bin/OpenRaider.app/Contents/Frameworks/libfreetype.6.dylib
  133. install_name_tool -change /opt/local/lib/libbz2.1.0.dylib @executable_path/../Frameworks/libbz2.1.0.dylib bin/OpenRaider.app/Contents/Frameworks/libfreetype.6.dylib
  134. install_name_tool -change /opt/local/lib/libpng15.15.dylib @executable_path/../Frameworks/libpng15.15.dylib bin/OpenRaider.app/Contents/Frameworks/libfreetype.6.dylib
  135. # libpng15.15.dylib
  136. install_name_tool -change /opt/local/lib/libz.1.dylib @executable_path/../Frameworks/libz.1.dylib bin/OpenRaider.app/Contents/Frameworks/libpng15.15.dylib
  137. bundle-image: bundle
  138. hdiutil create -size 32m -fs HFS+ -volname "OpenRaider" bin/tmp.dmg
  139. hdiutil attach bin/tmp.dmg
  140. cp -r bin/OpenRaider.app /Volumes/OpenRaider/OpenRaider.app
  141. osascript -e 'tell application "Finder" to make alias file to POSIX file "/Applications" at POSIX file "/Volumes/OpenRaider/"'
  142. hdiutil detach /Volumes/OpenRaider
  143. hdiutil convert bin/tmp.dmg -format UDZO -o bin/OpenRaider.dmg
  144. rm -rf bin/tmp.dmg
  145. all: debug release prof
  146. debug:
  147. @-mkdir -p $(BUILD_DEBUG_DIR)
  148. $(MAKE) targets BUILDDIR=$(BUILD_DEBUG_DIR) \
  149. CFLAGS="$(DEBUG_CFLAGS)" \
  150. LD_FLAGS="$(LD_FLAGS)"
  151. prof:
  152. @-mkdir -p $(BUILD_PROF_DIR)
  153. $(MAKE) targets BUILDDIR=$(BUILD_PROF_DIR) \
  154. CFLAGS="$(DEBUG_CFLAGS) -pg" \
  155. LD_FLAGS="$(LD_FLAGS) -pg"
  156. release:
  157. @-mkdir -p $(BUILD_RELEASE_DIR)
  158. $(MAKE) targets BUILDDIR=$(BUILD_RELEASE_DIR) \
  159. CFLAGS="$(RELEASE_CFLAGS)" \
  160. LD_FLAGS="$(LD_FLAGS)"
  161. #####################################
  162. ded:
  163. @-mkdir -p $(BUILD_DEBUG_DIR)/ded
  164. $(MAKE) targets BUILDDIR=$(BUILD_DEBUG_DIR)/ded \
  165. CFLAGS="$(DEBUG_CFLAGS) -DDEDICATED_SERVER" \
  166. LD_FLAGS="$(LD_FLAGS)"
  167. md3:
  168. @-mkdir -p $(BUILD_DEBUG_DIR)
  169. $(MAKE) targets BUILDDIR=$(BUILD_DEBUG_DIR) \
  170. DEBUG_OBJ="$(BUILD_DEBUG_DIR)/endian.o $(BUILD_DEBUG_DIR)/Md3.o $(BUILD_DEBUG_DIR)/Md3AnimModel.o" \
  171. CFLAGS="$(DEBUG_CFLAGS) -DUSING_MD3" \
  172. LD_FLAGS="$(LD_FLAGS)"
  173. # -DDEBUG_MEMEORY_VERBOSE
  174. # -DDEBUG_MEMEORY
  175. memory:
  176. @-mkdir -p $(BUILD_MEM_DIR)
  177. $(MAKE) targets BUILDDIR=$(BUILD_MEM_DIR) \
  178. DEBUG_OBJ="$(BUILD_MEM_DIR)/memeory_test.o" \
  179. CFLAGS="$(DEBUG_CFLAGS) -DDEBUG_MEMEORY" \
  180. LD_FLAGS="$(LD_FLAGS)"
  181. depend:
  182. @-echo "Making deps..."
  183. @-echo "# Autogenerated dependency file" > depend
  184. @-find ./src -name "*.cpp" -exec ./deps.sh $(BASE_DEFS) {} \; >> depend
  185. @-echo "[DONE]"
  186. ################################################################
  187. # Later hel will become a seperate library once it matures
  188. HEL_OBJ = \
  189. $(BUILDDIR)/Mass.o \
  190. $(BUILDDIR)/Simulation.o \
  191. $(BUILDDIR)/Vector3d.o \
  192. $(BUILDDIR)/Matrix.o \
  193. $(BUILDDIR)/ViewVolume.o \
  194. $(BUILDDIR)/CollisionObject.o \
  195. $(BUILDDIR)/BoundingVolume.o \
  196. $(BUILDDIR)/Quaternion.o \
  197. $(BUILDDIR)/math.o \
  198. $(BUILDDIR)/Entity.o
  199. #$(BUILDDIR)/Spring.o
  200. OBJS = \
  201. $(DEBUG_OBJ) \
  202. $(HEL_OBJ) \
  203. $(BUILDDIR)/mtk_tga.o \
  204. $(BUILDDIR)/System.o \
  205. $(BUILDDIR)/SDLSystem.o \
  206. $(BUILDDIR)/OpenRaider.o \
  207. $(BUILDDIR)/World.o \
  208. $(BUILDDIR)/TombRaider.o \
  209. $(BUILDDIR)/GLString.o \
  210. $(BUILDDIR)/Camera.o \
  211. $(BUILDDIR)/OpenGLMesh.o \
  212. $(BUILDDIR)/Render.o \
  213. $(BUILDDIR)/Sound.o \
  214. $(BUILDDIR)/Network.o \
  215. $(BUILDDIR)/Texture.o \
  216. $(BUILDDIR)/Emitter.o \
  217. $(BUILDDIR)/Particle.o \
  218. $(BUILDDIR)/SkeletalModel.o \
  219. $(BUILDDIR)/Light.o
  220. $(BUILDDIR)/$(NAME) : $(OBJS)
  221. $(CC) $(CFLAGS) $(LD_FLAGS) -o $@ $(OBJS)
  222. ifeq ($(UNAME),Darwin)
  223. install_name_tool -change libalut.0.1.0.dylib /opt/local/lib/libalut.0.1.0.dylib $@
  224. endif
  225. #################################################################
  226. clean: clean-small clean-dep
  227. clean-small: clean-emacs clean-build clean-test clean-obj
  228. @-rm -rf bin/OpenRaider.app
  229. @-rm -rf bin/OpenRaider.dmg
  230. clean-dep:
  231. @-echo "Cleaning dependencies "
  232. @-rm -f depend
  233. @-echo "[DONE]"
  234. clean-test:
  235. @-echo "Cleaning test builds "
  236. @-rm -f $(BUILD_TEST_DIR)/*.o
  237. @-rm -f $(BUILD_TEST_DIR)/*.test
  238. @-rm -rf $(BUILD_TEST_DIR)/*.build
  239. @-echo "[DONE]"
  240. clean-obj:
  241. @-echo "Cleaning objects "
  242. @-rm -f $(BUILD_PROF_DIR)/*.o
  243. @-rm -f $(BUILD_DEBUG_DIR)/*.o
  244. @-rm -f $(BUILD_RELEASE_DIR)/*.o
  245. @-rm -f $(BUILD_TEST_DIR)/*.o
  246. @-rm -f $(BUILD_MEM_DIR)/*.o
  247. @-echo "[DONE]"
  248. clean-emacs:
  249. @-echo "Cleaning emacs files "
  250. @-rm -f `find . -name "*~" -print`
  251. @-echo "[DONE]"
  252. clean-build:
  253. @-echo "Cleaning builds "
  254. @-rm -f $(BUILD_PROF_DIR)/$(NAME)
  255. @-rm -f $(BUILD_DEBUG_DIR)/$(NAME)
  256. @-rm -f $(BUILD_RELEASE_DIR)/$(NAME)
  257. @-rm -f $(BUILD_MEM_DIR)/$(NAME)
  258. @-echo "[DONE]"
  259. clean-deb:
  260. @-echo "Cleaning DEBs "
  261. @-rm -rf $(DEB_DIR)
  262. @-echo "[DONE]"
  263. #################################################################
  264. -include depend
  265. #################################################################
  266. redhat:
  267. cd $(DEB_DIR) && \
  268. alien --to-rpm $(NAME_DEB)_$(VERSION_DEB)-1_$(ARCH).deb
  269. debian:
  270. $(MAKE) tarball
  271. $(MAKE) clean-deb
  272. mkdir -p $(DEB_DIR)
  273. cp ../$(NAME_DEB)-$(VERSION_DEB).tar.gz $(DEB_DIR)
  274. cd $(DEB_DIR) && tar zxvf $(NAME_DEB)-$(VERSION_DEB).tar.gz && mv $(TREE_DIR) $(NAME_DEB)-$(VERSION_DEB) && cd $(NAME_DEB)-$(VERSION_DEB) && make deb-init && make deb
  275. deb-init:
  276. dh_make -c gpl -s \
  277. -e mongoose@icculus.org -f ../$(NAME_DEB)-$(VERSION_DEB).tar.gz
  278. @-cp debian/control debian/control.old
  279. @-sed -e "s/<insert up to 60 chars description>/Open source Tomb Raider series clone/g" debian/control.old > debian/control
  280. @-rm -f debian/control.old
  281. @-cp debian/control debian/control.old
  282. @-sed -e "s/<insert long description, indented with spaces>/OpenRaider is an open source multiplayer and single player Tomb Raider clone for linux and Playstation 2. It uses the game data such as models, sound, levels, and animation from the popular 3d series Tomb Raider by Core Design./g" debian/control.old > debian/control
  283. @-rm -f debian/control.old
  284. deb:
  285. dpkg-buildpackage -rfakeroot
  286. apt:
  287. cd $(DEB_DIR) && dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
  288. cd $(DEB_DIR) && dpkg-scansources . /dev/null | gzip -9c > Sources.gz
  289. apt-upload:
  290. scp $(DEB_DIR)/Packages.gz \
  291. $(DEB_DIR)/Sources.gz \
  292. $(DEB_DIR)/$(NAME_DEB)*.diff.gz \
  293. $(DEB_DIR)/$(NAME_DEB)*.deb \
  294. $(DEB_DIR)/$(NAME_DEB)*.dsc \
  295. $(DEB_DIR)/$(NAME_DEB)*.orig.tar.gz \
  296. orbital.sf.net:~/openraider/htdocs/debian/
  297. install:
  298. mkdir -p $(INSTALL_SHARE)/data
  299. cp setup.sh $(INSTALL_SHARE)
  300. cp data/* $(INSTALL_SHARE)/data
  301. mkdir -p $(INSTALL_DOC)
  302. cp README ChangeLog BUGS TODO $(INSTALL_DOC)
  303. mkdir -p $(INSTALL_BIN)
  304. cp bin/$(BUILD_SELECT)/OpenRaider $(INSTALL_BIN)
  305. bin-tarball:
  306. $(MAKE) clean-obj
  307. @-cd .. && tar zcvf $(NAME_DEB)-$(VERSION_DEB)-$(ARCH).tar.gz \
  308. $(TREE_DIR)/Makefile $(TREE_DIR)/data \
  309. $(TREE_DIR)/bin/$(BUILD_SELECT)/OpenRaider \
  310. $(TREE_DIR)/README $(TREE_DIR)/ChangeLog \
  311. $(TREE_DIR)/BUGS $(TREE_DIR)/TODO
  312. tarball:
  313. @-echo "Making tarball "
  314. @-cd .. && tar zcvf $(NAME_DEB)-$(VERSION_DEB).tar.gz \
  315. $(TREE_DIR) --exclude old --exclude models \
  316. --exclude semantic.cache --exclude TAGS \
  317. --exclude bin --exclude CVS --exclude *~
  318. @-echo "[DONE]"
  319. PSKModel.zip:
  320. @-echo "Making PSKModel pak "
  321. @-zip ../pskmodel-$(BUILD_ID)-src.zip \
  322. Makefile deps.sh README.PSKModel \
  323. src/PSKModel.h src/PSKModel.cpp \
  324. src/UTPackage.h src/UTPackage.cpp \
  325. src/Texture.h src/Texture.cpp \
  326. src/mtk_tga.cpp src/mtk_tga.h
  327. @-echo "[DONE]"
  328. @-echo "Making test data pak "
  329. @-zip -r ../pskmodel-$(BUILD_ID)-data.zip \
  330. data/models/test/
  331. @-echo "[DONE]"
  332. backup:
  333. $(MAKE) tarball
  334. @-cd .. && cp $(NAME)-$(VERSION)-$(BUILD_ID).tar.gz ~/Backup
  335. #################################################################
  336. # Unit Test builds
  337. #################################################################
  338. TEST_FLAGS=-Wall -g -O0 -DDEBUG -lstdc++
  339. TEST_MAP_TR5=~/projects/Data/models/tombraider/tr5/demo.trc
  340. TEST_MAP_TR4=~/projects/Data/models/tombraider/tr4/angkor1.tr4
  341. TEST_MAP_TR3=~/projects/Data/models/tombraider/tr3/scotland.tr2
  342. TEST_MAP_TR2=~/projects/Data/models/tombraider/tr2/unwater.tr2
  343. TEST_MAP_TR1=~/projects/Data/models/tombraider/tr1/level1.phd
  344. TombRaider.reg_test:
  345. $(MAKE) TombRaider.test
  346. $(BUILD_TEST_DIR)/TombRaider.test load $(TEST_MAP_TR1) > /tmp/log.tr1
  347. $(BUILD_TEST_DIR)/TombRaider.test load $(TEST_MAP_TR2) > /tmp/log.tr2
  348. $(BUILD_TEST_DIR)/TombRaider.test load $(TEST_MAP_TR3) > /tmp/log.tr3
  349. $(BUILD_TEST_DIR)/TombRaider.test load $(TEST_MAP_TR4) > /tmp/log.tr4
  350. $(BUILD_TEST_DIR)/TombRaider.test load $(TEST_MAP_TR5) > /tmp/log.tr5
  351. TombRaider.test:
  352. @-mkdir -p $(BUILD_TEST_DIR)
  353. $(MAKE) targets NAME=TombRaider.test BUILDDIR=$(BUILD_TEST_DIR) \
  354. OBJS="$(BUILD_TEST_DIR)/TombRaider.o $(BUILD_TEST_DIR)/mtk_tga.o $(BUILD_TEST_DIR)/memeory_test.o" \
  355. CFLAGS="$(BASE_CFLAGS) -g -D__TOMBRAIDER_TEST__ -D__TEST_TR5_DUMP_TGA -D__TEST_32BIT_TEXTILES -DDEBUG_MEMEORY" \
  356. LD_FLAGS="-lz"
  357. #################################################################
  358. MD3ANIMMODEL_CFLAGS=-DUSING_OPENGL -DUNIT_TEST_MD3ANIMMODEL_SDL \
  359. -DUSING_MTK_TGA -DUSING_HEL $(shell sdl-config --cflags) \
  360. -DHAVE_SDL_TTF
  361. MD3ANIMMODEL_LDFLAGS=-lm -lstdc++ -lGL -lGLU $(shell sdl-config --libs) \
  362. -lSDL_ttf
  363. MD3ANIMMODEL_OBJS=$(BUILD_TEST_DIR)/mtk_tga.o \
  364. $(BUILD_TEST_DIR)/Texture.o $(BUILD_TEST_DIR)/endian.o \
  365. $(BUILD_TEST_DIR)/Quaternion.o \
  366. $(BUILD_TEST_DIR)/Md3.o $(BUILD_TEST_DIR)/Md3AnimModel.o
  367. Md3AnimModel.test:
  368. mkdir -p $(BUILD_TEST_DIR)
  369. $(MAKE) targets \
  370. NAME=Md3AnimModel.test \
  371. BUILDDIR=$(BUILD_TEST_DIR) \
  372. OBJS="$(MD3ANIMMODEL_OBJS)" \
  373. CFLAGS=" -Wall -O0 -g -Isrc $(MD3ANIMMODEL_CFLAGS)" \
  374. LD_FLAGS="$(MD3ANIMMODEL_LDFLAGS)"
  375. #################################################################
  376. GLString.test:
  377. mkdir -p $(BUILD_TEST_DIR)
  378. $(CC) -Wall -Isrc -D__TEST__ -DHAVE_MTK -DHAVE_SDL -DUSING_MTK_TGA \
  379. $(shell sdl-config --cflags) $(shell sdl-config --libs) \
  380. -lGL -lGLU -lm \
  381. src/Texture.cpp src/mtk_tga.cpp \
  382. src/GLString.cpp -o $(BUILD_TEST_DIR)/GLString.test
  383. #################################################################
  384. SIMULATION_CFLAGS=-Wall -O0 -g -Isrc $(shell sdl-config --cflags) \
  385. -DUSING_OPENGL -DUSING_HEL -DUSING_MTK_TGA \
  386. -DUNIT_TEST_SIMULATION
  387. SIMULATION_OBJS=$(BUILD_TEST_DIR)/mtk_tga.o $(BUILD_TEST_DIR)/Texture.o \
  388. $(BUILD_TEST_DIR)/Mass.o \
  389. $(BUILD_TEST_DIR)/CollisionObject.o \
  390. $(BUILD_TEST_DIR)/Simulation.o \
  391. $(BUILD_TEST_DIR)/Vector3d.o \
  392. $(BUILD_TEST_DIR)/Matrix.o \
  393. $(BUILD_TEST_DIR)/ViewVolume.o \
  394. $(BUILD_TEST_DIR)/BoundingVolume.o \
  395. $(BUILD_TEST_DIR)/Quaternion.o \
  396. $(BUILD_TEST_DIR)/math.o
  397. Simulation.test:
  398. mkdir -p $(BUILD_TEST_DIR)
  399. $(MAKE) targets NAME=Simulation.test BUILDDIR=$(BUILD_TEST_DIR) \
  400. OBJS="$(SIMULATION_OBJS)" \
  401. CFLAGS="$(SIMULATION_CFLAGS)" \
  402. LD_FLAGS="-lm -lstdc++ -lGL -lGLU $(shell sdl-config --libs)"
  403. #################################################################
  404. HEL_PARTICLE_CFLAGS=-Wall -O0 -g -Isrc $(shell sdl-config --cflags) \
  405. -DUSING_OPENGL -DUSING_HEL -DUSING_MTK_TGA \
  406. -DUNIT_TEST_SPRING -DHAVE_SDL_TTF -lSDL_ttf
  407. HEL_PARTICLE_OBJS=$(BUILD_TEST_DIR)/mtk_tga.o $(BUILD_TEST_DIR)/Texture.o \
  408. $(BUILD_TEST_DIR)/Mass.o \
  409. $(BUILD_TEST_DIR)/Spring.o \
  410. $(BUILD_TEST_DIR)/CollisionObject.o \
  411. $(BUILD_TEST_DIR)/Simulation.o \
  412. $(BUILD_TEST_DIR)/Vector3d.o \
  413. $(BUILD_TEST_DIR)/Matrix.o \
  414. $(BUILD_TEST_DIR)/ViewVolume.o \
  415. $(BUILD_TEST_DIR)/BoundingVolume.o \
  416. $(BUILD_TEST_DIR)/Quaternion.o \
  417. $(BUILD_TEST_DIR)/math.o
  418. Spring.test:
  419. mkdir -p $(BUILD_TEST_DIR)
  420. $(MAKE) targets NAME=Spring.test BUILDDIR=$(BUILD_TEST_DIR) \
  421. OBJS="$(HEL_PARTICLE_OBJS)" \
  422. CFLAGS="$(HEL_PARTICLE_CFLAGS)" \
  423. LD_FLAGS="-lm -lstdc++ -lGL -lGLU $(shell sdl-config --libs)"
  424. #################################################################
  425. Hel.test: Quaternion.test Matrix.test Math.test
  426. Matrix.test:
  427. @-echo "Building Matrix unit test"
  428. mkdir -p $(BUILD_TEST_DIR)
  429. $(CC) -Wall -g -DMATRIX_UNIT_TEST -lm -lstdc++ -Isrc \
  430. src/hel/Matrix.cpp src/hel/Quaternion.cpp src/hel/Vector3d.cpp \
  431. -o $(BUILD_TEST_DIR)/Matrix.test
  432. @-echo "================================================="
  433. @-echo "Running Matrix unit test"
  434. $(BUILD_TEST_DIR)/Matrix.test
  435. Quaternion.test:
  436. @-echo "Building Quaternion unit test"
  437. mkdir -p $(BUILD_TEST_DIR)
  438. $(CC) -Wall -g -DQUATERNION_UNIT_TEST -lm -lstdc++ -Isrc \
  439. src/hel/Quaternion.cpp -o $(BUILD_TEST_DIR)/Quaternion.test
  440. @-echo "================================================="
  441. @-echo "Running Quaternion unit test"
  442. $(BUILD_TEST_DIR)/Quaternion.test
  443. Math.test:
  444. @-echo "Building Math unit test"
  445. mkdir -p $(BUILD_TEST_DIR)
  446. $(CC) -Wall -g -DMATH_UNIT_TEST -lm -lstdc++ -Isrc \
  447. src/hel/math.cpp -o $(BUILD_TEST_DIR)/Math.test
  448. @-echo "================================================="
  449. @-echo "Running hel unit test"
  450. $(BUILD_TEST_DIR)/Math.test
  451. #################################################################
  452. Memeory.test:
  453. mkdir -p $(BUILD_TEST_DIR)
  454. $(CC) -Wall -g -D__TEST__ -lstdc++ \
  455. -DDEBUG_MEMEORY -DDEBUG_MEMEORY_ERROR \
  456. src/memeory_test.cpp -o $(BUILD_TEST_DIR)/memeory_test.test
  457. #################################################################
  458. Network.test:
  459. mkdir -p $(BUILD_TEST_DIR)
  460. $(CC) $(TEST_FLAGS) -DUNIT_TEST_NETWORK \
  461. src/Network.cpp -o $(BUILD_TEST_DIR)/Network.test
  462. #################################################################
  463. Sound.test:
  464. mkdir -p $(BUILD_TEST_DIR)
  465. $(CC) $(TEST_FLAGS) -DUNIT_TEST_SOUND \
  466. -DUSING_OPENAL -lopenal \
  467. src/Sound.cpp -o $(BUILD_TEST_DIR)/Sound.test
  468. #################################################################
  469. PSKModel.test:
  470. mkdir -p $(BUILD_TEST_DIR)
  471. $(MAKE) targets NAME=PSKModel.test BUILDDIR=$(BUILD_TEST_DIR) \
  472. OBJS="$(BUILD_TEST_DIR)/PSKModel.o $(BUILD_TEST_DIR)/UTPackage.o $(BUILD_TEST_DIR)/mtk_tga.o $(BUILD_TEST_DIR)/Texture.o" \
  473. CFLAGS="-Wall -O0 -g -Isrc -DUNIT_TEST_PSKMODEL -DUSING_OPENGL $(shell sdl-config --cflags) -DUSING_MTK_TGA -DHAVE_SDL_TTF" \
  474. LD_FLAGS="-lm -lstdc++ -lGL -lGLU $(shell sdl-config --libs) -lSDL_ttf"
  475. #################################################################
  476. UTPackage.test:
  477. mkdir -p $(BUILD_TEST_DIR)
  478. $(MAKE) targets NAME=UTPackage.test BUILDDIR=$(BUILD_TEST_DIR) \
  479. OBJS="$(BUILD_TEST_DIR)/UTPackage.o $(BUILD_TEST_DIR)/mtk_tga.o" \
  480. CFLAGS="-Wall -O0 -g -Isrc -DUNIT_TEST_UTPACKAGE -DUSING_MTK_TGA" \
  481. LD_FLAGS="-lm -lstdc++"
  482. #################################################################