-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (58 loc) · 2.86 KB
/
Copy pathMakefile
File metadata and controls
70 lines (58 loc) · 2.86 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
EXE := reckless
TARGET := $(shell rustc --print host-tuple)
RUSTFLAGS ?= -C target-cpu=native
export RUSTFLAGS
ifdef MSYSTEM
NAME := $(EXE).exe
ENV := UNIX
else ifeq ($(OS),Windows_NT)
NAME := $(EXE).exe
ENV := WINDOWS
else
NAME := $(EXE)
ENV := UNIX
endif
ifeq ($(ENV),UNIX)
PGO_MOVE := mv "target/$(TARGET)/release/$(EXE)" "$(NAME)"
else
PGO_MOVE := move /Y "target\$(TARGET)\release\$(EXE).exe" "$(NAME)"
endif
.PHONY: all no-syzygy pgo wasm x64-check checkdeps clean help
all: ## Build the engine
cargo rustc --release --bin reckless -- --emit link=$(NAME)
no-syzygy: ## Build without syzygy support
cargo rustc --release --bin reckless --no-default-features -- --emit link=$(NAME)
pgo: ## Build with profile-guided optimization
cargo pgo instrument
cargo pgo run -- bench
cargo pgo optimize
$(PGO_MOVE)
wasm: ## Build the WebAssembly target
RUSTFLAGS= rustup run nightly \
cargo build -Z build-std=panic_abort,std \
--lib --target wasm32-unknown-unknown --release --no-default-features
wasm-bindgen target/wasm32-unknown-unknown/release/reckless.wasm --target web --out-dir pkg
wasm-opt -O3 --enable-simd --enable-threads --enable-relaxed-simd \
pkg/reckless_bg.wasm -o pkg/reckless_bg.wasm
x64-check: ## Check compilation for x86-64 v1-v4
RUSTFLAGS="-C target-cpu=x86-64" cargo check --target x86_64-unknown-linux-gnu --no-default-features
RUSTFLAGS="-C target-cpu=x86-64-v2" cargo check --target x86_64-unknown-linux-gnu --no-default-features
RUSTFLAGS="-C target-cpu=x86-64-v3" cargo check --target x86_64-unknown-linux-gnu --no-default-features
RUSTFLAGS="-C target-cpu=x86-64-v4 -C target-feature=+gfni,+avx512bw,+avx512vl,+avx512vbmi,+avx512vbmi2,+avx512vnni,+avx512bitalg" cargo check --target x86_64-unknown-linux-gnu --no-default-features
checkdeps: ## Verify build dependencies are installed
@echo "-- required --"
@command -v rustc >/dev/null 2>&1 && echo " rustc ok" || (echo " rustc MISSING"; exit 1)
@command -v clang >/dev/null 2>&1 && echo " clang ok" || echo " clang MISSING (required for Syzygy; use 'make no-syzygy' to skip)"
@echo "-- pgo --"
@command -v cargo-pgo >/dev/null 2>&1 && echo " cargo-pgo ok" || echo " cargo-pgo missing (run: cargo install cargo-pgo)"
@echo "-- wasm --"
@rustup toolchain list 2>/dev/null | grep -q nightly && echo " nightly ok" || echo " nightly missing (run: rustup toolchain install nightly)"
@command -v wasm-bindgen >/dev/null 2>&1 && echo " wasm-bindgen ok" || echo " wasm-bindgen missing (run: cargo install wasm-bindgen-cli)"
@command -v wasm-opt >/dev/null 2>&1 && echo " wasm-opt ok" || echo " wasm-opt missing (install binaryen)"
clean: ## Remove build artifacts
cargo clean
rm -f "$(EXE)" "$(EXE).exe"
help: ## Show this help
@awk 'BEGIN {FS = ":.*##"} /^[a-zA-Z0-9_-]+:.*?##/ { \
printf " %-12s %s\n", $$1, $$2 \
}' $(MAKEFILE_LIST)