summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Hensley <hensley.derek58@gmail.com>2024-05-26 20:01:31 -0700
committerGitHub <noreply@github.com>2024-05-26 20:01:31 -0700
commit659e2b5088eb960594844d2dd3625779c11476ca (patch)
tree73edcd131f66978d250e6b634857f3266751ac20
parentb7e5468ca16315a7e322055eff3d97fe980bbc25 (diff)
Use `gcc -E` for `cpp` (#1639)
* Fix cpp for macs? * Add comment * Move cppflags with cpp
-rw-r--r--Makefile12
-rwxr-xr-xtools/disasm/disasm.py8
2 files changed, 9 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 30a272dca..5285f4051 100644
--- a/Makefile
+++ b/Makefile
@@ -87,12 +87,6 @@ BASEROM_DIR := baseroms/$(VERSION)
BUILD_DIR := build/$(VERSION)
EXTRACTED_DIR := extracted/$(VERSION)
-CPPFLAGS += -P
-
-ifeq ($(DETECTED_OS), macos)
- CPPFLAGS += -xc++
-endif
-
#### Tools ####
ifneq ($(shell type $(MIPS_BINUTILS_PREFIX)ld >/dev/null 2>/dev/null; echo $$?), 0)
@@ -143,7 +137,11 @@ ifeq ($(RUN_CC_CHECK),0)
CC_CHECK_COMP := @:
endif
-CPP := cpp
+# The `cpp` command behaves differently on macOS (it behaves as if
+# `-traditional-cpp` was passed) so we use `gcc -E` instead.
+CPP := gcc -E
+CPPFLAGS += -P -xc -fno-dollars-in-identifiers
+
MKLDSCRIPT := tools/buildtools/mkldscript
MKDMADATA := tools/buildtools/mkdmadata
ZAPD := tools/ZAPD/ZAPD.out
diff --git a/tools/disasm/disasm.py b/tools/disasm/disasm.py
index 52c582575..9eec939ec 100755
--- a/tools/disasm/disasm.py
+++ b/tools/disasm/disasm.py
@@ -1097,10 +1097,10 @@ def find_symbols_in_rodata(section):
def asm_header(section_name: str):
return f""".include "macro.inc"
-# assembler directives
-.set noat # allow manual use of $at
-.set noreorder # don't insert nops after branches
-.set gp=64 # allow use of 64-bit general purpose registers
+/* assembler directives */
+.set noat /* allow manual use of $at */
+.set noreorder /* don't insert nops after branches */
+.set gp=64 /* allow use of 64-bit general purpose registers */
.section {section_name}