carlos / todomvc-bakeoff Public

Clone
git clone https://amadan.net/carlos/todomvc-bakeoff

Plain git — no account needed to clone.

Download

Download this file

1# todo-rust. Cargo's build output lives in .cache/target and Zig's compiled
2# libraries (musl, compiler-rt) in .cache/zig, both git-ignored; downloaded
3# crate sources stay in ~/.cargo/registry.
4SHELL := /bin/bash
5TARGET_DIR := .cache/target
6ZIG_CACHE := $(CURDIR)/.cache/zig
7ARM64 := aarch64-unknown-linux-musl
8VERSION := $(shell git rev-parse --short HEAD 2>/dev/null || echo dev)
9CARGO := source ../../scripts/env.sh && APP_VERSION=$(VERSION) CARGO_TARGET_DIR=$(TARGET_DIR) \
10 ZIG_GLOBAL_CACHE_DIR=$(ZIG_CACHE) ZIG_LOCAL_CACHE_DIR=$(ZIG_CACHE) cargo
11APP := todo-rust
12HOST := todo-rust.bfj.oncarlos.com
13MESSAGE ?= Deploy $(VERSION)
14
15.PHONY: build build-arm64 test clean clean-deps bump unbump deploy
16
17build:
18 $(CARGO) build --release --locked
19 mkdir -p dist && cp $(TARGET_DIR)/release/$(APP) dist/app
20
21build-arm64:
22 $(CARGO) zigbuild --release --locked --target $(ARM64)
23 mkdir -p dist && cp $(TARGET_DIR)/$(ARM64)/release/$(APP) dist/app-linux-arm64
24
25test:
26 $(CARGO) test --locked
27
28# Only this crate's own artifacts; compiled dependencies stay.
29clean:
30 rm -rf dist
31 $(CARGO) clean --release -p $(APP)
32 $(CARGO) clean --release --target $(ARM64) -p $(APP)
33
34# Every compiled artifact, dependencies included. Sources stay downloaded.
35clean-deps: clean
36 rm -rf $(TARGET_DIR) $(ZIG_CACHE)
37
38bump:
39 sed -i 's/^const BUMP: &str = "unbumped";/const BUMP: \&str = "bumped";/' src/app.rs
40
41unbump:
42 sed -i 's/^const BUMP: &str = "bumped";/const BUMP: \&str = "unbumped";/' src/app.rs
43
44deploy:
45 carlos deploy --account bfj --app $(APP) --target linux-arm64 --message "$(MESSAGE)" dist/app-linux-arm64
46