agb/Makefile

47 lines
1.3 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-%,%,$@)
2021-03-09 10:25:08 +11:00
@mgba-qt -l 31 -d -C logToStdout=1 $<
@rm -f out/debug/$${OUTNAME}.sav
2021-03-07 04:58:59 +11:00
r-%: out/release/%.gba
@OUTNAME=$(patsubst r-%,%,$@)
2021-03-09 10:25:08 +11:00
@mgba-qt -l 31 -d -C logToStdout=1 $<
@rm -f out/release/$${OUTNAME}.sav
2021-03-07 04:58:59 +11:00
cargo-release-%: $(RUSTFILES) out/crt0.o
@OUTNAME=$(patsubst cargo-release-%,%, $@)
2021-04-04 03:24:00 +10:00
@rustup run nightly cargo build --release --target=gba.json --example=$${OUTNAME}
2021-03-07 04:58:59 +11:00
cargo-debug-%: $(RUSTFILES) out/crt0.o
@OUTNAME=$(patsubst cargo-debug-%,%, $@)
2021-04-04 03:24:00 +10:00
@rustup run nightly cargo build --target=gba.json --example=$${OUTNAME}
2021-03-07 04:58:59 +11:00
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:
2021-04-04 03:24:00 +10:00
rustup run nightly cargo clippy --target=gba.json
doc:
2021-04-04 03:24:00 +10:00
rustup run nightly cargo doc --target=gba.json