I have a Make variable:
PASSWORD:=$(shell vault read -field=password test/password)
If vault
is not installed, make
will print make: vault: Command not found
, but continue executing the recipe. How do I make it fail and stop execution if the expression fails?
Maybe this idea should work:
For example you can create a
check:
PHONY-target which is needed by every (other) target.Explanation see here:
The
X=$(shell ls /)
doesn't work but IMHO should.Here is one approach:
In case you are intending to use a
call
function, and want to abort at one central place (so that future users ofGET_SECRET
do not forget to check e.g..SHELLSTATUS
), I found this hack practical:The parent
make
process is killed ofshell
error. See also 225542/how-to-make-a-failing-shell-command-interrupt-make and 50958731/assign-shell-output-to-variable-or-exit-terminate-makefile