mirror of
https://github.com/HackerN64/HackerOoT.git
synced 2026-01-21 10:37:37 -08:00
Merge remote-tracking branch 'decomp/main' into decomp_merge
This commit is contained in:
62
Makefile
62
Makefile
@@ -43,8 +43,6 @@ COMPILER ?= gcc
|
||||
VERSION ?= hackeroot-mq
|
||||
# Number of threads to extract and compress with.
|
||||
N_THREADS ?= $(shell nproc)
|
||||
# Check code syntax with host compiler.
|
||||
RUN_CC_CHECK ?= 1
|
||||
# If DEBUG_OBJECTS is 1, produce additional debugging files such as objdump output or raw binaries for assets
|
||||
DEBUG_OBJECTS ?= 0
|
||||
# Set prefix to mips binutils binaries (mips-linux-gnu-ld => 'mips-linux-gnu-') - Change at your own risk!
|
||||
@@ -434,10 +432,10 @@ CPPFLAGS += -P -xc -fno-dollars-in-identifiers $(CPP_DEFINES)
|
||||
ASFLAGS += -march=vr4300 -32 -no-pad-sections -Iinclude -I$(EXTRACTED_DIR)
|
||||
|
||||
ifeq ($(COMPILER),gcc)
|
||||
CFLAGS += $(CPP_DEFINES) $(GBI_DEFINES) -G 0 -nostdinc $(INC) -march=vr4300 -mfix4300 -mabi=32 -mno-abicalls -mdivide-breaks -fno-PIC -fno-common -ffreestanding -funsigned-char -fbuiltin -fno-builtin-sinf -fno-builtin-cosf $(CHECK_WARNINGS)
|
||||
CCASFLAGS += $(CPP_DEFINES) $(GBI_DEFINES) -G 0 -nostdinc $(INC) -march=vr4300 -mfix4300 -mabi=32 -mno-abicalls -fno-PIC -fno-common -Wa,-no-pad-sections
|
||||
CFLAGS += $(CPP_DEFINES) $(GBI_DEFINES) -G 0 -nostdinc -MD $(INC) -march=vr4300 -mfix4300 -mabi=32 -mno-abicalls -mdivide-breaks -fno-PIC -fno-common -ffreestanding -funsigned-char -fbuiltin -fno-builtin-sinf -fno-builtin-cosf $(CHECK_WARNINGS)
|
||||
CCASFLAGS += $(CPP_DEFINES) $(GBI_DEFINES) -G 0 -nostdinc -MD $(INC) -march=vr4300 -mfix4300 -mabi=32 -mno-abicalls -fno-PIC -fno-common -Wa,-no-pad-sections
|
||||
MIPS_VERSION := -mips3
|
||||
RUN_CC_CHECK := 0
|
||||
CC_CHECK = @:
|
||||
endif
|
||||
|
||||
OBJDUMP_FLAGS := -d -r -z -Mreg-names=32
|
||||
@@ -520,7 +518,7 @@ SOUNDFONT_EXTRACT_XMLS := $(foreach dir,$(SOUNDFONT_EXTRACT_DIRS),$(wildcard $(d
|
||||
SOUNDFONT_BUILD_XMLS := $(foreach f,$(SOUNDFONT_XMLS),$(BUILD_DIR)/$f) $(foreach f,$(SOUNDFONT_EXTRACT_XMLS),$(f:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%))
|
||||
SOUNDFONT_O_FILES := $(foreach f,$(SOUNDFONT_BUILD_XMLS),$(f:.xml=.o))
|
||||
SOUNDFONT_HEADERS := $(foreach f,$(SOUNDFONT_BUILD_XMLS),$(f:.xml=.h))
|
||||
SOUNDFONT_DEP_FILES := $(foreach f,$(SOUNDFONT_O_FILES),$(f:.o=.d))
|
||||
SOUNDFONT_DEP_FILES := $(foreach f,$(SOUNDFONT_O_FILES),$(f:.o=.c.d))
|
||||
|
||||
SEQUENCE_FILES := $(foreach dir,$(SEQUENCE_DIRS),$(wildcard $(dir)/*.seq))
|
||||
SEQUENCE_EXTRACT_FILES := $(foreach dir,$(SEQUENCE_EXTRACT_DIRS),$(wildcard $(dir)/*.seq))
|
||||
@@ -558,7 +556,7 @@ UCODE_O_FILES := $(foreach f,$(UCODE_FILES),$(BUILD_DIR)/$f.o)
|
||||
|
||||
# Automatic dependency files
|
||||
# (Only asm_processor dependencies and reloc dependencies are handled for now)
|
||||
DEP_FILES := $(O_FILES:.o=.asmproc.d) $(OVL_RELOC_FILES:.o=.d)
|
||||
DEP_FILES := $(O_FILES:.o=.d) $(O_FILES:.o=.asmproc.d) $(OVL_RELOC_FILES:.o=.d) $(BUILD_DIR)/spec.d
|
||||
|
||||
TEXTURE_FILES_PNG_EXTRACTED := $(foreach dir,$(ASSET_BIN_DIRS_EXTRACTED),$(wildcard $(dir)/*.png))
|
||||
TEXTURE_FILES_PNG_COMMITTED := $(foreach dir,$(ASSET_BIN_DIRS_COMMITTED),$(wildcard $(dir)/*.png))
|
||||
@@ -821,7 +819,7 @@ $(O_FILES): | asset_files
|
||||
|
||||
$(BUILD_DIR)/spec: $(SPEC) $(SPEC_INCLUDES)
|
||||
$(call print_two_args,Preprocessing:,$<,$@)
|
||||
$(V)$(CPP) $(CPPFLAGS) -I. $< | $(BUILD_DIR_REPLACE) > $@
|
||||
$(V)$(CPP) $(CPPFLAGS) -MD -MF $@.d -MT $@ -I. $< | $(BUILD_DIR_REPLACE) > $@
|
||||
|
||||
$(LDSCRIPT): $(BUILD_DIR)/spec
|
||||
$(call print_two_args,Creating linker script:,$<,$@)
|
||||
@@ -842,7 +840,7 @@ $(BUILD_DIR)/F3DEX3/%.o: F3DEX3/%
|
||||
|
||||
$(BUILD_DIR)/data/%.o: data/%.s
|
||||
$(call print_two_args,Assembling:,$<,$@)
|
||||
$(V)$(CPP) $(CPPFLAGS) -Iinclude $< | $(AS) $(ASFLAGS) -o $@
|
||||
$(V)$(CPP) $(CPPFLAGS) -MD -MF $(@:.o=.d) -MT $@ -Iinclude $< | $(AS) $(ASFLAGS) -o $@
|
||||
|
||||
ifeq ($(PLATFORM),IQUE)
|
||||
NES_CHARMAP := assets/text/charmap.chn.txt
|
||||
@@ -852,20 +850,19 @@ endif
|
||||
|
||||
$(BUILD_DIR)/assets/text/%.enc.nes.h: assets/text/%.h $(EXTRACTED_DIR)/text/%.h $(NES_CHARMAP)
|
||||
$(call print_two_args,Encoding:,$<,$@)
|
||||
$(V)$(CPP) $(CPPFLAGS) -I$(EXTRACTED_DIR) $< | $(PYTHON) tools/msgenc.py --encoding utf-8 --charmap $(NES_CHARMAP) - $@
|
||||
$(V)$(CPP) $(CPPFLAGS) -I$(EXTRACTED_DIR) -MD -MF $(@:.o=.d) -MT $@ $< | $(PYTHON) tools/msgenc.py --encoding utf-8 --charmap $(NES_CHARMAP) - $@
|
||||
|
||||
$(BUILD_DIR)/assets/text/%.enc.jpn.h: assets/text/%.h $(EXTRACTED_DIR)/text/%.h assets/text/charmap.jpn.txt
|
||||
$(call print_two_args,Encoding:,$<,$@)
|
||||
$(V)$(CPP) $(CPPFLAGS) -I$(EXTRACTED_DIR) $< | $(PYTHON) tools/msgenc.py --encoding SHIFT-JIS --wchar --charmap assets/text/charmap.jpn.txt - $@
|
||||
$(V)$(CPP) $(CPPFLAGS) -I$(EXTRACTED_DIR) -MD -MF $(@:.o=.d) -MT $@ $< | $(PYTHON) tools/msgenc.py --encoding SHIFT-JIS --wchar --charmap assets/text/charmap.jpn.txt - $@
|
||||
|
||||
# Dependencies for files including message data headers
|
||||
# TODO remove when full header dependencies are used.
|
||||
# Dependencies for encoded message headers. These dependencies are not automatic as these headers are generated
|
||||
# as part of the build. A clean build must know to generate them before the relevant .d files are created.
|
||||
$(BUILD_DIR)/assets/text/jpn_message_data_static.o: $(BUILD_DIR)/assets/text/message_data.enc.jpn.h
|
||||
$(BUILD_DIR)/assets/text/nes_message_data_static.o: $(BUILD_DIR)/assets/text/message_data.enc.nes.h
|
||||
$(BUILD_DIR)/assets/text/ger_message_data_static.o: $(BUILD_DIR)/assets/text/message_data.enc.nes.h
|
||||
$(BUILD_DIR)/assets/text/fra_message_data_static.o: $(BUILD_DIR)/assets/text/message_data.enc.nes.h
|
||||
$(BUILD_DIR)/assets/text/staff_message_data_static.o: $(BUILD_DIR)/assets/text/message_data_staff.enc.nes.h
|
||||
$(BUILD_DIR)/src/code/z_message.o: assets/text/message_data.h assets/text/message_data_staff.h
|
||||
|
||||
$(BUILD_DIR)/assets/text/%.o: assets/text/%.c
|
||||
$(call print_two_args,Compiling:,$<,$@)
|
||||
@@ -874,11 +871,13 @@ $(BUILD_DIR)/assets/text/%.o: assets/text/%.c
|
||||
|
||||
$(BUILD_DIR)/assets/%.o: assets/%.c
|
||||
$(call print,Compiling:,$<,$@)
|
||||
$(V)$(CC_CHECK) $< -o $@
|
||||
$(V)$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
|
||||
$(V)$(OBJCOPY_CMD)
|
||||
|
||||
$(BUILD_DIR)/assets/%.o: $(EXTRACTED_DIR)/assets/%.c
|
||||
$(call print_two_args,Compiling:,$<,$@)
|
||||
$(V)$(CC_CHECK) $< -o $@
|
||||
$(V)$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
|
||||
$(V)$(OBJCOPY_CMD)
|
||||
|
||||
@@ -903,6 +902,8 @@ $(BUILD_DIR)/src/code/z_message_z_game_over.o: $(BUILD_DIR)/src/code/z_message.o
|
||||
$(V)$(LD) -r -G 0 -T linker_scripts/data_with_rodata.ld -o $@ $^
|
||||
$(V)$(PYTHON) tools/patch_data_with_rodata_mdebug.py $@
|
||||
|
||||
DEP_FILES += $(BUILD_DIR)/src/code/z_message.d $(BUILD_DIR)/src/code/z_game_over.d
|
||||
|
||||
$(BUILD_DIR)/dmadata_table_spec.h $(BUILD_DIR)/compress_ranges.txt: $(BUILD_DIR)/spec
|
||||
$(V)$(MKDMADATA) $< $(BUILD_DIR)/dmadata_table_spec.h $(BUILD_DIR)/compress_ranges.txt
|
||||
|
||||
@@ -910,36 +911,20 @@ $(BUILD_DIR)/dmadata_table_spec.h $(BUILD_DIR)/compress_ranges.txt: $(BUILD_DIR)
|
||||
$(BUILD_DIR)/src/boot/z_std_dma.o: $(BUILD_DIR)/dmadata_table_spec.h
|
||||
$(BUILD_DIR)/src/dmadata/dmadata.o: $(BUILD_DIR)/dmadata_table_spec.h
|
||||
|
||||
# Dependencies for files including from include/tables/
|
||||
# TODO remove when full header dependencies are used.
|
||||
$(BUILD_DIR)/src/code/graph.o: include/tables/gamestate_table.h
|
||||
$(BUILD_DIR)/src/code/object_table.o: include/tables/object_table.h
|
||||
$(BUILD_DIR)/src/code/z_actor.o: include/tables/actor_table.h # so uses of ACTOR_ID_MAX update when the table length changes
|
||||
$(BUILD_DIR)/src/code/z_actor_dlftbls.o: include/tables/actor_table.h
|
||||
$(BUILD_DIR)/src/code/z_effect_soft_sprite_dlftbls.o: include/tables/effect_ss_table.h
|
||||
$(BUILD_DIR)/src/code/z_game_dlftbls.o: include/tables/gamestate_table.h
|
||||
$(BUILD_DIR)/src/code/z_scene_table.o: include/tables/scene_table.h include/tables/entrance_table.h
|
||||
$(BUILD_DIR)/src/audio/general.o: $(SEQUENCE_TABLE) include/tables/sfx/*.h
|
||||
$(BUILD_DIR)/src/audio/sfx_params.o: include/tables/sfx/*.h
|
||||
|
||||
$(BUILD_DIR)/src/%.o: src/%.c
|
||||
ifneq ($(RUN_CC_CHECK),0)
|
||||
$(V)$(CC_CHECK) $<
|
||||
endif
|
||||
$(call print_two_args,Compiling:,$<,$@)
|
||||
$(V)$(CC_CHECK) $< -o $@
|
||||
$(V)$(PREPROCESS) $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
|
||||
$(V)$(POSTPROCESS_OBJ) $@
|
||||
$(V)$(OBJDUMP_CMD)
|
||||
|
||||
$(BUILD_DIR)/src/audio/session_init.o: src/audio/session_init.c $(BUILD_DIR)/assets/audio/soundfont_sizes.h $(BUILD_DIR)/assets/audio/sequence_sizes.h
|
||||
ifneq ($(RUN_CC_CHECK),0)
|
||||
$(V)$(CC_CHECK) $<
|
||||
endif
|
||||
$(call print_two_args,Compiling:,$<,$@)
|
||||
$(V)$(CC_CHECK) $< -o $@
|
||||
$(V)$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $(@:.o=.tmp) $<
|
||||
$(V)$(LD) -r -T linker_scripts/data_with_rodata.ld -o $@ $(@:.o=.tmp)
|
||||
$(V)$(PYTHON) tools/patch_data_with_rodata_mdebug.py $@
|
||||
@$(OBJDUMP) $(OBJDUMP_FLAGS) $@ > $(@:.o=.s)
|
||||
$(V)$(OBJDUMP_CMD)
|
||||
|
||||
ifeq ($(PLATFORM),IQUE)
|
||||
ifneq ($(NON_MATCHING),1)
|
||||
@@ -1056,11 +1041,12 @@ $(BUILD_DIR)/assets/audio/soundfonts/%.xml: $(EXTRACTED_DIR)/assets/audio/soundf
|
||||
$(BUILD_DIR)/assets/audio/soundfonts/%.c $(BUILD_DIR)/assets/audio/soundfonts/%.h $(BUILD_DIR)/assets/audio/soundfonts/%.name: $(BUILD_DIR)/assets/audio/soundfonts/%.xml | $(SAMPLEBANK_BUILD_XMLS) $(AIFC_FILES)
|
||||
# This rule can be triggered for either the .c or .h file, so $@ may refer to either the .c or .h file. A simple
|
||||
# substitution $(@:.c=.h) will fail ~50% of the time with -j. Instead, don't assume anything about the suffix of $@.
|
||||
$(V)$(SFC) $(SFCFLAGS) --makedepend $(basename $@).d $< $(basename $@).c $(basename $@).h $(basename $@).name
|
||||
$(V)$(SFC) $(SFCFLAGS) --makedepend $(basename $@).c.d $< $(basename $@).c $(basename $@).h $(basename $@).name
|
||||
|
||||
-include $(SOUNDFONT_DEP_FILES)
|
||||
|
||||
$(BUILD_DIR)/assets/audio/soundfonts/%.o: $(BUILD_DIR)/assets/audio/soundfonts/%.c $(BUILD_DIR)/assets/audio/soundfonts/%.name
|
||||
$(CC_CHECK) -I include/audio $< -o $@
|
||||
# compile c to unlinked object
|
||||
$(V)$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -I include/audio -o $(@:.o=.tmp) $<
|
||||
# partial link
|
||||
@@ -1081,11 +1067,11 @@ endif
|
||||
# then assemble the sequences...
|
||||
|
||||
$(BUILD_DIR)/assets/audio/sequences/%.o: assets/audio/sequences/%.seq include/audio/aseq.h $(SEQUENCE_TABLE) | $(SOUNDFONT_HEADERS)
|
||||
$(V)$(SEQ_CPP) $(SEQ_CPPFLAGS) $< -o $(@:.o=.s) -MMD -MT $@
|
||||
$(V)$(SEQ_CPP) $(SEQ_CPPFLAGS) -MD -MT $@ $< -o $(@:.o=.s)
|
||||
$(V)$(AS) $(ASFLAGS) -I $(BUILD_DIR)/assets/audio/soundfonts -I include/audio -I $(dir $<) $(@:.o=.s) -o $@
|
||||
|
||||
$(BUILD_DIR)/assets/audio/sequences/%.o: $(EXTRACTED_DIR)/assets/audio/sequences/%.seq include/audio/aseq.h $(SEQUENCE_TABLE) | $(SOUNDFONT_HEADERS)
|
||||
$(V)$(SEQ_CPP) $(SEQ_CPPFLAGS) $< -o $(@:.o=.s) -MMD -MT $@
|
||||
$(V)$(SEQ_CPP) $(SEQ_CPPFLAGS) -MD -MT $@ $< -o $(@:.o=.s)
|
||||
$(V)$(AS) $(ASFLAGS) -I $(BUILD_DIR)/assets/audio/soundfonts -I include/audio -I $(dir $<) $(@:.o=.s) -o $@
|
||||
ifeq ($(AUDIO_BUILD_DEBUG),1)
|
||||
$(V)$(OBJCOPY) -O binary -j.data $@ $(@:.o=.aseq)
|
||||
@@ -1119,9 +1105,7 @@ $(BUILD_DIR)/src/audio/tables/sequence_table.o: src/audio/tables/sequence_table.
|
||||
$(BUILD_DIR)/src/audio/tables/sequence_table.o: CFLAGS += -I include/tables
|
||||
|
||||
$(BUILD_DIR)/src/audio/tables/%.o: src/audio/tables/%.c
|
||||
ifneq ($(RUN_CC_CHECK),0)
|
||||
$(V)$(CC_CHECK) $<
|
||||
endif
|
||||
$(V)$(CC_CHECK) $< -o $@
|
||||
$(V)$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $(@:.o=.tmp) $<
|
||||
$(V)$(LD) -r -T linker_scripts/data_with_rodata.ld $(@:.o=.tmp) -o $@
|
||||
$(V)$(PYTHON) tools/patch_data_with_rodata_mdebug.py $@
|
||||
|
||||
Reference in New Issue
Block a user