Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Splat (Tracking) #59

Open
wants to merge 78 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
59fb647
work on ovl1_10
farisawan2000 May 16, 2024
7fabebd
add splat, remove asm nonmatchings, start yaml description
farisawan2000 May 17, 2024
408e202
gitignore
farisawan2000 May 18, 2024
5d67703
commit the breaking change so i can show my branch
farisawan2000 May 19, 2024
8a9014b
gitignore
farisawan2000 May 19, 2024
82d88a6
build system works until link errors
farisawan2000 May 19, 2024
79b6d6e
match up to assets segment; tool refactoring
farisawan2000 May 19, 2024
1feba07
split sound
farisawan2000 May 20, 2024
81eaefc
OK
farisawan2000 May 20, 2024
ffe8be6
first CI test
farisawan2000 May 20, 2024
c3ee803
test PR
farisawan2000 May 20, 2024
47ec59b
More work on splits
farisawan2000 May 20, 2024
6f7fa43
update symbol_addrs to not have local libultra syms
farisawan2000 May 21, 2024
9af8e8b
merge master
farisawan2000 May 21, 2024
4ef1114
re-split test
farisawan2000 May 21, 2024
853ca9f
current splat changes
farisawan2000 Jul 30, 2024
4222a2c
wrap my head around exclusive_ram_id and resolve so many symbols (dow…
farisawan2000 Oct 26, 2024
fa01121
add latest build stuff
farisawan2000 Oct 26, 2024
6da1a1c
when you require a file remember to add it to the repo
farisawan2000 Oct 26, 2024
2f47c21
PR's now build serially
someone2639 Oct 26, 2024
a98973a
test this PR
farisawan2000 Oct 26, 2024
f8e148a
test this change
farisawan2000 Oct 26, 2024
f5d4d5a
test migration
farisawan2000 Oct 27, 2024
226a715
Don't dirty up the armips and f3dex2 dirs
farisawan2000 Oct 30, 2024
c040c46
point f3dex2 at the correct new armips
farisawan2000 Oct 30, 2024
3881de2
Merge branch 'master' into splat
farisawan-2000 Oct 30, 2024
9bb10a5
prepare potential splat extensions
farisawan2000 Oct 30, 2024
8eebf63
Migrate old asset build system; clean some makefile cruft;
farisawan2000 Oct 31, 2024
91ea394
Regen src
farisawan2000 Oct 31, 2024
c6a5e32
merge upstream
farisawan2000 Oct 31, 2024
f30996a
make clean works again
farisawan2000 Oct 31, 2024
cef7b22
cleanup more makefile cruft
farisawan2000 Oct 31, 2024
9bc303d
Some name migrations; src migration test works
farisawan2000 Oct 31, 2024
af08753
Verbose works on makefile now; some more code and build system renamings
farisawan2000 Oct 31, 2024
864c0ea
test CI
farisawan2000 Oct 31, 2024
b3cf54d
update splat; split ovl19 basically completely
farisawan2000 Nov 1, 2024
4c0d156
helplib migrated
farisawan2000 Nov 1, 2024
0e520f7
helper.c
farisawan2000 Nov 2, 2024
3cf11f6
dupe header
farisawan2000 Nov 2, 2024
d36efe1
More helper.cc; overdue header splitting; struct consolidation?
farisawan2000 Nov 2, 2024
63aaf19
the rest of helper.cc that im willing to do tonight
farisawan2000 Nov 2, 2024
8148ad1
helpeff migrated; need a better way to represent empty files
farisawan2000 Nov 2, 2024
40b3878
ovl1 rodata and text split
farisawan2000 Nov 3, 2024
5743b3a
split ovl2 and ovl3
farisawan2000 Nov 4, 2024
eb23914
split ovl4
farisawan2000 Nov 4, 2024
5115a90
ovl5 split
farisawan2000 Nov 4, 2024
8b1c5a6
ovl6 rodata
farisawan2000 Nov 4, 2024
2f63924
ovl7 split (minus one file)
farisawan2000 Nov 4, 2024
fad6fc5
split ovl8
farisawan2000 Nov 4, 2024
2c06e5c
update asm-processor; set untouched overlays back to asm because they…
farisawan2000 Nov 4, 2024
385cf61
libultra migration start
farisawan2000 Nov 5, 2024
914236a
more libultra migration
farisawan2000 Nov 5, 2024
b58e35e
libultra version bump
farisawan2000 Nov 5, 2024
7cdabe4
main is asm, pfs matching
farisawan2000 Nov 5, 2024
99e225f
xprintf
farisawan2000 Nov 5, 2024
af16e31
setintmask, sin/cos
farisawan2000 Nov 5, 2024
724836d
libultra checkpoint
farisawan2000 Nov 5, 2024
2f97f4c
motor and leointerrupt
farisawan2000 Nov 5, 2024
0eef32c
seteventmesg, quick build script; test CI
farisawan2000 Nov 5, 2024
a660a1e
libreultra update
farisawan2000 Nov 5, 2024
82ef80e
all libultra files (minus one unknown func)
farisawan2000 Nov 5, 2024
02b9768
delete extraneous mainseg src files
farisawan2000 Nov 5, 2024
ef0df0b
unsplit some meme audio files in mainseg, some more naming
farisawan2000 Nov 6, 2024
a90c0a7
start decomping audio.c
farisawan2000 Nov 9, 2024
9a87499
update ctx program; more syms; put up some decomp.me links
farisawan2000 Nov 10, 2024
892961a
migrate lbvector
farisawan2000 Nov 10, 2024
da15214
migrate main
farisawan2000 Nov 10, 2024
7ca7d29
migrate math
farisawan2000 Nov 10, 2024
d5ead24
resplit om, migrate ml
farisawan2000 Nov 10, 2024
2ef7047
a file split in om
farisawan2000 Nov 10, 2024
326eed8
om merge checkpoint plus some docs from pokemon snap
farisawan2000 Nov 10, 2024
c79346e
split ovl5 to get some more headers
farisawan2000 Nov 11, 2024
550f8a2
contpad and ovl1_1 splitting
farisawan2000 Nov 11, 2024
5b054ca
contpad func_80004E98 matched through decomp.me
farisawan2000 Nov 11, 2024
b1ee8c0
cleanup
farisawan2000 Nov 11, 2024
957683c
ovl5_11 (sound test) decomp
farisawan2000 Nov 13, 2024
90a5507
update readme
farisawan2000 Dec 22, 2024
8dd0473
update makefiles to pick a complete toolchain; remove qemu-irix depen…
farisawan2000 Dec 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
../*

# NEW Splat Things
asm/*
undefined_syms_auto.txt
undefined_funcs_auto.txt
kirby.ld
assets/boot.bin

**/**/*.bin
build/*
tools/GeoFromBin*
tools/level_settings/convert
tools/img_getprop
tools/rgb2c
tools/armips_bin/*
assets/*.bin
assets/**/*.png
assets/tools/__pycache__/*
tools/splat_ext/__pycache__/*
f3dex2/F3DEX2_2.04H/*
*.z64
textures/*
Expand Down
7 changes: 7 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
[submodule "tools/rgb2c"]
path = tools/modern_rgb2c
url = https://github.com/someone2639/modern_rgb2c
[submodule "splat"]
path = splat
url = https://github.com/ethteck/splat/
[submodule "tools/armips"]
path = tools/armips
url = https://github.com/Kingcom/armips

[submodule "tools/asm-processor"]
path = tools/asm-processor
url = https://github.com/simonlindholm/asm-processor
171 changes: 64 additions & 107 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,51 +1,41 @@
# Makefile to rebuild Kirby 64 split image
# New Makefile

################ Target Executable and Sources ###############

# BUILD_DIR is location where all build artifacts are placed
BUILD_DIR_BASE = build
BUILD_DIR = build
VERSION = us
BUILD_DIR = $(BUILD_DIR_BASE)/$(VERSION)

GRUCODE := F3DEX2_2.04H
LOCAL_ARMIPS=tools/armips/build/armips
LOCAL_ARMIPS=tools/armips_bin/armips

VERBOSE := 1

# check that either QEMU_IRIX is set or qemu-irix package installed
ifndef QEMU_IRIX
QEMU_IRIX := $(shell which qemu-irix)
ifeq (, $(QEMU_IRIX))
$(error Please install qemu-irix package or set QEMU_IRIX env var to the full qemu-irix binary path)
endif
endif
GAME_ASSETS := $(BUILD_DIR)/assets/game_assets.o

V := @
ifeq (VERBOSE, 1)
V=
endif

##################### Compiler Options #######################
# IRIX_ROOT := tools/ido5.3_compiler
IRIX_ROOT := tools/ido7.1
# CC := $(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/bin/cc
CC := tools/ido-7.1recomp/cc


ifeq ($(shell type mips-linux-gnu-ld >/dev/null 2>/dev/null; echo $$?), 0)
CROSS := mips-linux-gnu-
else ifeq ($(shell type mips64-linux-gnu-ld >/dev/null 2>/dev/null; echo $$?), 0)
CROSS := mips64-linux-gnu-
else ifeq ($(shell type mips-n64-ld >/dev/null 2>/dev/null; echo $$?), 0)
CROSS := mips-n64-
ifeq ($(shell type mips-linux-gnu-cpp >/dev/null 2>/dev/null; echo $$?), 0)
CROSS := mips-linux-gnu-
else ifeq ($(shell type mips64-linux-gnu-cpp >/dev/null 2>/dev/null; echo $$?), 0)
CROSS := mips64-linux-gnu-
else ifeq ($(shell type mips-n64-cpp >/dev/null 2>/dev/null; echo $$?), 0)
CROSS := mips-n64-
else
CROSS := mips64-elf-
CROSS := mips64-elf-
endif

GCC := $(CROSS)gcc

AS = $(CROSS)as
# CC = $(CROSS)gcc
CPP := $(CROSS)cpp -P -Wno-trigraphs
LD = $(CROSS)ld
OBJDUMP = $(CROSS)objdump
Expand All @@ -54,14 +44,15 @@ PYTHON := python3

TEXTURES_DIR := textures

# UNNAMED_SYMS := -T unnamed_syms.txt

INCLUDE_FLAGS := -I$(BUILD_DIR)
INCLUDE_FLAGS := -I$(BUILD_DIR) -Iinclude
ASFLAGS = -mtune=vr4300 -march=vr4300 --no-pad-sections -mabi=32 -mips3 $(INCLUDE_FLAGS)
# CFLAGS = -Wall -O2 -mtune=vr4300 -march=vr4300 -G 0 -c -Wab,-r4300_mul
LDFLAGS = --no-check-sections -mips3 --accept-unknown-input-arch \
-T $(BUILD_DIR)/$(LD_SCRIPT) -T libultra_unused.txt $(UNNAMED_SYMS) -T undefined_syms.txt -T rcp_syms.txt \
-Map $(BUILD_DIR)/$(TARGET).map
-T libultra_unused.txt $(UNNAMED_SYMS) -T rcp_syms.txt \
-Map $(BUILD_DIR)/$(TARGET).map \
-T funcstodo.txt \
-T datatodo.txt \
-T ramvals.txt \
-T $(BUILD_DIR)/$(LD_SCRIPT)
PRELIM_OBJCOPY_FLAGS = --pad-to=0x101000 --gap-fill=0x00
OBJCOPY_FLAGS = --pad-to=0x2000000 --gap-fill=0xFF

Expand All @@ -71,22 +62,16 @@ OBJCOPY_FLAGS = --pad-to=0x2000000 --gap-fill=0xFF
TOOLS_DIR = tools
N64CRC = tools/n64crc
N64GRAPHICS = $(TOOLS_DIR)/n64graphics
EMULATOR = ~/Downloads/mupen64plus/mupen64plus-gui
EMU_FLAGS = # --noosd --gfx mupen64plus-video-glide64mk2
LOADER = loader64
LOADER_FLAGS = -vwf
FixPath = $(subst /,/,$1)

ASSET_DIRS := $(wildcard assets/geo/bank_0/**) \
$(wildcard assets/geo/bank_1/**) \
$(wildcard assets/geo/bank_2/**) \
$(wildcard assets/geo/bank_7/**) \
$(wildcard assets/geo/bank_3/**)

ASM_DIRS := asm data $(wildcard asm/ovl*) asm/ovl0/lib \
asm/data asm/banks $(wildcard data/ovl*)
ASM_DIRS := asm asm/data asm/data/main $(wildcard asm/data/ovl*) asm/main $(wildcard asm/*)

SRC_DIRS := src $(wildcard src/ovl*) data $(wildcard data/ovl*)
SRC_DIRS := src src/main src/os $(wildcard src/ovl*)

BIN_DIRS := bin/geo bin/image bin/misc bin/anim

Expand All @@ -102,13 +87,13 @@ TEXTURES_DIR = textures

MIPSISET := -mips2 -32

GLOBAL_ASM_C_FILES != grep -rl 'GLOBAL_ASM(' $(wildcard src/*/*.c)
GLOBAL_ASM_O_FILES = $(foreach file,$(GLOBAL_ASM_C_FILES),$(BUILD_DIR)/$(file:.c=.o))

S_FILES := $(foreach dir,$(ASM_DIRS),$(wildcard $(dir)/*.s))
# S_FILES += $(LEVEL_S_FILES)
C_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c))

GLOBAL_ASM_C_FILES != grep -rl 'GLOBAL_ASM(' $(C_FILES)
GLOBAL_ASM_O_FILES = $(foreach file,$(GLOBAL_ASM_C_FILES),$(BUILD_DIR)/$(file:.c=.o))

MODEL_FILES := $(foreach dir,$(ASSET_DIRS),$(wildcard $(dir)/geo.bin))
MODEL_C_FILES := $(foreach file,$(MODEL_FILES),$(file:.bin=.c))

Expand All @@ -125,9 +110,15 @@ UCODE_DATA_O_FILES := $(addprefix $(BUILD_DIR)/,$(UCODE_DATA_FILES:.data=.data.o

BUILD_ASM_DIRS := $(foreach dir,$(ASM_DIRS),$(wildcard $(dir)/**/))

SOUND_BINS := $(wildcard assets/sound/*.bin)
MISC_SPLAT_BINS := $(wildcard assets/*.bin)
# Object files
O_FILES := $(foreach file,$(C_FILES),$(BUILD_DIR)/$(file:.c=.o)) \
$(foreach file,$(S_FILES),$(BUILD_DIR)/$(file:.s=.o))
$(foreach file,$(S_FILES),$(BUILD_DIR)/$(file:.s=.o)) \
$(BUILD_DIR)/assets/boot.o \
$(foreach file,$(SOUND_BINS),$(BUILD_DIR)/$(file:.bin=.o)) \
$(foreach file,$(MISC_SPLAT_BINS),$(BUILD_DIR)/$(file:.bin=.o))


ASSET_O_FILES := $(foreach file,$(MODEL_C_FILES),$(BUILD_DIR)/$(file:.c=.o))

Expand All @@ -138,12 +129,13 @@ ACTOR_FILES := $(foreach file,$(DATA_FILES),$(BUILD_DIR)/$(file:.c=.o))

# FLAGS
OPT_FLAGS := -O2
INCLUDE_CFLAGS := -I include -I $(BUILD_DIR) -I $(BUILD_DIR)/include -I $(BUILD_DIR)/assets -I src -I .
DEFS := -D_LANGUAGE_C -D_FINALROM
INCLUDE_CFLAGS := -I include -Ilibreultra/include/2.0I -I $(BUILD_DIR) -I $(BUILD_DIR)/include -I $(BUILD_DIR)/assets -I src -Isrc.old -I .
TARGET_CFLAGS := -nostdinc -I include/libc -DTARGET_N64 -DF3DEX_GBI_2
CFLAGS = -Wab,-r4300_mul -non_shared -G0 -Xcpluscomm -Xfullwarn -signed $(OPT_FLAGS) $(TARGET_CFLAGS) $(INCLUDE_CFLAGS) $(MIPSISET)
GCC_CFLAGS = -Wall $(TARGET_CFLAGS) $(INCLUDE_CFLAGS) -march=vr4300 -mtune=vr4300 -mfix4300 -mabi=32 -mno-shared -G 0 -fno-PIC -mno-abicalls -fno-zero-initialized-in-bss -fno-toplevel-reorder -Wno-missing-braces
CFLAGS = -Wab,-r4300_mul -non_shared -G0 -Xcpluscomm -Xfullwarn -signed $(DEFS) $(OPT_FLAGS) $(TARGET_CFLAGS) $(INCLUDE_CFLAGS) $(MIPSISET)
GCC_CFLAGS = -Wall $(DEFS) $(TARGET_CFLAGS) $(INCLUDE_CFLAGS) -march=vr4300 -mtune=vr4300 -mfix4300 -mabi=32 -mno-shared -G 0 -fno-PIC -mno-abicalls -fno-zero-initialized-in-bss -fno-toplevel-reorder -Wno-missing-braces

CC_CHECK := gcc -fsyntax-only -fsigned-char -m32 $(CC_CFLAGS) $(TARGET_CFLAGS) $(INCLUDE_CFLAGS) -std=gnu90 -Wall -Wextra -Wno-format-security -Wno-main -DNON_MATCHING -DAVOID_UB $(VERSION_CFLAGS) $(GRUCODE_CFLAGS)
CC_CHECK := gcc -fsyntax-only -fsigned-char -m32 $(DEFS) $(TARGET_CFLAGS) $(INCLUDE_CFLAGS) -std=gnu90 -Wall -Wextra -Wno-format-security -Wno-main -DNON_MATCHING -DAVOID_UB $(VERSION_CFLAGS) $(GRUCODE_CFLAGS)

CC_TEST := gcc -Wall

Expand All @@ -153,7 +145,7 @@ CC_TEST := gcc -Wall
NOEXTRACT ?= 0


ALL_DIRS = $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(LEVEL_DIRS) $(ASSET_DIRS) $(SRC_DIRS) $(INCLUDE_DIRS) $(ASM_DIRS) $(TEXTURES_DIR)/raw $(TEXTURES_DIR)/standalone $(UCODE_DIRS))
ALL_DIRS = $(BUILD_DIR) $(addprefix $(BUILD_DIR)/, assets/sound $(LEVEL_DIRS) $(ASSET_DIRS) $(SRC_DIRS) $(INCLUDE_DIRS) $(ASM_DIRS) $(TEXTURES_DIR)/raw $(TEXTURES_DIR)/standalone $(UCODE_DIRS))
DUMMY != mkdir -p $(ALL_DIRS)

# Checking if submodules exist
Expand All @@ -169,22 +161,14 @@ endif


# hardcoded compiler for ml.c until i figure out why it's breaking recomp
$(BUILD_DIR)/src/ovl0/memory_layer.o: CC = $(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/bin/cc
# $(BUILD_DIR)/src/ovl0/memory_layer.o: CC = $(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/bin/cc

default: all

TARGET = kirby.us
LD_SCRIPT = $(TARGET).ld
# TEXTURE_DIR = textures
# RAW_TEXTURE_FILES := $(addprefix $(BUILD_DIR)/,$(patsubst %.png,%,$(wildcard $(TEXTURES_DIR)/raw/*.png)))
LD_SCRIPT = kirby.ld

$(BUILD_DIR)/data/kirby.066630.o: $(BUILD_DIR)/assets/assets.marker

libreultra/build/2.0I/libultra_rom.a:
$(MAKE) -C libreultra -j4

libreultra/build/2.0I/libn_audio.a:
$(MAKE) -C libreultra naudio -j4
$(BUILD_DIR)/data/kirby.066630.o: $(GAME_ASSETS)

all: $(BUILD_DIR)/$(TARGET).z64
@sha1sum -c $(TARGET).sha1
Expand All @@ -209,58 +193,43 @@ softclean:
rm -rf build/us/src/
rm -rf build/us/asm/

# $(BUILD_DIR)/src/ovl0/ovl0_8.o: OPT_FLAGS += -framepointer
$(BUILD_DIR)/src/ovl7/yakulib.o: OPT_FLAGS = -O2 -Olimit 1000
$(BUILD_DIR)/src/ovl1/ovl1_5.o: OPT_FLAGS = -O2
$(BUILD_DIR)/src/ovl3/ovl3_1.o: OPT_FLAGS = -O2 -Wo,-loopunroll
# $(BUILD_DIR)/src/ovl7/yakulib.o: CC = $(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/bin/cc

# $(BUILD_DIR)/src/ovl1/save_file.o: OPT_FLAGS += -Wo,-loopunroll,0


$(BUILD_DIR):
mkdir $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(SRC_DIRS) $(ASM_DIRS))

# assets/misc/%.s: assets/misc/%.bin
# python3 tools/level_settings/helper.py $<

$(BUILD_DIR)/libultra.a: libreultra/build/2.0I/libultra_rom.a
cp $< $@
$(BUILD_DIR)/libultra_rom.a:
$(MAKE) -C libreultra BUILD_DIR=../$(BUILD_DIR) VERSION=
$(TOOLS_DIR)/patch_libultra_math $@

$(BUILD_DIR)/libn_audio.a: libreultra/build/2.0I/libn_audio.a
cp $< $@
$(BUILD_DIR)/libn_audio.a:
$(MAKE) -C libreultra naudio BUILD_DIR=../$(BUILD_DIR) VERSION=
$(TOOLS_DIR)/patch_libultra_math $@

$(BUILD_DIR)/$(UCODE_BASE_DIR)/$(GRUCODE)/$(GRUCODE).%.o: f3dex2/$(GRUCODE)/$(GRUCODE).%
$(BUILD_DIR)/$(UCODE_BASE_DIR)/$(GRUCODE)/$(GRUCODE).%.o: $(BUILD_DIR)/$(GRUCODE)/$(GRUCODE).%
$(OBJCOPY) -I binary -O elf32-big $< $@

$(BUILD_DIR)/%.o: %.bin
@printf " [BIN] $<\n"
$(V)$(LD) -r -b binary -o $@ $<

$(BUILD_DIR)/%.o: %.s
$(CPP) $(GCC_CFLAGS) -o $(@:.o=.i) $<
$(AS) $(ASFLAGS) -o $@ $(@:.o=.i)
@printf " [ASM] $<\n"
$(V)$(CPP) $(GCC_CFLAGS) -o $(@:.o=.i) $<
$(V)$(AS) $(ASFLAGS) -o $@ $(@:.o=.i)

$(BUILD_DIR)/%.o: %.c
@$(CC_CHECK) -MMD -MP -MT $@ -MF $(BUILD_DIR)/$*.d $<
$(CC) -c $(CFLAGS) -o $@ $<
@printf " [CC] $<\n"
$(V)$(CC_CHECK) -Wno-unknown-pragmas -MMD -MP -MT $@ -MF $(BUILD_DIR)/$*.d $<
$(V)$(CC) -c $(CFLAGS) -o $@ $<

$(BUILD_DIR)/data/%.o: data/%.c
# $(CC_TEST) -c $(INCLUDE_CFLAGS) -o $@ $<
$(GCC) -c $(GCC_CFLAGS) -D__sgi -o $@ $<

# assets/geo/%.c: assets/geo/%.bin
# python3 tools/decompile_geos.py $<

# $(BUILD_DIR)/assets/geo/%.o: assets/geo/%.c
# $(GCC) -c $(GCC_CFLAGS) -D__sgi -o $@ $<

# $(BUILD_DIR)/assets/geo/%.o: assets/geo/%.s
# $(AS) -c $(ASFLAGS) -o $@ $<

$(BUILD_DIR)/assets/assets.marker:
$(GAME_ASSETS): assets/assets.ld
$(MAKE) -C assets

# $(BUILD_DIR)/assets/misc/%.o: assets/misc/%.s
# $(AS) $(ASFLAGS) -o $@ $<
# TODO: make this a real dependency
DUMMY != $(MAKE) -C f3dex2 $(GRUCODE) PARENT_OUTPUT_DIR=../$(BUILD_DIR)/ ARMIPS=../$(LOCAL_ARMIPS)

$(BUILD_DIR)/%.o: $(BUILD_DIR)/%.c
@$(CC_CHECK) -MMD -MP -MT $@ -MF $(BUILD_DIR)/$*.d $<
Expand All @@ -269,12 +238,12 @@ $(BUILD_DIR)/%.o: $(BUILD_DIR)/%.c
$(BUILD_DIR)/$(UCODE_BASE_DIR)/%.o : $(UCODE_BASE_DIR)/%
$(OBJCOPY) -I binary -O elf32-big $< $@

$(BUILD_DIR)/$(LD_SCRIPT): $(LD_SCRIPT) $(UCODE_LD) rcp_syms.txt undefined_syms.txt unnamed_syms.txt $(BUILD_DIR)/assets/assets.marker
$(BUILD_DIR)/$(LD_SCRIPT): $(LD_SCRIPT) $(UCODE_LD) rcp_syms.txt undefined_syms.txt unnamed_syms.txt $(GAME_ASSETS)
$(CPP) $(VERSION_CFLAGS) $(INCLUDE_CFLAGS) -MMD -MP -MT $@ -MF [email protected] -o $@ $< \
-DBUILD_DIR=$(BUILD_DIR) -Umips

$(BUILD_DIR)/$(TARGET).elf: $(O_FILES) $(BUILD_DIR)/$(LD_SCRIPT) $(BUILD_DIR)/libultra.a $(BUILD_DIR)/libn_audio.a $(UCODE_TEXT_O_FILES) $(UCODE_DATA_O_FILES)
$(V)$(LD) -L $(BUILD_DIR) $(LDFLAGS) -o $@ $(LIBS) -lultra -ln_audio
$(BUILD_DIR)/$(TARGET).elf: $(GAME_ASSETS) $(O_FILES) $(BUILD_DIR)/$(LD_SCRIPT) $(BUILD_DIR)/libultra_rom.a $(BUILD_DIR)/libn_audio.a $(UCODE_TEXT_O_FILES) $(UCODE_DATA_O_FILES)
$(V)$(LD) -L $(BUILD_DIR) $(LDFLAGS) -o $@ $(LIBS) -ln_audio -lultra_rom

# final z64 updates checksum
$(BUILD_DIR)/$(TARGET).z64: $(BUILD_DIR)/$(TARGET).elf
Expand All @@ -287,24 +256,12 @@ $(BUILD_DIR)/$(TARGET).z64: $(BUILD_DIR)/$(TARGET).elf

$(GLOBAL_ASM_O_FILES): CC := $(PYTHON) tools/asm-processor/build.py $(CC) -- $(AS) $(ASFLAGS) --

test: $(BUILD_DIR)/$(TARGET).z64
$(EMULATOR) $(EMU_FLAGS) $<

test2: $(BUILD_DIR)/$(TARGET).z64
flatpak run --file-forwarding io.github.m64p.m64p @@ $< @@

test-pj64: $(BUILD_DIR)/$(TARGET).z64
wine ~/Desktop/new64/Project64.exe $<

load: $(BUILD_DIR)/$(TARGET).z64
$(LOADER) $(LOADER_FLAGS) $<

setup:
$(MAKE) -C libreultra -j4
$(MAKE) -C libreultra naudio -j4
$(MAKE) -C tools -j4
$(MAKE) -C f3dex2 $(GRUCODE) PARENT_OUTPUT_DIR=../f3dex2/ ARMIPS=../$(LOCAL_ARMIPS)
$(MAKE) -C libreultra BUILD_DIR=../$(BUILD_DIR) VERSION=
$(MAKE) -C libreultra naudio BUILD_DIR=../$(BUILD_DIR) VERSION=
$(MAKE) -C tools
tools/extract_assets baserom.$(VERSION).z64
./splat/split.py kirby64.yaml

.PHONY: all clean default diff test distclean

Expand Down
Loading
Loading