-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
108 lines (93 loc) · 3.83 KB
/
Copy pathMakefile
File metadata and controls
108 lines (93 loc) · 3.83 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
.PHONY: build check run dev test clean bump-patch bump-minor bump-major update-formula release-linux release-all
LINUX_TARGET = x86_64-unknown-linux-gnu
LINUX_OUT = target/$(LINUX_TARGET)/release
PORT ?= 8000
TARGET ?=
## Build the full project (frontend + backend, debug)
build:
cd frontend && bun run build
cargo build
## Release build (frontend + backend) — use this before manual testing
release:
cd frontend && bun run build
cargo build --release
## Build release binary for Linux x86_64 using Zig cross-compiler
release-linux:
cd frontend && bun run build
cargo zigbuild --release --target $(LINUX_TARGET)
@echo ""
@echo "Linux x86_64 release binary:"
@ls -lh $(LINUX_OUT)/drift
## Build release binaries for macOS (native) and Linux x86_64 (zigbuild), then zip both
release-all:
cd frontend && bun run build
cargo build --release
cargo zigbuild --release --target $(LINUX_TARGET)
zip -j target/release/drift_macos_arm64.zip target/release/drift
zip -j $(LINUX_OUT)/drift_linux_x86_64.zip $(LINUX_OUT)/drift
@echo ""
@echo "All platform zips ready:"
@echo " target/release/drift_macos_arm64.zip"
@echo " $(LINUX_OUT)/drift_linux_x86_64.zip"
## Type-check without producing a binary
check:
cargo check
## Start the server (PORT=8000 by default)
## make run
## make run PORT=9000
## make run PORT=9000 TARGET=192.168.0.2:8000
run:
cargo run -- --port $(PORT) $(if $(TARGET),--target $(TARGET),)
## Start the frontend dev server (hot reload, proxies to Rust backend)
dev:
cd frontend && bun dev
## Run integration tests
test:
cd frontend && bun run test
## Remove build artifacts
clean:
cargo clean
## Bump the patch version (0.1.3 → 0.1.4) and update all version references
bump-patch:
@old=$$(grep '^version' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/'); \
major=$$(echo $$old | cut -d. -f1); \
minor=$$(echo $$old | cut -d. -f2); \
patch=$$(echo $$old | cut -d. -f3); \
new="$$major.$$minor.$$((patch+1))"; \
sed -i '' "s/^version = \"$$old\"/version = \"$$new\"/" Cargo.toml; \
sed -i '' "s/v$$old/v$$new/" frontend/src/App.tsx; \
sed -i '' "s/version \"$$old\"/version \"$$new\"/" Formula/drift.rb; \
echo "$$old → $$new"
## Bump the minor version (0.1.4 → 0.2.0) and update all version references
bump-minor:
@old=$$(grep '^version' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/'); \
major=$$(echo $$old | cut -d. -f1); \
minor=$$(echo $$old | cut -d. -f2); \
new="$$major.$$((minor+1)).0"; \
sed -i '' "s/^version = \"$$old\"/version = \"$$new\"/" Cargo.toml; \
sed -i '' "s/v$$old/v$$new/" frontend/src/App.tsx; \
sed -i '' "s/version \"$$old\"/version \"$$new\"/" Formula/drift.rb; \
echo "$$old → $$new"
## Bump the major version (0.1.4 → 1.0.0) and update all version references
bump-major:
@old=$$(grep '^version' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/'); \
major=$$(echo $$old | cut -d. -f1); \
new="$$((major+1)).0.0"; \
sed -i '' "s/^version = \"$$old\"/version = \"$$new\"/" Cargo.toml; \
sed -i '' "s/v$$old/v$$new/" frontend/src/App.tsx; \
sed -i '' "s/version \"$$old\"/version \"$$new\"/" Formula/drift.rb; \
echo "$$old → $$new"
## Update Formula/drift.rb SHA256 from local release zips (run after release-all, before upload).
## make update-formula
update-formula:
@mac_zip="target/release/drift_macos_arm64.zip"; \
lin_zip="$(LINUX_OUT)/drift_linux_x86_64.zip"; \
echo "Computing macOS SHA256 …"; \
mac_sha=$$(shasum -a 256 "$$mac_zip" | cut -d' ' -f1); \
echo "macOS SHA256: $$mac_sha"; \
echo "Computing Linux SHA256 …"; \
lin_sha=$$(shasum -a 256 "$$lin_zip" | cut -d' ' -f1); \
echo "Linux SHA256: $$lin_sha"; \
sed -i '' "/drift_macos_arm64\.zip/{n; s/sha256 \"[a-f0-9]*\"/sha256 \"$$mac_sha\"/;}" Formula/drift.rb; \
sed -i '' "/drift_linux_x86_64\.zip/{n; s/sha256 \"[a-f0-9]*\"/sha256 \"$$lin_sha\"/;}" Formula/drift.rb; \
echo "Formula/drift.rb updated"