makefile 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. # !!! FIXME: Make this more robust. MUCH more robust.
  2. # !!! FIXME: ...or at least comment the rest of these options...
  3. ifeq ($(PANDORA),1)
  4. macosx := false
  5. CPUARCH := arm
  6. CC := g++
  7. LINKER := g++
  8. steamworks := false
  9. CFLAGS += -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -ffast-math -DPANDORA
  10. else ifeq ($(ODROID),1)
  11. macosx := false
  12. CPUARCH := arm
  13. CC := g++
  14. LINKER := g++
  15. steamworks := false
  16. CFLAGS += -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=hard -ftree-vectorize -ffast-math -DODROID
  17. else ifeq ($(linux_x86),1)
  18. target := linux_x86
  19. else
  20. target := macosx_x86
  21. steamworks := true
  22. endif
  23. BINDIR := ./bin
  24. SRCDIR := .
  25. #debug := true
  26. debug := false
  27. # ----------------------------------------------------- ... bleh.
  28. ifeq ($(strip $(target)),linux_x86)
  29. macosx := false
  30. CPUARCH := x86
  31. CC := g++
  32. LINKER := g++
  33. endif
  34. ifeq ($(strip $(target)),macosx_x86)
  35. macosx := true
  36. CPUARCH := x86
  37. CC := g++
  38. LINKER := g++
  39. endif
  40. CLEANUP := $(wildcard *.exe) $(wildcard *.obj) \
  41. $(wildcard $(BINDIR)/*.exe) $(wildcard $(BINDIR)/*.obj) \
  42. $(wildcard *~) $(wildcard *.err) \
  43. $(wildcard .\#*) core
  44. SRCS := \
  45. AnimThing.cpp \
  46. ball.cpp \
  47. barrel.cpp \
  48. bouy.cpp \
  49. character.cpp \
  50. chunk.cpp \
  51. deathWad.cpp \
  52. demon.cpp \
  53. dispenser.cpp \
  54. doofus.cpp \
  55. dude.cpp \
  56. explode.cpp \
  57. fire.cpp \
  58. fireball.cpp \
  59. firebomb.cpp \
  60. flag.cpp \
  61. flagbase.cpp \
  62. grenade.cpp \
  63. heatseeker.cpp \
  64. hood.cpp \
  65. item3d.cpp \
  66. mine.cpp \
  67. napalm.cpp \
  68. navnet.cpp \
  69. ostrich.cpp \
  70. person.cpp \
  71. PowerUp.cpp \
  72. pylon.cpp \
  73. rocket.cpp \
  74. sentry.cpp \
  75. SndRelay.cpp \
  76. SoundThing.cpp \
  77. thing.cpp \
  78. Thing3d.cpp \
  79. trigger.cpp \
  80. warp.cpp \
  81. weapon.cpp \
  82. alphablitforpostal.cpp \
  83. Anim3D.cpp \
  84. BufQ.cpp \
  85. bulletFest.cpp \
  86. camera.cpp \
  87. crawler.cpp \
  88. cutscene.cpp \
  89. encrypt.cpp \
  90. gameedit.cpp \
  91. GameSettings.cpp \
  92. grip.cpp \
  93. IdBank.cpp \
  94. InputSettings.cpp \
  95. InputSettingsDlg.cpp \
  96. keys.cpp \
  97. Log.cpp \
  98. logtab.cpp \
  99. MemFileFest.cpp \
  100. MenuSettings.cpp \
  101. MenuTrans.cpp \
  102. net.cpp \
  103. NetBrowse.cpp \
  104. NetClient.cpp \
  105. NetDlg.cpp \
  106. netmsgr.cpp \
  107. NetServer.cpp \
  108. organ.cpp \
  109. Personatorium.cpp \
  110. ProtoBSDIP.cpp \
  111. realm.cpp \
  112. scene.cpp \
  113. score.cpp \
  114. settings.cpp \
  115. smash.cpp \
  116. socket.cpp \
  117. StockPile.cpp \
  118. TexEdit.cpp \
  119. toolbar.cpp \
  120. TriggerRegions.cpp \
  121. update.cpp \
  122. yatime.cpp \
  123. aivars.cpp \
  124. band.cpp \
  125. credits.cpp \
  126. game.cpp \
  127. input.cpp \
  128. localize.cpp \
  129. main.cpp \
  130. menus.cpp \
  131. play.cpp \
  132. SampleMaster.cpp \
  133. title.cpp \
  134. RSPiX/Src/BLUE/unix/Bdebug.cpp \
  135. RSPiX/Src/BLUE/unix/Bjoy.cpp \
  136. RSPiX/Src/BLUE/unix/Bkey.cpp \
  137. RSPiX/Src/BLUE/unix/Bmain.cpp \
  138. RSPiX/Src/BLUE/unix/Bmouse.cpp \
  139. RSPiX/Src/BLUE/unix/Btime.cpp \
  140. RSPiX/Src/BLUE/unix/Bdisp.cpp \
  141. RSPiX/Src/BLUE/unix/Bsound.cpp \
  142. RSPiX/Src/GREEN/Hot/hot.cpp \
  143. RSPiX/Src/GREEN/Image/Image.cpp \
  144. RSPiX/Src/GREEN/Image/Imagecon.cpp \
  145. RSPiX/Src/GREEN/Image/ImageFile.cpp \
  146. RSPiX/Src/GREEN/InputEvent/InputEvent.cpp \
  147. RSPiX/Src/GREEN/Mix/mix.cpp \
  148. RSPiX/Src/GREEN/Mix/MixBuf.cpp \
  149. RSPiX/Src/GREEN/Image/pal.cpp \
  150. RSPiX/Src/GREEN/Image/PalFile.cpp \
  151. RSPiX/Src/GREEN/Sample/sample.cpp \
  152. RSPiX/Src/GREEN/Snd/snd.cpp \
  153. RSPiX/Src/GREEN/SndFx/SndFx.cpp \
  154. RSPiX/Src/GREEN/Task/task.cpp \
  155. RSPiX/Src/GREEN/3D/pipeline.cpp \
  156. RSPiX/Src/GREEN/3D/render.cpp \
  157. RSPiX/Src/GREEN/3D/types3d.cpp \
  158. RSPiX/Src/GREEN/3D/zbuffer.cpp \
  159. RSPiX/Src/GREEN/BLiT/alphablit.cpp \
  160. RSPiX/Src/GREEN/BLiT/BLIT.cpp \
  161. RSPiX/Src/GREEN/BLiT/BLITINIT.cpp \
  162. RSPiX/Src/GREEN/BLiT/BLiTT.cpp \
  163. RSPiX/Src/GREEN/BLiT/CFNT.cpp \
  164. RSPiX/Src/GREEN/BLiT/Fspr1.cpp \
  165. RSPiX/Src/GREEN/BLiT/FSPR8.cpp \
  166. RSPiX/Src/GREEN/BLiT/line.cpp \
  167. RSPiX/Src/GREEN/BLiT/mono.cpp \
  168. RSPiX/Src/GREEN/BLiT/Rotate96.cpp \
  169. RSPiX/Src/GREEN/BLiT/RPrint.cpp \
  170. RSPiX/Src/GREEN/BLiT/ScaleFlat.cpp \
  171. RSPiX/Src/ORANGE/GameLib/ANIMSPRT.cpp \
  172. RSPiX/Src/ORANGE/Attribute/attribute.cpp \
  173. RSPiX/Src/ORANGE/GUI/btn.cpp \
  174. RSPiX/Src/ORANGE/Channel/channel.cpp \
  175. RSPiX/Src/ORANGE/color/colormatch.cpp \
  176. RSPiX/Src/ORANGE/DirtRect/DirtRect.cpp \
  177. RSPiX/Src/ORANGE/color/dithermatch.cpp \
  178. RSPiX/Src/ORANGE/GUI/dlg.cpp \
  179. RSPiX/Src/ORANGE/GUI/edit.cpp \
  180. RSPiX/Src/ORANGE/File/file.cpp \
  181. RSPiX/Src/ORANGE/QuickMath/FixedPoint.cpp \
  182. RSPiX/Src/ORANGE/GUI/guiItem.cpp \
  183. RSPiX/Src/ORANGE/IFF/iff.cpp \
  184. RSPiX/Src/ORANGE/ImageTools/lasso.cpp \
  185. RSPiX/Src/ORANGE/Laymage/laymage.cpp \
  186. RSPiX/Src/ORANGE/GUI/ListBox.cpp \
  187. RSPiX/Src/ORANGE/GUI/ListContents.cpp \
  188. RSPiX/Src/ORANGE/Meter/meter.cpp \
  189. RSPiX/Src/ORANGE/MsgBox/MsgBox.cpp \
  190. RSPiX/Src/ORANGE/GUI/MultiBtn.cpp \
  191. RSPiX/Src/ORANGE/MultiGrid/MultiGrid.cpp \
  192. RSPiX/Src/ORANGE/MultiGrid/MultiGridIndirect.cpp \
  193. RSPiX/Src/ORANGE/GUI/ProcessGui.cpp \
  194. RSPiX/Src/ORANGE/Debug/profile.cpp \
  195. RSPiX/Src/ORANGE/GUI/PushBtn.cpp \
  196. RSPiX/Src/ORANGE/QuickMath/QuickMath.cpp \
  197. RSPiX/Src/ORANGE/GameLib/Region.cpp \
  198. RSPiX/Src/ORANGE/RString/rstring.cpp \
  199. RSPiX/Src/ORANGE/GUI/scrollbar.cpp \
  200. RSPiX/Src/ORANGE/GameLib/SHAPES.cpp \
  201. RSPiX/Src/ORANGE/Parse/SimpleBatch.cpp \
  202. RSPiX/Src/ORANGE/GameLib/SPRITE.cpp \
  203. RSPiX/Src/ORANGE/str/str.cpp \
  204. RSPiX/Src/ORANGE/GUI/txt.cpp \
  205. RSPiX/Src/CYAN/Unix/uDialog.cpp \
  206. RSPiX/Src/CYAN/Unix/uColors.cpp \
  207. RSPiX/Src/CYAN/Unix/uPath.cpp \
  208. WishPiX/Menu/menu.cpp \
  209. WishPiX/Prefs/prefline.cpp \
  210. WishPiX/Prefs/prefs.cpp \
  211. WishPiX/ResourceManager/resmgr.cpp \
  212. WishPiX/Spry/spry.cpp
  213. # wtf is THIS?!
  214. #RSPiX/Src/ORANGE/MTask/mtask.cpp \
  215. CLIENTEXE := $(BINDIR)/postal1-bin
  216. OBJS0 := $(SRCS:.s=.o)
  217. OBJS1 := $(OBJS0:.c=.o)
  218. OBJS2 := $(OBJS1:.cpp=.o)
  219. OBJS3 := $(OBJS2:.nasm=.o)
  220. OBJS4 := $(OBJS3:.s=.o)
  221. OBJS := $(foreach f,$(OBJS4),$(BINDIR)/$(f))
  222. SRCS := $(foreach f,$(SRCS),$(SRCDIR)/$(f))
  223. # !!! FIXME: Get -Wall in here, some day.
  224. CFLAGS += -fsigned-char -g -DPLATFORM_UNIX -w
  225. ifeq ($(strip $(macosx)),true)
  226. CFLAGS += -DPLATFORM_MACOSX
  227. endif
  228. # defines the game needs...
  229. CFLAGS += -DLOCALE=US -DTARGET=POSTAL_2015
  230. # includes ...
  231. CFLAGS += -I$(SRCDIR)
  232. CFLAGS += -I$(SRCDIR)/SDL2/include
  233. CFLAGS += -I$(SRCDIR)/RSPiX
  234. CFLAGS += -I$(SRCDIR)/RSPiX/Inc
  235. CFLAGS += -I$(SRCDIR)/RSPiX/Src
  236. CFLAGS += -I$(SRCDIR)/RSPiX/Src/BLUE
  237. CFLAGS += -I$(SRCDIR)/RSPiX/Src/BLUE/unix
  238. CFLAGS += -I$(SRCDIR)/RSPiX/Src/CYAN
  239. CFLAGS += -I$(SRCDIR)/RSPiX/Src/CYAN/Unix
  240. CFLAGS += -I$(SRCDIR)/RSPiX/Src/ORANGE
  241. CFLAGS += -I$(SRCDIR)/RSPiX/Src/ORANGE/CDT
  242. CFLAGS += -I$(SRCDIR)/RSPiX/Src/ORANGE/GameLib
  243. CFLAGS += -I$(SRCDIR)/RSPiX/Src/ORANGE/File
  244. CFLAGS += -I$(SRCDIR)/RSPiX/Src/ORANGE/Multigrid
  245. CFLAGS += -I$(SRCDIR)/RSPiX/Src/GREEN/Image
  246. CFLAGS += -I$(SRCDIR)/WishPiX
  247. CFLAGS += -I$(SRCDIR)/WishPiX/Spry
  248. ifeq ($(strip $(expiring_beta)),true)
  249. CFLAGS += -DBETAEXPIRE=$(shell date +%s)
  250. endif
  251. ifeq ($(strip $(debug)),true)
  252. CFLAGS += -DDEBUG -D_DEBUG -O0
  253. else
  254. OPTFLAG := -O3
  255. CFLAGS += -DNDEBUG -D_NDEBUG $(OPTFLAG)
  256. endif
  257. ifeq ($(strip $(macosx)),true)
  258. CFLAGS += -arch i386 -mmacosx-version-min=10.5
  259. LDFLAGS += -arch i386 -mmacosx-version-min=10.5
  260. LDFLAGS += -framework CoreFoundation -framework Cocoa
  261. LIBS += SDL2/libs/macosx/libSDL2-2.0.0.dylib
  262. STEAMLDFLAGS += steamworks/sdk/redistributable_bin/osx32/libsteam_api.dylib
  263. else
  264. ifeq ($(CPUARCH),arm)
  265. LIBS += -lSDL2
  266. else
  267. LIBS += SDL2/libs/linux-x86/libSDL2-2.0.so.0
  268. LDFLAGS += -Wl,-rpath,\$$ORIGIN
  269. STEAMLDFLAGS += steamworks/sdk/redistributable_bin/linux32/libsteam_api.so
  270. endif
  271. endif
  272. ifeq ($(strip $(steamworks)),true)
  273. CFLAGS += -DWITH_STEAMWORKS=1 -Isteamworks/sdk/public
  274. LDFLAGS += $(STEAMLDFLAGS)
  275. endif
  276. CFLAGS += -DALLOW_TWINSTICK
  277. .PHONY: all bindir
  278. all: $(CLIENTEXE)
  279. $(BINDIR)/%.o: $(SRCDIR)/%.s
  280. $(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
  281. $(BINDIR)/%.o: $(SRCDIR)/%.cpp
  282. $(CC) -c -o $@ $< $(CFLAGS)
  283. $(BINDIR)/%.o: $(SRCDIR)/%.c
  284. $(CC) -c -o $@ $< $(CFLAGS)
  285. $(BINDIR)/%.a: $(SRCDIR)/%.a
  286. cp $< $@
  287. ranlib $@
  288. $(CLIENTEXE): $(BINDIR) $(OBJS) $(LIBS)
  289. $(LINKER) -o $(CLIENTEXE) $(OBJS) $(LDFLAGS) $(LIBS)
  290. $(BINDIR) :
  291. $(MAKE) bindir
  292. bindir :
  293. mkdir -p $(BINDIR)
  294. mkdir -p $(BINDIR)/RSPiX/Src/BLUE/unix
  295. mkdir -p $(BINDIR)/RSPiX/Src/GREEN/Hot
  296. mkdir -p $(BINDIR)/RSPiX/Src/GREEN/Image
  297. mkdir -p $(BINDIR)/RSPiX/Src/GREEN/InputEvent
  298. mkdir -p $(BINDIR)/RSPiX/Src/GREEN/Mix
  299. mkdir -p $(BINDIR)/RSPiX/Src/GREEN/Sample
  300. mkdir -p $(BINDIR)/RSPiX/Src/GREEN/Snd
  301. mkdir -p $(BINDIR)/RSPiX/Src/GREEN/SndFx
  302. mkdir -p $(BINDIR)/RSPiX/Src/GREEN/Task
  303. mkdir -p $(BINDIR)/RSPiX/Src/GREEN/3D
  304. mkdir -p $(BINDIR)/RSPiX/Src/GREEN/BLiT
  305. mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/GameLib
  306. mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/Attribute
  307. mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/GUI
  308. mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/Channel
  309. mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/color
  310. mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/DirtRect
  311. mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/File
  312. mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/QuickMath
  313. mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/IFF
  314. mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/ImageTools
  315. mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/Laymage
  316. mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/Meter
  317. mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/MsgBox
  318. mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/MTask
  319. mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/MultiGrid
  320. mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/Debug
  321. mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/RString
  322. mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/Parse
  323. mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/str
  324. mkdir -p $(BINDIR)/RSPiX/Src/CYAN/Unix
  325. mkdir -p $(BINDIR)/WishPiX/Menu
  326. mkdir -p $(BINDIR)/WishPiX/Prefs
  327. mkdir -p $(BINDIR)/WishPiX/ResourceManager
  328. mkdir -p $(BINDIR)/WishPiX/Spry
  329. mkdir -p $(BINDIR)/libs
  330. distclean: clean
  331. clean:
  332. rm -f $(CLEANUP)
  333. rm -rf $(BINDIR)
  334. #rm -f $(SRCDIR)/parser/y.tab.c
  335. #rm -f $(SRCDIR)/parser/lex.yy.c
  336. # end of Makefile ...