Skip to content

Instantly share code, notes, and snippets.

@brimston3
Created November 29, 2016 01:51
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brimston3/fc43658bdb6882ed13d942fa584dd2de to your computer and use it in GitHub Desktop.
Save brimston3/fc43658bdb6882ed13d942fa584dd2de to your computer and use it in GitHub Desktop.
Makefile env variable declaration guard w/ file existence protection
guard-%: GUARD
@ if [ -z '${${*}}' ]; then echo 'Environment variable $* not set.' && exit 1; fi
.PHONY: GUARD
GUARD:
@brimston3
Copy link
Author

A modification of http://stackoverflow.com/a/7367903/436063 to force rule evaluation even if a file named guard-VARIABLENAME exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment