keep the dynamism of make in pure shell
Two mechanisms, matching what the make engine actually did:
Lazy defaults. A stack setting is a function myos_default_<VAR>, called only
when the variable has no value, and called again at every reference. That is
exactly a recursive ?=: an explicit value wins, and the default follows a
DOMAIN that a .env changes later. The prefix is what makes it safe; the first
version used a bare function named after the variable, and the test suite
caught it running /usr/bin/host for a stack group called host.
Templates. myos env-update fills a .env from the .env.dist files, expanding
${VAR} against the current values and running $(command), forward references
included.
Also fixed: the project .env now wins over /etc/conf.d/myos, which is what the
documentation claimed and the code did not.
share/make/shim.mk lets a project keep make as a front end: every myos command
becomes a target that shells out to bin/myos, and the project keeps its own
targets and its stack .mk files. It sits outside make/ because the legacy
engine globs every .mk in there.
This commit is contained in:
+3
-2
@@ -47,8 +47,9 @@ myos_normalize() {
|
||||
# shellcheck disable=SC2046 # myos_hermetic_env output is meant to be word-split
|
||||
myos_run_engine() {
|
||||
_engine=$1; _sb=$2; shift 2
|
||||
# "@make" as first arg = include mode: the project Makefile includes make/include.mk
|
||||
# and make runs from the project dir (CURDIR = project). Same for both engines.
|
||||
# "@make" as first arg = the project drives make itself: its Makefile includes
|
||||
# either the legacy engine (make/include.mk) or the shim (make/shim.mk), and
|
||||
# make runs from the project directory.
|
||||
if [ "${1:-}" = "@make" ]; then
|
||||
shift
|
||||
_out=$(cd "$_sb/wd" && env -i $(myos_hermetic_env "$_sb") MYOS_CONF=/dev/null \
|
||||
|
||||
Reference in New Issue
Block a user