src/db/sqlite.sx declares the vendored amalgamation as a named '#import c' unit (pinned defines + -O2 + #source); every #foreign binding resolves against it with UNPREFIXED sqlite3_* names. sx compiles the unit through its content-addressed object cache — once per checkout — links the objects into 'sx build' binaries, and loads them as a priority symbol target under 'sx run', so the OS libsqlite3 can never shadow the vendored copy (the version pin in sqlite_smoke proves it). Retired: the Makefile vendor targets (cc -> .a + jit/.dylib), the GENERATED dist_sqlite3_* rename.h (the JIT no longer resolves program-owned symbols through the process images, so the rename's reason is gone), and the -L plumbing in make build + tests/run.sh. make test 22/22; otool -L build/dist carries no libsqlite3.
46 lines
1.7 KiB
Makefile
46 lines
1.7 KiB
Makefile
# distribution — build/test gate.
|
|
#
|
|
# The sx compiler lives in a separate repo; locate it via SX (overridable):
|
|
# make build SX=/path/to/sx
|
|
SX ?= /Users/agra/projects/sx/zig-out/bin/sx
|
|
|
|
BUILD_DIR := build
|
|
|
|
# Programs compiled by `make build`: the smoke program and the `dist`
|
|
# product entry point. Further entry points under src/ get added here as
|
|
# they land.
|
|
#
|
|
# The vendored SQLite (vendor/sqlite/) is part of the PROGRAM, not the
|
|
# build system: src/db/sqlite.sx declares it as a named `#import c` unit
|
|
# (pinned defines + -O2 + #source), so sx compiles and links it through
|
|
# its content-addressed object cache (.sx-cache/) — once per checkout.
|
|
# `sx build` links the unit's objects into the binary; `sx run` loads
|
|
# them as a priority symbol target the OS libsqlite3 cannot shadow.
|
|
SMOKE := tests/smoke.sx
|
|
DIST := src/dist.sx
|
|
|
|
.PHONY: build test publish-example clean
|
|
|
|
# Compile the product sources (and the smoke program) without running.
|
|
build:
|
|
@mkdir -p $(BUILD_DIR)
|
|
$(SX) build -o $(BUILD_DIR)/smoke $(SMOKE)
|
|
$(SX) build -o $(BUILD_DIR)/dist $(DIST)
|
|
|
|
# Run the test runner over every tests/**/*.sx. Exits non-zero on any
|
|
# failure. Depends on `build` so the CLI acceptance test (tests/cli_*.sx)
|
|
# finds a fresh `build/dist` to drive.
|
|
test: build
|
|
@SX="$(SX)" ./tests/run.sh
|
|
|
|
# End-to-end local publish of examples/dist.json into a fresh .sx-tmp/
|
|
# store, emitting the machine-readable JSON result on stdout. Depends on
|
|
# `build` so build/dist exists; the store is reset first so re-runs don't
|
|
# collide on the release id.
|
|
publish-example: build
|
|
@rm -rf .sx-tmp/publish-example
|
|
./$(BUILD_DIR)/dist ci publish --manifest examples/dist.json --local-store .sx-tmp/publish-example --json
|
|
|
|
clean:
|
|
@rm -rf $(BUILD_DIR) .sx-cache
|