2022-02-08 19:06:54 +00:00
|
|
|
# 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
|
|
|
|
|
2022-07-15 22:48:11 +00:00
|
|
|
COMMON_LIBS:= -lvitaGL -lvitashark -lSceShaccCgExt -lvorbisfile -lvorbis -logg -lspeexdsp -lmpg123 \
|
2022-07-15 22:59:07 +00:00
|
|
|
-lScePspnetAdhoc_stub -lc -lSceLibKernel_stub -lmathneon -lSDL2 -lSceAudioIn_stub -lSceKernelDmacMgr_stub \
|
2022-02-08 19:06:54 +00:00
|
|
|
-lSceNet_stub -lSceNetCtl_stub -lpng -lSceDisplay_stub -lSceGxm_stub -lSceShaccCg_stub \
|
2022-07-15 22:48:11 +00:00
|
|
|
-ltaihen_stub -lSceSysmodule_stub -lSceCtrl_stub -lSceTouch_stub -lSceMotion_stub -lm -lSceAppMgr_stub \
|
2022-02-08 19:06:54 +00:00
|
|
|
-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/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
|
|
|
|
mkdir -p build/vita/
|
|
|
|
vita-make-fself -c -s $< 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 assets/vita/eboot.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
|