-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
87 lines (75 loc) · 3.53 KB
/
Makefile
File metadata and controls
87 lines (75 loc) · 3.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Make targets are invoked as `make <target>`.
# A target is either:
# - a real file to be built, or
# - a label (a "phony" target) that always runs a recipe.
#
# This Makefile is a thin wrapper around the repo's Python entrypoints.
# Every Python invocation pins the repo root on `sys.path` via `PYTHONPATH`
# (rather than relying on shell activation or python aliases).
.DEFAULT_GOAL := test
# Toolchain inputs.
SWIFT ?= swift
REPO_ROOT := $(abspath $(CURDIR))
# Prefer the repo venv python if it exists; allow override via `make PYTHON=...`.
# `VENV_PY` is the concrete `.venv` interpreter path; `PYTHON` is what recipes run.
VENV_PY := $(REPO_ROOT)/.venv/bin/python
ifeq ($(wildcard $(VENV_PY)),)
PYTHON ?= python3
else
PYTHON ?= $(VENV_PY)
endif
# Phony targets always run (even if a same-named file exists).
.PHONY: test ci validate swift clean build carton-refresh venv-check cold-start forward-build
# `make` runs `test` by default (see .DEFAULT_GOAL).
test: ci
# Unified "run everything we expect locally": CARTON build + pytest + Swift build.
ci:
@echo "Running unified CI harness..."
PYTHONPATH=$(REPO_ROOT) SWIFT=$(SWIFT) $(PYTHON) -m integration.ci
# Sanity-check the repo-local virtualenv.
# This is a fast failure that catches "missing venv" and "wrong interpreter"
# before running slower harnesses.
venv-check:
@if [ ! -x "$(VENV_PY)" ]; then \
echo "missing venv interpreter: $(VENV_PY)"; \
echo "expected a repo-local virtualenv at: $(REPO_ROOT)/.venv"; \
exit 2; \
fi
@echo "venv python: $(VENV_PY)"; \
PYTHONPATH=$(REPO_ROOT) $(VENV_PY) -c "import sys; print('sys.executable:', sys.executable); print('sys.version:', sys.version.replace('\\n',' '))"
@PYTHONPATH=$(REPO_ROOT) $(VENV_PY) -c "import pawl, integration; print('import: ok (pawl, integration)')"
# Historical alias for `ci`. The Swift module cache env vars are kept here so
# the Swift build is reproducible even when invoked outside `integration.ci`.
build:
@echo "Running Python tests and Swift build..."
CLANG_MODULE_CACHE_PATH=$(CURDIR)/integration/carton/runtime/graph/.module-cache \
SWIFTPM_MODULECACHE_OVERRIDE=$(CURDIR)/integration/carton/runtime/graph/.module-cache \
PYTHONPATH=$(REPO_ROOT) SWIFT=$(SWIFT) $(PYTHON) -m integration.ci
# Optional subtargets to run pieces directly.
# `validate` runs the Python test harness only (pytest).
validate:
PYTHONPATH=$(REPO_ROOT) $(PYTHON) -c "from integration import ci; ci.run_python_harness()"
# `swift` runs the Swift graph build only.
swift:
PYTHONPATH=$(REPO_ROOT) SWIFT=$(SWIFT) $(PYTHON) -c "from integration import ci; ci.run_swift_build()"
# Refresh the CARTON bundle/claims surfaces (contract refresh).
carton-refresh:
PYTHONPATH=$(REPO_ROOT) $(PYTHON) -m integration.carton build --promote
# Build the forward compiler (container_profile).
# Requires: cmake, nlohmann-json, argp-standalone (via Homebrew).
forward-build:
@echo "Building forward compiler (container_profile)..."
@mkdir -p $(REPO_ROOT)/pawl/forward/build
@cd $(REPO_ROOT)/pawl/forward/build && cmake ../src && make
@echo "Built: pawl/forward/build/bin/container_profile"
# Cold start: first CI run from a fresh checkout.
# Order: venv → forward compiler → test harness.
# See COLD-START.md for full walkthrough.
cold-start: venv-check forward-build
@echo "Running cold-start CI..."
PYTHONPATH=$(REPO_ROOT) SWIFT=$(SWIFT) $(PYTHON) -m integration.ci
@echo ""
@echo "Cold start complete. See COLD-START.md sections 3-6 for optional next steps:"
@echo " - Kernel extraction (Ghidra)"
@echo " - Runtime readiness (PolicyWitness)"
@echo " - Probe farm execution"