Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/mk/quiet.mk # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / mk / quiet.mk` 61 lines ยท 2941 bytes Raw Blame History 1 # HD-13: the Spark quiet flag as a real lock. 2 # 3 # Included by the top-level Makefile through `-include mk/*.mk`. Every make 4 # goal in omega first runs `quietlock check` while the Makefile is being read, 5 # so a build or test started by anyone (agent, script, human) stops with the 6 # marker QUIETLOCK_REFUSED and the holder's name while someone else holds the 7 # quiet flag. (make itself then exits 2; `quietlock run -- make ...` exits 75.) 8 # The holder runs its own commands as 9 # quietlock hold --owner ID --minutes N -- make 10 # which sets QUIETLOCK_HOLD so its own make passes. 11 # 12 # This is a real entry-point check, not text matching. Rules: 13 # - `make quietlock` (or `make $(OUT_DIR)/quietlock`) builds the tool without 14 # the check (bootstrap). 15 # - Any other goal builds the tool on demand (missing or older than its 16 # source) into a temp file and renames it into place, so parallel makes never 17 # run a half-written binary. 18 # - GitHub CI / another machine: no state dir means clear, so CI is unaffected. 19 # If the tool cannot be built at all: continue with a NOTICE when no quiet 20 # flag exists, refuse when one does. 21 # - No make variable skips the check. The QUIETLOCK_DIR environment variable 22 # moves the state dir (tests need it); this is a cooperative lock against 23 # accidents, not a security boundary. 24 QUIETLOCK_SRC := tools/quietlock/quietlock.c 25 QUIETLOCK_BIN := $(OUT_DIR)/quietlock 26 QUIETLOCK_CFLAGS := -std=gnu11 -Wall -Wextra -Werror -O2 -D_GNU_SOURCE 27 QUIETLOCK_BOOT_GOALS := quietlock $(QUIETLOCK_BIN) 28 29 QUIETLOCK_NEED_CHECK := 30 ifeq ($(strip $(MAKECMDGOALS)),) 31 QUIETLOCK_NEED_CHECK := 1 32 endif 33 ifneq ($(strip $(filter-out $(QUIETLOCK_BOOT_GOALS),$(MAKECMDGOALS))),) 34 QUIETLOCK_NEED_CHECK := 1 35 endif 36 37 ifeq ($(QUIETLOCK_NEED_CHECK),1) 38 QUIETLOCK_STATUS := $(shell ql='$(QUIETLOCK_BIN)'; \ 39 if [ ! -x "$$ql" ] || [ '$(QUIETLOCK_SRC)' -nt "$$ql" ]; then \ 40 { mkdir -p '$(OUT_DIR)' && $(CC) $(QUIETLOCK_CFLAGS) -o "$$ql.tmp.$$$$" '$(QUIETLOCK_SRC)' && \ 41 mv -f "$$ql.tmp.$$$$" "$$ql"; } >&2 || rm -f "$$ql.tmp.$$$$"; \ 42 fi; \ 43 if [ -x "$$ql" ]; then "$$ql" check >&2; echo $$?; \ 44 elif [ -e "$${QUIETLOCK_DIR:-$$HOME/workspace}/.spark-quiet" ]; then \ 45 echo "quietlock: QUIETLOCK_REFUSED the quietlock tool could not be built and a quiet flag exists" >&2; echo 75; \ 46 else echo "quietlock: NOTICE the quietlock tool could not be built; no quiet flag exists, continuing" >&2; echo 0; fi) 47 ifneq ($(QUIETLOCK_STATUS),0) 48 $(error QUIETLOCK_REFUSED this make run (status $(QUIETLOCK_STATUS)); see the message above. Wait for the quiet flag to clear, or run under 'quietlock hold') 49 endif 50 endif 51 52 .PHONY: quietlock quietlock-check 53 quietlock: $(QUIETLOCK_BIN) 54 55 $(QUIETLOCK_BIN): $(QUIETLOCK_SRC) 56 mkdir -p $(dir $@) 57 $(CC) $(QUIETLOCK_CFLAGS) -o $@.tmp.$$$$ $< && mv -f $@.tmp.$$$$ $@ 58 59 # Cheap goal that does nothing but pass the check (used by tests/quietlock). 60 quietlock-check: 61 @echo "quietlock: clear for this make run"