36 lines
No EOL
1,022 B
Makefile
36 lines
No EOL
1,022 B
Makefile
# Minimal build rules for the Zig CLI (no build.zig)
|
|
|
|
ZIG ?= zig
|
|
BUILD_DIR ?= zig-out/bin
|
|
BINARY := $(BUILD_DIR)/ml
|
|
|
|
.PHONY: all prod dev install clean help
|
|
|
|
all: $(BINARY)
|
|
|
|
$(BUILD_DIR):
|
|
mkdir -p $(BUILD_DIR)
|
|
|
|
$(BINARY): src/main.zig | $(BUILD_DIR)
|
|
$(ZIG) build-exe -OReleaseSmall -fstrip -femit-bin=$(BINARY) src/main.zig
|
|
|
|
prod: src/main.zig | $(BUILD_DIR)
|
|
$(ZIG) build-exe -OReleaseSmall -fstrip -femit-bin=$(BUILD_DIR)/ml src/main.zig
|
|
|
|
dev: src/main.zig | $(BUILD_DIR)
|
|
$(ZIG) build-exe -OReleaseFast -femit-bin=$(BUILD_DIR)/ml src/main.zig
|
|
|
|
install: $(BINARY)
|
|
install -d $(DESTDIR)/usr/local/bin
|
|
install -m 0755 $(BINARY) $(DESTDIR)/usr/local/bin/ml
|
|
|
|
clean:
|
|
rm -rf $(BUILD_DIR) zig-out .zig-cache
|
|
|
|
help:
|
|
@echo "Targets:"
|
|
@echo " all - build release-small binary (default)"
|
|
@echo " prod - build production binary with ReleaseSmall"
|
|
@echo " dev - build development binary with ReleaseFast"
|
|
@echo " install - copy binary into /usr/local/bin"
|
|
@echo " clean - remove build artifacts"
|