Add support for building with a custom compiler (eg. recomp)

This commit is contained in:
Ryan Dwyer 2021-01-16 23:46:33 +10:00
parent 29d86ccf7b
commit 3fba1dbfee

View File

@ -6,6 +6,8 @@ PIRACYCHECKS ?= 1
QEMU_IRIX ?= tools/irix/qemu-irix
IRIX_ROOT ?= tools/irix/root
CC ?= $(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/bin/cc
################################################################################
export ROMID
@ -280,7 +282,7 @@ $(B_DIR)/files/G%Z: $(E_DIR)/files/G%Z
# Lang
$(B_DIR)/files/lang/L%.o: src/files/lang/$(ROMID)/%.c
@mkdir -p $(B_DIR)/files/lang
$(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/bin/cc -c $(CFLAGS) $< -o $@ -O2
$(CC) -c $(CFLAGS) $< -o $@ -O2
$(B_DIR)/files/L%.elf: $(B_DIR)/files/lang/L%.o
TOOLCHAIN=$(TOOLCHAIN) tools/mksimpleelf $< $@
@ -340,10 +342,24 @@ $(B_DIR)/accessingpak.o: $(B_DIR)/accessingpak.bin
$(B_DIR)/copyright.o: $(B_DIR)/copyright.bin
TOOLCHAIN=$(TOOLCHAIN) ROMID=$(ROMID) tools/mkrawobject $< $@
$(B_DIR)/boot/%.o: src/boot/%.c
@mkdir -p $(dir $@)
/usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< | $(CC) -c $(CFLAGS) tools/asmpreproc/include-stdin.c -o $@ -O2
/usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< --post-process $@ --assembler "$(TOOLCHAIN)-as -march=vr4300 -mabi=32" --asm-prelude tools/asmpreproc/prelude.s
$(B_DIR)/lib/%.o: src/lib/%.c
@mkdir -p $(dir $@)
/usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< | $(CC) -c $(CFLAGS) tools/asmpreproc/include-stdin.c -o $@ -O2
/usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< --post-process $@ --assembler "$(TOOLCHAIN)-as -march=vr4300 -mabi=32" --asm-prelude tools/asmpreproc/prelude.s
$(B_DIR)/game/%.o: src/game/%.c
@mkdir -p $(dir $@)
/usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< | $(CC) -c $(CFLAGS) tools/asmpreproc/include-stdin.c -o $@ -O2
/usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< --post-process $@ --assembler "$(TOOLCHAIN)-as -march=vr4300 -mabi=32" --asm-prelude tools/asmpreproc/prelude.s
$(B_DIR)/%.o: src/%.c
@mkdir -p $(dir $@)
/usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< | $(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/bin/cc -c $(CFLAGS) tools/asmpreproc/include-stdin.c -o $@ -O2
/usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< --post-process $@ --assembler "$(TOOLCHAIN)-as -march=vr4300 -mabi=32" --asm-prelude tools/asmpreproc/prelude.s
$(CC) -c $(CFLAGS) $< -o $@ -O2
extract:
ROMID=$(ROMID) tools/extract