1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-14 05:19:36 +00:00

changes based on Tharo's suggestion

This commit is contained in:
ProjectRevoTPP 2021-12-03 10:32:31 -05:00
parent fb641cc81d
commit 0d1a240238

View file

@ -10,10 +10,6 @@ NON_MATCHING ?= 0
ORIG_COMPILER ?= 0
# If COMPILER is GCC, compile with GCC instead of IDO.
COMPILER ?= ido
# Convert text in source files (.c) to EUC-JP before compilation, but only on GCC.
# This is required in order to preserve debug print functionality on GCC since it
# doesn't seem to recognize EUC-JP marked files without doing this beforehand.
CONV_SOURCE_TEXT ?= 1
# If gcc is used, define the NON_MATCHING flag respectively so the files that
# are safe to be used can avoid using GLOBAL_ASM which doesn't work with gcc.
@ -57,11 +53,7 @@ endif
# Detect compiler and set variables appropriately.
ifeq ($(COMPILER),gcc)
ifeq ($(CONV_SOURCE_TEXT),1)
CC = iconv -f UTF-8 -t EUC-JP $< | mips-linux-gnu-gcc -x c -
else
CC = mips-linux-gnu-gcc $<
endif
CC := $(MIPS_BINUTILS_PREFIX)gcc
CC_OLD := $(CC)
else
ifeq ($(COMPILER),ido)
@ -107,14 +99,12 @@ OPTFLAGS := -O2
ASFLAGS := -march=vr4300 -32 -Iinclude
ifeq ($(COMPILER),gcc)
CFLAGS += -c -G 0 -nostdinc $(INC) -DNON_MATCHING=1 -DAVOID_UB=1 -mno-shared -march=vr4300 -mfix4300 -mabi=32 -mhard-float -mdivide-breaks -fno-stack-protector -fno-common -fno-zero-initialized-in-bss -mno-abicalls -fno-strict-aliasing -fno-inline-functions -fno-inline-small-functions -fno-toplevel-reorder -ffreestanding -fwrapv $(CHECK_WARNINGS) -g -mno-explicit-relocs -mno-split-addresses -funsigned-char
CFLAGS += -G 0 -nostdinc $(INC) -DNON_MATCHING=1 -DAVOID_UB=1 -mno-shared -march=vr4300 -mfix4300 -mabi=32 -mhard-float -mdivide-breaks -fno-stack-protector -fno-common -fno-zero-initialized-in-bss -mno-abicalls -fno-strict-aliasing -fno-inline-functions -fno-inline-small-functions -fno-toplevel-reorder -ffreestanding -fwrapv $(CHECK_WARNINGS) -g -mno-explicit-relocs -mno-split-addresses -funsigned-char
MIPS_VERSION := -mips3
PIPEIN =
else
# we support Microsoft extensions such as anonymous structs, which the compiler does support but warns for their usage. Surpress the warnings with -woff.
CFLAGS += -G 0 -non_shared -Xfullwarn -Xcpluscomm $(INC) -Wab,-r4300_mul -woff 649,838,712
MIPS_VERSION := -mips2
PIPEIN = $<
endif
ifeq ($(shell getconf LONG_BIT), 32)
@ -198,6 +188,8 @@ build/src/code/%.o: CC := python3 tools/asm_processor/build.py $(CC) -- $(AS) $(
build/src/overlays/%.o: CC := python3 tools/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) --
build/assets/%.o: CC := python3 tools/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) --
else
build/src/%.o: CC := $(CC) -fexec-charset=euc-jp
endif
#### Main Targets ###
@ -268,7 +260,7 @@ build/assets/text/nes_message_data_static.o: build/assets/text/message_data.enc.
build/assets/text/staff_message_data_static.o: build/assets/text/message_data_staff.enc.h
build/assets/%.o: assets/%.c
$(CC) -c $(CFLAGS) -I $(<D) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $(PIPEIN)
$(CC) -c $(CFLAGS) -I $(<D) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
$(OBJCOPY) -O binary $@ $@.bin
build/dmadata_table_spec.h: build/$(SPEC)
@ -278,25 +270,25 @@ build/src/boot/z_std_dma.o: build/dmadata_table_spec.h
build/src/dmadata/dmadata.o: build/dmadata_table_spec.h
build/src/overlays/%.o: src/overlays/%.c
$(CC) -c $(CFLAGS) -I $(<D) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $(PIPEIN)
$(CC) -c $(CFLAGS) -I $(<D) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
$(CC_CHECK) $<
$(ZAPD) bovl -eh -i $@ -cfg $< --outputpath $(@D)/$(notdir $(@D))_reloc.s $(ZAPDFLAGS)
-test -f $(@D)/$(notdir $(@D))_reloc.s && $(AS) $(ASFLAGS) $(@D)/$(notdir $(@D))_reloc.s -o $(@D)/$(notdir $(@D))_reloc.o
@$(OBJDUMP) -d $@ > $(@:.o=.s)
build/src/%.o: src/%.c
$(CC) -c $(CFLAGS) -I $(<D) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $(PIPEIN)
$(CC) -c $(CFLAGS) -I $(<D) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
$(CC_CHECK) $<
@$(OBJDUMP) -d $@ > $(@:.o=.s)
build/src/libultra/libc/ll.o: src/libultra/libc/ll.c
$(CC) -c $(CFLAGS) -I $(<D) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $(PIPEIN)
$(CC) -c $(CFLAGS) -I $(<D) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
$(CC_CHECK) $<
python3 tools/set_o32abi_bit.py $@
@$(OBJDUMP) -d $@ > $(@:.o=.s)
build/src/libultra/libc/llcvt.o: src/libultra/libc/llcvt.c
$(CC) -c $(CFLAGS) -I $(<D) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $(PIPEIN)
$(CC) -c $(CFLAGS) -I $(<D) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
$(CC_CHECK) $<
python3 tools/set_o32abi_bit.py $@
@$(OBJDUMP) -d $@ > $(@:.o=.s)