jw-pkg/make/common.mk
Jan Lindemann f5249a58ef
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m32s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 5m49s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 5m13s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 5m28s
CI / Packaging test (push) Successful in 0s
common.mk: Set WHICH to command -v
defs.mk derives WHICH from the external which binary, first from a
hardcoded /usr/bin/which path and then with a `which which` fallback, while
the probes for time, ruff, pyright, and python3 call which directly.
Systems that do not ship the which package, such as minimal containers, are
left to the shell's PATH search.

Define WHICH once in common.mk as the POSIX command -v builtin and drop the
old definition from defs.mk. Route the remaining direct which calls through
$(WHICH):

- projects-dir.mk: TIME probe
- py-check.mk: PY_CHECK_RUFF and PY_CHECK_PYRIGHT probes
- py-version.mk: PYTHON lookup

command -v runs in the /bin/sh that $(shell) already uses, so the build no
longer depends on the which package. The builtin names that command -v
reports for echo, test, pwd, and printf are safe, because every use of
those variables runs through the shell, and the bash time keyword keeps the
-p output format identical to the GNU time binary.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.3.0
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-10-20 09:03:08 +02:00

18 lines
621 B
Makefile

# Common fragment for all jw-pkg-aware Makefiles. Its contents is pulled in
# - from every directory of every project
# - from the projects directory (i.e. the directory containing projects)
ifndef COMMON_MK_INCLUDED
COMMON_MK_INCLUDED = true
Q ?= @
INTERACTIVE ?= auto
ifndef WHICH
WHICH := command -v
endif
BROWSER ?= xdg-open
JWB_SCRIPT_DIR ?= $(firstword $(wildcard $(JWBDIR)/scripts $(JWBDIR)/bin) jwb-script-dir-not-found)
LIST_VCS_FILES = /bin/bash $(JWB_SCRIPT_DIR)/scm.sh ls-files
endif