blob: 1bce9930d3b40752df0385bc90c356a28c7d4729 (
plain)
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
|
# Settings
include prelude.mk
-include local.mk
RM_F = rm -f
RM_RF = rm -rf
ZIG = zig
# Main targets
.PHONY: all debug release watch run release format clean
all: debug release ## Check codebase and compile in debug mode
debug: ## Compile program in debug mode
@$(ZIG) build
@echo "[ZIG] zig-out"
watch: ## Watch and compile program in debug mode
@$(ZIG) build --watch
run: ## Compile and run program in debug mode
@$(ZIG) build run
release: ## Compile program in release mode
@for target in \
aarch64-linux-gnu \
aarch64-linux-musl \
aarch64-macos-none \
arm-linux-gnueabihf \
arm-linux-musleabihf \
x86_64-linux-gnu \
x86_64-linux-gnux32 \
x86_64-linux-musl \
x86_64-windows \
; \
do \
echo "[ZIG] zig-release/$${target}"; \
$(ZIG) build -p zig-release/$${target} -Dtarget=$${target} --release=small; \
done
SRCS = build.zig $(shell find src -name \*.zig)
format: ## Format source files
@echo "[FMT] $(SRCS)"
@find . -name \*.zig -exec '$(ZIG)' 'fmt' '{}' ';'
clean: ## Remove build files
@echo "[CLEAN] zig-out zig-release"
@$(RM_RF) -- zig-out zig-release
|