You've already forked ultrasm64-2
mirror of
https://github.com/HackerN64/ultrasm64-2.git
synced 2026-01-21 10:38:08 -08:00
Refresh 14
This commit is contained in:
68
Makefile
68
Makefile
@@ -304,12 +304,6 @@ else
|
||||
COPT := $(IDO_ROOT)/copt
|
||||
endif
|
||||
endif
|
||||
# Prefer gcc's cpp if installed on the system
|
||||
ifneq (,$(call find-command,cpp-10))
|
||||
CPP := cpp-10
|
||||
else
|
||||
CPP := cpp
|
||||
endif
|
||||
LD := $(CROSS)ld
|
||||
AR := $(CROSS)ar
|
||||
OBJDUMP := $(CROSS)objdump
|
||||
@@ -328,6 +322,15 @@ endif
|
||||
C_DEFINES := $(foreach d,$(DEFINES),-D$(d))
|
||||
DEF_INC_CFLAGS := $(foreach i,$(INCLUDE_DIRS),-I$(i)) $(C_DEFINES)
|
||||
|
||||
# Prefer clang as C preprocessor if installed on the system
|
||||
ifneq (,$(call find-command,clang))
|
||||
CPP := clang
|
||||
CPPFLAGS := -E -P -x c -Wno-trigraphs $(DEF_INC_CFLAGS)
|
||||
else
|
||||
CPP := cpp
|
||||
CPPFLAGS := -P -Wno-trigraphs $(DEF_INC_CFLAGS)
|
||||
endif
|
||||
|
||||
# Check code syntax with host compiler
|
||||
CC_CHECK := gcc
|
||||
CC_CHECK_CFLAGS := -fsyntax-only -fsigned-char $(CC_CFLAGS) $(TARGET_CFLAGS) -std=gnu90 -Wall -Wextra -Wno-format-security -Wno-main -DNON_MATCHING -DAVOID_UB $(DEF_INC_CFLAGS)
|
||||
@@ -343,9 +346,6 @@ endif
|
||||
ASFLAGS := -march=vr4300 -mabi=32 $(foreach i,$(INCLUDE_DIRS),-I$(i)) $(foreach d,$(DEFINES),--defsym $(d))
|
||||
RSPASMFLAGS := $(foreach d,$(DEFINES),-definelabel $(subst =, ,$(d)))
|
||||
|
||||
# C preprocessor flags
|
||||
CPPFLAGS := -P -Wno-trigraphs $(DEF_INC_CFLAGS)
|
||||
|
||||
ifeq ($(shell getconf LONG_BIT), 32)
|
||||
# Work around memory allocation bug in QEMU
|
||||
export QEMU_GUEST_BASE := 1
|
||||
@@ -437,7 +437,7 @@ $(SOUND_BIN_DIR)/sound_data.o: $(SOUND_BIN_DIR)/sound_data.ctl.inc.c $(SO
|
||||
$(BUILD_DIR)/levels/scripts.o: $(BUILD_DIR)/include/level_headers.h
|
||||
|
||||
ifeq ($(VERSION),sh)
|
||||
$(BUILD_DIR)/src/audio/load.o: $(SOUND_BIN_DIR)/bank_sets.inc.c $(SOUND_BIN_DIR)/sequences_header.inc.c $(SOUND_BIN_DIR)/ctl_header.inc.c $(SOUND_BIN_DIR)/tbl_header.inc.c
|
||||
$(BUILD_DIR)/src/audio/load_sh.o: $(SOUND_BIN_DIR)/bank_sets.inc.c $(SOUND_BIN_DIR)/sequences_header.inc.c $(SOUND_BIN_DIR)/ctl_header.inc.c $(SOUND_BIN_DIR)/tbl_header.inc.c
|
||||
endif
|
||||
|
||||
$(CRASH_TEXTURE_C_FILES): TEXTURE_ENCODING := u32
|
||||
@@ -521,11 +521,11 @@ $(BUILD_DIR)/levels/%/leveldata.elf: $(BUILD_DIR)/levels/%/leveldata.o $(BUILD_D
|
||||
$(V)$(LD) -e 0 -Ttext=$(SEGMENT_ADDRESS) -Map $@.map --just-symbols=$(BUILD_DIR)/bin/$(TEXTURE_BIN).elf -o $@ $<
|
||||
|
||||
$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf
|
||||
$(call print,Extracting compressionable data from:,$<,$@)
|
||||
$(call print,Extracting compressible data from:,$<,$@)
|
||||
$(V)$(EXTRACT_DATA_FOR_MIO) $< $@
|
||||
|
||||
$(BUILD_DIR)/levels/%/leveldata.bin: $(BUILD_DIR)/levels/%/leveldata.elf
|
||||
$(call print,Extracting compressionable data from:,$<,$@)
|
||||
$(call print,Extracting compressible data from:,$<,$@)
|
||||
$(V)$(EXTRACT_DATA_FOR_MIO) $< $@
|
||||
|
||||
# Compress binary file
|
||||
@@ -536,7 +536,7 @@ $(BUILD_DIR)/%.mio0: $(BUILD_DIR)/%.bin
|
||||
# convert binary mio0 to object file
|
||||
$(BUILD_DIR)/%.mio0.o: $(BUILD_DIR)/%.mio0
|
||||
$(call print,Converting MIO0 to ELF:,$<,$@)
|
||||
$(V)printf ".section .data\n\n.incbin \"$<\"\n" | $(AS) $(ASFLAGS) -o $@
|
||||
$(V)$(LD) -r -b binary $< -o $@
|
||||
|
||||
|
||||
#==============================================================================#
|
||||
@@ -548,7 +548,7 @@ $(BUILD_DIR)/%.table: %.aiff
|
||||
$(V)$(AIFF_EXTRACT_CODEBOOK) $< >$@
|
||||
|
||||
$(BUILD_DIR)/%.aifc: $(BUILD_DIR)/%.table %.aiff
|
||||
$(call print,Encoding VADPCM:,$<,$@)
|
||||
$(call print,Encoding ADPCM:,$(word 2,$^),$@)
|
||||
$(V)$(VADPCM_ENC) -c $^ $@
|
||||
|
||||
$(ENDIAN_BITWIDTH): $(TOOLS_DIR)/determine-endian-bitwidth.c
|
||||
@@ -556,8 +556,8 @@ $(ENDIAN_BITWIDTH): $(TOOLS_DIR)/determine-endian-bitwidth.c
|
||||
$(V)$(CC) -c $(CFLAGS) -o $@.dummy2 $< 2>$@.dummy1; true
|
||||
$(V)grep -o 'msgbegin --endian .* --bitwidth .* msgend' $@.dummy1 > $@.dummy2
|
||||
$(V)head -n1 <$@.dummy2 | cut -d' ' -f2-5 > $@
|
||||
@$(RM) $@.dummy1
|
||||
@$(RM) $@.dummy2
|
||||
$(V)$(RM) $@.dummy1
|
||||
$(V)$(RM) $@.dummy2
|
||||
|
||||
$(SOUND_BIN_DIR)/sound_data.ctl: sound/sound_banks/ $(SOUND_BANK_FILES) $(SOUND_SAMPLE_AIFCS) $(ENDIAN_BITWIDTH)
|
||||
@$(PRINT) "$(GREEN)Generating: $(BLUE)$@ $(NO_COL)\n"
|
||||
@@ -593,7 +593,7 @@ $(SOUND_BIN_DIR)/%.m64: $(SOUND_BIN_DIR)/%.o
|
||||
|
||||
# Convert binary file to a comma-separated list of byte values for inclusion in C code
|
||||
$(BUILD_DIR)/%.inc.c: $(BUILD_DIR)/%
|
||||
$(call print,Piping:,$<,$@)
|
||||
$(call print,Converting to C:,$<,$@)
|
||||
$(V)hexdump -v -e '1/1 "0x%X,"' $< > $@
|
||||
$(V)echo >> $@
|
||||
|
||||
@@ -624,7 +624,7 @@ $(BUILD_DIR)/text/%/define_text.inc.c: text/define_text.inc.c text/%/courses.h t
|
||||
# Level headers
|
||||
$(BUILD_DIR)/include/level_headers.h: levels/level_headers.h.in
|
||||
$(call print,Preprocessing level headers:,$<,$@)
|
||||
$(V)$(CPP) $(CPPFLAGS) -I . levels/level_headers.h.in | $(PYTHON) $(TOOLS_DIR)/output_level_headers.py > $(BUILD_DIR)/include/level_headers.h
|
||||
$(V)$(CPP) $(CPPFLAGS) -I . $< | sed -E 's|(.+)|#include "\1"|' > $@
|
||||
|
||||
# Run asm_processor on files that have NON_MATCHING code
|
||||
ifeq ($(NON_MATCHING),0)
|
||||
@@ -667,46 +667,36 @@ ifeq ($(COMPILER),ido)
|
||||
$(BUILD_DIR)/lib/src/string.o: OPT_FLAGS := -O2
|
||||
$(BUILD_DIR)/lib/src/gu%.o: OPT_FLAGS := -O3
|
||||
$(BUILD_DIR)/lib/src/al%.o: OPT_FLAGS := -O3
|
||||
# For the asm-processor, since it doesn't support -O3. Probably not actually compiled with these flags.
|
||||
|
||||
ifeq ($(VERSION),sh)
|
||||
$(BUILD_DIR)/lib/src/unk_shindou_file.o: OPT_FLAGS := -O1
|
||||
$(BUILD_DIR)/lib/src/func_sh_80304D20.o: OPT_FLAGS := -O1
|
||||
$(BUILD_DIR)/lib/src/_Printf.o: OPT_FLAGS := -O3
|
||||
$(BUILD_DIR)/lib/src/contramread.o: OPT_FLAGS := -O1
|
||||
$(BUILD_DIR)/lib/src/osPfsIsPlug.o: OPT_FLAGS := -O1
|
||||
$(BUILD_DIR)/lib/src/osAiSetFrequency.o: OPT_FLAGS := -O1
|
||||
$(BUILD_DIR)/lib/src/contramwrite.o: OPT_FLAGS := -O1
|
||||
$(BUILD_DIR)/lib/src/sprintf.o: OPT_FLAGS := -O3
|
||||
$(BUILD_DIR)/lib/src/_Litob.o: OPT_FLAGS := -O3
|
||||
$(BUILD_DIR)/lib/src/_Ldtob.o: OPT_FLAGS := -O3
|
||||
$(BUILD_DIR)/lib/src/_Ldtob.o: OPT_FLAGS := -O3
|
||||
$(BUILD_DIR)/lib/src/_Litob.o: OPT_FLAGS := -O3
|
||||
$(BUILD_DIR)/lib/src/_Printf.o: OPT_FLAGS := -O3
|
||||
$(BUILD_DIR)/lib/src/sprintf.o: OPT_FLAGS := -O3
|
||||
$(BUILD_DIR)/lib/src/osDriveRomInit.o: OPT_FLAGS := -g
|
||||
endif
|
||||
ifeq ($(VERSION),eu)
|
||||
$(BUILD_DIR)/lib/src/_Litob.o: OPT_FLAGS := -O3
|
||||
$(BUILD_DIR)/lib/src/_Ldtob.o: OPT_FLAGS := -O3
|
||||
$(BUILD_DIR)/lib/src/_Litob.o: OPT_FLAGS := -O3
|
||||
$(BUILD_DIR)/lib/src/_Printf.o: OPT_FLAGS := -O3
|
||||
$(BUILD_DIR)/lib/src/sprintf.o: OPT_FLAGS := -O3
|
||||
|
||||
# Enable loop unrolling except for external.c (external.c might also have used
|
||||
# unrolling, but it makes one loop harder to match).
|
||||
# For all audio files other than external.c and port_eu.c, put string literals
|
||||
# in .data. (In Shindou, the port_eu.c string literals also moved to .data.)
|
||||
$(BUILD_DIR)/src/audio/%.o: OPT_FLAGS := -O2 -use_readwrite_const
|
||||
$(BUILD_DIR)/src/audio/port_eu.o: OPT_FLAGS := -O2
|
||||
$(BUILD_DIR)/src/audio/external.o: OPT_FLAGS := -O2 -Wo,-loopunroll,0
|
||||
endif
|
||||
ifeq ($(VERSION_JP_US),true)
|
||||
$(BUILD_DIR)/src/audio/%.o: OPT_FLAGS := -O2 -Wo,-loopunroll,0
|
||||
$(BUILD_DIR)/src/audio/load.o: OPT_FLAGS := -O2 -framepointer -Wo,-loopunroll,0
|
||||
endif
|
||||
ifeq ($(VERSION_JP_US),true)
|
||||
$(BUILD_DIR)/src/audio/load.o: OPT_FLAGS := -O2 -Wo,-loopunroll,0 -framepointer
|
||||
# The source-to-source optimizer copt is enabled for audio. This makes it use
|
||||
# acpp, which needs -Wp,-+ to handle C++-style comments.
|
||||
# All other files than external.c should really use copt, but only a few have
|
||||
# been matched so far.
|
||||
$(BUILD_DIR)/src/audio/effects.o: OPT_FLAGS := -O2 -Wo,-loopunroll,0 -sopt,-inline=sequence_channel_process_sound,-scalaroptimize=1 -Wp,-+
|
||||
$(BUILD_DIR)/src/audio/synthesis.o: OPT_FLAGS := -O2 -sopt,-scalaroptimize=1 -Wp,-+
|
||||
$(BUILD_DIR)/src/audio/synthesis.o: OPT_FLAGS := -O2 -Wo,-loopunroll,0 -sopt,-scalaroptimize=1 -Wp,-+
|
||||
endif
|
||||
$(BUILD_DIR)/src/audio/external.o: OPT_FLAGS := -O2 -Wo,-loopunroll,0
|
||||
|
||||
# Add a target for build/eu/src/audio/*.copt to make it easier to see debug
|
||||
$(BUILD_DIR)/src/audio/%.acpp: src/audio/%.c
|
||||
@@ -720,7 +710,7 @@ endif
|
||||
# Assemble assembly code
|
||||
$(BUILD_DIR)/%.o: %.s
|
||||
$(call print,Assembling:,$<,$@)
|
||||
$(V)$(AS) $(ASFLAGS) -MD $(BUILD_DIR)/$*.d -o $@ $<
|
||||
$(V)$(CPP) $(CPPFLAGS) $< | $(AS) $(ASFLAGS) -MD $(BUILD_DIR)/$*.d -o $@
|
||||
|
||||
# Assemble RSP assembly code
|
||||
$(BUILD_DIR)/rsp/%.bin $(BUILD_DIR)/rsp/%_data.bin: rsp/%.s
|
||||
@@ -736,7 +726,7 @@ $(BUILD_DIR)/$(LD_SCRIPT): $(LD_SCRIPT)
|
||||
$(BUILD_DIR)/libultra.a: $(ULTRA_O_FILES)
|
||||
@$(PRINT) "$(GREEN)Linking libultra: $(BLUE)$@ $(NO_COL)\n"
|
||||
$(V)$(AR) rcs -o $@ $(ULTRA_O_FILES)
|
||||
$(V)$(TOOLS_DIR)/patch_libultra_math $@
|
||||
$(V)$(TOOLS_DIR)/patch_elf_32bit $@
|
||||
|
||||
# Link libgoddard
|
||||
$(BUILD_DIR)/libgoddard.a: $(GODDARD_O_FILES)
|
||||
|
||||
Reference in New Issue
Block a user