Skip to content

Commit 1fca2d0

Browse files
authored
Update build commands in README (#1083)
No functional change. Bench: 3204302
1 parent eb8335f commit 1fca2d0

2 files changed

Lines changed: 50 additions & 23 deletions

File tree

Makefile

Lines changed: 45 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,70 @@
1-
export RUSTFLAGS := -Ctarget-cpu=native
1+
EXE := reckless
2+
TARGET := $(shell rustc --print host-tuple)
23

3-
EXE := reckless
4-
TARGET_TUPLE := $(shell rustc --print host-tuple)
4+
RUSTFLAGS ?= -C target-cpu=native
5+
export RUSTFLAGS
56

67
ifdef MSYSTEM
78
NAME := $(EXE).exe
8-
ENV = UNIX
9+
ENV := UNIX
910
else ifeq ($(OS),Windows_NT)
1011
NAME := $(EXE).exe
11-
ENV = WINDOWS
12+
ENV := WINDOWS
1213
else
1314
NAME := $(EXE)
14-
ENV := UNIX
15+
ENV := UNIX
1516
endif
1617

1718
ifeq ($(ENV),UNIX)
18-
PGO_MOVE := mv "target/$(TARGET_TUPLE)/release/reckless" "$(NAME)"
19+
PGO_MOVE := mv "target/$(TARGET)/release/$(EXE)" "$(NAME)"
1920
else
20-
PGO_MOVE := move /Y "target\$(TARGET_TUPLE)\release\reckless.exe" "$(NAME)"
21+
PGO_MOVE := move /Y "target\$(TARGET)\release\$(EXE).exe" "$(NAME)"
2122
endif
2223

23-
rule:
24-
cargo rustc --release --bin reckless -- -C target-cpu=native --emit link=$(NAME)
24+
.PHONY: all no-syzygy pgo wasm x64-check checkdeps clean help
2525

26-
wasm:
27-
unset RUSTFLAGS && rustup run nightly \
26+
all: ## Build the engine
27+
cargo rustc --release --bin $(EXE) -- --emit link=$(NAME)
28+
29+
no-syzygy: ## Build without syzygy support
30+
cargo rustc --release --bin $(EXE) --no-default-features -- --emit link=$(NAME)
31+
32+
pgo: ## Build with profile-guided optimization
33+
cargo pgo instrument
34+
cargo pgo run -- bench
35+
cargo pgo optimize
36+
$(PGO_MOVE)
37+
38+
wasm: ## Build the WebAssembly target
39+
RUSTFLAGS= rustup run nightly \
2840
cargo build -Z build-std=panic_abort,std \
2941
--lib --target wasm32-unknown-unknown --release --no-default-features
3042
wasm-bindgen target/wasm32-unknown-unknown/release/reckless.wasm --target web --out-dir pkg
3143
wasm-opt -O3 --enable-simd --enable-threads --enable-relaxed-simd \
3244
pkg/reckless_bg.wasm -o pkg/reckless_bg.wasm
3345

34-
35-
x64-check:
46+
x64-check: ## Check compilation for x86-64 v1-v4
3647
RUSTFLAGS="-C target-cpu=x86-64" cargo check --target x86_64-unknown-linux-gnu --no-default-features
48+
RUSTFLAGS="-C target-cpu=x86-64-v2" cargo check --target x86_64-unknown-linux-gnu --no-default-features
3749
RUSTFLAGS="-C target-cpu=x86-64-v3" cargo check --target x86_64-unknown-linux-gnu --no-default-features
3850
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
3951

40-
pgo:
41-
cargo pgo instrument
42-
cargo pgo run -- bench
43-
cargo pgo optimize
44-
$(PGO_MOVE)
52+
checkdeps: ## Verify build dependencies are installed
53+
@echo "-- required --"
54+
@command -v rustc >/dev/null 2>&1 && echo " rustc ok" || (echo " rustc MISSING"; exit 1)
55+
@command -v clang >/dev/null 2>&1 && echo " clang ok" || echo " clang MISSING (required for Syzygy; use 'make no-syzygy' to skip)"
56+
@echo "-- pgo --"
57+
@command -v cargo-pgo >/dev/null 2>&1 && echo " cargo-pgo ok" || echo " cargo-pgo missing (run: cargo install cargo-pgo)"
58+
@echo "-- wasm --"
59+
@rustup toolchain list 2>/dev/null | grep -q nightly && echo " nightly ok" || echo " nightly missing (run: rustup toolchain install nightly)"
60+
@command -v wasm-bindgen >/dev/null 2>&1 && echo " wasm-bindgen ok" || echo " wasm-bindgen missing (run: cargo install wasm-bindgen-cli)"
61+
@command -v wasm-opt >/dev/null 2>&1 && echo " wasm-opt ok" || echo " wasm-opt missing (install binaryen)"
62+
63+
clean: ## Remove build artifacts
64+
cargo clean
65+
rm -f "$(EXE)" "$(EXE).exe"
66+
67+
help: ## Show this help
68+
@awk 'BEGIN {FS = ":.*##"} /^[a-zA-Z0-9_-]+:.*?##/ { \
69+
printf " %-12s %s\n", $$1, $$2 \
70+
}' $(MAKEFILE_LIST)

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,15 @@ To build Reckless from source, make sure you have:
6464
Once installed, you can build it with:
6565

6666
```bash
67-
cargo rustc --release -- -C target-cpu=native
68-
# ./target/release/reckless
67+
make
68+
# ./reckless
6969
```
7070

71-
To build without Syzygy tablebase support and Clang dependency, add the `--no-default-features` flag:
71+
To build without Syzygy tablebase support and Clang dependency:
7272

7373
```bash
74-
cargo rustc --release --no-default-features -- -C target-cpu=native
74+
make no-syzygy
75+
# ./reckless
7576
```
7677

7778
#### PGO builds

0 commit comments

Comments
 (0)