2019-09-05 22:09:40 +00:00
|
|
|
# User configurable
|
|
|
|
|
2020-04-14 07:12:59 +00:00
|
|
|
ROMID ?= ntsc-final
|
|
|
|
PIRACYCHECKS ?= 1
|
|
|
|
|
|
|
|
QEMU_IRIX ?= tools/irix/qemu-irix
|
|
|
|
IRIX_ROOT ?= tools/irix/root
|
2019-09-05 22:09:40 +00:00
|
|
|
|
2021-01-23 00:26:56 +00:00
|
|
|
IDOCC ?= $(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/bin/cc
|
2021-01-26 07:14:42 +00:00
|
|
|
IDOAS ?= $(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/bin/as
|
2021-01-16 13:46:33 +00:00
|
|
|
|
2019-09-05 22:09:40 +00:00
|
|
|
################################################################################
|
|
|
|
|
2020-04-14 07:12:59 +00:00
|
|
|
export ROMID
|
|
|
|
|
|
|
|
NTSC=0
|
|
|
|
PAL=0
|
2021-01-03 22:23:02 +00:00
|
|
|
JPN=0
|
2020-04-14 07:12:59 +00:00
|
|
|
|
|
|
|
ifeq ($(ROMID),ntsc-beta)
|
|
|
|
NTSC=1
|
|
|
|
VERSION=0
|
|
|
|
endif
|
|
|
|
ifeq ($(ROMID),ntsc-1.0)
|
|
|
|
NTSC=1
|
|
|
|
VERSION=1
|
|
|
|
endif
|
|
|
|
ifeq ($(ROMID),ntsc-final)
|
|
|
|
NTSC=1
|
|
|
|
VERSION=2
|
|
|
|
endif
|
|
|
|
ifeq ($(ROMID),pal-beta)
|
|
|
|
PAL=1
|
|
|
|
VERSION=3
|
|
|
|
endif
|
|
|
|
ifeq ($(ROMID),pal-final)
|
|
|
|
PAL=1
|
|
|
|
VERSION=4
|
|
|
|
endif
|
2021-01-03 22:23:02 +00:00
|
|
|
ifeq ($(ROMID),jpn-final)
|
|
|
|
JPN=1
|
2020-04-14 07:12:59 +00:00
|
|
|
VERSION=5
|
|
|
|
endif
|
|
|
|
|
2019-09-05 22:09:40 +00:00
|
|
|
B_DIR := build/$(ROMID)
|
2019-09-07 06:12:32 +00:00
|
|
|
|
2020-11-02 08:05:10 +00:00
|
|
|
ifeq ($(shell type mips-linux-gnu-ld >/dev/null 2>/dev/null; echo $$?), 0)
|
|
|
|
# Debian, Ubuntu and Arch AUR
|
2019-09-07 06:12:32 +00:00
|
|
|
TOOLCHAIN := mips-linux-gnu
|
2020-11-02 08:05:10 +00:00
|
|
|
else ifeq ($(shell type mips64-elf-ld >/dev/null 2>/dev/null; echo $$?), 0)
|
|
|
|
# Arch AUR
|
|
|
|
TOOLCHAIN := mips64-elf
|
2019-12-08 07:50:05 +00:00
|
|
|
else ifeq ($(shell type mips64-linux-gnu-ld >/dev/null 2>/dev/null; echo $$?), 0)
|
|
|
|
TOOLCHAIN := mips64-linux-gnu
|
2019-09-07 06:12:32 +00:00
|
|
|
else
|
2019-12-08 09:59:44 +00:00
|
|
|
TOOLCHAIN := mips-elf
|
2019-09-07 06:12:32 +00:00
|
|
|
endif
|
|
|
|
|
2021-01-25 07:38:12 +00:00
|
|
|
MIPSISET := -mips2 -32
|
2021-01-26 09:31:50 +00:00
|
|
|
OPT_LVL := -O2
|
2021-01-28 22:24:42 +00:00
|
|
|
LOOPUNROLL := -Wo,-loopunroll,0
|
|
|
|
|
2021-01-29 13:29:37 +00:00
|
|
|
$(B_DIR)/lib/ultra/gu/frustum.o: LOOPUNROLL :=
|
2021-01-29 15:02:51 +00:00
|
|
|
$(B_DIR)/lib/ultra/gu/mtxutil.o: LOOPUNROLL :=
|
|
|
|
$(B_DIR)/lib/ultra/gu/ortho.o: LOOPUNROLL :=
|
2021-01-30 15:27:02 +00:00
|
|
|
$(B_DIR)/lib/ultra/io/pfsgetstatus.o: LOOPUNROLL :=
|
2021-01-25 07:38:12 +00:00
|
|
|
|
2021-01-29 13:29:37 +00:00
|
|
|
$(B_DIR)/lib/ultra/libc/ll.o: MIPSISET := -mips3 -o32
|
|
|
|
$(B_DIR)/lib/ultra/libc/llcvt.o: MIPSISET := -mips3 -o32
|
2021-01-26 09:31:50 +00:00
|
|
|
|
2021-01-30 07:34:42 +00:00
|
|
|
$(B_DIR)/lib/ultra/gu/frustum.o: OPT_LVL := -O3
|
2021-01-30 07:33:34 +00:00
|
|
|
$(B_DIR)/lib/ultra/gu/ortho.o: OPT_LVL := -O3
|
2021-01-30 07:34:17 +00:00
|
|
|
$(B_DIR)/lib/ultra/gu/scale.o: OPT_LVL := -O3
|
2021-01-30 00:33:14 +00:00
|
|
|
$(B_DIR)/lib/ultra/io/ai.o: OPT_LVL := -O1
|
2021-01-30 00:26:33 +00:00
|
|
|
$(B_DIR)/lib/ultra/io/aisetnextbuf.o: OPT_LVL := -O1
|
2021-01-30 14:32:39 +00:00
|
|
|
$(B_DIR)/lib/ultra/io/conteeplongread.o: OPT_LVL := -O1
|
2021-01-30 14:26:36 +00:00
|
|
|
$(B_DIR)/lib/ultra/io/contquery.o: OPT_LVL := -O1
|
2021-01-26 09:54:48 +00:00
|
|
|
$(B_DIR)/lib/ultra/io/dpctr.o: OPT_LVL := -O1
|
2021-01-26 13:30:20 +00:00
|
|
|
$(B_DIR)/lib/ultra/io/pigetcmdq.o: OPT_LVL := -O1
|
2021-01-29 15:15:07 +00:00
|
|
|
$(B_DIR)/lib/ultra/io/si.o: OPT_LVL := -O1
|
2021-01-26 09:52:30 +00:00
|
|
|
$(B_DIR)/lib/ultra/io/sp.o: OPT_LVL := -O1
|
2021-01-26 09:46:42 +00:00
|
|
|
$(B_DIR)/lib/ultra/io/spsetpc.o: OPT_LVL := -O1
|
2021-01-26 09:58:32 +00:00
|
|
|
$(B_DIR)/lib/ultra/io/sptaskyielded.o: OPT_LVL := -O1
|
2021-01-26 10:53:56 +00:00
|
|
|
$(B_DIR)/lib/ultra/io/vi.o: OPT_LVL := -O1
|
2021-01-29 14:14:34 +00:00
|
|
|
$(B_DIR)/lib/ultra/io/viblack.o: OPT_LVL := -O1
|
2021-01-26 09:37:26 +00:00
|
|
|
$(B_DIR)/lib/ultra/io/vigetcurrframebuf.o: OPT_LVL := -O1
|
2021-01-26 09:31:50 +00:00
|
|
|
$(B_DIR)/lib/ultra/io/vigetnextframebuf.o: OPT_LVL := -O1
|
2021-01-26 10:07:38 +00:00
|
|
|
$(B_DIR)/lib/ultra/io/visetevent.o: OPT_LVL := -O1
|
2021-01-29 14:11:28 +00:00
|
|
|
$(B_DIR)/lib/ultra/io/visetmode.o: OPT_LVL := -O1
|
2021-01-29 14:03:37 +00:00
|
|
|
$(B_DIR)/lib/ultra/io/visetxscale.o: OPT_LVL := -O1
|
2021-01-29 13:46:41 +00:00
|
|
|
$(B_DIR)/lib/ultra/io/visetyscale.o: OPT_LVL := -O1
|
2021-01-29 14:20:14 +00:00
|
|
|
$(B_DIR)/lib/ultra/io/viswapbuf.o: OPT_LVL := -O1
|
2021-01-29 14:46:18 +00:00
|
|
|
$(B_DIR)/lib/ultra/libc/ll.o: OPT_LVL := -O1
|
|
|
|
$(B_DIR)/lib/ultra/libc/llcvt.o: OPT_LVL := -O1
|
2021-01-29 11:02:37 +00:00
|
|
|
$(B_DIR)/lib/ultra/os/createmesgqueue.o: OPT_LVL := -O1
|
2021-01-26 12:44:10 +00:00
|
|
|
$(B_DIR)/lib/ultra/os/destroythread.o: OPT_LVL := -O1
|
2021-01-29 14:46:18 +00:00
|
|
|
$(B_DIR)/lib/ultra/os/gettime.o: OPT_LVL := -O1
|
2021-01-29 08:45:18 +00:00
|
|
|
$(B_DIR)/lib/ultra/os/jammesg.o: OPT_LVL := -O1
|
2021-01-29 08:48:01 +00:00
|
|
|
$(B_DIR)/lib/ultra/os/recvmesg.o: OPT_LVL := -O1
|
2021-01-26 12:50:15 +00:00
|
|
|
$(B_DIR)/lib/ultra/os/resetglobalintmask.o: OPT_LVL := -O1
|
2021-01-29 08:46:46 +00:00
|
|
|
$(B_DIR)/lib/ultra/os/sendmesg.o: OPT_LVL := -O1
|
2021-01-29 11:00:33 +00:00
|
|
|
$(B_DIR)/lib/ultra/os/seteventmesg.o: OPT_LVL := -O1
|
2021-01-26 13:24:12 +00:00
|
|
|
$(B_DIR)/lib/ultra/os/setthreadpri.o: OPT_LVL := -O1
|
2021-01-31 02:47:42 +00:00
|
|
|
$(B_DIR)/lib/ultra/os/settimer.o: OPT_LVL := -O1
|
2021-01-26 13:26:29 +00:00
|
|
|
$(B_DIR)/lib/ultra/os/startthread.o: OPT_LVL := -O1
|
2021-01-26 13:22:30 +00:00
|
|
|
$(B_DIR)/lib/ultra/os/stopthread.o: OPT_LVL := -O1
|
2021-01-29 08:43:06 +00:00
|
|
|
$(B_DIR)/lib/ultra/os/stoptimer.o: OPT_LVL := -O1
|
2021-01-26 12:54:56 +00:00
|
|
|
$(B_DIR)/lib/ultra/os/thread.o: OPT_LVL := -O1
|
2021-01-31 02:49:52 +00:00
|
|
|
$(B_DIR)/lib/ultra/os/timerintr.o: OPT_LVL := -O1
|
2021-01-29 15:31:52 +00:00
|
|
|
$(B_DIR)/lib/ultra/os/virtualtophysical.o: OPT_LVL := -O1
|
2021-01-26 12:57:31 +00:00
|
|
|
$(B_DIR)/lib/ultra/os/yieldthread.o: OPT_LVL := -O1
|
2021-01-25 07:38:12 +00:00
|
|
|
|
|
|
|
CFLAGS = -DVERSION=$(VERSION) \
|
2020-04-14 07:12:59 +00:00
|
|
|
-DNTSC=$(NTSC) \
|
|
|
|
-DPAL=$(PAL) \
|
2021-01-03 22:23:02 +00:00
|
|
|
-DJPN=$(JPN) \
|
2020-04-14 07:12:59 +00:00
|
|
|
-DPIRACYCHECKS=$(PIRACYCHECKS) \
|
2021-01-28 22:24:42 +00:00
|
|
|
$(LOOPUNROLL) \
|
2020-04-14 07:12:59 +00:00
|
|
|
-Wab,-r4300_mul \
|
|
|
|
-non_shared \
|
|
|
|
-G 0 \
|
|
|
|
-Xcpluscomm \
|
2020-04-14 09:42:57 +00:00
|
|
|
-woff 581,649,819,820,821,838,852 \
|
2020-04-14 07:12:59 +00:00
|
|
|
-w2 \
|
|
|
|
-I src/include \
|
2021-01-30 07:28:30 +00:00
|
|
|
$(OPT_LVL) \
|
2021-01-25 07:38:12 +00:00
|
|
|
$(MIPSISET)
|
2019-10-07 07:50:26 +00:00
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
C_FILES := $(shell find src/gvars src/boot src/lib src/game src/inflate -name '*.c')
|
2021-01-26 07:14:42 +00:00
|
|
|
S_FILES := $(shell find src/boot src/lib src/game -name '*.s')
|
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
# Create names such as $(B_DIR)/assets/files/PfooZ
|
|
|
|
# These names (with .o added) will be dependenices for LD
|
|
|
|
ASSET_FILES := \
|
|
|
|
$(patsubst src/assets/files/audio/%.mp3, $(B_DIR)/assets/files/A%M, $(shell find src/assets/files/audio -name '*.mp3')) \
|
|
|
|
$(patsubst src/assets/files/chrs/%.bin, $(B_DIR)/assets/files/C%Z, $(shell find src/assets/files/chrs -name '*.bin')) \
|
|
|
|
$(patsubst src/assets/files/guns/%.bin, $(B_DIR)/assets/files/G%Z, $(shell find src/assets/files/guns -name '*.bin')) \
|
|
|
|
$(patsubst src/assets/files/props/%.bin, $(B_DIR)/assets/files/P%Z, $(shell find src/assets/files/props -name '*.bin')) \
|
|
|
|
$(patsubst src/assets/files/setup/%.c, $(B_DIR)/assets/files/U%Z, $(shell find src/assets/files/setup -name '*.c')) \
|
|
|
|
$(patsubst src/assets/files/bgdata/%.seg, $(B_DIR)/assets/files/bgdata/%.seg, $(shell find src/assets/files/bgdata -name '*.seg')) \
|
|
|
|
$(patsubst src/assets/files/bgdata/%_pads.bin, $(B_DIR)/assets/files/bgdata/%_padsZ, $(shell find src/assets/files/bgdata -name 'bg_*_pads.bin')) \
|
|
|
|
$(patsubst src/assets/files/bgdata/%_tiles.s, $(B_DIR)/assets/files/bgdata/%_tilesZ, $(shell find src/assets/files/bgdata -name 'bg_*_tiles.s')) \
|
|
|
|
$(patsubst src/assets/files/bgdata/%_tiles.bin, $(B_DIR)/assets/files/bgdata/%_tilesZ, $(shell find src/assets/files/bgdata -name 'bg_*_tiles.bin')) \
|
|
|
|
$(patsubst src/assets/files/lang/$(ROMID)/%.c, $(B_DIR)/assets/files/L%, $(shell find src/assets/files/lang/$(ROMID) -name '*[EJP].c')) \
|
|
|
|
$(patsubst src/assets/files/lang/$(ROMID)/%.c, $(B_DIR)/assets/files/L%Z, $(shell find src/assets/files/lang/$(ROMID) -name '*_str_[fgis].c')) \
|
|
|
|
$(B_DIR)/assets/files/ob/ob_mid.seg.o
|
|
|
|
|
2021-02-12 12:24:51 +00:00
|
|
|
ANIM_FILES := $(shell find src/assets/animations -name '*.bin')
|
2021-02-12 08:50:05 +00:00
|
|
|
SEQ_FILES := $(shell find src/assets/sequences -name '*.seq')
|
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
O_FILES := \
|
|
|
|
$(patsubst src/%.c, $(B_DIR)/%.o, $(C_FILES)) \
|
|
|
|
$(patsubst src/%.s, $(B_DIR)/%.o, $(S_FILES)) \
|
|
|
|
$(patsubst %, %.o, $(ASSET_FILES)) \
|
2021-02-12 12:24:51 +00:00
|
|
|
$(patsubst src/%.bin, $(B_DIR)/%.o, $(ANIM_FILES)) \
|
|
|
|
$(B_DIR)/assets/animations/list.o \
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/accessingpakZ.o \
|
|
|
|
$(B_DIR)/assets/copyrightZ.o \
|
|
|
|
$(B_DIR)/assets/files/list.o \
|
|
|
|
$(B_DIR)/assets/firingrange.o \
|
|
|
|
$(B_DIR)/assets/fonts/bankgothic.o \
|
|
|
|
$(B_DIR)/assets/fonts/handelgothiclg.o \
|
|
|
|
$(B_DIR)/assets/fonts/handelgothicmd.o \
|
|
|
|
$(B_DIR)/assets/fonts/handelgothicsm.o \
|
|
|
|
$(B_DIR)/assets/fonts/handelgothicxs.o \
|
|
|
|
$(B_DIR)/assets/fonts/numeric.o \
|
|
|
|
$(B_DIR)/assets/fonts/ocralg.o \
|
|
|
|
$(B_DIR)/assets/fonts/ocramd.o \
|
|
|
|
$(B_DIR)/assets/fonts/tahoma.o \
|
|
|
|
$(B_DIR)/assets/fonts/zurich.o \
|
|
|
|
$(B_DIR)/assets/getitle.o \
|
|
|
|
$(B_DIR)/assets/mpconfigs.o \
|
|
|
|
$(B_DIR)/assets/mpstrings/$(ROMID)/mpstringsE.o \
|
|
|
|
$(B_DIR)/assets/mpstrings/$(ROMID)/mpstringsF.o \
|
|
|
|
$(B_DIR)/assets/mpstrings/$(ROMID)/mpstringsG.o \
|
|
|
|
$(B_DIR)/assets/mpstrings/$(ROMID)/mpstringsI.o \
|
|
|
|
$(B_DIR)/assets/mpstrings/$(ROMID)/mpstringsJ.o \
|
|
|
|
$(B_DIR)/assets/mpstrings/$(ROMID)/mpstringsP.o \
|
|
|
|
$(B_DIR)/assets/mpstrings/$(ROMID)/mpstringsS.o \
|
|
|
|
$(B_DIR)/assets/rspboot.o \
|
|
|
|
$(B_DIR)/assets/seq.ctl.o \
|
|
|
|
$(B_DIR)/assets/seq.tbl.o \
|
|
|
|
$(B_DIR)/assets/sequences.o \
|
|
|
|
$(B_DIR)/assets/sfx.ctl.o \
|
|
|
|
$(B_DIR)/assets/sfx.tbl.o \
|
|
|
|
$(B_DIR)/assets/textures.o \
|
|
|
|
$(B_DIR)/assets/textures/config.o \
|
2020-08-25 10:40:35 +00:00
|
|
|
$(B_DIR)/romheader.o \
|
2020-12-20 12:06:23 +00:00
|
|
|
|
2020-08-25 10:40:35 +00:00
|
|
|
default: rom
|
2019-09-05 22:09:40 +00:00
|
|
|
|
|
|
|
################################################################################
|
2020-08-25 10:40:35 +00:00
|
|
|
# ROM Finalisation Stages
|
2019-09-05 22:09:40 +00:00
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
# Link all objects together with ld to make stage1.elf. In this stage, the game,
|
|
|
|
# lib and data segments are uncompressed and placed past the end of the ROM.
|
|
|
|
$(B_DIR)/stage1.elf: $(O_FILES) ld/pd.ld
|
|
|
|
cpp -DROMID=$(ROMID) -DVERSION=$(VERSION) -P ld/pd.ld -o $(B_DIR)/pd.ld
|
|
|
|
$(TOOLCHAIN)-ld --no-check-sections -T $(B_DIR)/pd.ld --print-map -o $@ > $(B_DIR)/pd.map
|
2020-08-25 10:40:35 +00:00
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/stage1.bin: $(B_DIR)/stage1.elf
|
|
|
|
$(TOOLCHAIN)-objcopy $< $@ -O binary
|
2020-08-25 10:40:35 +00:00
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
# Stage2 takes stage1 and patches the piracy checksums.
|
2020-08-25 10:40:35 +00:00
|
|
|
$(B_DIR)/stage2.bin: $(B_DIR)/stage1.bin
|
|
|
|
@cp $< $@.tmp
|
2020-12-21 07:48:01 +00:00
|
|
|
ROMID=$(ROMID) PIRACYCHECKS=$(PIRACYCHECKS) tools/patchpiracysums $@.tmp $(B_DIR)/pd.map && mv $@.tmp $@
|
2020-08-25 10:40:35 +00:00
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
# Stage3 takes stage2, compresses the game/lib/data segments,
|
|
|
|
# inserts them and truncates the ROM to 32MB.
|
|
|
|
$(B_DIR)/stage3.bin: $(B_DIR)/stage2.bin $(B_DIR)/segments/gamezips.bin
|
|
|
|
@cp $< $@.tmp
|
|
|
|
tools/packrom $@.tmp && mv $@.tmp $@
|
2019-12-07 14:19:45 +00:00
|
|
|
|
2020-08-25 10:40:35 +00:00
|
|
|
$(B_DIR)/segments/gamezips.bin: $(B_DIR)/segments/game.bin
|
|
|
|
ROMID=$(ROMID) tools/mkgamezips
|
2019-09-05 22:09:40 +00:00
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
# The final ROM image takes stage3 and calculates the ROM CRC.
|
|
|
|
$(B_DIR)/pd.z64: $(B_DIR)/stage3.bin
|
|
|
|
@cp $< $@.tmp
|
|
|
|
tools/patchromcrc $@.tmp --write && mv $@.tmp $@
|
|
|
|
|
2019-09-05 22:09:40 +00:00
|
|
|
################################################################################
|
2020-08-25 10:40:35 +00:00
|
|
|
# Testing Related
|
|
|
|
# ---------------------
|
|
|
|
# This works a little backwards, in that the ROM has to be built to at least
|
|
|
|
# stage 2, then extract-segment is used to slice out the segments.
|
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
CHECK_FILES := \
|
2020-08-25 10:40:35 +00:00
|
|
|
$(B_DIR)/segments/boot.bin \
|
|
|
|
$(B_DIR)/segments/filenames.bin \
|
|
|
|
$(B_DIR)/segments/firingrange.bin \
|
|
|
|
$(B_DIR)/segments/game.bin \
|
|
|
|
$(B_DIR)/segments/data.bin \
|
|
|
|
$(B_DIR)/segments/gvars.bin \
|
|
|
|
$(B_DIR)/segments/lib.bin \
|
|
|
|
$(B_DIR)/segments/inflate.bin \
|
|
|
|
$(B_DIR)/segments/mpconfigs.bin \
|
|
|
|
$(B_DIR)/segments/mpstringsE.bin \
|
|
|
|
$(B_DIR)/segments/mpstringsJ.bin \
|
|
|
|
$(B_DIR)/segments/mpstringsP.bin \
|
|
|
|
$(B_DIR)/segments/mpstringsG.bin \
|
|
|
|
$(B_DIR)/segments/mpstringsF.bin \
|
|
|
|
$(B_DIR)/segments/mpstringsS.bin \
|
2020-10-11 05:24:19 +00:00
|
|
|
$(B_DIR)/segments/mpstringsI.bin \
|
|
|
|
$(B_DIR)/segments/textureconfig.bin
|
2020-08-25 10:40:35 +00:00
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
test: rom $(CHECK_FILES) $(ASSET_FILES)
|
2020-08-25 10:40:35 +00:00
|
|
|
@md5sum --quiet -c checksums.$(ROMID).md5
|
2019-09-05 22:09:40 +00:00
|
|
|
|
2020-08-25 10:40:35 +00:00
|
|
|
$(B_DIR)/segments/%.bin: $(B_DIR)/stage2.bin
|
|
|
|
@B_DIR=$(B_DIR) tools/extract-segment $*
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Raw data segments
|
2019-09-05 22:09:40 +00:00
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/fonts/%.o: src/assets/fonts/%.bin
|
|
|
|
mkdir -p $(B_DIR)/assets/fonts
|
2020-08-25 10:40:35 +00:00
|
|
|
TOOLCHAIN=$(TOOLCHAIN) ROMID=$(ROMID) tools/mkrawobject $< $@
|
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/getitle.o: src/assets/getitle.bin
|
2020-08-25 10:40:35 +00:00
|
|
|
TOOLCHAIN=$(TOOLCHAIN) ROMID=$(ROMID) tools/mkrawobject $< $@
|
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/rspboot.o: src/assets/rspboot.bin
|
2020-08-25 10:40:35 +00:00
|
|
|
TOOLCHAIN=$(TOOLCHAIN) ROMID=$(ROMID) tools/mkrawobject $< $@
|
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/seq.ctl.o: src/assets/seq.ctl
|
2020-08-25 10:40:35 +00:00
|
|
|
TOOLCHAIN=$(TOOLCHAIN) ROMID=$(ROMID) tools/mkrawobject $< $@
|
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/seq.tbl.o: src/assets/seq.tbl
|
2020-08-25 10:40:35 +00:00
|
|
|
TOOLCHAIN=$(TOOLCHAIN) ROMID=$(ROMID) tools/mkrawobject $< $@
|
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/sfx.ctl.o: src/assets/sfx.ctl
|
2020-08-25 10:40:35 +00:00
|
|
|
TOOLCHAIN=$(TOOLCHAIN) ROMID=$(ROMID) tools/mkrawobject $< $@
|
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/sfx.tbl.o: src/assets/sfx.tbl
|
2020-08-25 10:40:35 +00:00
|
|
|
TOOLCHAIN=$(TOOLCHAIN) ROMID=$(ROMID) tools/mkrawobject $< $@
|
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/textures.o: src/assets/textures.bin
|
2020-08-25 10:40:35 +00:00
|
|
|
TOOLCHAIN=$(TOOLCHAIN) ROMID=$(ROMID) tools/mkrawobject $< $@
|
2019-09-07 12:07:13 +00:00
|
|
|
|
2019-12-07 14:19:45 +00:00
|
|
|
################################################################################
|
2020-08-25 10:40:35 +00:00
|
|
|
# Files
|
2019-09-05 22:09:40 +00:00
|
|
|
|
2020-08-25 10:40:35 +00:00
|
|
|
# Audio
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/files/A%M: src/assets/files/audio/%.mp3
|
|
|
|
@mkdir -p $(B_DIR)/assets/files
|
2019-12-07 14:19:45 +00:00
|
|
|
cp $< $@
|
2019-09-07 12:07:13 +00:00
|
|
|
|
2020-08-25 10:40:35 +00:00
|
|
|
# BG segs
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/files/bgdata/bg_%.seg: src/assets/files/bgdata/bg_%.seg
|
|
|
|
@mkdir -p $(B_DIR)/assets/files/bgdata
|
2020-08-25 10:40:35 +00:00
|
|
|
cp $< $@
|
2019-10-07 07:50:26 +00:00
|
|
|
|
2020-08-25 10:40:35 +00:00
|
|
|
# BG pads
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/files/bgdata/bg_%_padsZ: src/assets/files/bgdata/bg_%_pads.bin
|
|
|
|
@mkdir -p $(B_DIR)/assets/files/bgdata
|
|
|
|
tools/rarezip $< > $@
|
2019-10-28 23:10:46 +00:00
|
|
|
|
2020-08-25 10:40:35 +00:00
|
|
|
# BG tiles
|
2021-02-12 07:07:02 +00:00
|
|
|
# src/assets/files/bgdata/bg_foo_tiles.s
|
|
|
|
# -> B_DIR/assets/files/bgdata/bg_foo_tiles.o (done by generic .o target)
|
|
|
|
# -> B_DIR/assets/files/bgdata/bg_foo_tiles.elf (done here)
|
|
|
|
# -> B_DIR/assets/files/bgdata/bg_foo_tiles (done here)
|
|
|
|
# -> B_DIR/assets/files/bgdata/bg_foo_tilesZ (done here)
|
|
|
|
# Or create src/assets/files/bgdata/bg_foo_tiles.bin and it'll get copied/zipped
|
|
|
|
$(B_DIR)/assets/files/bgdata/bg_%_tiles.o: src/assets/files/bgdata/bg_%_tiles.s
|
2020-04-14 07:12:59 +00:00
|
|
|
$(TOOLCHAIN)-as --defsym VERSION=$(VERSION) -march=vr4300 -mabi=32 -I src/include -EB -o $@ $<
|
2019-10-28 23:10:46 +00:00
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/files/bgdata/bg_%_tiles.elf: $(B_DIR)/assets/files/bgdata/bg_%_tiles.o
|
2020-12-12 11:54:19 +00:00
|
|
|
TOOLCHAIN=$(TOOLCHAIN) tools/mksimpleelf $< $@
|
2019-10-28 23:10:46 +00:00
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/files/bgdata/bg_%_tiles: $(B_DIR)/assets/files/bgdata/bg_%_tiles.elf
|
|
|
|
$(TOOLCHAIN)-objcopy $< $@ -O binary
|
|
|
|
|
|
|
|
$(B_DIR)/assets/files/bgdata/bg_%_tilesZ: src/assets/files/bgdata/bg_%_tiles.bin
|
|
|
|
tools/rarezip $< > $@
|
|
|
|
|
|
|
|
$(B_DIR)/assets/files/bgdata/bg_%_tilesZ: $(B_DIR)/assets/files/bgdata/bg_%_tiles
|
|
|
|
tools/rarezip $< > $@
|
|
|
|
|
2020-08-25 10:40:35 +00:00
|
|
|
# Chrs
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/files/C%Z: src/assets/files/chrs/%.bin
|
|
|
|
@mkdir -p $(B_DIR)/assets/files
|
|
|
|
tools/rarezip $< > $@
|
2019-12-07 14:19:45 +00:00
|
|
|
|
2020-08-25 10:40:35 +00:00
|
|
|
# Guns
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/files/G%Z: src/assets/files/guns/%.bin
|
|
|
|
@mkdir -p $(B_DIR)/assets/files
|
|
|
|
tools/rarezip $< > $@
|
2019-12-07 14:19:45 +00:00
|
|
|
|
2020-08-25 10:40:35 +00:00
|
|
|
# Lang
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/files/lang/%.elf: $(B_DIR)/assets/files/lang/$(ROMID)/%.o
|
2020-12-12 11:54:19 +00:00
|
|
|
TOOLCHAIN=$(TOOLCHAIN) tools/mksimpleelf $< $@
|
2019-09-05 22:09:40 +00:00
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/files/lang/%.bin: $(B_DIR)/assets/files/lang/%.elf
|
|
|
|
$(TOOLCHAIN)-objcopy $< $@ -O binary
|
|
|
|
|
|
|
|
$(B_DIR)/assets/files/L%E: $(B_DIR)/assets/files/lang/%E.bin
|
|
|
|
tools/rarezip $< > $@
|
|
|
|
|
|
|
|
$(B_DIR)/assets/files/L%J: $(B_DIR)/assets/files/lang/%J.bin
|
|
|
|
tools/rarezip $< > $@
|
|
|
|
|
|
|
|
$(B_DIR)/assets/files/L%P: $(B_DIR)/assets/files/lang/%P.bin
|
|
|
|
tools/rarezip $< > $@
|
|
|
|
|
|
|
|
$(B_DIR)/assets/files/L%_str_fZ: $(B_DIR)/assets/files/lang/%_str_f.bin
|
|
|
|
tools/rarezip $< > $@
|
|
|
|
|
|
|
|
$(B_DIR)/assets/files/L%_str_gZ: $(B_DIR)/assets/files/lang/%_str_g.bin
|
2019-09-07 12:07:13 +00:00
|
|
|
tools/rarezip $< > $@
|
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/files/L%_str_iZ: $(B_DIR)/assets/files/lang/%_str_i.bin
|
2019-09-07 12:07:13 +00:00
|
|
|
tools/rarezip $< > $@
|
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/files/L%_str_sZ: $(B_DIR)/assets/files/lang/%_str_s.bin
|
2019-09-07 12:07:13 +00:00
|
|
|
tools/rarezip $< > $@
|
|
|
|
|
2020-08-25 10:40:35 +00:00
|
|
|
# OB seg
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/files/ob/ob_mid.seg.o: $(B_DIR)/assets/files/ob/ob_mid.seg
|
|
|
|
TOOLCHAIN=$(TOOLCHAIN) ROMID=$(ROMID) tools/mkrawobject $< $@
|
|
|
|
|
|
|
|
$(B_DIR)/assets/files/ob/ob_mid.seg:
|
|
|
|
@mkdir -p $(B_DIR)/assets/files/ob
|
2019-12-07 14:19:45 +00:00
|
|
|
> $@
|
2019-09-05 22:09:40 +00:00
|
|
|
|
2020-08-25 10:40:35 +00:00
|
|
|
# Props
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/files/P%Z: src/assets/files/props/%.bin
|
|
|
|
tools/rarezip $< > $@
|
2019-12-07 14:19:45 +00:00
|
|
|
|
2020-08-25 10:40:35 +00:00
|
|
|
# Stage setups
|
2021-02-12 07:07:02 +00:00
|
|
|
# src/assets/files/setup/foo.c
|
|
|
|
# -> B_DIR/assets/files/setup/foo.o (done by generic .o target)
|
|
|
|
# -> B_DIR/assets/files/setup/foo.elf (done here)
|
|
|
|
# -> B_DIR/assets/files/Usetupfoo (done here)
|
|
|
|
# -> B_DIR/assets/files/UsetupfooZ (done here)
|
|
|
|
# Or create src/assets/files/setup/foo.bin and it'll get copied/zipped
|
|
|
|
$(B_DIR)/assets/files/setup/%.elf: $(B_DIR)/assets/files/setup/%.o
|
2020-12-12 11:54:19 +00:00
|
|
|
TOOLCHAIN=$(TOOLCHAIN) tools/mksimpleelf $< $@
|
2019-12-07 14:19:45 +00:00
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/files/U%: $(B_DIR)/assets/files/setup/%.elf
|
|
|
|
$(TOOLCHAIN)-objcopy $< $@ -O binary
|
|
|
|
|
|
|
|
$(B_DIR)/assets/files/U%Z: src/assets/files/setup/%.bin
|
|
|
|
tools/rarezip $< > $@
|
|
|
|
|
|
|
|
$(B_DIR)/assets/files/U%Z: $(B_DIR)/assets/files/U%
|
|
|
|
tools/rarezip $< > $@
|
|
|
|
|
2020-08-25 10:40:35 +00:00
|
|
|
# General target to convert any finalised file into a raw object for ld
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/files/%.o: $(B_DIR)/assets/files/%
|
2020-08-25 10:40:35 +00:00
|
|
|
TOOLCHAIN=$(TOOLCHAIN) ROMID=$(ROMID) tools/mkrawobject $< $@
|
2020-04-26 11:48:17 +00:00
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/files/%.bin: $(B_DIR)/assets/files/%.elf
|
2020-08-25 10:40:35 +00:00
|
|
|
$(TOOLCHAIN)-objcopy $< $@ -O binary
|
2020-04-27 07:42:02 +00:00
|
|
|
|
2019-12-07 08:03:53 +00:00
|
|
|
################################################################################
|
2019-12-07 14:19:45 +00:00
|
|
|
# Miscellaneous
|
|
|
|
|
2020-08-25 10:40:35 +00:00
|
|
|
$(B_DIR)/romheader.o: src/romheader/romheader.s
|
|
|
|
$(TOOLCHAIN)-as --defsym VERSION=$(VERSION) -march=vr4300 -mabi=32 -I src/include -EB -o $@ $<
|
2019-12-07 08:03:53 +00:00
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/accessingpakZ: src/assets/accessingpak.bin
|
2020-08-25 10:40:35 +00:00
|
|
|
tools/rarezip $< > $@
|
2019-12-07 08:03:53 +00:00
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/copyrightZ: src/assets/copyright.bin
|
2020-08-25 10:40:35 +00:00
|
|
|
tools/rarezip $< > $@
|
2019-09-07 12:07:13 +00:00
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/accessingpakZ.o: $(B_DIR)/assets/accessingpakZ
|
2020-08-25 10:40:35 +00:00
|
|
|
TOOLCHAIN=$(TOOLCHAIN) ROMID=$(ROMID) tools/mkrawobject $< $@
|
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
$(B_DIR)/assets/copyrightZ.o: $(B_DIR)/assets/copyrightZ
|
2020-08-25 10:40:35 +00:00
|
|
|
TOOLCHAIN=$(TOOLCHAIN) ROMID=$(ROMID) tools/mkrawobject $< $@
|
2019-09-05 22:09:40 +00:00
|
|
|
|
2021-02-12 08:50:05 +00:00
|
|
|
$(B_DIR)/assets/sequences.bin: $(SEQ_FILES) src/assets/sequences/sequences.py
|
|
|
|
tools/mksequences
|
|
|
|
|
|
|
|
$(B_DIR)/assets/sequences.o: $(B_DIR)/assets/sequences.bin
|
|
|
|
TOOLCHAIN=$(TOOLCHAIN) ROMID=$(ROMID) tools/mkrawobject $< $@
|
|
|
|
|
2021-02-12 12:24:51 +00:00
|
|
|
$(B_DIR)/assets/animations/%.o: src/assets/animations/%.bin
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
TOOLCHAIN=$(TOOLCHAIN) ROMID=$(ROMID) tools/mkrawobject $< $@ 0x1
|
|
|
|
|
|
|
|
$(B_DIR)/assets/animations/list.o: src/assets/animations/list.c
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
$(IDOCC) -c $(CFLAGS) $< -o $@
|
|
|
|
|
2021-01-16 13:46:33 +00:00
|
|
|
$(B_DIR)/boot/%.o: src/boot/%.c
|
|
|
|
@mkdir -p $(dir $@)
|
2021-01-30 07:28:30 +00:00
|
|
|
/usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< | $(IDOCC) -c $(CFLAGS) tools/asmpreproc/include-stdin.c -o $@
|
2021-01-16 13:46:33 +00:00
|
|
|
/usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< --post-process $@ --assembler "$(TOOLCHAIN)-as -march=vr4300 -mabi=32" --asm-prelude tools/asmpreproc/prelude.s
|
|
|
|
|
2021-01-29 13:29:37 +00:00
|
|
|
$(B_DIR)/lib/ultra/libc/llcvt.o: src/lib/ultra/libc/llcvt.c
|
2021-01-25 07:43:41 +00:00
|
|
|
@mkdir -p $(dir $@)
|
2021-01-30 07:28:30 +00:00
|
|
|
/usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< | $(IDOCC) -c $(CFLAGS) tools/asmpreproc/include-stdin.c -o $@
|
2021-01-25 07:43:41 +00:00
|
|
|
/usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< --post-process $@ --assembler "$(TOOLCHAIN)-as -march=vr4300 -mabi=32" --asm-prelude tools/asmpreproc/prelude.s
|
|
|
|
tools/patchmips3 $@ || rm $@
|
|
|
|
|
2021-01-29 13:29:37 +00:00
|
|
|
$(B_DIR)/lib/ultra/libc/ll.o: src/lib/ultra/libc/ll.c
|
2021-01-25 07:38:12 +00:00
|
|
|
@mkdir -p $(dir $@)
|
2021-01-30 07:28:30 +00:00
|
|
|
$(IDOCC) -c $(CFLAGS) $< -o $@
|
2021-01-25 07:38:12 +00:00
|
|
|
tools/patchmips3 $@ || rm $@
|
|
|
|
|
2021-02-07 11:17:11 +00:00
|
|
|
# Files that use -O3 must be compiled without the ASM processor, otherwise it
|
|
|
|
# introduces a race condition when using make -j because they create a temporary
|
|
|
|
# include-stdin.u file during compilation.
|
|
|
|
$(B_DIR)/lib/ultra/gu/frustum.o: src/lib/ultra/gu/frustum.c
|
2021-02-07 12:39:53 +00:00
|
|
|
@mkdir -p $(dir $@)
|
2021-02-07 11:17:11 +00:00
|
|
|
$(IDOCC) -c $(CFLAGS) $< -o $@
|
|
|
|
|
|
|
|
$(B_DIR)/lib/ultra/gu/ortho.o: src/lib/ultra/gu/ortho.c
|
2021-02-07 12:39:53 +00:00
|
|
|
@mkdir -p $(dir $@)
|
2021-02-07 11:17:11 +00:00
|
|
|
$(IDOCC) -c $(CFLAGS) $< -o $@
|
|
|
|
|
|
|
|
$(B_DIR)/lib/ultra/gu/scale.o: src/lib/ultra/gu/scale.c
|
2021-02-07 12:39:53 +00:00
|
|
|
@mkdir -p $(dir $@)
|
2021-02-07 11:17:11 +00:00
|
|
|
$(IDOCC) -c $(CFLAGS) $< -o $@
|
|
|
|
|
2021-01-16 13:46:33 +00:00
|
|
|
$(B_DIR)/lib/%.o: src/lib/%.c
|
2020-04-19 13:53:08 +00:00
|
|
|
@mkdir -p $(dir $@)
|
2021-01-30 07:28:30 +00:00
|
|
|
/usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< | $(IDOCC) -c $(CFLAGS) tools/asmpreproc/include-stdin.c -o $@
|
2020-02-02 04:42:08 +00:00
|
|
|
/usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< --post-process $@ --assembler "$(TOOLCHAIN)-as -march=vr4300 -mabi=32" --asm-prelude tools/asmpreproc/prelude.s
|
2019-10-07 07:50:26 +00:00
|
|
|
|
2021-01-16 13:46:33 +00:00
|
|
|
$(B_DIR)/game/%.o: src/game/%.c
|
|
|
|
@mkdir -p $(dir $@)
|
2021-01-30 07:28:30 +00:00
|
|
|
/usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< | $(IDOCC) -c $(CFLAGS) tools/asmpreproc/include-stdin.c -o $@
|
2021-01-16 13:46:33 +00:00
|
|
|
/usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< --post-process $@ --assembler "$(TOOLCHAIN)-as -march=vr4300 -mabi=32" --asm-prelude tools/asmpreproc/prelude.s
|
|
|
|
|
|
|
|
$(B_DIR)/%.o: src/%.c
|
|
|
|
@mkdir -p $(dir $@)
|
2021-01-30 07:28:30 +00:00
|
|
|
$(IDOCC) -c $(CFLAGS) $< -o $@
|
2021-01-16 13:46:33 +00:00
|
|
|
|
2021-01-26 07:14:42 +00:00
|
|
|
$(B_DIR)/%.o: src/%.s
|
|
|
|
@mkdir -p $(dir $@)
|
2021-01-30 07:28:30 +00:00
|
|
|
$(IDOAS) $(CFLAGS) $< -o $@
|
2021-01-26 07:14:42 +00:00
|
|
|
|
2020-08-25 10:40:35 +00:00
|
|
|
extract:
|
|
|
|
ROMID=$(ROMID) tools/extract
|
2019-12-07 08:03:53 +00:00
|
|
|
|
2020-08-25 10:40:35 +00:00
|
|
|
rom: $(B_DIR)/pd.z64
|
2019-09-05 22:09:40 +00:00
|
|
|
|
|
|
|
clean:
|
2020-04-19 13:53:08 +00:00
|
|
|
rm -rf build/$(ROMID)
|
|
|
|
|
|
|
|
allclean:
|
2019-09-05 22:09:40 +00:00
|
|
|
rm -rf build/*
|
|
|
|
|
2021-02-12 07:07:02 +00:00
|
|
|
assetsclean:
|
|
|
|
find src/assets -name '*.bin' -delete
|
|
|
|
find src/assets -name '*.ctl' -delete
|
|
|
|
find src/assets -name '*.mp3' -delete
|
|
|
|
find src/assets -name '*.seg' -delete
|
|
|
|
find src/assets -name '*.seq' -delete
|
|
|
|
find src/assets -name '*.tbl' -delete
|
|
|
|
|
2020-04-19 13:53:08 +00:00
|
|
|
codeclean:
|
2020-08-25 10:40:35 +00:00
|
|
|
rm -f $(B_DIR)/segments/*.bin
|
2020-04-20 09:21:34 +00:00
|
|
|
find $(B_DIR)/{boot,game,gvars,inflate,lib} -name '*.o' -delete
|