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 8
This commit is contained in:
48
Makefile
48
Makefile
@@ -19,6 +19,12 @@ COMPARE ?= 1
|
||||
NON_MATCHING ?= 0
|
||||
# Build for the N64 (turn this off for ports)
|
||||
TARGET_N64 ?= 1
|
||||
# Compiler to use (ido or gcc)
|
||||
COMPILER ?= ido
|
||||
|
||||
ifeq ($(COMPILER),gcc)
|
||||
NON_MATCHING := 1
|
||||
endif
|
||||
|
||||
# Release
|
||||
|
||||
@@ -51,7 +57,7 @@ ifeq ($(VERSION),sh)
|
||||
GRUCODE_ASFLAGS := --defsym F3D_NEW=1
|
||||
TARGET := sm64.sh
|
||||
# TODO: GET RID OF THIS!!! We should mandate assets for Shindou like EU but we dont have the addresses extracted yet so we'll just pretend you have everything extracted for now.
|
||||
NOEXTRACT := 1
|
||||
NOEXTRACT := 1
|
||||
else
|
||||
$(error unknown version "$(VERSION)")
|
||||
endif
|
||||
@@ -96,6 +102,7 @@ endif
|
||||
|
||||
ifeq ($(NON_MATCHING),1)
|
||||
VERSION_CFLAGS := $(VERSION_CFLAGS) -DNON_MATCHING -DAVOID_UB
|
||||
VERSION_ASFLAGS := --defsym AVOID_UB=1
|
||||
COMPARE := 0
|
||||
endif
|
||||
|
||||
@@ -153,8 +160,12 @@ ULTRA_BIN_DIRS := lib/bin
|
||||
|
||||
GODDARD_SRC_DIRS := src/goddard src/goddard/dynlists
|
||||
|
||||
MIPSISET := -mips2
|
||||
MIPSBIT := -32
|
||||
|
||||
MIPSISET := -mips2 -32
|
||||
ifeq ($(COMPILER),gcc)
|
||||
MIPSISET := -mips3
|
||||
endif
|
||||
|
||||
ifeq ($(VERSION),eu)
|
||||
OPT_FLAGS := -O2
|
||||
@@ -166,6 +177,11 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
# Use a default opt flag for gcc
|
||||
ifeq ($(COMPILER),gcc)
|
||||
OPT_FLAGS := -O2
|
||||
endif
|
||||
|
||||
# File dependencies and variables for specific files
|
||||
include Makefile.split
|
||||
|
||||
@@ -228,6 +244,8 @@ IRIX_ROOT := tools/ido5.3_compiler
|
||||
|
||||
ifeq ($(shell type mips-linux-gnu-ld >/dev/null 2>/dev/null; echo $$?), 0)
|
||||
CROSS := mips-linux-gnu-
|
||||
else ifeq ($(shell type mips64-linux-gnu-ld >/dev/null 2>/dev/null; echo $$?), 0)
|
||||
CROSS := mips64-linux-gnu-
|
||||
else
|
||||
CROSS := mips64-elf-
|
||||
endif
|
||||
@@ -249,6 +267,11 @@ OBJDUMP := $(CROSS)objdump
|
||||
OBJCOPY := $(CROSS)objcopy
|
||||
PYTHON := python3
|
||||
|
||||
# change the compiler to gcc, to use the default, install the gcc-mips-linux-gnu package
|
||||
ifeq ($(COMPILER),gcc)
|
||||
CC := $(CROSS)gcc
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_N64),1)
|
||||
TARGET_CFLAGS := -nostdinc -I include/libc -DTARGET_N64
|
||||
CC_CFLAGS := -fno-builtin
|
||||
@@ -259,13 +282,19 @@ INCLUDE_CFLAGS := -I include -I $(BUILD_DIR) -I $(BUILD_DIR)/include -I src -I .
|
||||
# Check code syntax with host compiler
|
||||
CC_CHECK := gcc -fsyntax-only -fsigned-char $(CC_CFLAGS) $(TARGET_CFLAGS) $(INCLUDE_CFLAGS) -std=gnu90 -Wall -Wextra -Wno-format-security -Wno-main -DNON_MATCHING -DAVOID_UB $(VERSION_CFLAGS) $(GRUCODE_CFLAGS)
|
||||
|
||||
COMMON_CFLAGS = $(OPT_FLAGS) $(TARGET_CFLAGS) $(INCLUDE_CFLAGS) $(VERSION_CFLAGS) $(MIPSISET) $(GRUCODE_CFLAGS)
|
||||
|
||||
ASFLAGS := -march=vr4300 -mabi=32 -I include -I $(BUILD_DIR) $(VERSION_ASFLAGS) $(GRUCODE_ASFLAGS)
|
||||
CFLAGS = -Wab,-r4300_mul -non_shared -G 0 -Xcpluscomm -Xfullwarn -signed $(OPT_FLAGS) $(TARGET_CFLAGS) $(INCLUDE_CFLAGS) $(VERSION_CFLAGS) $(MIPSISET) $(GRUCODE_CFLAGS)
|
||||
CFLAGS = -Wab,-r4300_mul -non_shared -G 0 -Xcpluscomm -Xfullwarn -signed $(COMMON_CFLAGS) $(MIPSBIT)
|
||||
OBJCOPYFLAGS := --pad-to=0x800000 --gap-fill=0xFF
|
||||
SYMBOL_LINKING_FLAGS := $(addprefix -R ,$(SEG_FILES))
|
||||
LDFLAGS := -T undefined_syms.txt -T $(BUILD_DIR)/$(LD_SCRIPT) -Map $(BUILD_DIR)/sm64.$(VERSION).map --no-check-sections $(SYMBOL_LINKING_FLAGS)
|
||||
ENDIAN_BITWIDTH := $(BUILD_DIR)/endian-and-bitwidth
|
||||
|
||||
ifeq ($(COMPILER),gcc)
|
||||
CFLAGS := -march=vr4300 -mfix4300 -mno-shared -G 0 -mhard-float -fno-stack-protector -fno-common -I include -I src/ -I $(BUILD_DIR)/include -fno-PIC -mno-abicalls -fno-strict-aliasing -fno-inline-functions -ffreestanding -fwrapv -Wall -Wextra $(COMMON_CFLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(shell getconf LONG_BIT), 32)
|
||||
# Work around memory allocation bug in QEMU
|
||||
export QEMU_GUEST_BASE := 1
|
||||
@@ -297,6 +326,11 @@ LOADER = loader64
|
||||
LOADER_FLAGS = -vwf
|
||||
SHA1SUM = sha1sum
|
||||
|
||||
# Use Objcopy instead of extract_data_for_mio
|
||||
ifeq ($(COMPILER),gcc)
|
||||
EXTRACT_DATA_FOR_MIO := $(OBJCOPY) -O binary --only-section=.data
|
||||
endif
|
||||
|
||||
###################### Dependency Check #####################
|
||||
|
||||
BINUTILS_VER_MAJOR := $(shell $(LD) --version | grep ^GNU | sed 's/^.* //; s/\..*//g')
|
||||
@@ -339,6 +373,10 @@ $(BUILD_DIR)/include/text_strings.h: include/text_strings.h.in
|
||||
$(BUILD_DIR)/include/text_menu_strings.h: include/text_menu_strings.h.in
|
||||
$(TEXTCONV) charmap_menu.txt $< $@
|
||||
|
||||
ifeq ($(COMPILER),gcc)
|
||||
$(BUILD_DIR)/lib/src/math/%.o: CFLAGS += -fno-builtin
|
||||
endif
|
||||
|
||||
ifeq ($(VERSION),eu)
|
||||
TEXT_DIRS := text/de text/us text/fr
|
||||
|
||||
@@ -486,7 +524,7 @@ $(BUILD_DIR)/assets/mario_anim_data.c: $(wildcard assets/anims/*.inc.c)
|
||||
$(BUILD_DIR)/assets/demo_data.c: assets/demo_data.json $(wildcard assets/demos/*.bin)
|
||||
$(PYTHON) tools/demo_data_converter.py assets/demo_data.json $(VERSION_CFLAGS) > $@
|
||||
|
||||
|
||||
ifeq ($(COMPILER),ido)
|
||||
# Source code
|
||||
$(BUILD_DIR)/levels/%/leveldata.o: OPT_FLAGS := -g
|
||||
$(BUILD_DIR)/actors/%.o: OPT_FLAGS := -g
|
||||
@@ -520,6 +558,7 @@ else
|
||||
# The source-to-source optimizer copt is enabled for audio. This makes it use
|
||||
# acpp, which needs -Wp,-+ to handle C++-style comments.
|
||||
$(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,-+
|
||||
|
||||
# Add a target for build/eu/src/audio/*.copt to make it easier to see debug
|
||||
$(BUILD_DIR)/src/audio/%.acpp: src/audio/%.c
|
||||
@@ -527,6 +566,7 @@ $(BUILD_DIR)/src/audio/%.acpp: src/audio/%.c
|
||||
$(BUILD_DIR)/src/audio/%.copt: $(BUILD_DIR)/src/audio/%.acpp
|
||||
$(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/lib/copt -signed -I=$< -CMP=$@ -cp=i -scalaroptimize=1
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(NON_MATCHING),0)
|
||||
$(GLOBAL_ASM_O_FILES): CC := $(PYTHON) tools/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) --
|
||||
|
||||
Reference in New Issue
Block a user