File: makefile

package info (click to toggle)
postal1 2015.git20250526%2Bds-2
  • links: PTS, VCS
  • area: contrib
  • in suites: forky, sid
  • size: 14,024 kB
  • sloc: cpp: 130,877; ansic: 38,942; python: 874; makefile: 351; sh: 61
file content (411 lines) | stat: -rw-r--r-- 10,718 bytes parent folder | download
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411

# !!! FIXME: Make this more robust. MUCH more robust.
# !!! FIXME: ...or at least comment the rest of these options...

BINDIR := ./bin
SRCDIR := .

ifeq ($(WITH_STEAMWORKS),1)
  steamworks := true
endif

ifeq ($(macosx_x86),1)
  target := macosx_x86
  CLIENTEXE := $(BINDIR)/postal1-x86
else
  target := linux
  CLIENTEXE := $(BINDIR)/postal1
endif

# ----------------------------------------------------- ... bleh.

ifeq ($(strip $(target)),linux)
  macosx := false
  CC ?= gcc
  CXX ?= g++
  LINKER ?= g++
endif
ifeq ($(strip $(target)),macosx_x86)
  macosx := true
  CPUARCH := x86
  CC := gcc
  CXX := g++
  LINKER := g++
endif

CLEANUP := $(wildcard *.exe) $(wildcard *.obj) \
          $(wildcard $(BINDIR)/*.exe) $(wildcard $(BINDIR)/*.obj) \
          $(wildcard *~) $(wildcard *.err) \
          $(wildcard .\#*) core

SRCS := \
	AnimThing.cpp \
	ball.cpp \
	barrel.cpp \
	bouy.cpp \
	character.cpp \
	chunk.cpp \
	deathWad.cpp \
	demon.cpp \
	dispenser.cpp \
	doofus.cpp \
	dude.cpp \
	explode.cpp \
	fire.cpp \
	fireball.cpp \
	firebomb.cpp \
	flag.cpp \
	flagbase.cpp \
	grenade.cpp \
	heatseeker.cpp \
	hood.cpp \
	item3d.cpp \
	mine.cpp \
	napalm.cpp \
	navnet.cpp \
	ostrich.cpp \
	person.cpp \
	PowerUp.cpp \
	pylon.cpp \
	rocket.cpp \
	sentry.cpp \
	SndRelay.cpp \
	SoundThing.cpp \
	thing.cpp \
	Thing3d.cpp \
	trigger.cpp \
	warp.cpp \
	weapon.cpp \
	alphablitforpostal.cpp \
	Anim3D.cpp \
	BufQ.cpp \
	bulletFest.cpp \
	camera.cpp \
	crawler.cpp \
	cutscene.cpp \
	encrypt.cpp \
	gameedit.cpp \
	GameSettings.cpp \
	grip.cpp \
	IdBank.cpp \
	InputSettings.cpp \
	InputSettingsDlg.cpp \
	keys.cpp \
	Log.cpp \
	logtab.cpp \
	MemFileFest.cpp \
	MenuSettings.cpp \
	MenuTrans.cpp \
	net.cpp \
	NetBrowse.cpp \
	NetClient.cpp \
	NetDlg.cpp \
	netmsgr.cpp \
	NetServer.cpp \
	organ.cpp \
	Personatorium.cpp \
	ProtoBSDIP.cpp \
	realm.cpp \
	scene.cpp \
	score.cpp \
	settings.cpp \
	smash.cpp \
	socket.cpp \
	StockPile.cpp \
	TexEdit.cpp \
	toolbar.cpp \
	TriggerRegions.cpp \
	update.cpp \
	yatime.cpp \
	aivars.cpp \
	band.cpp \
	credits.cpp \
	game.cpp \
	input.cpp \
	localize.cpp \
	main.cpp \
	menus.cpp \
	play.cpp \
	SampleMaster.cpp \
	title.cpp

RSSRCS := \
	RSPiX/Src/BLUE/unix/Bdebug.cpp \
	RSPiX/Src/BLUE/unix/Bjoy.cpp \
	RSPiX/Src/BLUE/unix/Bkey.cpp \
	RSPiX/Src/BLUE/unix/Bmain.cpp \
	RSPiX/Src/BLUE/unix/Bmouse.cpp \
	RSPiX/Src/BLUE/unix/Btime.cpp \
	RSPiX/Src/BLUE/unix/Bdisp.cpp \
	RSPiX/Src/BLUE/unix/Bsound.cpp \
	RSPiX/Src/GREEN/Hot/hot.cpp \
	RSPiX/Src/GREEN/Image/Image.cpp \
	RSPiX/Src/GREEN/Image/Imagecon.cpp \
	RSPiX/Src/GREEN/Image/ImageFile.cpp \
	RSPiX/Src/GREEN/InputEvent/InputEvent.cpp \
	RSPiX/Src/GREEN/Mix/mix.cpp \
	RSPiX/Src/GREEN/Mix/MixBuf.cpp \
	RSPiX/Src/GREEN/Image/pal.cpp \
	RSPiX/Src/GREEN/Image/PalFile.cpp \
	RSPiX/Src/GREEN/Sample/sample.cpp \
	RSPiX/Src/GREEN/Snd/snd.cpp \
	RSPiX/Src/GREEN/SndFx/SndFx.cpp \
	RSPiX/Src/GREEN/Task/task.cpp \
	RSPiX/Src/GREEN/3D/pipeline.cpp \
	RSPiX/Src/GREEN/3D/render.cpp \
	RSPiX/Src/GREEN/3D/types3d.cpp \
	RSPiX/Src/GREEN/3D/zbuffer.cpp \
	RSPiX/Src/GREEN/BLiT/alphablit.cpp \
	RSPiX/Src/GREEN/BLiT/BLIT.cpp \
	RSPiX/Src/GREEN/BLiT/BLITINIT.cpp \
	RSPiX/Src/GREEN/BLiT/BLiTT.cpp \
	RSPiX/Src/GREEN/BLiT/CFNT.cpp \
	RSPiX/Src/GREEN/BLiT/Fspr1.cpp \
	RSPiX/Src/GREEN/BLiT/FSPR8.cpp \
	RSPiX/Src/GREEN/BLiT/line.cpp \
	RSPiX/Src/GREEN/BLiT/mono.cpp \
	RSPiX/Src/GREEN/BLiT/Rotate96.cpp \
	RSPiX/Src/GREEN/BLiT/RPrint.cpp \
	RSPiX/Src/GREEN/BLiT/ScaleFlat.cpp \
	RSPiX/Src/ORANGE/GameLib/ANIMSPRT.cpp \
	RSPiX/Src/ORANGE/Attribute/attribute.cpp \
	RSPiX/Src/ORANGE/GUI/btn.cpp \
	RSPiX/Src/ORANGE/Channel/channel.cpp \
	RSPiX/Src/ORANGE/color/colormatch.cpp \
	RSPiX/Src/ORANGE/DirtRect/DirtRect.cpp \
	RSPiX/Src/ORANGE/color/dithermatch.cpp \
	RSPiX/Src/ORANGE/GUI/dlg.cpp \
	RSPiX/Src/ORANGE/GUI/edit.cpp \
	RSPiX/Src/ORANGE/File/file.cpp \
	RSPiX/Src/ORANGE/QuickMath/FixedPoint.cpp \
	RSPiX/Src/ORANGE/GUI/guiItem.cpp \
	RSPiX/Src/ORANGE/IFF/iff.cpp \
	RSPiX/Src/ORANGE/ImageTools/lasso.cpp \
	RSPiX/Src/ORANGE/Laymage/laymage.cpp \
	RSPiX/Src/ORANGE/GUI/ListBox.cpp \
	RSPiX/Src/ORANGE/GUI/ListContents.cpp \
	RSPiX/Src/ORANGE/Meter/meter.cpp \
	RSPiX/Src/ORANGE/MsgBox/MsgBox.cpp \
	RSPiX/Src/ORANGE/GUI/MultiBtn.cpp \
	RSPiX/Src/ORANGE/MultiGrid/MultiGrid.cpp \
	RSPiX/Src/ORANGE/MultiGrid/MultiGridIndirect.cpp \
	RSPiX/Src/ORANGE/GUI/ProcessGui.cpp \
	RSPiX/Src/ORANGE/Debug/profile.cpp \
	RSPiX/Src/ORANGE/GUI/PushBtn.cpp \
	RSPiX/Src/ORANGE/QuickMath/QuickMath.cpp \
	RSPiX/Src/ORANGE/GameLib/Region.cpp \
	RSPiX/Src/ORANGE/RString/rstring.cpp \
	RSPiX/Src/ORANGE/GUI/scrollbar.cpp \
	RSPiX/Src/ORANGE/GameLib/SHAPES.cpp \
	RSPiX/Src/ORANGE/Parse/SimpleBatch.cpp \
	RSPiX/Src/ORANGE/GameLib/SPRITE.cpp \
	RSPiX/Src/ORANGE/str/str.cpp \
	RSPiX/Src/ORANGE/GUI/txt.cpp \
	RSPiX/Src/CYAN/Unix/uDialog.cpp \
	RSPiX/Src/CYAN/Unix/uColors.cpp \
	RSPiX/Src/CYAN/Unix/uPath.cpp

WSRCS :=  \
	WishPiX/Menu/menu.cpp \
	WishPiX/Prefs/prefline.cpp \
	WishPiX/Prefs/prefs.cpp \
	WishPiX/ResourceManager/resmgr.cpp \
	WishPiX/Spry/spry.cpp

    # wtf is THIS?!
	#RSPiX/Src/ORANGE/MTask/mtask.cpp \

SRCS += $(RSSRCS)
SRCS += $(WSRCS)

RSOBJS := $(RSSRCS:.cpp=.o)
RSOBJS := $(foreach f,$(RSOBJS),$(BINDIR)/$(f))

OBJS0 := $(SRCS:.s=.o)
OBJS1 := $(OBJS0:.c=.o)
OBJS2 := $(OBJS1:.cpp=.o)
OBJS3 := $(OBJS2:.nasm=.o)
OBJS4 := $(OBJS3:.s=.o)
OBJS := $(foreach f,$(OBJS4),$(BINDIR)/$(f))
SRCS := $(foreach f,$(SRCS),$(SRCDIR)/$(f))

EBINDIR := ./extra
ESRCS := \
		saktool.c

EOBJS := $(ESRCS:.c=.o)
EOBJS := $(foreach f,$(EOBJS),$(EBINDIR)/$(f))
ESRCS := $(foreach f,$(ESRCS),$(SRCDIR)/$(f))

# !!! FIXME: Get -Wall in here, some day.
COMMONFLAGS += -fsigned-char -DPLATFORM_UNIX -w

ifeq ($(strip $(macosx)),true)
  COMMONFLAGS += -DPLATFORM_MACOSX
endif

# defines the game needs...
COMMONFLAGS += -DLOCALE=US -DTARGET=POSTAL_2015

# includes ...
COMMONFLAGS += -I$(SRCDIR)
COMMONFLAGS += -I/usr/include/SDL2
COMMONFLAGS += -I$(SRCDIR)/RSPiX
COMMONFLAGS += -I$(SRCDIR)/RSPiX/Inc
COMMONFLAGS += -I$(SRCDIR)/RSPiX/Src
COMMONFLAGS += -I$(SRCDIR)/RSPiX/Src/BLUE
COMMONFLAGS += -I$(SRCDIR)/RSPiX/Src/BLUE/unix
COMMONFLAGS += -I$(SRCDIR)/RSPiX/Src/CYAN
COMMONFLAGS += -I$(SRCDIR)/RSPiX/Src/CYAN/Unix
COMMONFLAGS += -I$(SRCDIR)/RSPiX/Src/ORANGE
COMMONFLAGS += -I$(SRCDIR)/RSPiX/Src/ORANGE/CDT
COMMONFLAGS += -I$(SRCDIR)/RSPiX/Src/ORANGE/GameLib
COMMONFLAGS += -I$(SRCDIR)/RSPiX/Src/ORANGE/File
COMMONFLAGS += -I$(SRCDIR)/RSPiX/Src/ORANGE/Multigrid
COMMONFLAGS += -I$(SRCDIR)/RSPiX/Src/GREEN/Image
COMMONFLAGS += -I$(SRCDIR)/WishPiX
COMMONFLAGS += -I$(SRCDIR)/WishPiX/Spry

ifeq ($(strip $(expiring_beta)),true)
  COMMONFLAGS += -DBETAEXPIRE=$(shell date +%s)
endif

ifeq ($(strip $(macosx)),true)
  COMMONFLAGS += -arch i386 -mmacosx-version-min=10.6
  LDFLAGS += -arch i386 -mmacosx-version-min=10.6
  LDFLAGS += -framework CoreFoundation -framework Cocoa
  LIBS += SDL2/libs/macosx/libSDL2-2.0.0.dylib
  STEAMLDFLAGS += steamworks/sdk/redistributable_bin/osx32/libsteam_api.dylib
else
  LIBS += -lSDL2
  STEAMLDFLAGS += steamworks/sdk/redistributable_bin/linux32/libsteam_api.so
endif

ifeq ($(strip $(steamworks)),true)
  COMMONFLAGS += -DWITH_STEAMWORKS=1 -Isteamworks/sdk/public
  LDFLAGS += $(STEAMLDFLAGS)
endif

COMMONFLAGS += -DALLOW_TWINSTICK

CFLAGS += $(CPPFLAGS) $(COMMONFLAGS)
CXXFLAGS += $(CPPFLAGS) $(COMMONFLAGS)

.PHONY: all bindir


all: debugoff $(CLIENTEXE)


debug: debugon $(CLIENTEXE)

debugon:
	$(eval CFLAGS += -DDEBUG -D_DEBUG -O0 -g)
	$(eval CXXFLAGS += -DDEBUG -D_DEBUG -O0 -g)

debugoff:
	$(eval OPTFLAG := -O3)
	$(eval CFLAGS += -DNDEBUG -D_NDEBUG -O2)
	$(eval CXXFLAGS += -DNDEBUG -D_NDEBUG -O2)

$(BINDIR)/%.o: $(SRCDIR)/%.s
	$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<

$(BINDIR)/%.o: $(SRCDIR)/%.cpp
	$(CXX) -c -o $@ $< $(CXXFLAGS) -std=c++03

$(BINDIR)/%.o: $(SRCDIR)/%.c
	$(CC) -c -o $@ $< $(CFLAGS)

$(BINDIR)/%.a: $(SRCDIR)/%.a
	cp $< $@
	ranlib $@

$(CLIENTEXE): $(BINDIR) $(OBJS) $(LIBS)
	$(LINKER) -o $(CLIENTEXE) $(OBJS) $(LDFLAGS) $(LIBS)

$(BINDIR) :
	$(MAKE) bindir

bindir :
	mkdir -p $(BINDIR)
	mkdir -p $(BINDIR)/RSPiX/Src/BLUE/unix
	mkdir -p $(BINDIR)/RSPiX/Src/GREEN/Hot
	mkdir -p $(BINDIR)/RSPiX/Src/GREEN/Image
	mkdir -p $(BINDIR)/RSPiX/Src/GREEN/InputEvent
	mkdir -p $(BINDIR)/RSPiX/Src/GREEN/Mix
	mkdir -p $(BINDIR)/RSPiX/Src/GREEN/Sample
	mkdir -p $(BINDIR)/RSPiX/Src/GREEN/Snd
	mkdir -p $(BINDIR)/RSPiX/Src/GREEN/SndFx
	mkdir -p $(BINDIR)/RSPiX/Src/GREEN/Task
	mkdir -p $(BINDIR)/RSPiX/Src/GREEN/3D
	mkdir -p $(BINDIR)/RSPiX/Src/GREEN/BLiT
	mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/GameLib
	mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/Attribute
	mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/GUI
	mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/Channel
	mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/color
	mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/DirtRect
	mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/File
	mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/QuickMath
	mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/IFF
	mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/ImageTools
	mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/Laymage
	mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/Meter
	mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/MsgBox
	mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/MTask
	mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/MultiGrid
	mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/Debug
	mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/RString
	mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/Parse
	mkdir -p $(BINDIR)/RSPiX/Src/ORANGE/str
	mkdir -p $(BINDIR)/RSPiX/Src/CYAN/Unix
	mkdir -p $(BINDIR)/WishPiX/Menu
	mkdir -p $(BINDIR)/WishPiX/Prefs
	mkdir -p $(BINDIR)/WishPiX/ResourceManager
	mkdir -p $(BINDIR)/WishPiX/Spry
	mkdir -p $(BINDIR)/libs

$(EBINDIR)/%.o: $(SRCDIR)/%.c
	$(CC) -c -g -o $@ $< $(CFLAGS)

saktool: $(EBINDIR) $(EOBJS) $(ELIBS)
	$(LINKER) -o saktool $(EOBJS) $(ELDFLAGS) $(ELIBS)

picon:
	$(eval CFLAGS += -fPIC -shared)
	$(eval CXXFLAGS += -fPIC -shared)

RSPiX_wrap.cxx: RSPiX.i
	swig -c++ -python -IRSPiX/Src RSPiX.i 
	# Idk if there's a way to fix this "properly"
	sed -i "s/ Node \\*/ RFList< RSprite \\* >::Pointer /g" RSPiX_wrap.cxx
	sed -i "s/(Node \\*/(RFList< RSprite \\* >::Pointer/g" RSPiX_wrap.cxx

RSPiX_wrap.o: RSPiX.i RSPiX_wrap.cxx
	$(CXX) -c RSPiX_wrap.cxx $(CXXFLAGS)

_RSPiX.so: $(BINDIR) picon $(RSOBJS) RSPiX.i RSPiX_wrap.cxx RSPiX_wrap.o $(BINDIR)/WishPiX/Spry/spry.o $(BINDIR)/malphagen.o
	$(CXX) RSPiX_wrap.o $(RSOBJS) $(BINDIR)/WishPiX/Spry/spry.o $(BINDIR)/malphagen.o -o _RSPiX.so $(LDFLAGS) $(LIBS) $(CXXFLAGS)

swig:
	BINDIR=binpic $(MAKE) -e _RSPiX.so

$(EBINDIR) :
	$(MAKE) ebindir

ebindir :
	mkdir -p $(EBINDIR)

distclean: clean

clean:
	rm -f $(CLEANUP)
	rm -rf $(BINDIR)
	#rm -f $(SRCDIR)/parser/y.tab.c
	#rm -f $(SRCDIR)/parser/lex.yy.c
	rm -rf $(EBINDIR)
	rm -f saktool
	rm -f RSPiX_wrap.c RSPiX_wrap.cxx RSPiX_wrap.o _RSPiX.so RSPiX.py

# end of Makefile ...