feat: add compiler installation step

- Ref: add `-debug` suffix to debug targets
- Ref: remove `-release` suffix from release targets
- Feat: add `make install` command
- Feat: add cmake variables:
  - `FZL_TESTS` for enable testing
  - `FZL_SKIP_C` to not build the compiler
  - `FZL_SKIP_VM` to not build the vm
This commit is contained in:
samsonium
2026-10-29 18:18:35 +03:00
parent a885746fdd
commit fe5fcd7b96
2 changed files with 135 additions and 113 deletions
+12 -9
View File
@@ -7,34 +7,37 @@ MAX_ITER ?= 2000000
current_time = python3 -c "import time; print(time.time())"
build:
build-debug:
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
cmake --build build
build-release:
build:
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release $(COMPARING)
cmake --build build $(COMPARING)
debug-c: build
install: build-release
cmake --install build
debug-c: build-debug
gdb --args ./build/fzc -v ${FILE}
debug-vm: build
debug-vm: build-debug
gdb --args ./build/fz ${FILE}
test-debug: build-debug
ctest --output-on-failure --test-dir build
test: build
ctest --output-on-failure --test-dir build
test-release: build-release
ctest --output-on-failure --test-dir build
bench: COMPARING=&>/dev/null
bench: build-release
bench: build
@./build/fzc -o build/benchmark.fzb $(BENCH_FILE)
@python3 scripts/benchmark.py --runs $(RUNS) --warmup $(WARMUP) \
--max-iter $(MAX_ITER) --vm ./build/fz --program build/benchmark.fzb
compare: COMPARING=&>/dev/null
compare: build-release
compare: build
@echo "=== Million sums benchmark ==="
@./build/fzc -o build/bench.fzb $(BENCH_FILE) 1>/dev/null 2>/dev/null