Quantcast
Channel: User HolyBlackCat - Stack Overflow
Viewing all articles
Browse latest Browse all 1306

Answer by HolyBlackCat for How to abort makefile if variable not set?

$
0
0

Another option:

MY_FLAG = $(error Please set this flag)

Attempting to use this variable anywhere will cause an error, unless it's overriden from the command line.

To accept environment variables as well, use ?=:

MY_FLAG ?= $(error Please set this flag)

To be clear:

  • make MY_FLAG=42 - this is a command line override, accepted by both forms.
  • MY_FLAG=42 make - this is an environment variable override, accepted by ?= and ignored by =.

Viewing all articles
Browse latest Browse all 1306

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>