summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorEllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com>2021-09-25 14:36:15 +0100
committerGitHub <noreply@github.com>2021-09-25 09:36:15 -0400
commitf77cfb9020da043b2a104f9637a0d7873cfac6c9 (patch)
treec7b6afb5f1b7fd892670cc6b8de501dbb46e49f5 /Makefile
parent9e4d51fb9ffc676607f6eb793fb21ef47c891ce5 (diff)
Remove `.mdebug` sections by default (#313)
* Add RM_MDEBUG to makefile * Add to diff settings to allow use of --source
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile13
1 files changed, 13 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 21d954572..0d0326231 100644
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,8 @@ COMPARE ?= 1
NON_MATCHING ?= 0
# If ORIG_COMPILER is 1, compile with QEMU_IRIX and the original compiler
ORIG_COMPILER ?= 0
+# Keep .mdebug section in build
+KEEP_MDEBUG ?= 0
ifeq ($(NON_MATCHING),1)
CFLAGS := -DNON_MATCHING
@@ -68,6 +70,12 @@ LD := $(MIPS_BINUTILS_PREFIX)ld
OBJCOPY := $(MIPS_BINUTILS_PREFIX)objcopy
OBJDUMP := $(MIPS_BINUTILS_PREFIX)objdump
+ifeq ($(KEEP_MDEBUG),0)
+ RM_MDEBUG = $(OBJCOPY) --remove-section .mdebug $@
+else
+ RM_MDEBUG = @:
+endif
+
# Check code syntax with host compiler
CHECK_WARNINGS := -Wall -Wextra -Wno-format-security -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-variable -Wno-missing-braces -Wno-int-conversion -Wno-unused-but-set-variable -Wno-unused-label
CC_CHECK := gcc -fno-builtin -fsyntax-only -funsigned-char -std=gnu90 -D _LANGUAGE_C -D NON_MATCHING -Iinclude -Isrc -Iassets -Ibuild -include stdarg.h $(CHECK_WARNINGS)
@@ -236,6 +244,7 @@ init:
build/assets/%.o: assets/%.c
$(CC) -I build/ -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
+ $(RM_MDEBUG)
#### Various Recipes ####
@@ -263,23 +272,27 @@ build/src/overlays/%.o: src/overlays/%.c
# the following is moved to a separate rule that is only run once when all the required objects have been compiled.
$(ZAPD) bovl -eh -i $@ -cfg $< --outputpath $(@D)/$(notdir $(@D))_reloc.s
(test -f $(@D)/$(notdir $(@D))_reloc.s && $(AS) $(ASFLAGS) $(@D)/$(notdir $(@D))_reloc.s -o $(@D)/$(notdir $(@D))_reloc.o) || true
+ $(RM_MDEBUG)
build/src/%.o: src/%.c
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
$(CC_CHECK) $<
@$(OBJDUMP) -d $@ > $(@:.o=.s)
+ $(RM_MDEBUG)
build/src/libultra/libc/ll.o: src/libultra/libc/ll.c
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
$(CC_CHECK) $<
python3 tools/set_o32abi_bit.py $@
@$(OBJDUMP) -d $@ > $(@:.o=.s)
+ $(RM_MDEBUG)
build/src/libultra/libc/llcvt.o: src/libultra/libc/llcvt.c
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
$(CC_CHECK) $<
python3 tools/set_o32abi_bit.py $@
@$(OBJDUMP) -d $@ > $(@:.o=.s)
+ $(RM_MDEBUG)
# Build C files from assets
build/%.inc.c: %.png