jw-pkg/make/py-run.mk
Jan Lindemann 2fcda74277
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m27s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m43s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 5m0s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m16s
CI / Packaging test (push) Successful in 0s
run-success.mk: Record last successful run
Add a run-success.mk which provides a $(RUN_SUCCESS_CREATE_MARKER)
variable, and include it from run.mk and py-run.mk. If it's not overridden,
it logs the current commit to a marker file if the run succeeds. The marker
file is ignored from Git and cleaned in the context of the distclean
target.

The machinery can be customized by variables:

  RUN_SUCCESS_MARKER is the name of the marker file
  RUN_SUCCESS_RECORD_CMD is the generator for its content

For example, putting this into local.mk or jw-pkg/make/local.mk will record
the hashes of every repository in the entire workspace:

  define RUN_SUCCESS_RECORD_CMD
  make git-log-1
  make git-log-tree-1
  endef

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-09-16 18:16:17 +02:00

26 lines
623 B
Makefile

include $(JWBDIR)/make/defs.mk
include $(JWBDIR)/make/py-defs.mk
include $(JWBDIR)/make/test-guard.mk
include $(JWBDIR)/make/run-success.mk
EXE ?= $(firstword $(wildcard main.py runme.py test.py *.py))
EXE_ARGS ?=
PYTHON_RUNNER ?= $(PYTHON)
all:
install:
clean:
distclean:
test: all testability
run:
$(PYTHON_RUNNER) $(EXE) $(EXE_ARGS)
$(RUN_SUCCESS_CREATE_MARKER)
run.sh:
echo -e "#!/bin/bash\n\nexport PYTHONPATH=$(PYTHONPATH)\nset -x\nexec $(PYTHON) $(EXE)" '"$$@"' > $@.tmp
chmod 755 $@.tmp
mv $@.tmp $@
clean.py-run:
rm -rf run.sh
clean: clean.py-run