2022-02-25 08:54:16 +11:00
|
|
|
export CARGO_TARGET_DIR := env_var_or_default('CARGO_TARGET_DIR', justfile_directory() + "/target")
|
2022-04-25 02:07:43 +10:00
|
|
|
CLIPPY_ARGUMENTS := "-Dwarnings -Dclippy::all -Aclippy::empty-loop"
|
2022-02-25 08:54:16 +11:00
|
|
|
|
2022-02-25 08:35:02 +11:00
|
|
|
build: build-roms
|
2022-02-25 08:29:33 +11:00
|
|
|
|
2022-04-24 02:10:17 +10:00
|
|
|
build-debug:
|
2022-04-24 02:24:55 +10:00
|
|
|
just _build-debug agb
|
2022-04-24 02:10:17 +10:00
|
|
|
build-release:
|
2022-04-24 02:24:55 +10:00
|
|
|
just _build-release agb
|
2022-04-24 02:10:17 +10:00
|
|
|
clippy:
|
|
|
|
just _all-crates _clippy
|
|
|
|
|
2022-02-25 08:54:16 +11:00
|
|
|
test:
|
2022-04-24 02:10:17 +10:00
|
|
|
just _test-debug agb
|
|
|
|
just _test-debug agb-fixnum
|
2022-08-02 02:36:12 +10:00
|
|
|
just _test-debug-arm agb
|
2022-04-24 02:10:17 +10:00
|
|
|
|
|
|
|
test-release:
|
|
|
|
just _test-release agb
|
2022-08-02 02:36:12 +10:00
|
|
|
just _test-release-arm agb
|
2022-02-25 08:54:16 +11:00
|
|
|
|
2022-07-12 23:37:17 +10:00
|
|
|
doctest-agb:
|
|
|
|
(cd agb && cargo test --doc -Z doctest-xcompile)
|
|
|
|
|
2022-02-25 08:54:16 +11:00
|
|
|
clean:
|
|
|
|
just _all-crates _clean
|
|
|
|
|
2022-02-25 09:07:28 +11:00
|
|
|
run-example example:
|
|
|
|
just _build-example "{{example}}"
|
|
|
|
mgba-qt "$CARGO_TARGET_DIR/thumbv4t-none-eabi/debug/examples/{{example}}"
|
|
|
|
|
2022-02-25 09:08:36 +11:00
|
|
|
run-example-release example:
|
|
|
|
just _build-example-release "{{example}}"
|
|
|
|
mgba-qt "$CARGO_TARGET_DIR/thumbv4t-none-eabi/release/examples/{{example}}"
|
|
|
|
|
2022-02-25 09:19:25 +11:00
|
|
|
run-game game:
|
|
|
|
(cd "examples/{{game}}" && cargo run --release)
|
|
|
|
|
|
|
|
run-game-debug game:
|
|
|
|
(cd "examples/{{game}}" && cargo run)
|
|
|
|
|
2022-08-03 07:55:24 +10:00
|
|
|
check-linker-script-consistency:
|
|
|
|
find -type f -name gba.ld -print0 | xargs -0 -n1 cmp -- agb/gba.ld
|
|
|
|
find -type f -name gba_mb.ld -print0 | xargs -0 -n1 cmp -- agb/gba_mb.ld
|
|
|
|
|
|
|
|
ci: check-linker-script-consistency build-debug clippy test build-release test-release doctest-agb build-roms build-book
|
2022-02-25 08:29:33 +11:00
|
|
|
|
2022-02-25 08:35:02 +11:00
|
|
|
build-roms:
|
2022-02-25 08:29:33 +11:00
|
|
|
just _build-rom "examples/the-purple-night" "PURPLENIGHT"
|
|
|
|
just _build-rom "examples/the-hat-chooses-the-wizard" "HATWIZARD"
|
2022-07-25 06:35:28 +10:00
|
|
|
just _build-rom "examples/hyperspace-roll" "HYPERSPACE"
|
2022-02-25 08:29:33 +11:00
|
|
|
|
|
|
|
just _build-rom "book/games/pong" "PONG"
|
|
|
|
|
|
|
|
(cd examples/target && zip examples.zip examples/*.gba)
|
|
|
|
|
2022-02-25 08:36:18 +11:00
|
|
|
build-book:
|
|
|
|
(cd book && mdbook build)
|
|
|
|
|
2022-02-25 08:37:22 +11:00
|
|
|
update-lockfiles:
|
|
|
|
bash .github/scripts/update-lockfiles.sh
|
|
|
|
|
2022-06-17 09:45:26 +10:00
|
|
|
update-linker-scripts:
|
|
|
|
find -type f -name gba.ld | grep -v ./agb/gba.ld | xargs -n1 cp -v -- agb/gba.ld
|
|
|
|
find -type f -name gba_mb.ld | grep -v ./agb/gba_mb.ld | xargs -n1 cp -v -- agb/gba_mb.ld
|
|
|
|
|
2022-02-25 08:29:33 +11:00
|
|
|
_build-rom folder name:
|
|
|
|
#!/usr/bin/env bash
|
2022-02-25 08:35:02 +11:00
|
|
|
set -euxo pipefail
|
|
|
|
|
2022-02-25 08:29:33 +11:00
|
|
|
GAME_FOLDER="{{folder}}"
|
|
|
|
INTERNAL_NAME="{{name}}"
|
|
|
|
|
|
|
|
GAME_NAME="$(basename "$GAME_FOLDER")"
|
|
|
|
|
|
|
|
TARGET_FOLDER="${CARGO_TARGET_DIR:-$GAME_FOLDER/target}"
|
|
|
|
GBA_FILE="$TARGET_FOLDER/$GAME_NAME.gba"
|
|
|
|
|
2022-04-25 02:07:43 +10:00
|
|
|
(cd "$GAME_FOLDER" && cargo build --release --target thumbv4t-none-eabi && cargo clippy --release --target thumbv4t-none-eabi -- {{CLIPPY_ARGUMENTS}})
|
2022-02-25 08:29:33 +11:00
|
|
|
|
|
|
|
mkdir -p examples/target/examples
|
|
|
|
|
|
|
|
arm-none-eabi-objcopy -O binary "$TARGET_FOLDER/thumbv4t-none-eabi/release/$GAME_NAME" "$GBA_FILE"
|
|
|
|
gbafix -p "-t${INTERNAL_NAME:0:12}" "-c${INTERNAL_NAME:0:4}" -mGC "$GBA_FILE"
|
|
|
|
|
|
|
|
cp -v "$GBA_FILE" "examples/target/examples/$GAME_NAME.gba"
|
|
|
|
|
|
|
|
_all-crates target:
|
2022-04-24 02:10:17 +10:00
|
|
|
for CARGO_PROJECT_FILE in agb-*/Cargo.toml agb/Cargo.toml; do \
|
2022-02-25 08:29:33 +11:00
|
|
|
PROJECT_DIR=$(dirname "$CARGO_PROJECT_FILE"); \
|
2022-03-14 07:10:37 +11:00
|
|
|
just "{{target}}" "$PROJECT_DIR" || exit $?; \
|
2022-02-25 08:29:33 +11:00
|
|
|
done
|
|
|
|
|
2022-04-24 02:10:17 +10:00
|
|
|
_build-debug crate:
|
|
|
|
(cd "{{crate}}" && cargo build --examples --tests)
|
|
|
|
_build-release crate:
|
|
|
|
(cd "{{crate}}" && cargo build --release --examples --tests)
|
2022-02-25 08:29:33 +11:00
|
|
|
_test-release crate:
|
2022-04-24 02:10:17 +10:00
|
|
|
just _build-release {{crate}}
|
|
|
|
(cd "{{crate}}" && cargo test --release)
|
2022-08-02 02:36:12 +10:00
|
|
|
_test-release-arm crate:
|
2022-08-02 05:31:23 +10:00
|
|
|
(cd "{{crate}}" && cargo test --release --target="{{justfile_directory()+"/armv4t-none-eabi.json"}}")
|
2022-02-25 08:29:33 +11:00
|
|
|
_test-debug crate:
|
2022-04-24 02:10:17 +10:00
|
|
|
just _build-debug {{crate}}
|
|
|
|
(cd "{{crate}}" && cargo test)
|
2022-08-02 02:36:12 +10:00
|
|
|
_test-debug-arm crate:
|
2022-08-02 05:31:23 +10:00
|
|
|
(cd "{{crate}}" && cargo test --release --target="{{justfile_directory()+"/armv4t-none-eabi.json"}}")
|
2022-02-25 08:29:33 +11:00
|
|
|
_clippy crate:
|
2022-04-25 02:07:43 +10:00
|
|
|
(cd "{{crate}}" && cargo clippy --examples --tests -- {{CLIPPY_ARGUMENTS}})
|
2022-02-25 08:54:16 +11:00
|
|
|
_clean crate:
|
|
|
|
(cd "{{crate}}" && cargo clean)
|
2022-02-25 09:07:28 +11:00
|
|
|
|
|
|
|
_build-example example:
|
2022-02-25 09:08:36 +11:00
|
|
|
(cd agb && cargo build "--example={{example}}")
|
|
|
|
_build-example-release example:
|
|
|
|
(cd agb && cargo build "--example={{example}}" --release)
|