-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
40 lines (32 loc) · 907 Bytes
/
Makefile
File metadata and controls
40 lines (32 loc) · 907 Bytes
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
VERSION := $(shell grep -m1 '^version' Cargo.toml | sed 's/.*"\(.*\)".*/\1/')
BIN := dstimer
TARGET := target/release/$(BIN)
.PHONY: build release clean
## Default: build release binary + compress with UPX
release: build upx
## Build optimized release binary
build:
cargo build --release
## Compress binary with UPX (skip on macOS)
upx: build
ifeq ($(shell uname),Darwin)
@echo "Skipping UPX on macOS (breaks code signing)"
else
@command -v upx >/dev/null 2>&1 || { echo "Error: upx not found. Install it first."; exit 1; }
upx --best --lzma $(TARGET)
endif
## Build without UPX
build-only: build
## Show binary size before/after
size: build
@echo "Before UPX:"
@ls -lh $(TARGET) | awk '{print $$5, $$9}'
@$(MAKE) upx
@echo "After UPX:"
@ls -lh $(TARGET) | awk '{print $$5, $$9}'
## Clean build artifacts
clean:
cargo clean
## Print version from Cargo.toml
version:
@echo $(VERSION)