make: use zig variable

This commit is contained in:
Pierre Tachoire
2023-09-15 15:36:28 +02:00
parent 6c2f515997
commit e5c7a57946

View File

@@ -1,3 +1,8 @@
# Variables
# ---------
ZIG := zig
# Infos
# -----
.PHONY: help
@@ -15,19 +20,19 @@ help:
-e 'p;}' Makefile | awk '{printf "\033[33m%-35s\033[0m%s\n", $$1, substr($$0,length($$1)+1)}'
# Zig commands
# $(ZIG) commands
# ------------
.PHONY: build build-release run run-release shell test bench
## Build in debug mode
build:
@printf "\e[36mBuilding (debug)...\e[0m\n"
@zig build -Dengine=v8 || (printf "\e[33mBuild ERROR\e[0m\n"; exit 1;)
@$(ZIG) build -Dengine=v8 || (printf "\e[33mBuild ERROR\e[0m\n"; exit 1;)
@printf "\e[33mBuild OK\e[0m\n"
build-release:
@printf "\e[36mBuilding (release safe)...\e[0m\n"
@zig build -Drelease-safe -Dengine=v8 || (printf "\e[33mBuild ERROR\e[0m\n"; exit 1;)
@$(ZIG) build -Doptimize=ReleaseSafe -Dengine=v8 || (printf "\e[33mBuild ERROR\e[0m\n"; exit 1;)
@printf "\e[33mBuild OK\e[0m\n"
## Run the server
@@ -38,12 +43,12 @@ run: build
## Run a JS shell in release-safe mode
shell:
@printf "\e[36mBuilding shell...\e[0m\n"
@zig build shell -Dengine=v8 || (printf "\e[33mBuild ERROR\e[0m\n"; exit 1;)
@$(ZIG) build shell -Dengine=v8 || (printf "\e[33mBuild ERROR\e[0m\n"; exit 1;)
## Test
test:
@printf "\e[36mTesting...\e[0m\n"
@zig build test -Dengine=v8 || (printf "\e[33mTest ERROR\e[0m\n"; exit 1;)
@$(ZIG) build test -Dengine=v8 || (printf "\e[33mTest ERROR\e[0m\n"; exit 1;)
@printf "\e[33mTest OK\e[0m\n"
# Install and build required dependencies commands