-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
86 lines (69 loc) · 3.87 KB
/
Copy pathMakefile
File metadata and controls
86 lines (69 loc) · 3.87 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
PYTHON ?= python3
INSTALLER := src/install/codex_install.py
COMPILED_DIR ?= src/misc/compiled
INSTALLER_ARGS ?=
# Use `make <target> -- --dry-run` for installer-managed dry runs, for example:
# `make build-src -- --dry-run`, `make build-install -- --dry-run`, or
# `make install -- --dry-run`. This passes the flag through without triggering
# GNU Make's own dry-run mode.
# Keep Python bytecode out of the repo for all Makefile-driven Python commands.
PYTHON_PYCACHE_PREFIX ?= /tmp/codex-pycache
ifneq ($(filter --dry-run,$(MAKECMDGOALS)),)
INSTALLER_ARGS += --dry-run
endif
ifeq ($(DRY_RUN),1)
INSTALLER_ARGS += --dry-run
endif
export LC_ALL := C
export TZ := UTC
export PYTHONDONTWRITEBYTECODE := 1
export PYTHONHASHSEED := 0
export PYTHONPYCACHEPREFIX := $(PYTHON_PYCACHE_PREFIX)
export PYTHONPATH := $(CURDIR)/src/python
PYTHON_ENV := LC_ALL=C TZ=UTC PYTHONPATH=$(CURDIR)/src/python PYTHONDONTWRITEBYTECODE=1 PYTHONHASHSEED=0 PYTHONPYCACHEPREFIX=$(PYTHON_PYCACHE_PREFIX)
.PHONY: preflight build-src build-install install runtime runtime-home runtime-skills runtime-instructions vars-init vars-reset nuke --dry-run
preflight:
@printf "[make] preflight -> validating installer inputs, runtime contracts, and Python bytecode outputs\n"
$(PYTHON_ENV) $(PYTHON) $(INSTALLER) preflight
$(PYTHON_ENV) $(PYTHON) -m compileall src tests
build-src:
@printf "[make] build-src -> building source artifacts and patched schema\n"
$(PYTHON_ENV) $(PYTHON) $(INSTALLER) build-src $(INSTALLER_ARGS)
build-install:
@printf "Confirm 'make build-install' will build and apply runtime changes. Continue? [y/N] "; \
read -r confirm; \
case "$$confirm" in [yY]|[yY][eE][sS]) ;; *) printf "Aborted.\n"; exit 1 ;; esac
@printf "[make] build-install -> building from source and installing runtime assets\n"
$(PYTHON_ENV) $(PYTHON) $(INSTALLER) build-install --compiled-dir $(COMPILED_DIR) $(INSTALLER_ARGS)
install:
@printf "Confirm 'make install' will install dependencies, refresh runtime assets, and replace managed files in place. Continue? [y/N] "; \
read -r confirm; \
case "$$confirm" in [yY]|[yY][eE][sS]) ;; *) printf "Aborted.\n"; exit 1 ;; esac
@printf "[make] install -> installing dependencies and packaged runtime assets\n"
$(PYTHON_ENV) $(PYTHON) $(INSTALLER) install --compiled-dir $(COMPILED_DIR) $(INSTALLER_ARGS)
runtime:
@printf "[make] runtime -> refreshing managed runtime assets without dependency installation\n"
$(PYTHON_ENV) $(PYTHON) $(INSTALLER) runtime --compiled-dir $(COMPILED_DIR) $(INSTALLER_ARGS)
runtime-home:
@printf "[make] runtime-home -> refreshing runtime-home pack, agents, instructions, and system config\n"
$(PYTHON_ENV) $(PYTHON) $(INSTALLER) runtime-home --compiled-dir $(COMPILED_DIR) $(INSTALLER_ARGS)
runtime-skills:
@printf "[make] runtime-skills -> refreshing skills, plugins, marketplace, and system skill bundles\n"
$(PYTHON_ENV) $(PYTHON) $(INSTALLER) runtime-skills --compiled-dir $(COMPILED_DIR) $(INSTALLER_ARGS)
runtime-instructions:
@printf "[make] runtime-instructions -> refreshing instruction assets and rendered instruction paths\n"
$(PYTHON_ENV) $(PYTHON) $(INSTALLER) runtime-instructions --compiled-dir $(COMPILED_DIR) $(INSTALLER_ARGS)
# Standalone env refresh/reset targets. Install, runtime, and nuke manage their
# own environment flows directly and do not route through these targets.
vars-init:
$(PYTHON_ENV) $(PYTHON) $(INSTALLER) vars-init --compiled-dir $(COMPILED_DIR)
vars-reset:
$(PYTHON_ENV) $(PYTHON) $(INSTALLER) vars-reset --compiled-dir $(COMPILED_DIR)
nuke:
@printf "Confirm 'make nuke' will remove runtime state. Continue? [y/N] "; \
read -r confirm; \
case "$$confirm" in [yY]|[yY][eE][sS]) ;; *) printf "Aborted.\n"; exit 1 ;; esac
@printf "[make] nuke -> removing runtime state and managed shell exports while preserving secret-tool tokens\n"
$(PYTHON_ENV) $(PYTHON) $(INSTALLER) nuke --compiled-dir $(COMPILED_DIR) $(INSTALLER_ARGS)
--dry-run:
@: