fetch_ml/cli/Makefile
Jeremie Fraeys 2c596038b5
refactor(cli): update build system and config for local mode
- Update Makefile with build-sqlite target matching rsync pattern
- Fix build.zig to handle SQLite assets and dataset_hash linking
- Add SQLite asset detection mirroring rsync binary detection
- Update CLI README with local mode documentation
- Restructure rsync assets into rsync/ subdirectory
- Remove obsolete files (fix_arraylist.sh, old rsync_placeholder.bin)
- Add build_rsync.sh script to fetch/build rsync from source
2026-02-20 15:50:52 -05:00

64 lines
No EOL
1.8 KiB
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 test build-rsync build-sqlite install clean help
RSYNC_VERSION ?= 3.3.0
RSYNC_SRC_BASE ?= https://download.samba.org/pub/rsync/src
RSYNC_TARBALL ?= rsync-$(RSYNC_VERSION).tar.gz
RSYNC_TARBALL_SHA256 ?=
SQLITE_VERSION ?= 3450000
SQLITE_YEAR ?= 2024
SQLITE_SRC_BASE ?= https://www.sqlite.org/2024
all: $(BINARY)
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
$(BINARY): | $(BUILD_DIR)
$(ZIG) build --release=small
prod: src/main.zig | $(BUILD_DIR)
$(ZIG) build --release=small
dev: src/main.zig | $(BUILD_DIR)
$(ZIG) build --release=fast
test:
$(ZIG) build test
build-rsync:
@RSYNC_VERSION="$(RSYNC_VERSION)" \
RSYNC_SRC_BASE="$(RSYNC_SRC_BASE)" \
RSYNC_TARBALL="$(RSYNC_TARBALL)" \
RSYNC_TARBALL_SHA256="$(RSYNC_TARBALL_SHA256)" \
bash "$(CURDIR)/scripts/build_rsync.sh"
build-sqlite:
@SQLITE_VERSION="$(SQLITE_VERSION)" \
SQLITE_YEAR="$(SQLITE_YEAR)" \
SQLITE_SRC_BASE="$(SQLITE_SRC_BASE)" \
bash "$(CURDIR)/scripts/build_sqlite.sh"
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 " test - run Zig unit tests"
@echo " build-rsync - build pinned rsync from official source into src/assets (RSYNC_VERSION=... override)"
@echo " build-sqlite - fetch SQLite amalgamation into src/assets (SQLITE_VERSION=... override)"
@echo " install - copy binary into /usr/local/bin"
@echo " clean - remove build artifacts"