hackerlibultra

This commit is contained in:
username
2025-02-18 13:06:31 -05:00
parent ad88263101
commit d3c6853e17
4 changed files with 20 additions and 7 deletions

View File

@@ -183,6 +183,7 @@ endif
TOOLS_DIR := tools
LIBULTRA_DIR := lib/hackerlibultra
LIBULTRA_BUILD_DIR := lib/hackerlibultra/build/L/libgultra_rom
# (This is a bit hacky, but a lot of rules implicitly depend
# on tools and assets, and we use directory globs further down
@@ -212,6 +213,13 @@ ifeq ($(filter clean distclean print-%,$(MAKECMDGOALS)),)
ifeq ($(DUMMY),FAIL)
$(error Failed to build tools)
endif
$(info Building hackerlibultra...)
DUMMY != $(MAKE) -s -C $(LIBULTRA_DIR) >&2 || echo FAIL
ifeq ($(DUMMY),FAIL)
$(error Failed to build hackerlibultra)
endif
$(info Building ROM...)
endif
@@ -475,6 +483,7 @@ distclean: clean
$(PYTHON) extract_assets.py --clean
$(MAKE) -C $(TOOLS_DIR) clean
$(MAKE) -C $(TOOLS_DIR)/sm64tools clean
$(MAKE) -C $(LIBULTRA_DIR) clean
test: $(ROM)
$(EMULATOR) $(EMU_FLAGS) $<
@@ -778,7 +787,7 @@ $(BUILD_DIR)/rsp/%.bin $(BUILD_DIR)/rsp/%_data.bin: rsp/%.s
# Run linker script through the C preprocessor
$(BUILD_DIR)/$(LD_SCRIPT): $(LD_SCRIPT)
$(call print,Preprocessing linker script:,$<,$@)
$(V)$(CPP) $(CPPFLAGS) -DBUILD_DIR=$(BUILD_DIR) -MMD -MP -MT $@ -MF $@.d -o $@ $<
$(V)$(CPP) $(CPPFLAGS) -DBUILD_DIR=$(BUILD_DIR) -DULTRA_BUILD_DIR=$(LIBULTRA_BUILD_DIR) -MMD -MP -MT $@ -MF $@.d -o $@ $<
# Link libgoddard
$(BUILD_DIR)/libgoddard.a: $(GODDARD_O_FILES)
@@ -793,7 +802,7 @@ $(BUILD_DIR)/libgcc.a: $(LIBGCC_O_FILES)
# Link SM64 ELF file
$(ELF): $(O_FILES) $(MIO0_OBJ_FILES) $(SEG_FILES) $(BUILD_DIR)/$(LD_SCRIPT) $(LIBULTRA_AR) $(BUILD_DIR)/libgoddard.a $(BUILD_DIR)/libgcc.a
@$(PRINT) "$(GREEN)Linking ELF file: $(BLUE)$@ $(NO_COL)\n"
$(V)$(LD) -L $(BUILD_DIR) -T $(BUILD_DIR)/$(LD_SCRIPT) -Map $(BUILD_DIR)/sm64.$(VERSION).map --no-check-sections $(addprefix -R ,$(SEG_FILES)) -o $@ $(O_FILES) -lultra -lgoddard -lgcc
$(V)$(LD) -L $(BUILD_DIR) -L $(LIBULTRA_BUILD_DIR) -T $(BUILD_DIR)/$(LD_SCRIPT) -Map $(BUILD_DIR)/sm64.$(VERSION).map --no-check-sections $(addprefix -R ,$(SEG_FILES)) -o $@ $(O_FILES) -lgultra_rom -lgoddard -lgcc
# Build ROM
ifeq ($(VERSION),cn)

View File

@@ -10,7 +10,7 @@
/* Revision */
.half 0x0000
.byte 20 /* Major version 2.0 */
.ascii LIBULTRA_STR_VER /* Minor Version */
.ascii "L" /* Minor Version */
#ifdef VERSION_CN
.fill 0x30

0
sm64. Normal file
View File

12
sm64.ld
View File

@@ -224,7 +224,8 @@ SECTIONS
// JP has an additional 0x40 of weird padding space in text
#define JP_PADDING_TEXT
#endif
#include "lib/ultra/ld.inc"
// #include "lib/ultra/ld.inc"
ULTRA_BUILD_DIR/libgultra_rom.a*.o(.text*);
#undef SECTION
#ifdef VERSION_JP
#undef JP_PADDING_TEXT
@@ -318,7 +319,8 @@ SECTIONS
#endif
#define SECTION data*
#include "lib/ultra/ld.inc"
// #include "lib/ultra/ld.inc"
ULTRA_BUILD_DIR/libgultra_rom.a*.o(.data*);
#undef SECTION
/* rodata */
@@ -388,7 +390,8 @@ SECTIONS
AUDIO_DIR*.o(.rodata*);
#define SECTION rodata*
#include "lib/ultra/ld.inc"
// #include "lib/ultra/ld.inc"
ULTRA_BUILD_DIR/libgultra_rom.a*.o(.rodata*);
#undef SECTION
#ifndef __sgi
@@ -474,7 +477,8 @@ SECTIONS
// osPfsIsPlug bss section is located slightly different in Shindou.
#define SH_PFS_BSS
#endif
#include "lib/ultra/ld.inc"
// #include "lib/ultra/ld.inc"
ULTRA_BUILD_DIR/libgultra_rom.a*.o(.bss*);
#undef SECTION
#ifdef VERSION_SH
#undef SH_PFS_BSS