-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (44 loc) · 1.61 KB
/
Makefile
File metadata and controls
54 lines (44 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
NAME := play
APP := Play.app
ARCH := $(shell uname -m | sed 's/arm64/aarch64/')
TARGET := $(ARCH)-apple-darwin
.PHONY: setup build release-bin release install test test-ci pc bump-version
setup:
rustup show active-toolchain
prek install --install-hooks
build:
cargo build
release-bin:
cargo clean -p $(NAME) --release --target $(TARGET)
RUSTFLAGS="-Zlocation-detail=none -Zunstable-options -Cpanic=immediate-abort" \
cargo build --release \
-Z build-std=std \
-Z build-std-features= \
--target $(TARGET)
release: release-bin
mkdir -p $(APP)/Contents/MacOS
cp Info.plist $(APP)/Contents/
cp target/$(TARGET)/release/$(NAME) $(APP)/Contents/MacOS/
zip -r $(APP).zip $(APP)
install: release
unzip -o $(APP).zip -d /Applications
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f /Applications/$(APP)
test:
@OUT=$$(cargo test --quiet -- --test-threads=32 2>&1) || { echo "$$OUT"; exit 1; }
# So we don't do duplicate work (building both debug and release) in CI.
test-ci:
@OUT=$$(cargo test --release --quiet -- --test-threads=32 2>&1) || { echo "$$OUT"; exit 1; }
pc:
prek --quiet run --all-files
# Usage: make bump-version [V=x.y.z]
# Without V, increments the patch version.
bump-version:
ifndef V
$(eval OLD := $(shell sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml))
$(eval V := $(shell echo "$(OLD)" | awk -F. '{printf "%d.%d.%d", $$1, $$2, $$3+1}'))
endif
sed -i '' 's/^version = ".*"/version = "$(V)"/' Cargo.toml
cargo check --quiet 2>/dev/null
git add Cargo.toml Cargo.lock
git commit -m "bump version to $(V)"
git tag "release/$(V)"