# todo-rust. Cargo's build output lives in .cache/target and Zig's compiled # libraries (musl, compiler-rt) in .cache/zig, both git-ignored; downloaded # crate sources stay in ~/.cargo/registry. SHELL := /bin/bash TARGET_DIR := .cache/target ZIG_CACHE := $(CURDIR)/.cache/zig ARM64 := aarch64-unknown-linux-musl VERSION := $(shell git rev-parse --short HEAD 2>/dev/null || echo dev) CARGO := source ../../scripts/env.sh && APP_VERSION=$(VERSION) CARGO_TARGET_DIR=$(TARGET_DIR) \ ZIG_GLOBAL_CACHE_DIR=$(ZIG_CACHE) ZIG_LOCAL_CACHE_DIR=$(ZIG_CACHE) cargo APP := todo-rust HOST := todo-rust.bfj.oncarlos.com MESSAGE ?= Deploy $(VERSION) .PHONY: build build-arm64 test clean clean-deps bump unbump deploy build: $(CARGO) build --release --locked mkdir -p dist && cp $(TARGET_DIR)/release/$(APP) dist/app build-arm64: $(CARGO) zigbuild --release --locked --target $(ARM64) mkdir -p dist && cp $(TARGET_DIR)/$(ARM64)/release/$(APP) dist/app-linux-arm64 test: $(CARGO) test --locked # Only this crate's own artifacts; compiled dependencies stay. clean: rm -rf dist $(CARGO) clean --release -p $(APP) $(CARGO) clean --release --target $(ARM64) -p $(APP) # Every compiled artifact, dependencies included. Sources stay downloaded. clean-deps: clean rm -rf $(TARGET_DIR) $(ZIG_CACHE) bump: sed -i 's/^const BUMP: &str = "unbumped";/const BUMP: \&str = "bumped";/' src/app.rs unbump: sed -i 's/^const BUMP: &str = "bumped";/const BUMP: \&str = "unbumped";/' src/app.rs deploy: carlos deploy --account bfj --app $(APP) --target linux-arm64 --message "$(MESSAGE)" dist/app-linux-arm64