Last active
September 26, 2020 10:27
-
-
Save rlespinasse/d20168b330e249f467c2a59054b032a9 to your computer and use it in GitHub Desktop.
guard-makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task-who-need-specific-envvar: guard-SPECIFIC_ENVVAR | |
@echo ${SPECIFIC_ENVVAR} | |
guard-%: | |
@ if [ "${${*}}" = "" ]; then \ | |
echo "Environment variable $* not set"; \ | |
exit 1; \ | |
fi | |
# $ make task-who-need-specific-envvar | |
# Environment variable SPECIFIC_ENVVAR not set | |
# make: *** [guard-SPECIFIC_ENVVAR] Error 1 | |
# $ make task-who-need-specific-envvar SPECIFIC_ENVVAR=value | |
# value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
good things. thanks very much!