Created
March 1, 2024 10:48
-
-
Save Integralist/a4418dc1fc7940e2ee77183461e6ed9d to your computer and use it in GitHub Desktop.
[Check if Makefile target is called with a required input arg] #Makefile #make
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
# Check that given variables are set and all have non-empty values, | |
# die with an error otherwise. | |
# | |
# PARAMS: | |
# 1. Variable name(s) to test. | |
# 2. (optional) Error message to print. | |
# | |
# EXAMPLE: | |
# @:$(call check_defined, ENV_REGION, you must set ENV_REGION=usc1|awsuse2) | |
# | |
check_defined = \ | |
$(strip $(foreach 1,$1, \ | |
$(call __check_defined,$1,$(strip $(value 2))))) | |
__check_defined = \ | |
$(if $(value $1),, \ | |
$(error Undefined $1$(if $2, ($2))$(if $(value @), \ | |
required by target `$@'))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment