makefile to create .gba files

This commit is contained in:
lif 2024-01-14 00:30:13 -08:00
parent 83f6ffab56
commit eef96a70de
3 changed files with 39 additions and 2 deletions

2
Cargo.lock generated
View file

@ -32,7 +32,7 @@ dependencies = [
] ]
[[package]] [[package]]
name = "gba-template" name = "lsdpack-player"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"build_const", "build_const",

View file

@ -1,5 +1,5 @@
[package] [package]
name = "gba-template" name = "lsdpack-player"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"

37
Makefile Normal file
View file

@ -0,0 +1,37 @@
export PATH := $(DEVKITARM)/bin:$(PATH)
PROJECT_NAME = lsdpack-player
BUILD_TYPE := release
# or debug
BUILD_ARG =
ifeq ($(BUILD_TYPE),release)
BUILD_ARG = --$(BUILD_TYPE)
endif
CARGO_TARGET_PATH=target
TARGET=armv4t-none-eabi
ELF_OUTPUT=$(CARGO_TARGET_PATH)/$(TARGET)/$(BUILD_TYPE)/$(PROJECT_NAME)
ROM_OUTPUT=$(CARGO_TARGET_PATH)/$(PROJECT_NAME)-$(BUILD_TYPE).gba
EMU := mgba-qt -3 -C interframeBlending=1 --log-level 15
SOURCES=$(shell find src -name \*.rs)
all: $(ROM_OUTPUT)
test: $(ROM_OUTPUT)
$(EMU) $(ROM_OUTPUT)
debug: $(ROM_OUTPUT)
cp $(ELF_OUTPUT) $(ROM_OUTPUT).elf
$(EMU) $(ROM_OUTPUT).elf
$(ELF_OUTPUT): $(SOURCES) Cargo.toml linker_scripts/mono_boot.ld
cargo build $(BUILD_ARG)
$(ROM_OUTPUT): $(ELF_OUTPUT)
arm-none-eabi-objcopy -O binary $(ELF_OUTPUT) $(ROM_OUTPUT)
gbafix $(ROM_OUTPUT)
clean:
cargo clean