agb/Makefile

44 lines
1.2 KiB
Makefile
Raw Normal View History

2021-03-07 04:58:59 +11:00
BINUTILS_PREFIX=arm-none-eabi-
CC=$(BINUTILS_PREFIX)as
ARCH = -mthumb-interwork -mthumb
RUSTFILES=$(shell find . -name '*.rs')
.ONESHELL:
out/debug/%.gba: cargo-debug-%
@mkdir -p $(dir $@)
@OUTNAME=$(patsubst out/debug/%.gba,%,$@)
@$(BINUTILS_PREFIX)objcopy -O binary target/gba/debug/examples/$${OUTNAME} out/debug/$${OUTNAME}.gba
@gbafix $@
out/release/%.gba: cargo-release-%
@mkdir -p $(dir $@)
@OUTNAME=$(patsubst out/release/%.gba,%,$@)
@$(BINUTILS_PREFIX)objcopy -O binary target/gba/release/examples/$${OUTNAME} out/release/$${OUTNAME}.gba
@gbafix $@
d-%: out/debug/%.gba
@OUTNAME=$(patsubst d-%,%,$@)
@mgba-qt $<
@rm -f out/debug/$${OUTNAME}.sav
2021-03-07 04:58:59 +11:00
r-%: out/release/%.gba
@OUTNAME=$(patsubst r-%,%,$@)
@mgba-qt $<
@rm -f out/release/$${OUTNAME}.sav
2021-03-07 04:58:59 +11:00
cargo-release-%: $(RUSTFILES) out/crt0.o
@OUTNAME=$(patsubst cargo-release-%,%, $@)
@rustup run nightly cargo xbuild --release --target=gba.json --example=$${OUTNAME}
cargo-debug-%: $(RUSTFILES) out/crt0.o
@OUTNAME=$(patsubst cargo-debug-%,%, $@)
@rustup run nightly cargo xbuild --target=gba.json --example=$${OUTNAME}
out/crt0.o: crt0.s interrupt_simple.s
@mkdir -p $(dir $@)
2021-03-07 04:58:59 +11:00
@$(CC) $(ARCH) -o out/crt0.o crt0.s
clippy:
rustup run nightly cargo xclippy --target=gba.json