forked from nzp-team/quakespasm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.vita
290 lines (260 loc) · 6.77 KB
/
Makefile.vita
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
# GNU Makefile for QuakeSpasm unix targets.
# You need the SDL library fully installed.
# "make DEBUG=1" to build a debug client.
# "make SDL_CONFIG=/path/to/sdl-config" for unusual SDL installations.
# "make DO_USERDIRS=1" to enable user directories support
# Enable/Disable user directories support
DO_USERDIRS=0
### Enable/Disable SDL2
USE_SDL2=1
### Enable the use of zlib, for compressed pk3s.
USE_ZLIB=1
### Enable/Disable codecs for streaming music support
USE_CODEC_WAVE=1
USE_CODEC_FLAC=0
USE_CODEC_MP3=1
USE_CODEC_VORBIS=1
USE_CODEC_OPUS=1
# either mikmod or xmp
USE_CODEC_MIKMOD=0
USE_CODEC_XMP=0
USE_CODEC_UMX=0
# which library to use for mp3 decoding: mad or mpg123
MP3LIB=mad
# which library to use for ogg decoding: vorbis or tremor
VORBISLIB=vorbis
# ---------------------------
DEBUG ?= 0
# ---------------------------
# build variables
# ---------------------------
PREFIX = arm-vita-eabi
CC = $(PREFIX)-gcc
LINKER = $(CC)
STRIP ?= $(PREFIX)-strip
#CPUFLAGS= -mtune=i686
#CPUFLAGS= -march=pentium4
#CPUFLAGS= -mtune=k8
#CPUFLAGS= -march=atom
CPUFLAGS=
LDFLAGS =
DFLAGS ?=
CFLAGS ?= -Wl,-q -g \
-Wall -Wno-trigraphs -I$(VITASDK)/arm-vita-eabi/include/SDL2 -fno-short-enums \
-DVITA -I$(VITASDK)/arm-vita-eabi/include/opus -fno-optimize-sibling-calls -fno-strict-aliasing \
-DUSE_ZLIB
CFLAGS += $(CPUFLAGS)
ifneq ($(DEBUG),0)
DFLAGS += -DDEBUG
CFLAGS += -g
do_strip=
else
DFLAGS += -DNDEBUG
CFLAGS += -O3
cmd_strip=$(STRIP) $(1)
define do_strip
$(call cmd_strip,$(1));
endef
endif
CFLAGS += $(QSS_CFLAGS)
LDFLAGS += $(QSS_LDFLAGS)
ifeq ($(DO_USERDIRS),1)
CFLAGS += -DDO_USERDIRS=1
endif
ifeq ($(USE_SDL2),1)
CFLAGS += -DUSE_SDL2
endif
NET_LIBS :=
ifneq ($(VORBISLIB),vorbis)
ifneq ($(VORBISLIB),tremor)
$(error Invalid VORBISLIB setting)
endif
endif
ifneq ($(MP3LIB),mpg123)
ifneq ($(MP3LIB),mad)
$(error Invalid MP3LIB setting)
endif
endif
ifeq ($(MP3LIB),mad)
mp3_obj=snd_mp3
lib_mp3dec=-lmad
endif
ifeq ($(MP3LIB),mpg123)
mp3_obj=snd_mpg123
lib_mp3dec=-lmpg123
endif
ifeq ($(VORBISLIB),vorbis)
cpp_vorbisdec=
lib_vorbisdec=-lvorbisfile -lvorbis -logg
endif
ifeq ($(VORBISLIB),tremor)
cpp_vorbisdec=-DVORBIS_USE_TREMOR
lib_vorbisdec=-lvorbisidec -logg
endif
CODECLIBS :=
ifeq ($(USE_CODEC_WAVE),1)
CFLAGS+= -DUSE_CODEC_WAVE
endif
ifeq ($(USE_CODEC_FLAC),1)
CFLAGS+= -DUSE_CODEC_FLAC
CODECLIBS+= -lFLAC
endif
ifeq ($(USE_CODEC_OPUS),1)
# opus and opusfile put their *.h under <includedir>/opus,
# but they include the headers without the opus directory
# prefix and rely on pkg-config. ewww...
CFLAGS+= -DUSE_CODEC_OPUS
CODECLIBS+= -lopusfile -lopus
endif
ifeq ($(USE_CODEC_VORBIS),1)
CFLAGS+= -DUSE_CODEC_VORBIS $(cpp_vorbisdec)
CODECLIBS+= $(lib_vorbisdec)
endif
ifeq ($(USE_CODEC_MP3),1)
CFLAGS+= -DUSE_CODEC_MP3
CODECLIBS+= $(lib_mp3dec)
endif
ifeq ($(USE_CODEC_MIKMOD),1)
CFLAGS+= -DUSE_CODEC_MIKMOD
CODECLIBS+= -lmikmod
endif
ifeq ($(USE_CODEC_XMP),1)
CFLAGS+= -DUSE_CODEC_XMP
CODECLIBS+= -lxmp
endif
ifeq ($(USE_CODEC_UMX),1)
CFLAGS+= -DUSE_CODEC_UMX
endif
COMMON_LIBS:= -lvitaGL -lvitashark -lSceShaccCgExt -lvorbisfile -lvorbis -logg -lspeexdsp -lmpg123 \
-lScePspnetAdhoc_stub -lc -lSceLibKernel_stub -lmathneon -lSDL2 -lSceAudioIn_stub -lSceKernelDmacMgr_stub \
-lSceNet_stub -lSceNetCtl_stub -lpng -lSceDisplay_stub -lSceGxm_stub -lSceShaccCg_stub -lSceIme_stub \
-ltaihen_stub -lSceSysmodule_stub -lSceCtrl_stub -lSceTouch_stub -lSceMotion_stub -lm -lSceAppMgr_stub \
-lSceAppUtil_stub -lScePgf_stub -ljpeg -lSceRtc_stub -lScePower_stub -lcurl -lssl -lcrypto -lz \
-lSceHid_stub -lSceCommonDialog_stub -lSceAudio_stub
ifeq ($(USE_ZLIB),1)
CFLAGS+= -DUSE_ZLIB
COMMON_LIBS+= -lz
endif
LIBS := $(NET_LIBS) $(CODECLIBS) $(COMMON_LIBS)
# ---------------------------
# targets
# ---------------------------
.PHONY: clean debug release
DEFAULT_TARGET := nzp.vpk
# ---------------------------
# rules
# ---------------------------
%.o: %.c
$(CC) $(DFLAGS) -c $(CFLAGS) $(SDL_CFLAGS) -o $@ $<
# ----------------------------------------------------------------------------
# objects
# ----------------------------------------------------------------------------
OBJS :=\
source/bsd_strlcat.o \
source/bsd_strlcpy.o \
source/bgmusic.o \
source/snd_codec.o \
source/snd_flac.o \
source/snd_wave.o \
source/snd_vorbis.o \
source/snd_opus.o \
source/snd_mpg123.o \
source/snd_mikmod.o \
source/snd_xmp.o \
source/snd_umx.o \
source/snd_dma.o \
source/snd_mix.o \
source/snd_mem.o \
source/snd_sdl.o \
source/cd_sdl.o \
source/in_sdl.o \
source/gl_refrag.o \
source/gl_rlight.o \
source/gl_rpart.o \
source/gl_rmain.o \
source/gl_fog.o \
source/gl_rmisc.o \
source/r_part.o \
source/r_world.o \
source/gl_screen.o \
source/gl_sky.o \
source/gl_warp.o \
source/gl_vidsdl.o \
source/gl_hud.o \
source/gl_draw.o \
source/image.o \
source/gl_texmgr.o \
source/gl_mesh.o \
source/r_sprite.o \
source/r_alias.o \
source/r_brush.o \
source/gl_model.o \
source/net_bsd.o \
source/net_udp.o \
source/pl_linux.o \
source/sys_sdl_unix.o \
source/main_sdl.o \
source/net_dgrm.o \
source/net_loop.o \
source/net_main.o \
source/chase.o \
source/cl_demo.o \
source/cl_input.o \
source/cl_main.o \
source/cl_parse.o \
source/cl_tent.o \
source/console.o \
source/keys.o \
source/menu.o \
source/sbar.o \
source/view.o \
source/wad.o \
source/cmd.o \
source/common.o \
source/crc.o \
source/cvar.o \
source/cfgfile.o \
source/host.o \
source/host_cmd.o \
source/matrixlib.o \
source/mathlib.o \
source/pr_cmds.o \
source/pr_edict.o \
source/pr_exec.o \
source/sv_main.o \
source/sv_move.o \
source/sv_phys.o \
source/sv_user.o \
source/world.o \
source/zone.o \
source/fnmatch.o
nzp.vpk: nzp.velf
make -f Makefile.launcher
mkdir -p build/vita/
vita-make-fself -c $< assets/vita/eboot.bin
vita-mksfoex -s TITLE_ID=NZZMBSPTB -d ATTRIBUTE2=12 "Nazi Zombies: Portable" param.sfo
cp -f param.sfo assets/vita/sce_sys/param.sfo
vita-pack-vpk -s param.sfo -b eboot.bin \
--add assets/vita/eboot.bin=nzp.bin \
--add assets/vita/sce_sys/icon0.png=sce_sys/icon0.png \
--add assets/vita/sce_sys/livearea/contents/bg.png=sce_sys/livearea/contents/bg.png \
--add assets/vita/sce_sys/livearea/contents/startup.png=sce_sys/livearea/contents/startup.png \
--add assets/vita/sce_sys/livearea/contents/template.xml=sce_sys/livearea/contents/template.xml \
build/vita/nzp.vpk
mv param.sfo build/vita/
mv nzp.elf build/vita/
mv nzp.elf.unstripped.elf build/vita/
mv nzp.velf build/vita/
mv source/*.o build/vita/
%.velf: %.elf
cp $< $<.unstripped.elf
$(PREFIX)-strip -g $<
vita-elf-create $< $@
nzp.elf: $(OBJS)
$(CC) $(CFLAGS) $^ $(LDFLAGS) $(LIBS) $(SDL_LIBS) -o $@
image.o: lodepng.c lodepng.h stb_image_write.h
release: nzp
debug:
$(error Use "make DEBUG=1")
clean:
@rm -rf nzp.velf nzp.elf $(OBJS) nzp.elf.unstripped.elf nzp.vpk assets/vita/eboot.bin assets/vita/sce_sys/param.sfo ./param.sfo