2022-02-23 18:17:18 +00:00
|
|
|
.SECONDEXPANSION:
|
2022-03-02 00:38:54 +00:00
|
|
|
.SECONDARY:
|
2022-02-23 18:17:18 +00:00
|
|
|
|
2022-01-01 17:45:41 +00:00
|
|
|
# Binaries
|
2023-02-21 01:42:33 +00:00
|
|
|
VERSION ?= us
|
2022-01-01 17:45:41 +00:00
|
|
|
MAIN := main
|
|
|
|
DRA := dra
|
|
|
|
|
|
|
|
# Compilers
|
2023-04-05 18:08:14 +00:00
|
|
|
CC1PSX := ./bin/cc1-psx-26
|
2022-01-01 17:45:41 +00:00
|
|
|
CROSS := mipsel-linux-gnu-
|
|
|
|
AS := $(CROSS)as
|
2023-04-05 18:08:14 +00:00
|
|
|
CC := $(CC1PSX)
|
2022-01-01 17:45:41 +00:00
|
|
|
LD := $(CROSS)ld
|
2022-02-09 11:56:45 +00:00
|
|
|
CPP := $(CROSS)cpp
|
2022-01-01 17:45:41 +00:00
|
|
|
OBJCOPY := $(CROSS)objcopy
|
2023-02-12 00:22:31 +00:00
|
|
|
AS_FLAGS += -Iinclude -march=r3000 -mtune=r3000 -no-pad-sections -O1 -G0
|
2023-01-22 18:34:27 +00:00
|
|
|
CC_FLAGS += -mcpu=3000 -quiet -G0 -w -O2 -funsigned-char -fpeephole -ffunction-cse -fpcc-struct-return -fcommon -fverbose-asm -fgnu-linker -mgas -msoft-float
|
2022-01-24 20:45:27 +00:00
|
|
|
CPP_FLAGS += -Iinclude -undef -Wall -lang-c -fno-builtin -gstabs
|
2023-03-12 00:11:04 +00:00
|
|
|
CPP_FLAGS += -Dmips -D__GNUC__=2 -D__OPTIMIZE__ -D__mips__ -D__mips -Dpsx -D__psx__ -D__psx -D_PSYQ -D__EXTENSIONS__ -D_MIPSEL -D_LANGUAGE_C -DLANGUAGE_C -DHACKS
|
2023-05-04 22:11:15 +00:00
|
|
|
CPP_FLAGS += -DVERSION_$(VERSION)
|
2022-01-01 17:45:41 +00:00
|
|
|
|
|
|
|
# Directories
|
2023-02-21 19:11:05 +00:00
|
|
|
ASM_DIR := asm/$(VERSION)
|
2022-01-01 17:45:41 +00:00
|
|
|
SRC_DIR := src
|
2023-02-03 15:38:48 +00:00
|
|
|
ASSETS_DIR := assets
|
2022-08-26 18:16:27 +00:00
|
|
|
INCLUDE_DIR := include
|
2023-02-21 20:06:27 +00:00
|
|
|
BUILD_DIR := build/$(VERSION)
|
2023-02-21 23:25:24 +00:00
|
|
|
DISK_DIR := $(BUILD_DIR)/${VERSION}/disk
|
2022-01-01 17:45:41 +00:00
|
|
|
CONFIG_DIR := config
|
|
|
|
TOOLS_DIR := tools
|
|
|
|
|
|
|
|
# Files
|
|
|
|
MAIN_ASM_DIRS := $(ASM_DIR)/$(MAIN) $(ASM_DIR)/$(MAIN)/psxsdk $(ASM_DIR)/$(MAIN)/data
|
|
|
|
MAIN_SRC_DIRS := $(SRC_DIR)/$(MAIN) $(SRC_DIR)/$(MAIN)/psxsdk
|
|
|
|
MAIN_S_FILES := $(foreach dir,$(MAIN_ASM_DIRS),$(wildcard $(dir)/*.s)) \
|
|
|
|
$(foreach dir,$(MAIN_ASM_DIRS),$(wildcard $(dir)/**/*.s))
|
|
|
|
MAIN_C_FILES := $(foreach dir,$(MAIN_SRC_DIRS),$(wildcard $(dir)/*.c)) \
|
|
|
|
$(foreach dir,$(MAIN_SRC_DIRS),$(wildcard $(dir)/**/*.c))
|
|
|
|
MAIN_O_FILES := $(foreach file,$(MAIN_S_FILES),$(BUILD_DIR)/$(file).o) \
|
|
|
|
$(foreach file,$(MAIN_C_FILES),$(BUILD_DIR)/$(file).o)
|
|
|
|
MAIN_TARGET := $(BUILD_DIR)/$(MAIN)
|
|
|
|
|
|
|
|
# Tooling
|
|
|
|
PYTHON := python3
|
|
|
|
SPLAT_DIR := $(TOOLS_DIR)/n64splat
|
2022-10-14 20:19:34 +00:00
|
|
|
SPLAT_APP := $(SPLAT_DIR)/split.py
|
2022-10-15 10:18:32 +00:00
|
|
|
SPLAT := $(PYTHON) $(SPLAT_APP)
|
2022-10-14 20:19:34 +00:00
|
|
|
ASMDIFFER_DIR := $(TOOLS_DIR)/asm-differ
|
|
|
|
ASMDIFFER_APP := $(ASMDIFFER_DIR)/diff.py
|
2022-10-15 10:18:32 +00:00
|
|
|
M2CTX_APP := $(TOOLS_DIR)/m2ctx.py
|
|
|
|
M2CTX := $(PYTHON) $(M2CTX_APP)
|
2022-10-15 10:45:20 +00:00
|
|
|
M2C_DIR := $(TOOLS_DIR)/m2c
|
|
|
|
M2C_APP := $(M2C_DIR)/m2c.py
|
|
|
|
M2C := $(PYTHON) $(M2C_APP)
|
|
|
|
M2C_ARGS := -P 4
|
2023-03-16 12:28:17 +00:00
|
|
|
GO := $(HOME)/go/bin/go
|
2022-10-26 06:41:13 +00:00
|
|
|
GOPATH := $(HOME)/go
|
|
|
|
ASPATCH := $(GOPATH)/bin/aspatch
|
2022-12-26 20:37:34 +00:00
|
|
|
SOTNDISK := $(GOPATH)/bin/sotn-disk
|
2023-03-10 03:59:33 +00:00
|
|
|
GFXSTAGE := $(PYTHON) $(TOOLS_DIR)/gfxstage.py
|
2022-01-01 17:45:41 +00:00
|
|
|
|
2022-02-23 18:17:18 +00:00
|
|
|
define list_src_files
|
|
|
|
$(foreach dir,$(ASM_DIR)/$(1),$(wildcard $(dir)/**.s))
|
|
|
|
$(foreach dir,$(ASM_DIR)/$(1)/data,$(wildcard $(dir)/**.s))
|
|
|
|
$(foreach dir,$(ASM_DIR)/$(1)/psxsdk,$(wildcard $(dir)/**.s))
|
|
|
|
$(foreach dir,$(SRC_DIR)/$(1),$(wildcard $(dir)/**.c))
|
|
|
|
$(foreach dir,$(SRC_DIR)/$(1)/psxsdk,$(wildcard $(dir)/**.c))
|
2023-03-09 13:32:00 +00:00
|
|
|
$(foreach dir,$(ASSETS_DIR)/$(1),$(wildcard $(dir)/**))
|
2022-02-23 18:17:18 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define list_o_files
|
|
|
|
$(foreach file,$(call list_src_files,$(1)),$(BUILD_DIR)/$(file).o)
|
|
|
|
endef
|
|
|
|
|
|
|
|
define link
|
|
|
|
$(LD) -o $(2) \
|
|
|
|
-Map $(BUILD_DIR)/$(1).map \
|
|
|
|
-T $(1).ld \
|
2023-02-21 01:42:33 +00:00
|
|
|
-T $(CONFIG_DIR)/symbols.$(VERSION).txt \
|
|
|
|
-T $(CONFIG_DIR)/undefined_syms_auto.$(VERSION).$(1).txt \
|
|
|
|
-T $(CONFIG_DIR)/undefined_funcs_auto.$(VERSION).$(1).txt \
|
2022-02-23 18:17:18 +00:00
|
|
|
--no-check-sections \
|
|
|
|
-nostdlib \
|
|
|
|
-s
|
|
|
|
endef
|
|
|
|
|
2022-10-26 06:41:13 +00:00
|
|
|
all: build check
|
2023-02-08 14:03:44 +00:00
|
|
|
build: main dra ric cen dre mad no3 np3 nz0 sel st0 wrp rwrp tt_000
|
2022-01-01 17:45:41 +00:00
|
|
|
clean:
|
2023-02-21 01:42:33 +00:00
|
|
|
git clean -fdx assets/
|
2022-10-16 08:10:43 +00:00
|
|
|
git clean -fdx asm/
|
2023-02-21 20:06:27 +00:00
|
|
|
git clean -fdx build/
|
2022-10-16 08:10:43 +00:00
|
|
|
git clean -fdx config/
|
2022-08-26 18:16:27 +00:00
|
|
|
format:
|
2022-11-06 17:47:57 +00:00
|
|
|
clang-format -i $$(find $(SRC_DIR)/ -type f -name "*.c")
|
|
|
|
clang-format -i $$(find $(INCLUDE_DIR)/ -type f -name "*.h")
|
2022-10-23 16:55:36 +00:00
|
|
|
check:
|
2023-02-21 20:06:27 +00:00
|
|
|
sha1sum --check config/check.$(VERSION).sha
|
2022-10-23 16:55:36 +00:00
|
|
|
expected: check
|
|
|
|
rm -rf expected/build
|
|
|
|
cp -r build expected/
|
2022-01-01 17:45:41 +00:00
|
|
|
|
|
|
|
main: main_dirs $(MAIN_TARGET).exe
|
|
|
|
main_dirs:
|
|
|
|
$(foreach dir,$(MAIN_ASM_DIRS) $(MAIN_SRC_DIRS),$(shell mkdir -p $(BUILD_DIR)/$(dir)))
|
|
|
|
$(MAIN_TARGET).exe: $(MAIN_TARGET).elf
|
2022-10-16 09:31:54 +00:00
|
|
|
$(OBJCOPY) -O binary $< $@
|
2022-01-01 17:45:41 +00:00
|
|
|
$(MAIN_TARGET).elf: $(MAIN_O_FILES)
|
|
|
|
$(LD) -o $@ \
|
|
|
|
-Map $(MAIN_TARGET).map \
|
|
|
|
-T $(MAIN).ld \
|
2023-02-21 01:42:33 +00:00
|
|
|
-T $(CONFIG_DIR)/symbols.$(VERSION).txt \
|
|
|
|
-T $(CONFIG_DIR)/undefined_syms_auto.$(VERSION).$(MAIN).txt \
|
2022-01-01 17:45:41 +00:00
|
|
|
--no-check-sections \
|
|
|
|
-nostdlib \
|
|
|
|
-s
|
|
|
|
|
2022-02-23 18:17:18 +00:00
|
|
|
dra: dra_dirs $(BUILD_DIR)/DRA.BIN
|
|
|
|
$(BUILD_DIR)/DRA.BIN: $(BUILD_DIR)/$(DRA).elf
|
2022-01-01 17:45:41 +00:00
|
|
|
$(OBJCOPY) -O binary $< $@
|
2022-02-23 18:17:18 +00:00
|
|
|
$(BUILD_DIR)/$(DRA).elf: $(call list_o_files,dra)
|
|
|
|
$(call link,dra,$@)
|
2022-01-01 17:45:41 +00:00
|
|
|
|
2022-03-07 22:46:43 +00:00
|
|
|
ric: ric_dirs $(BUILD_DIR)/RIC.BIN
|
|
|
|
$(BUILD_DIR)/RIC.BIN: $(BUILD_DIR)/ric.elf
|
|
|
|
$(OBJCOPY) -O binary $< $@
|
|
|
|
$(BUILD_DIR)/ric.elf: $(call list_o_files,ric)
|
|
|
|
$(call link,ric,$@)
|
|
|
|
|
2023-03-10 04:04:18 +00:00
|
|
|
cen: stcen_dirs $(BUILD_DIR)/CEN.BIN $(BUILD_DIR)/F_CEN.BIN
|
2022-10-28 22:46:47 +00:00
|
|
|
$(BUILD_DIR)/CEN.BIN: $(BUILD_DIR)/stcen.elf
|
|
|
|
$(OBJCOPY) -O binary $< $@
|
2023-03-10 04:04:18 +00:00
|
|
|
$(BUILD_DIR)/F_CEN.BIN:
|
|
|
|
$(GFXSTAGE) e assets/st/cen $@
|
2022-10-28 22:46:47 +00:00
|
|
|
|
2023-03-10 04:04:18 +00:00
|
|
|
dre: stdre_dirs $(BUILD_DIR)/DRE.BIN $(BUILD_DIR)/F_DRE.BIN
|
2022-02-23 18:17:18 +00:00
|
|
|
$(BUILD_DIR)/DRE.BIN: $(BUILD_DIR)/stdre.elf
|
2022-02-09 12:49:33 +00:00
|
|
|
$(OBJCOPY) -O binary $< $@
|
2023-03-10 04:04:18 +00:00
|
|
|
$(BUILD_DIR)/F_DRE.BIN:
|
|
|
|
$(GFXSTAGE) e assets/st/dre $@
|
2022-02-09 12:49:33 +00:00
|
|
|
|
2023-03-10 04:04:18 +00:00
|
|
|
mad: stmad_dirs $(BUILD_DIR)/MAD.BIN $(BUILD_DIR)/F_MAD.BIN
|
2022-02-23 18:17:18 +00:00
|
|
|
$(BUILD_DIR)/MAD.BIN: $(BUILD_DIR)/stmad.elf
|
2022-01-20 22:02:05 +00:00
|
|
|
$(OBJCOPY) -O binary $< $@
|
2023-03-10 04:04:18 +00:00
|
|
|
$(BUILD_DIR)/F_MAD.BIN:
|
|
|
|
$(GFXSTAGE) e assets/st/mad $@
|
2022-01-20 22:02:05 +00:00
|
|
|
|
2023-03-10 04:04:18 +00:00
|
|
|
no3: stno3_dirs $(BUILD_DIR)/NO3.BIN $(BUILD_DIR)/F_NO3.BIN
|
2022-02-23 18:17:18 +00:00
|
|
|
$(BUILD_DIR)/NO3.BIN: $(BUILD_DIR)/stno3.elf
|
2022-01-20 22:02:05 +00:00
|
|
|
$(OBJCOPY) -O binary $< $@
|
2023-03-10 04:04:18 +00:00
|
|
|
$(BUILD_DIR)/F_NO3.BIN:
|
|
|
|
$(GFXSTAGE) e assets/st/no3 $@
|
2022-01-20 22:02:05 +00:00
|
|
|
|
2023-03-10 04:04:18 +00:00
|
|
|
np3: stnp3_dirs $(BUILD_DIR)/NP3.BIN $(BUILD_DIR)/F_NP3.BIN
|
2022-02-23 18:17:18 +00:00
|
|
|
$(BUILD_DIR)/NP3.BIN: $(BUILD_DIR)/stnp3.elf
|
2022-02-05 17:16:17 +00:00
|
|
|
$(OBJCOPY) -O binary $< $@
|
2023-03-10 04:04:18 +00:00
|
|
|
$(BUILD_DIR)/F_NP3.BIN:
|
|
|
|
$(GFXSTAGE) e assets/st/np3 $@
|
2022-02-05 17:16:17 +00:00
|
|
|
|
2023-03-10 04:04:18 +00:00
|
|
|
nz0: stnz0_dirs $(BUILD_DIR)/NZ0.BIN $(BUILD_DIR)/F_NZ0.BIN
|
2022-10-29 17:58:02 +00:00
|
|
|
$(BUILD_DIR)/NZ0.BIN: $(BUILD_DIR)/stnz0.elf
|
|
|
|
$(OBJCOPY) -O binary $< $@
|
2023-03-10 04:04:18 +00:00
|
|
|
$(BUILD_DIR)/F_NZ0.BIN:
|
|
|
|
$(GFXSTAGE) e assets/st/nz0 $@
|
2022-10-29 17:58:02 +00:00
|
|
|
|
2022-12-21 16:33:15 +00:00
|
|
|
sel: stsel_dirs $(BUILD_DIR)/SEL.BIN
|
|
|
|
$(BUILD_DIR)/SEL.BIN: $(BUILD_DIR)/stsel.elf
|
|
|
|
$(OBJCOPY) -O binary $< $@
|
|
|
|
|
2023-03-10 04:04:18 +00:00
|
|
|
st0: stst0_dirs $(BUILD_DIR)/ST0.BIN $(BUILD_DIR)/F_ST0.BIN
|
2022-02-23 18:17:18 +00:00
|
|
|
$(BUILD_DIR)/ST0.BIN: $(BUILD_DIR)/stst0.elf
|
2022-02-09 12:49:33 +00:00
|
|
|
$(OBJCOPY) -O binary $< $@
|
2023-03-10 04:04:18 +00:00
|
|
|
$(BUILD_DIR)/F_ST0.BIN:
|
|
|
|
$(GFXSTAGE) e assets/st/st0 $@
|
2022-02-09 12:49:33 +00:00
|
|
|
|
2023-03-10 03:59:33 +00:00
|
|
|
wrp: stwrp_dirs $(BUILD_DIR)/WRP.BIN $(BUILD_DIR)/F_WRP.BIN
|
2022-02-23 18:17:18 +00:00
|
|
|
$(BUILD_DIR)/WRP.BIN: $(BUILD_DIR)/stwrp.elf
|
2022-02-09 12:49:33 +00:00
|
|
|
$(OBJCOPY) -O binary $< $@
|
2023-03-10 03:59:33 +00:00
|
|
|
$(BUILD_DIR)/F_WRP.BIN:
|
|
|
|
$(GFXSTAGE) e assets/st/wrp $@
|
2022-02-09 12:49:33 +00:00
|
|
|
|
2023-03-10 04:04:18 +00:00
|
|
|
rwrp: strwrp_dirs $(BUILD_DIR)/RWRP.BIN $(BUILD_DIR)/F_RWRP.BIN
|
2022-02-23 18:17:18 +00:00
|
|
|
$(BUILD_DIR)/RWRP.BIN: $(BUILD_DIR)/strwrp.elf
|
2022-02-09 12:49:33 +00:00
|
|
|
$(OBJCOPY) -O binary $< $@
|
2023-03-10 04:04:18 +00:00
|
|
|
$(BUILD_DIR)/F_RWRP.BIN:
|
|
|
|
$(GFXSTAGE) e assets/st/rwrp $@
|
2022-02-09 12:49:33 +00:00
|
|
|
|
2023-02-08 14:03:44 +00:00
|
|
|
tt_000: tt_000_dirs $(BUILD_DIR)/TT_000.BIN
|
|
|
|
$(BUILD_DIR)/TT_000.BIN: $(BUILD_DIR)/tt_000.elf
|
|
|
|
$(OBJCOPY) -O binary $< $@
|
|
|
|
|
2023-02-19 18:15:49 +00:00
|
|
|
mad_fix: stmad_dirs $$(call list_o_files,st/mad)
|
|
|
|
$(LD) -o $(BUILD_DIR)/stmad_fix.elf \
|
|
|
|
-Map $(BUILD_DIR)/stmad_fix.map \
|
|
|
|
-T stmad.ld \
|
2023-02-21 01:42:33 +00:00
|
|
|
-T $(CONFIG_DIR)/symbols.$(VERSION).txt \
|
2023-02-19 18:15:49 +00:00
|
|
|
-T $(CONFIG_DIR)/undefined_syms_auto.stmad.txt \
|
|
|
|
-T $(CONFIG_DIR)/undefined_funcs_auto.stmad.txt \
|
|
|
|
--no-check-sections \
|
|
|
|
-nostdlib \
|
|
|
|
-s
|
|
|
|
$(OBJCOPY) -O binary $(BUILD_DIR)/stmad_fix.elf $(BUILD_DIR)/MAD.BIN
|
2022-03-05 02:45:54 +00:00
|
|
|
|
2023-02-08 14:03:44 +00:00
|
|
|
tt_%_dirs:
|
|
|
|
$(foreach dir,$(ASM_DIR)/servant/tt_$* $(ASM_DIR)/servant/tt_$*/data $(SRC_DIR)/servant/tt_$* $(ASSETS_DIR)/servant/tt_$*,$(shell mkdir -p $(BUILD_DIR)/$(dir)))
|
2022-02-23 18:17:18 +00:00
|
|
|
st%_dirs:
|
2023-02-03 15:38:48 +00:00
|
|
|
$(foreach dir,$(ASM_DIR)/st/$* $(ASM_DIR)/st/$*/data $(SRC_DIR)/st/$* $(ASSETS_DIR)/st/$*,$(shell mkdir -p $(BUILD_DIR)/$(dir)))
|
2022-02-23 18:17:18 +00:00
|
|
|
%_dirs:
|
2023-02-03 15:38:48 +00:00
|
|
|
$(foreach dir,$(ASM_DIR)/$* $(ASM_DIR)/$*/data $(SRC_DIR)/$* $(ASSETS_DIR)/$*,$(shell mkdir -p $(BUILD_DIR)/$(dir)))
|
2022-02-23 18:17:18 +00:00
|
|
|
|
2023-02-08 14:03:44 +00:00
|
|
|
$(BUILD_DIR)/tt_%.elf: $$(call list_o_files,servant/tt_$$*)
|
|
|
|
$(call link,tt_$*,$@)
|
2023-02-19 18:15:49 +00:00
|
|
|
$(BUILD_DIR)/stmad.elf: $$(call list_o_files,st/mad)
|
|
|
|
$(LD) -o $@ \
|
|
|
|
-Map $(BUILD_DIR)/stmad.map \
|
|
|
|
-T stmad.ld \
|
|
|
|
-T $(CONFIG_DIR)/symbols.beta.txt \
|
|
|
|
-T $(CONFIG_DIR)/undefined_syms_auto.stmad.txt \
|
|
|
|
-T $(CONFIG_DIR)/undefined_funcs_auto.stmad.txt \
|
|
|
|
--no-check-sections \
|
|
|
|
-nostdlib \
|
|
|
|
-s
|
2022-02-23 18:17:18 +00:00
|
|
|
$(BUILD_DIR)/st%.elf: $$(call list_o_files,st/$$*)
|
|
|
|
$(call link,st$*,$@)
|
|
|
|
|
2023-02-08 14:03:44 +00:00
|
|
|
extract: extract_main extract_dra extract_ric extract_stcen extract_stdre extract_stmad extract_stno3 extract_stnp3 extract_stnz0 extract_stsel extract_stst0 extract_stwrp extract_strwrp extract_tt_000
|
2023-02-25 15:02:43 +00:00
|
|
|
extract_main: $(SPLAT_APP)
|
2023-02-21 01:42:33 +00:00
|
|
|
$(SPLAT) $(CONFIG_DIR)/splat.$(VERSION).$(MAIN).yaml
|
2023-02-25 15:02:43 +00:00
|
|
|
extract_dra: $(SPLAT_APP)
|
2023-02-21 01:42:33 +00:00
|
|
|
cat $(CONFIG_DIR)/symbols.$(VERSION).txt $(CONFIG_DIR)/symbols.$(VERSION).dra.txt > $(CONFIG_DIR)/generated.symbols.$(VERSION).dra.txt
|
|
|
|
$(SPLAT) $(CONFIG_DIR)/splat.$(VERSION).$(DRA).yaml
|
2023-02-25 15:02:43 +00:00
|
|
|
extract_ric: $(SPLAT_APP)
|
2023-02-21 01:42:33 +00:00
|
|
|
cat $(CONFIG_DIR)/symbols.$(VERSION).txt $(CONFIG_DIR)/symbols.$(VERSION).ric.txt > $(CONFIG_DIR)/generated.symbols.$(VERSION).ric.txt
|
|
|
|
$(SPLAT) $(CONFIG_DIR)/splat.$(VERSION).ric.yaml
|
2023-02-25 15:02:43 +00:00
|
|
|
extract_stmad: $(SPLAT_APP)
|
2023-02-19 18:15:49 +00:00
|
|
|
cat $(CONFIG_DIR)/symbols.beta.txt $(CONFIG_DIR)/symbols.stmad.txt > $(CONFIG_DIR)/generated.symbols.stmad.txt
|
2023-02-21 01:42:33 +00:00
|
|
|
$(SPLAT) $(CONFIG_DIR)/splat.$(VERSION).stmad.yaml
|
2023-03-10 04:04:18 +00:00
|
|
|
$(GFXSTAGE) d disks/$(VERSION)/ST/MAD/F_MAD.BIN $(ASSETS_DIR)/st/mad
|
2023-02-25 15:02:43 +00:00
|
|
|
extract_st%: $(SPLAT_APP)
|
2023-02-21 01:42:33 +00:00
|
|
|
cat $(CONFIG_DIR)/symbols.$(VERSION).txt $(CONFIG_DIR)/symbols.$(VERSION).st$*.txt > $(CONFIG_DIR)/generated.symbols.$(VERSION).st$*.txt
|
|
|
|
$(SPLAT) $(CONFIG_DIR)/splat.$(VERSION).st$*.yaml
|
2023-03-10 03:59:33 +00:00
|
|
|
$(GFXSTAGE) d disks/$(VERSION)/ST/$$(echo '$*' | tr '[:lower:]' '[:upper:]')/F_$$(echo '$*' | tr '[:lower:]' '[:upper:]').BIN $(ASSETS_DIR)/st/$*
|
2023-02-25 15:02:43 +00:00
|
|
|
extract_tt_%: $(SPLAT_APP)
|
2023-02-21 01:42:33 +00:00
|
|
|
cat $(CONFIG_DIR)/symbols.$(VERSION).txt $(CONFIG_DIR)/symbols.$(VERSION).tt_$*.txt > $(CONFIG_DIR)/generated.symbols.$(VERSION).tt_$*.txt
|
|
|
|
$(SPLAT) $(CONFIG_DIR)/splat.$(VERSION).tt_$*.yaml
|
|
|
|
$(CONFIG_DIR)/generated.$(VERSION).symbols.%.txt:
|
2022-10-15 10:18:32 +00:00
|
|
|
|
2022-12-19 05:32:00 +00:00
|
|
|
context:
|
|
|
|
$(M2CTX) $(SOURCE)
|
|
|
|
@echo ctx.c has been updated.
|
|
|
|
|
2023-02-21 23:25:24 +00:00
|
|
|
extract_disk: $(SOTNDISK)
|
|
|
|
$(SOTNDISK) extract disks/sotn.$(VERSION).cue disks/$(VERSION)
|
2023-01-10 20:38:49 +00:00
|
|
|
disk: build $(SOTNDISK)
|
2023-01-01 20:49:12 +00:00
|
|
|
mkdir -p $(DISK_DIR)
|
2023-02-21 23:25:24 +00:00
|
|
|
cp -r disks/${VERSION}/* $(DISK_DIR)
|
2023-01-01 20:49:12 +00:00
|
|
|
cp $(BUILD_DIR)/main.exe $(DISK_DIR)/SLUS_000.67
|
|
|
|
cp $(BUILD_DIR)/DRA.BIN $(DISK_DIR)/DRA.BIN
|
|
|
|
cp $(BUILD_DIR)/RIC.BIN $(DISK_DIR)/BIN/RIC.BIN
|
|
|
|
cp $(BUILD_DIR)/CEN.BIN $(DISK_DIR)/ST/CEN/CEN.BIN
|
2023-03-10 04:04:18 +00:00
|
|
|
cp $(BUILD_DIR)/F_CEN.BIN $(DISK_DIR)/ST/CEN/F_CEN.BIN
|
2023-01-01 20:49:12 +00:00
|
|
|
cp $(BUILD_DIR)/DRE.BIN $(DISK_DIR)/ST/DRE/DRE.BIN
|
2023-03-10 04:04:18 +00:00
|
|
|
cp $(BUILD_DIR)/F_DRE.BIN $(DISK_DIR)/ST/DRE/F_DRE.BIN
|
2023-01-01 20:49:12 +00:00
|
|
|
cp $(BUILD_DIR)/MAD.BIN $(DISK_DIR)/ST/MAD/MAD.BIN
|
2023-03-10 04:04:18 +00:00
|
|
|
cp $(BUILD_DIR)/F_MAD.BIN $(DISK_DIR)/ST/MAD/F_MAD.BIN
|
2023-01-01 20:49:12 +00:00
|
|
|
cp $(BUILD_DIR)/NO3.BIN $(DISK_DIR)/ST/NO3/NO3.BIN
|
2023-03-10 04:04:18 +00:00
|
|
|
cp $(BUILD_DIR)/F_NO3.BIN $(DISK_DIR)/ST/NO3/F_NO3.BIN
|
2023-01-01 20:49:12 +00:00
|
|
|
cp $(BUILD_DIR)/NP3.BIN $(DISK_DIR)/ST/NP3/NP3.BIN
|
2023-03-10 04:04:18 +00:00
|
|
|
cp $(BUILD_DIR)/F_NP3.BIN $(DISK_DIR)/ST/NP3/F_NP3.BIN
|
2023-01-01 20:49:12 +00:00
|
|
|
cp $(BUILD_DIR)/NZ0.BIN $(DISK_DIR)/ST/NZ0/NZ0.BIN
|
2023-03-10 04:04:18 +00:00
|
|
|
cp $(BUILD_DIR)/F_NZ0.BIN $(DISK_DIR)/ST/NZ0/F_NZ0.BIN
|
2023-01-01 20:49:12 +00:00
|
|
|
cp $(BUILD_DIR)/RWRP.BIN $(DISK_DIR)/ST/RWRP/RWRP.BIN
|
2023-03-10 04:04:18 +00:00
|
|
|
cp $(BUILD_DIR)/F_RWRP.BIN $(DISK_DIR)/ST/RWRP/F_RWRP.BIN
|
2023-01-01 20:49:12 +00:00
|
|
|
cp $(BUILD_DIR)/SEL.BIN $(DISK_DIR)/ST/SEL/SEL.BIN
|
|
|
|
cp $(BUILD_DIR)/ST0.BIN $(DISK_DIR)/ST/ST0/ST0.BIN
|
2023-03-10 04:04:18 +00:00
|
|
|
cp $(BUILD_DIR)/F_ST0.BIN $(DISK_DIR)/ST/ST0/F_ST0.BIN
|
2023-01-01 20:49:12 +00:00
|
|
|
cp $(BUILD_DIR)/WRP.BIN $(DISK_DIR)/ST/WRP/WRP.BIN
|
2023-03-10 04:04:18 +00:00
|
|
|
cp $(BUILD_DIR)/F_WRP.BIN $(DISK_DIR)/ST/WRP/F_WRP.BIN
|
2023-02-08 14:03:44 +00:00
|
|
|
cp $(BUILD_DIR)/TT_000.BIN $(DISK_DIR)/SERVANT/TT_000.BIN
|
2023-02-21 20:06:27 +00:00
|
|
|
$(SOTNDISK) make build/sotn.$(VERSION).cue $(DISK_DIR) $(CONFIG_DIR)/disk.us.lba
|
2023-01-01 20:49:12 +00:00
|
|
|
|
2023-02-25 15:02:43 +00:00
|
|
|
update-dependencies: $(SPLAT_APP) $(ASMDIFFER_APP) $(M2CTX_APP) $(M2C_APP) $(GO)
|
2022-10-25 20:26:35 +00:00
|
|
|
pip3 install -r $(TOOLS_DIR)/requirements-python.txt
|
2022-10-26 06:41:13 +00:00
|
|
|
$(GO) install github.com/xeeynamo/sotn-decomp/tools/aspatch@latest
|
2023-01-01 20:49:12 +00:00
|
|
|
$(GO) install github.com/xeeynamo/sotn-decomp/tools/gfxsotn@latest
|
|
|
|
$(GO) install github.com/xeeynamo/sotn-decomp/tools/sotn-disk@latest
|
2023-04-05 18:08:14 +00:00
|
|
|
git clean -fd bin/
|
2022-10-14 20:19:34 +00:00
|
|
|
|
2023-04-05 18:08:14 +00:00
|
|
|
bin/%:
|
|
|
|
cd ./bin && wget https://github.com/Xeeynamo/sotn-decomp/releases/download/$*/$*.tar.gz
|
|
|
|
rm -f $*.tar.gz*
|
|
|
|
cd ./bin && sha256sum --check $*.tar.gz.sha256 && tar -xzf $*.tar.gz
|
|
|
|
rm -f $*.tar.gz*
|
2022-10-14 20:19:34 +00:00
|
|
|
$(SPLAT_APP):
|
2022-01-01 17:45:41 +00:00
|
|
|
git submodule init $(SPLAT_DIR)
|
|
|
|
git submodule update $(SPLAT_DIR)
|
2023-01-01 20:59:50 +00:00
|
|
|
pip3 install -r $(TOOLS_DIR)/requirements-python.txt
|
2022-10-14 20:19:34 +00:00
|
|
|
$(ASMDIFFER_APP):
|
2022-10-14 20:26:57 +00:00
|
|
|
git submodule init $(ASMDIFFER_DIR)
|
|
|
|
git submodule update $(ASMDIFFER_DIR)
|
2022-10-15 10:18:32 +00:00
|
|
|
$(M2CTX_APP):
|
|
|
|
curl -o $@ https://raw.githubusercontent.com/ethteck/m2ctx/main/m2ctx.py
|
2022-10-15 10:45:20 +00:00
|
|
|
$(M2C_APP):
|
|
|
|
git submodule init $(M2C_DIR)
|
|
|
|
git submodule update $(M2C_DIR)
|
|
|
|
python3 -m pip install --upgrade pycparser
|
2022-10-26 06:41:13 +00:00
|
|
|
$(GO):
|
2023-03-16 12:28:17 +00:00
|
|
|
curl -L -o go1.19.7.linux-amd64.tar.gz https://go.dev/dl/go1.19.7.linux-amd64.tar.gz
|
|
|
|
tar -C $(HOME) -xzf go1.19.7.linux-amd64.tar.gz
|
|
|
|
rm go1.19.7.linux-amd64.tar.gz
|
2022-10-26 06:41:13 +00:00
|
|
|
$(ASPATCH): $(GO)
|
|
|
|
$(GO) install github.com/xeeynamo/sotn-decomp/tools/aspatch@latest
|
2022-12-26 20:37:34 +00:00
|
|
|
$(SOTNDISK): $(GO)
|
|
|
|
$(GO) install github.com/xeeynamo/sotn-decomp/tools/sotn-disk@latest
|
2022-01-01 17:45:41 +00:00
|
|
|
|
|
|
|
$(BUILD_DIR)/%.s.o: %.s
|
|
|
|
$(AS) $(AS_FLAGS) -o $@ $<
|
2023-04-05 18:08:14 +00:00
|
|
|
$(BUILD_DIR)/%.c.o: %.c $(ASPATCH) $(CC1PSX)
|
2022-10-26 06:41:13 +00:00
|
|
|
$(CPP) $(CPP_FLAGS) $< | $(CC) $(CC_FLAGS) | $(ASPATCH) | $(AS) $(AS_FLAGS) -o $@
|
2022-01-01 17:45:41 +00:00
|
|
|
|
2023-03-09 13:32:00 +00:00
|
|
|
# Handles assets
|
|
|
|
$(BUILD_DIR)/$(ASSETS_DIR)/%.layoutobj.json.o: $(ASSETS_DIR)/%.layoutobj.json
|
|
|
|
./tools/splat_ext/layoutobj.py $< $(BUILD_DIR)/$(ASSETS_DIR)/$*.bin
|
|
|
|
$(LD) -r -b binary -o $(BUILD_DIR)/$(ASSETS_DIR)/$*.o $(BUILD_DIR)/$(ASSETS_DIR)/$*.bin
|
|
|
|
$(BUILD_DIR)/$(ASSETS_DIR)/%.roomdef.json.o: $(ASSETS_DIR)/%.roomdef.json
|
|
|
|
./tools/splat_ext/roomdef.py $< $(BUILD_DIR)/$(ASSETS_DIR)/$*.bin
|
|
|
|
$(LD) -r -b binary -o $(BUILD_DIR)/$(ASSETS_DIR)/$*.o $(BUILD_DIR)/$(ASSETS_DIR)/$*.bin
|
2023-03-31 07:41:52 +00:00
|
|
|
$(BUILD_DIR)/$(ASSETS_DIR)/%.layers.json.o: $(ASSETS_DIR)/%.layers.json
|
|
|
|
./tools/splat_ext/layers.py $< $(BUILD_DIR)/$(ASSETS_DIR)/$*.s
|
|
|
|
$(AS) $(AS_FLAGS) -o $(BUILD_DIR)/$(ASSETS_DIR)/$*.o $(BUILD_DIR)/$(ASSETS_DIR)/$*.s
|
2023-03-09 13:32:00 +00:00
|
|
|
$(BUILD_DIR)/$(ASSETS_DIR)/%.tiledef.json.o: $(ASSETS_DIR)/%.tiledef.json
|
|
|
|
./tools/splat_ext/tiledef.py $< $(BUILD_DIR)/$(ASSETS_DIR)/$*.s
|
|
|
|
$(AS) $(AS_FLAGS) -o $(BUILD_DIR)/$(ASSETS_DIR)/$*.o $(BUILD_DIR)/$(ASSETS_DIR)/$*.s
|
2023-04-22 20:03:55 +00:00
|
|
|
$(BUILD_DIR)/$(ASSETS_DIR)/%.spritesheet.json.o: $(ASSETS_DIR)/%.spritesheet.json
|
|
|
|
./tools/splat_ext/spritesheet.py $< $(BUILD_DIR)/$(ASSETS_DIR)/$*.s
|
|
|
|
$(AS) $(AS_FLAGS) -o $(BUILD_DIR)/$(ASSETS_DIR)/$*.o $(BUILD_DIR)/$(ASSETS_DIR)/$*.s
|
2023-03-09 13:32:00 +00:00
|
|
|
$(BUILD_DIR)/$(ASSETS_DIR)/%.spriteparts.json.o: $(ASSETS_DIR)/%.spriteparts.json
|
|
|
|
./tools/splat_ext/spriteparts.py $< $(BUILD_DIR)/$(ASSETS_DIR)/$*.bin
|
|
|
|
$(LD) -r -b binary -o $(BUILD_DIR)/$(ASSETS_DIR)/$*.o $(BUILD_DIR)/$(ASSETS_DIR)/$*.bin
|
2023-03-18 14:16:56 +00:00
|
|
|
$(BUILD_DIR)/$(ASSETS_DIR)/%.equipment.json.o: $(ASSETS_DIR)/%.equipment.json
|
|
|
|
./tools/splat_ext/equipment.py $< $(BUILD_DIR)/$(ASSETS_DIR)/$*.bin
|
|
|
|
$(LD) -r -b binary -o $(BUILD_DIR)/$(ASSETS_DIR)/$*.o $(BUILD_DIR)/$(ASSETS_DIR)/$*.bin
|
2023-03-09 13:32:00 +00:00
|
|
|
$(BUILD_DIR)/$(ASSETS_DIR)/%.spritepartslist.json.o: $(ASSETS_DIR)/%.spritepartslist.json
|
|
|
|
./tools/splat_ext/spritepartslist.py $< $(BUILD_DIR)/$(ASSETS_DIR)/$*.s
|
|
|
|
$(AS) $(AS_FLAGS) -o $(BUILD_DIR)/$(ASSETS_DIR)/$*.o $(BUILD_DIR)/$(ASSETS_DIR)/$*.s
|
|
|
|
$(BUILD_DIR)/$(ASSETS_DIR)/%.tilelayout.bin.o: $(ASSETS_DIR)/%.tilelayout.bin
|
|
|
|
$(LD) -r -b binary -o $(BUILD_DIR)/$(ASSETS_DIR)/$*.o $(ASSETS_DIR)/$*.tilelayout.bin
|
|
|
|
$(BUILD_DIR)/$(ASSETS_DIR)/%.bin.o: $(ASSETS_DIR)/%.bin
|
|
|
|
$(LD) -r -b binary -o $(BUILD_DIR)/$(ASSETS_DIR)/$*.o $<
|
|
|
|
$(BUILD_DIR)/$(ASSETS_DIR)/%.dec.o: $(ASSETS_DIR)/%.dec
|
|
|
|
# for now '.dec' files are ignored
|
|
|
|
touch $@
|
2023-04-22 20:03:55 +00:00
|
|
|
$(BUILD_DIR)/$(ASSETS_DIR)/%.png.o: $(ASSETS_DIR)/%.png
|
|
|
|
touch $@
|
2023-03-09 13:32:00 +00:00
|
|
|
|
2022-01-01 17:45:41 +00:00
|
|
|
SHELL = /bin/bash -e -o pipefail
|
|
|
|
|
2022-10-23 16:55:36 +00:00
|
|
|
.PHONY: all, clean, format, check, expected
|
2023-02-08 14:03:44 +00:00
|
|
|
.PHONY: main, dra, ric, cen, dre, mad, no3, np3, nz0, st0, wrp, rwrp, tt_000
|
2022-02-23 18:17:18 +00:00
|
|
|
.PHONY: %_dirs
|
|
|
|
.PHONY: extract, extract_%
|
2022-10-25 20:26:35 +00:00
|
|
|
.PHONY: require-tools,update-dependencies
|