diff --git a/Makefile b/Makefile index bfd78b903..cf699344f 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,10 @@ IRIX_ROOT := tools/irix/root ifeq ($(shell type mips-linux-gnu-ld >/dev/null 2>/dev/null; echo $$?), 0) TOOLCHAIN := mips-linux-gnu +else ifeq ($(shell type mips64-linux-gnu-ld >/dev/null 2>/dev/null; echo $$?), 0) + TOOLCHAIN := mips64-linux-gnu +else ifeq ($(shell type mips-elf-ld >/dev/null 2>/dev/null; echo $$?), 0) + TOOLCHAIN := mips-elf else TOOLCHAIN := mips64-elf endif @@ -297,7 +301,7 @@ $(B_DIR)/stage1.bin: $(B_DIR)/stage1.elf all: $(UCODE_BIN_FILES) $(ASSET_O_FILES) rom: $(UCODE_BIN_FILES) $(B_DIR)/ucode/gamezips.bin $(ASSET_O_FILES) - tools/buildrom + TOOLCHAIN=$(TOOLCHAIN) tools/buildrom tools/checksum build/ntsc-final/pd.z64 --write clean: diff --git a/tools/buildrom b/tools/buildrom index 1980b0300..8cd2296fe 100755 --- a/tools/buildrom +++ b/tools/buildrom @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +import os import re import subprocess @@ -116,7 +117,12 @@ def zip(filename): return subprocess.check_output(['tools/rarezip', filename]) def getlinkervariable(varname): - objdump = subprocess.check_output(['mips64-elf-objdump', 'build/ntsc-final/stage1.elf', '-t']).decode('utf-8') + if 'TOOLCHAIN' in os.environ: + cmd = '%s-objdump' % os.environ['TOOLCHAIN'] + else: + cmd = 'mips64-elf-objdump' + + objdump = subprocess.check_output([cmd, 'build/ntsc-final/stage1.elf', '-t']).decode('utf-8') matches = re.findall(r'^([0-9a-f]+) .*? %s$' % varname, objdump, re.MULTILINE) return int(matches[0], 16)