-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add splat, remove asm nonmatchings, start yaml description
symbol_addrs done; split works up to ovl3 splitting works; git repo cleanup backup current source and asm folders Move makefile too we're rewriting that new makefile, labeled yaml
- Loading branch information
1 parent
59fb647
commit 7fabebd
Showing
9,382 changed files
with
789,148 additions
and
236,876 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,316 @@ | ||
# Makefile to rebuild Kirby 64 split image | ||
|
||
################ Target Executable and Sources ############### | ||
|
||
# BUILD_DIR is location where all build artifacts are placed | ||
BUILD_DIR_BASE = build | ||
VERSION = us | ||
BUILD_DIR = $(BUILD_DIR_BASE)/$(VERSION) | ||
|
||
GRUCODE := F3DEX2_2.04H | ||
|
||
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 | ||
|
||
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- | ||
else | ||
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 | ||
OBJCOPY = $(CROSS)objcopy | ||
PYTHON := python3 | ||
|
||
TEXTURES_DIR := textures | ||
|
||
# UNNAMED_SYMS := -T unnamed_syms.txt | ||
|
||
INCLUDE_FLAGS := -I$(BUILD_DIR) | ||
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 | ||
PRELIM_OBJCOPY_FLAGS = --pad-to=0x101000 --gap-fill=0x00 | ||
OBJCOPY_FLAGS = --pad-to=0x2000000 --gap-fill=0xFF | ||
|
||
####################### Other Tools ######################### | ||
|
||
# N64 tools | ||
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*) | ||
|
||
SRC_DIRS := src $(wildcard src/ovl*) data $(wildcard data/ovl*) | ||
|
||
BIN_DIRS := bin/geo bin/image bin/misc bin/anim | ||
|
||
DATA_DIRS := actors | ||
DATA_FILES := $(foreach dir,$(DATA_DIRS),$(wildcard $(dir)/*.c)) | ||
|
||
LEVEL_DIRS = $(wildcard assets/misc/bank_7/*) | ||
LEVEL_FILES = $(foreach dir, $(LEVEL_DIRS), $(wildcard $(dir)/level.bin)) | ||
LEVEL_S_FILES = $(foreach file, $(LEVEL_FILES), $(file:.bin=.s)) | ||
LEVEL_O_FILES = $(foreach file, $(LEVEL_S_FILES), $(BUILD_DIR)/$(file:.s=.o)) | ||
|
||
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)) | ||
|
||
MODEL_FILES := $(foreach dir,$(ASSET_DIRS),$(wildcard $(dir)/geo.bin)) | ||
MODEL_C_FILES := $(foreach file,$(MODEL_FILES),$(file:.bin=.c)) | ||
|
||
|
||
UCODE_BASE_DIR := ucode | ||
UCODES := L3DEX2_2.04H S2DEX2_2.04 | ||
|
||
UCODE_DIRS := $(foreach ucode,$(UCODES) $(GRUCODE),$(UCODE_BASE_DIR)/$(ucode)) | ||
UCODE_TEXT_FILES := $(foreach ucode,$(UCODES),$(UCODE_BASE_DIR)/$(ucode)/$(ucode).code) | ||
UCODE_DATA_FILES := $(foreach ucode,$(UCODES),$(UCODE_BASE_DIR)/$(ucode)/$(ucode).data) | ||
|
||
UCODE_TEXT_O_FILES := $(addprefix $(BUILD_DIR)/,$(UCODE_TEXT_FILES:.code=.code.o)) $(BUILD_DIR)/$(UCODE_BASE_DIR)/$(GRUCODE)/$(GRUCODE).code.o | ||
UCODE_DATA_O_FILES := $(addprefix $(BUILD_DIR)/,$(UCODE_DATA_FILES:.data=.data.o)) $(BUILD_DIR)/$(UCODE_BASE_DIR)/$(GRUCODE)/$(GRUCODE).data.o | ||
|
||
BUILD_ASM_DIRS := $(foreach dir,$(ASM_DIRS),$(wildcard $(dir)/**/)) | ||
|
||
# Object files | ||
O_FILES := $(foreach file,$(C_FILES),$(BUILD_DIR)/$(file:.c=.o)) \ | ||
$(foreach file,$(S_FILES),$(BUILD_DIR)/$(file:.s=.o)) | ||
|
||
ASSET_O_FILES := $(foreach file,$(MODEL_C_FILES),$(BUILD_DIR)/$(file:.c=.o)) | ||
|
||
D_FILES := $(O_FILES:.o=.d) | ||
|
||
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 . | ||
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 | ||
|
||
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_TEST := gcc -Wall | ||
|
||
|
||
######################## Targets ############################# | ||
|
||
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)) | ||
DUMMY != mkdir -p $(ALL_DIRS) | ||
|
||
# Checking if submodules exist | ||
DUMMY != ls libreultra >/dev/null || echo FAIL | ||
ifeq ($(DUMMY),FAIL) | ||
$(error Missing submodule libreultra. Please run 'git submodule update --init') | ||
endif | ||
|
||
DUMMY != ls f3dex2 >/dev/null || echo FAIL | ||
ifeq ($(DUMMY),FAIL) | ||
$(error Missing submodule f3dex2. Please run 'git submodule update --init') | ||
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 | ||
|
||
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))) | ||
|
||
$(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 | ||
|
||
all: $(BUILD_DIR)/$(TARGET).z64 | ||
@sha1sum -c $(TARGET).sha1 | ||
|
||
clean: | ||
rm -rf build/ | ||
|
||
distclean: | ||
rm -rf build/ | ||
tools/extract_assets --clean | ||
$(MAKE) -C tools clean | ||
$(MAKE) -C libreultra clean | ||
$(MAKE) -C f3dex2 clean | ||
# TODO: remove these | ||
rm -rf assets/geo | ||
rm -rf assets/image | ||
rm -rf assets/anim | ||
rm -rf assets/misc | ||
|
||
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 $< $@ | ||
$(TOOLS_DIR)/patch_libultra_math $@ | ||
|
||
$(BUILD_DIR)/libn_audio.a: libreultra/build/2.0I/libn_audio.a | ||
cp $< $@ | ||
$(TOOLS_DIR)/patch_libultra_math $@ | ||
|
||
$(BUILD_DIR)/$(UCODE_BASE_DIR)/$(GRUCODE)/$(GRUCODE).%.o: f3dex2/$(GRUCODE)/$(GRUCODE).% | ||
$(OBJCOPY) -I binary -O elf32-big $< $@ | ||
|
||
$(BUILD_DIR)/%.o: %.s | ||
$(CPP) $(GCC_CFLAGS) -o $(@:.o=.i) $< | ||
$(AS) $(ASFLAGS) -o $@ $(@:.o=.i) | ||
|
||
$(BUILD_DIR)/%.o: %.c | ||
@$(CC_CHECK) -MMD -MP -MT $@ -MF $(BUILD_DIR)/$*.d $< | ||
$(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: | ||
$(MAKE) -C assets | ||
|
||
# $(BUILD_DIR)/assets/misc/%.o: assets/misc/%.s | ||
# $(AS) $(ASFLAGS) -o $@ $< | ||
|
||
$(BUILD_DIR)/%.o: $(BUILD_DIR)/%.c | ||
@$(CC_CHECK) -MMD -MP -MT $@ -MF $(BUILD_DIR)/$*.d $< | ||
$(CC) -c $(CFLAGS) -o $@ $< | ||
|
||
$(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 | ||
$(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 | ||
|
||
# final z64 updates checksum | ||
$(BUILD_DIR)/$(TARGET).z64: $(BUILD_DIR)/$(TARGET).elf | ||
$(OBJCOPY) $< $(BUILD_DIR)/$(@F).bin -O binary $(PRELIM_OBJCOPY_FLAGS) | ||
$(LD) -r -b binary -o $(BUILD_DIR)/$(@F).elf.1 $(BUILD_DIR)/$(@F).bin | ||
$(OBJCOPY) $(BUILD_DIR)/$(@F).elf.1 $@ -O binary $(OBJCOPY_FLAGS) | ||
$(N64CRC) $@ | ||
@python3 tools/progress2.py -m | ||
|
||
|
||
$(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 VERSION=2.04H ARMIPS=../tools/armips | ||
tools/extract_assets baserom.$(VERSION).z64 | ||
|
||
.PHONY: all clean default diff test distclean | ||
|
||
# Remove built-in rules, to improve performance | ||
MAKEFLAGS += --no-builtin-rules | ||
|
||
-include $(D_FILES) | ||
-include $(BUILD_DIR)/$(LD_SCRIPT).d | ||
|
||
print-% : ; $(info $* is a $(flavor $*) variable set to [$($*)]) @true | ||
|
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
.include "macro.inc" | ||
|
||
.section .bss | ||
|
||
/* Generated by spimdisasm 1.25.1 */ | ||
|
||
glabel D_801F4D30_ovl10 | ||
/* 1E5AA0 801F4D30 */ .space 0x18 | ||
|
||
glabel .L801F4D48_ovl10 | ||
/* 1E5AB8 801F4D48 */ .space 0x18 | ||
|
||
glabel D_801F4D60_ovl10 | ||
/* 1E5AD0 801F4D60 */ .space 0x08 | ||
|
||
glabel D_801F4D68_ovl10 | ||
/* 1E5AD8 801F4D68 */ .space 0x04 | ||
|
||
glabel .L801F4D6C_ovl10 | ||
/* 1E5ADC 801F4D6C */ .space 0x04 | ||
|
||
glabel .L801F4D70_ovl10 | ||
/* 1E5AE0 801F4D70 */ .space 0x04 | ||
|
||
glabel D_801F4D74_ovl10 | ||
/* 1E5AE4 801F4D74 */ .space 0x04 | ||
|
||
glabel D_801F4D78_ovl10 | ||
/* 1E5AE8 801F4D78 */ .space 0x04 | ||
|
||
glabel func_801F4D7C_ovl10 | ||
/* 1E5AEC 801F4D7C */ .space 0x34 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.include "macro.inc" | ||
|
||
.section .bss | ||
|
||
/* Generated by spimdisasm 1.25.1 */ | ||
|
||
glabel D_801E0C60_ovl11 | ||
/* 1EB520 801E0C60 */ .space 0x18 | ||
|
||
glabel func_801E0C78_ovl11 | ||
/* 1EB538 801E0C78 */ .space 0x18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.include "macro.inc" | ||
|
||
.section .bss | ||
|
||
/* Generated by spimdisasm 1.25.1 */ | ||
|
||
glabel D_801E2E20_ovl12 | ||
/* 1F3160 801E2E20 */ .space 0x04 | ||
|
||
glabel func_801E2E24_ovl17 | ||
/* 1F3164 801E2E24 */ .space 0x0C |
Oops, something went wrong.