-
-
Save rebornwwp/9ba6f9446f7c30d8b349be3636eb7720 to your computer and use it in GitHub Desktop.
guard-makefile
This file contains hidden or 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