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-06-16 18:51:16 +00:00
|
|
|
VERSION ?= us
|
2022-01-01 17:45:41 +00:00
|
|
|
MAIN := main
|
|
|
|
DRA := dra
|
|
|
|
|
|
|
|
# Compilers
|
2023-06-16 18:51:16 +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
|
2023-06-16 18:51:16 +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-06-16 18:51:16 +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 -gcoff
|
|
|
|
CPP_FLAGS += -Iinclude -undef -Wall -lang-c -fno-builtin
|
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:32:35 +00:00
|
|
|
CPP_FLAGS += -D_internal_version_$(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)) \
|
2023-06-16 18:51:16 +00:00
|
|
|
$(foreach dir,$(MAIN_ASM_DIRS),$(wildcard $(dir)/**/*.s))
|
2022-01-01 17:45:41 +00:00
|
|
|
MAIN_C_FILES := $(foreach dir,$(MAIN_SRC_DIRS),$(wildcard $(dir)/*.c)) \
|
2023-06-16 18:51:16 +00:00
|
|
|
$(foreach dir,$(MAIN_SRC_DIRS),$(wildcard $(dir)/**/*.c))
|
2022-01-01 17:45:41 +00:00
|
|
|
MAIN_O_FILES := $(foreach file,$(MAIN_S_FILES),$(BUILD_DIR)/$(file).o) \
|
2023-06-16 18:51:16 +00:00
|
|
|
$(foreach file,$(MAIN_C_FILES),$(BUILD_DIR)/$(file).o)
|
2022-01-01 17:45:41 +00:00
|
|
|
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)
|
2023-06-16 18:51:16 +00:00
|
|
|
M2C_ARGS := -P 4
|
2023-06-17 11:29:42 +00:00
|
|
|
MASPSX_DIR := $(TOOLS_DIR)/maspsx
|
|
|
|
MASPSX_APP := $(MASPSX_DIR)/maspsx.py
|
|
|
|
MASPSX := $(PYTHON) $(MASPSX_APP) --no-macro-inc --expand-div
|
2023-06-16 18:51:16 +00:00
|
|
|
GO := $(HOME)/go/bin/go
|
|
|
|
GOPATH := $(HOME)/go
|
|
|
|
SOTNDISK := $(GOPATH)/bin/sotn-disk
|
|
|
|
GFXSTAGE := $(PYTHON) $(TOOLS_DIR)/gfxstage.py
|
2023-05-25 18:29:10 +00:00
|
|
|
SATURN_SPLITTER_DIR := $(TOOLS_DIR)/saturn-splitter
|
|
|
|
SATURN_SPLITTER_APP := $(SATURN_SPLITTER_DIR)/rust-dis/target/release/rust-dis
|
2023-06-16 18:39:45 +00:00
|
|
|
SATURN_ADPCM_EXTRACT_APP := $(SATURN_SPLITTER_DIR)/adpcm-extract/target/release/adpcm-extract
|
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-06-12 05:04:25 +00:00
|
|
|
-T $(CONFIG_DIR)/undefined_syms.$(VERSION).txt \
|
2023-02-21 01:42:33 +00:00
|
|
|
-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")
|
2023-07-01 21:02:56 +00:00
|
|
|
clang-format -i $$(find $(SRC_DIR)/saturn -type f -name "*.h")
|
2023-05-06 01:14:07 +00:00
|
|
|
$(PYTHON) ./tools/symbols.py sort
|
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
|
2023-05-07 09:24:15 +00:00
|
|
|
mkdir -p expected
|
2022-10-23 16:55:36 +00:00
|
|
|
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-06-12 05:04:25 +00:00
|
|
|
-T $(CONFIG_DIR)/undefined_syms.$(VERSION).txt \
|
2023-02-21 01:42:33 +00:00
|
|
|
-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-06-12 05:04:25 +00:00
|
|
|
-T $(CONFIG_DIR)/undefined_syms.$(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 \
|
2023-06-12 05:04:25 +00:00
|
|
|
-T $(CONFIG_DIR)/undefined_syms.beta.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
|
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
|
|
|
|
2023-05-25 18:29:10 +00:00
|
|
|
extract_saturn: $(SATURN_SPLITTER_APP)
|
|
|
|
$(SATURN_SPLITTER_APP) $(CONFIG_DIR)/saturn/game.prg.yaml
|
|
|
|
$(SATURN_SPLITTER_APP) $(CONFIG_DIR)/saturn/t_bat.prg.yaml
|
2023-06-03 18:09:44 +00:00
|
|
|
$(SATURN_SPLITTER_APP) $(CONFIG_DIR)/saturn/zero.bin.yaml
|
2023-06-06 22:28:19 +00:00
|
|
|
$(SATURN_SPLITTER_APP) $(CONFIG_DIR)/saturn/stage_02.prg.yaml
|
2023-05-25 18:29:10 +00:00
|
|
|
|
2023-06-16 18:39:45 +00:00
|
|
|
extract_saturn_pcm: $(SATURN_SPLITTER_APP)
|
|
|
|
mkdir -p build/saturn/SD
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD01.PCM build/saturn/SD/SD01.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD02.PCM build/saturn/SD/SD02.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD03.PCM build/saturn/SD/SD03.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD04.PCM build/saturn/SD/SD04.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD05.PCM build/saturn/SD/SD05.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD06.PCM build/saturn/SD/SD06.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD07.PCM build/saturn/SD/SD07.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD08.PCM build/saturn/SD/SD08.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD09.PCM build/saturn/SD/SD09.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD0A.PCM build/saturn/SD/SD0A.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD0B.PCM build/saturn/SD/SD0B.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD0C.PCM build/saturn/SD/SD0C.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD0D.PCM build/saturn/SD/SD0D.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD0E.PCM build/saturn/SD/SD0E.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD0F.PCM build/saturn/SD/SD0F.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD10.PCM build/saturn/SD/SD10.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD11.PCM build/saturn/SD/SD11.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD12.PCM build/saturn/SD/SD12.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD13.PCM build/saturn/SD/SD13.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD14.PCM build/saturn/SD/SD14.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD15.PCM build/saturn/SD/SD15.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD16.PCM build/saturn/SD/SD16.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD17.PCM build/saturn/SD/SD17.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD18.PCM build/saturn/SD/SD18.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD19.PCM build/saturn/SD/SD19.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD1A.PCM build/saturn/SD/SD1A.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD1B.PCM build/saturn/SD/SD1B.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD1C.PCM build/saturn/SD/SD1C.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD1D.PCM build/saturn/SD/SD1D.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD1E.PCM build/saturn/SD/SD1E.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD1F.PCM build/saturn/SD/SD1F.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD20.PCM build/saturn/SD/SD20.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD21.PCM build/saturn/SD/SD21.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD22.PCM build/saturn/SD/SD22.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD23.PCM build/saturn/SD/SD23.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD24.PCM build/saturn/SD/SD24.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD25.PCM build/saturn/SD/SD25.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD26.PCM build/saturn/SD/SD26.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD27.PCM build/saturn/SD/SD27.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD28.PCM build/saturn/SD/SD28.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD29.PCM build/saturn/SD/SD29.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD2A.PCM build/saturn/SD/SD2A.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD2B.PCM build/saturn/SD/SD2B.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD2C.PCM build/saturn/SD/SD2C.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD2D.PCM build/saturn/SD/SD2D.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD2E.PCM build/saturn/SD/SD2E.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD2F.PCM build/saturn/SD/SD2F.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD30.PCM build/saturn/SD/SD30.wav
|
|
|
|
$(SATURN_ADPCM_EXTRACT_APP) disks/saturn/SD/SD31.PCM build/saturn/SD/SD31.wav
|
|
|
|
|
2023-05-29 17:06:28 +00:00
|
|
|
# Force to extract all the assembly code regardless if a function is already decompiled
|
|
|
|
force_extract:
|
|
|
|
mv src src_tmp
|
|
|
|
make extract -j
|
|
|
|
rm -rf src/
|
|
|
|
mv src_tmp src
|
|
|
|
|
2022-12-19 05:32:00 +00:00
|
|
|
context:
|
|
|
|
$(M2CTX) $(SOURCE)
|
|
|
|
@echo ctx.c has been updated.
|
|
|
|
|
2023-05-05 21:26:39 +00:00
|
|
|
extract_disk: extract_disk_$(VERSION)
|
|
|
|
extract_disk_us: extract_disk_ps1us
|
|
|
|
extract_disk_hd: extract_disk_pspeu
|
|
|
|
extract_disk_psp%:
|
|
|
|
mkdir -p disks/psp$*
|
|
|
|
7z x disks/sotn.psp$*.iso -odisks/psp$*/
|
|
|
|
extract_disk_ps1%: $(SOTNDISK)
|
|
|
|
$(SOTNDISK) extract disks/sotn.$*.cue disks/$*
|
2023-05-25 18:29:10 +00:00
|
|
|
extract_disk_saturn:
|
|
|
|
bchunk disks/sotn.saturn.bin disks/sotn.saturn.cue disks/sotn.saturn.iso
|
2023-06-12 07:27:29 +00:00
|
|
|
7z x disks/sotn.saturn.iso01.iso -odisks/saturn/ || true
|
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-06-17 13:23:44 +00:00
|
|
|
update-dependencies: $(SPLAT_APP) $(ASMDIFFER_APP) $(M2CTX_APP) $(M2C_APP) $(MASPSX_APP) $(SATURN_SPLITTER_APP) $(GO)
|
|
|
|
cd $(SATURN_SPLITTER_DIR)/rust-dis && cargo build --release
|
|
|
|
cd $(SATURN_SPLITTER_DIR)/adpcm-extract && cargo build --release
|
2022-10-25 20:26:35 +00:00
|
|
|
pip3 install -r $(TOOLS_DIR)/requirements-python.txt
|
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
|
2023-06-17 11:29:42 +00:00
|
|
|
$(MASPSX_APP):
|
|
|
|
git submodule init $(MASPSX_DIR)
|
|
|
|
git submodule update $(MASPSX_DIR)
|
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-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
|
|
|
|
2023-05-25 18:29:10 +00:00
|
|
|
$(SATURN_SPLITTER_APP):
|
|
|
|
git submodule init $(SATURN_SPLITTER_DIR)
|
|
|
|
git submodule update $(SATURN_SPLITTER_DIR)
|
|
|
|
cd $(SATURN_SPLITTER_DIR)/rust-dis && cargo build --release
|
2023-06-16 18:39:45 +00:00
|
|
|
cd $(SATURN_SPLITTER_DIR)/adpcm-extract && cargo build --release
|
2023-05-25 18:29:10 +00:00
|
|
|
|
2022-01-01 17:45:41 +00:00
|
|
|
$(BUILD_DIR)/%.s.o: %.s
|
|
|
|
$(AS) $(AS_FLAGS) -o $@ $<
|
2023-06-17 11:29:42 +00:00
|
|
|
$(BUILD_DIR)/%.c.o: %.c $(MASPSX_APP) $(CC1PSX)
|
2023-06-16 18:51:16 +00:00
|
|
|
$(CPP) $(CPP_FLAGS) $< | $(CC) $(CC_FLAGS) | $(MASPSX) | $(AS) $(AS_FLAGS) -o $@
|
2022-01-01 17:45:41 +00:00
|
|
|
|
2023-06-12 07:27:29 +00:00
|
|
|
build_saturn_dosemu_docker_container:
|
2023-06-16 18:51:16 +00:00
|
|
|
docker build -t dosemu:latest -f tools/saturn_toolchain/dosemu_dockerfile .
|
2023-06-12 07:27:29 +00:00
|
|
|
|
|
|
|
build_saturn_binutils_docker_container:
|
|
|
|
docker build -t binutils-sh-elf:latest -f tools/saturn_toolchain/binutils_dockerfile .
|
|
|
|
|
|
|
|
build_saturn_toolchain_gccsh:
|
2023-06-03 18:09:44 +00:00
|
|
|
# get GCCSH
|
|
|
|
wget -nc https://github.com/sozud/saturn-compilers/archive/refs/heads/main.zip
|
|
|
|
unzip -n main.zip
|
|
|
|
rm -rf ./tools/saturn_toolchain/GCCSH
|
|
|
|
mv saturn-compilers-main/cygnus-2.7-96Q3-bin ./tools/saturn_toolchain/GCCSH
|
|
|
|
rm -rf main.zip
|
|
|
|
rm -rf saturn-compilers-main
|
|
|
|
|
2023-06-12 07:27:29 +00:00
|
|
|
# parallel OK
|
2023-06-19 19:10:09 +00:00
|
|
|
build_saturn_toolchain_docker: build_saturn_dosemu_docker_container build_saturn_binutils_docker_container build_saturn_toolchain_gccsh $(SATURN_SPLITTER_APP)
|
2023-06-12 07:27:29 +00:00
|
|
|
|
|
|
|
# CI prep, don't build dosemu container (parallel OK)
|
2023-06-19 19:10:09 +00:00
|
|
|
build_saturn_toolchain_native: extract_disk_saturn build_saturn_toolchain_gccsh $(SATURN_SPLITTER_APP)
|
2023-06-03 18:09:44 +00:00
|
|
|
|
|
|
|
SATURN_BUILD_DIR := build/saturn
|
|
|
|
# absolute path for docker mounts
|
2023-06-12 07:27:29 +00:00
|
|
|
SATURN_BUILD_ABS := $(shell pwd)/$(SATURN_BUILD_DIR)
|
2023-06-03 18:09:44 +00:00
|
|
|
SATURN_DISK_DIR := disks/saturn
|
|
|
|
# absolute path for docker mounts
|
2023-06-12 07:27:29 +00:00
|
|
|
SATURN_DISK_ABS := $(shell pwd)/$(SATURN_DISK_DIR)
|
2023-06-03 18:09:44 +00:00
|
|
|
|
2023-06-12 07:27:29 +00:00
|
|
|
build_saturn_copy_files:
|
2023-06-03 18:09:44 +00:00
|
|
|
# copy everything into same directory since dosemu is hard to use otherwise
|
|
|
|
rm -rf $(SATURN_BUILD_DIR)
|
|
|
|
mkdir -p $(SATURN_BUILD_DIR)
|
|
|
|
cp -r ./tools/saturn_toolchain/GCCSH/* $(SATURN_BUILD_DIR)
|
|
|
|
cp ./src/saturn/inc_asm.h $(SATURN_BUILD_DIR)
|
|
|
|
cp ./src/saturn/macro.inc $(SATURN_BUILD_DIR)
|
|
|
|
cp ./src/saturn/game.c $(SATURN_BUILD_DIR)
|
|
|
|
cp ./src/saturn/t_bat.c $(SATURN_BUILD_DIR)
|
|
|
|
cp ./src/saturn/zero.c $(SATURN_BUILD_DIR)
|
2023-06-06 22:28:19 +00:00
|
|
|
cp ./src/saturn/stage_02.c $(SATURN_BUILD_DIR)
|
2023-07-01 21:02:56 +00:00
|
|
|
cp ./src/saturn/stage_02.h $(SATURN_BUILD_DIR)
|
2023-06-06 22:28:19 +00:00
|
|
|
cp ./src/saturn/sattypes.h $(SATURN_BUILD_DIR)
|
2023-06-03 18:09:44 +00:00
|
|
|
mkdir -p $(SATURN_BUILD_DIR)/asm/saturn/
|
|
|
|
mkdir -p $(SATURN_BUILD_DIR)/asm/saturn/
|
|
|
|
cp -r ./asm/saturn/game $(SATURN_BUILD_DIR)/asm/saturn/game
|
|
|
|
cp -r ./asm/saturn/t_bat $(SATURN_BUILD_DIR)/asm/saturn/t_bat
|
|
|
|
cp -r ./asm/saturn/zero $(SATURN_BUILD_DIR)/asm/saturn/zero
|
2023-06-06 22:28:19 +00:00
|
|
|
cp -r ./asm/saturn/stage_02 $(SATURN_BUILD_DIR)/asm/saturn/stage_02
|
2023-06-03 18:09:44 +00:00
|
|
|
cp ./tools/saturn_toolchain/compile_dosemu.sh $(SATURN_BUILD_DIR)
|
|
|
|
chmod +x $(SATURN_BUILD_DIR)/compile_dosemu.sh
|
|
|
|
|
2023-06-12 07:27:29 +00:00
|
|
|
build_saturn_dosemu_native:
|
|
|
|
cd build/saturn && FILENAME=game sh ./compile_dosemu.sh
|
|
|
|
cd build/saturn && FILENAME=t_bat sh ./compile_dosemu.sh
|
|
|
|
cd build/saturn && FILENAME=zero sh ./compile_dosemu.sh
|
|
|
|
cd build/saturn && FILENAME=stage_02 sh ./compile_dosemu.sh
|
|
|
|
|
|
|
|
build_saturn_dosemu_docker:
|
2023-06-03 18:09:44 +00:00
|
|
|
docker run --rm -e FILENAME=game -v $(SATURN_BUILD_ABS):/build -w /build dosemu:latest /bin/bash -c "./compile_dosemu.sh"
|
|
|
|
docker run --rm -e FILENAME=t_bat -v $(SATURN_BUILD_ABS):/build -w /build dosemu:latest /bin/bash -c "./compile_dosemu.sh"
|
|
|
|
docker run --rm -e FILENAME=zero -v $(SATURN_BUILD_ABS):/build -w /build dosemu:latest /bin/bash -c "./compile_dosemu.sh"
|
2023-06-06 22:28:19 +00:00
|
|
|
docker run --rm -e FILENAME=stage_02 -v $(SATURN_BUILD_ABS):/build -w /build dosemu:latest /bin/bash -c "./compile_dosemu.sh"
|
2023-06-03 18:09:44 +00:00
|
|
|
|
2023-06-19 19:10:09 +00:00
|
|
|
build_saturn_link_docker_ld:
|
|
|
|
docker run --rm -v $(SATURN_BUILD_ABS):/build -w /build binutils-sh-elf:latest /bin/bash -c "sh-elf-ld -o zero_li.o -Map zero.map -T zero.ld -T all_syms.txt -verbose zero.o --no-check-sections -nostdlib -s"
|
|
|
|
docker run --rm -v $(SATURN_BUILD_ABS):/build -w /build binutils-sh-elf:latest /bin/bash -c "sh-elf-ld -o t_bat_li.o -Map t_bat.map -T t_bat.ld -T all_syms.txt -T t_bat_user_syms.txt -verbose t_bat.o --no-check-sections -nostdlib -s"
|
|
|
|
docker run --rm -v $(SATURN_BUILD_ABS):/build -w /build binutils-sh-elf:latest /bin/bash -c "sh-elf-ld -o game_li.o -Map game.map -T game.ld -T all_syms.txt -T game_user_syms.txt -verbose game.o --no-check-sections -nostdlib -s"
|
|
|
|
docker run --rm -v $(SATURN_BUILD_ABS):/build -w /build binutils-sh-elf:latest /bin/bash -c "sh-elf-ld -o stage_02_li.o -Map stage_02.map -T stage_02.ld -T all_syms.txt -T stage_02_user_syms.txt -verbose stage_02.o --no-check-sections -nostdlib -s"
|
|
|
|
|
|
|
|
build_saturn_link_native_ld:
|
|
|
|
cd build/saturn && sh-elf-ld -o zero_li.o -Map zero.map -T zero.ld -T all_syms.txt -verbose zero.o --no-check-sections -nostdlib -s
|
|
|
|
cd build/saturn && sh-elf-ld -o t_bat_li.o -Map t_bat.map -T t_bat.ld -T all_syms.txt -T t_bat_user_syms.txt -verbose t_bat.o --no-check-sections -nostdlib -s
|
|
|
|
cd build/saturn && sh-elf-ld -o game_li.o -Map game.map -T game.ld -T all_syms.txt -T game_user_syms.txt -verbose game.o --no-check-sections -nostdlib -s
|
|
|
|
cd build/saturn && sh-elf-ld -o stage_02_li.o -Map stage_02.map -T stage_02.ld -T all_syms.txt -T stage_02_user_syms.txt -verbose stage_02.o --no-check-sections -nostdlib -s
|
|
|
|
|
|
|
|
build_saturn_link_copy:
|
2023-06-03 18:09:44 +00:00
|
|
|
# link
|
|
|
|
cat ./config/saturn/game_syms.txt > ./build/saturn/all_syms.txt
|
|
|
|
cat ./config/saturn/t_bat_syms.txt >> ./build/saturn/all_syms.txt
|
|
|
|
cat ./config/saturn/zero_syms.txt >> ./build/saturn/all_syms.txt
|
|
|
|
cp ./config/saturn/t_bat_user_syms.txt ./build/saturn/
|
|
|
|
cp ./config/saturn/game_user_syms.txt ./build/saturn/
|
2023-06-06 22:28:19 +00:00
|
|
|
cp ./config/saturn/stage_02_user_syms.txt ./build/saturn/
|
2023-06-03 18:09:44 +00:00
|
|
|
|
|
|
|
cp ./config/saturn/*.ld ./build/saturn
|
2023-06-19 19:10:09 +00:00
|
|
|
|
|
|
|
build_saturn_link_docker: build_saturn_link_copy build_saturn_link_docker_ld
|
|
|
|
|
|
|
|
build_saturn_link_native: build_saturn_link_copy build_saturn_link_native_ld
|
2023-06-03 18:09:44 +00:00
|
|
|
|
2023-06-12 07:27:29 +00:00
|
|
|
# do not run in parallel
|
2023-06-19 19:10:09 +00:00
|
|
|
build_saturn_docker: build_saturn_copy_files build_saturn_dosemu_docker build_saturn_link_docker
|
2023-06-12 07:27:29 +00:00
|
|
|
|
|
|
|
# do not run in parallel
|
2023-06-19 19:10:09 +00:00
|
|
|
build_saturn_native: build_saturn_copy_files build_saturn_dosemu_native build_saturn_link_native
|
2023-06-12 07:27:29 +00:00
|
|
|
|
2023-06-19 19:10:09 +00:00
|
|
|
check_saturn_docker:
|
2023-06-03 18:09:44 +00:00
|
|
|
# dump binaries using sh binutils container
|
|
|
|
chmod +x tools/saturn_toolchain/strip.sh
|
|
|
|
cp tools/saturn_toolchain/strip.sh $(SATURN_BUILD_DIR)
|
|
|
|
docker run --rm -e INPUT_FILENAME=game_li.o -e OUTPUT_FILENAME=GAME.PRG -v $(SATURN_BUILD_ABS):/build -w /build binutils-sh-elf:latest /bin/bash -c ./strip.sh
|
|
|
|
docker run --rm -e INPUT_FILENAME=t_bat_li.o -e OUTPUT_FILENAME=T_BAT.PRG -v $(SATURN_BUILD_ABS):/build -w /build binutils-sh-elf:latest /bin/bash -c ./strip.sh
|
|
|
|
docker run --rm -e INPUT_FILENAME=zero_li.o -e OUTPUT_FILENAME=0.BIN -v $(SATURN_BUILD_ABS):/build -w /build binutils-sh-elf:latest /bin/bash -c ./strip.sh
|
2023-06-06 22:28:19 +00:00
|
|
|
docker run --rm -e INPUT_FILENAME=stage_02_li.o -e OUTPUT_FILENAME=STAGE_02.PRG -v $(SATURN_BUILD_ABS):/build -w /build binutils-sh-elf:latest /bin/bash -c ./strip.sh
|
2023-06-03 18:09:44 +00:00
|
|
|
# check hashes
|
|
|
|
sha1sum --check config/saturn/check.saturn.sha
|
|
|
|
|
2023-06-19 19:10:09 +00:00
|
|
|
check_saturn_native:
|
|
|
|
# dump binaries using sh binutils container
|
|
|
|
sh-elf-objcopy ./build/saturn/game_li.o -O binary ./build/saturn/GAME.PRG
|
|
|
|
sh-elf-objcopy ./build/saturn/t_bat_li.o -O binary ./build/saturn/T_BAT.PRG
|
|
|
|
sh-elf-objcopy ./build/saturn/zero_li.o -O binary ./build/saturn/0.BIN
|
|
|
|
sh-elf-objcopy ./build/saturn/stage_02_li.o -O binary ./build/saturn/STAGE_02.PRG
|
|
|
|
# check hashes
|
|
|
|
sha1sum --check config/saturn/check.saturn.sha
|
|
|
|
|
|
|
|
diff_saturn_docker:
|
2023-06-03 18:09:44 +00:00
|
|
|
chmod +x tools/saturn_toolchain/diff.sh
|
|
|
|
cp tools/saturn_toolchain/diff.sh $(SATURN_BUILD_DIR)
|
|
|
|
docker run --rm -e FILENAME=$(FILENAME) -v $(SATURN_DISK_ABS):/theirs -v $(SATURN_BUILD_ABS):/build -w /build binutils-sh-elf:latest /bin/bash -c ./diff.sh
|
|
|
|
|
2023-06-19 19:10:09 +00:00
|
|
|
diff_saturn_native:
|
|
|
|
sh-elf-objdump -z -m sh2 -b binary -D ./build/saturn/$(FILENAME) > ./build/saturn/$(FILENAME)-ours.txt && \
|
|
|
|
sh-elf-objdump -z -m sh2 -b binary -D ./disks/saturn/$(FILENAME) > ./build/saturn/$(FILENAME)-theirs.txt && \
|
|
|
|
diff ./build/saturn/$(FILENAME)-ours.txt ./build/saturn/$(FILENAME)-theirs.txt > ./build/saturn/$(FILENAME)-diff.txt || true
|
|
|
|
|
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
|
Accessories extracted and building (#264)
Like Equipment, this will take the accessories, extract to a json in the
assets directory, and then when building the game, read items from that
json. Full list of changes required for this capability, and their
reasons/purposes:
Addition of entry in the makefile for the accessory json. This is
literally just the equipment one copied and the name changed.
Adjustment of splat extraction. Accessory data runs all the way up until
a bunch of strings which are now in 8258.data.s. Previously, the file
8000.data.s was created, and was just a whole bunch of uninterpreted
.word values. The accessory table runs all the way up to 0x8258.
Happily, this means there is no longer any gap between understood and
non-understood data in this region of the ROM.
Accessory.py is extremely similar to the existing Equipment.py. As
stated in the large comment at the top of this script, it would be neat
if we could combine the two scripts to one script that would process all
equippables in the game. For now, this is functional. Tidying this up
could be a nice future task, especially for someone new to the project
who is more comfortable with Python than C.
Finally, the dictionary of punctuation in the utils.py has been
expanded. The question mark shows up in the description of the Alucart
Mail "Resists fire, lightning, ice?", while the plus signs show up in
many items which provide stat bonuses that have descriptions like
"DEF+15". These symbols were previously unknown.
Feels very nice to now have equipment and accessories both extracting to
human-editable forms!
2023-06-19 18:12:20 +00:00
|
|
|
$(BUILD_DIR)/$(ASSETS_DIR)/%.accessory.json.o: $(ASSETS_DIR)/%.accessory.json
|
|
|
|
./tools/splat_ext/accessory.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
|