diff --git a/Makefile b/Makefile index 3c4577e7..928bb0ac 100644 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/asm/rom_header.s b/asm/rom_header.s index 82dd3b3b..feb84d7e 100644 --- a/asm/rom_header.s +++ b/asm/rom_header.s @@ -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 diff --git a/sm64. b/sm64. new file mode 100644 index 00000000..e69de29b diff --git a/sm64.ld b/sm64.ld index 4554cc6f..06ac936d 100755 --- a/sm64.ld +++ b/sm64.ld @@ -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