bmakelib.default-if-blank
If the given variable is blank, sets its value to the provided default.
Example 1
Makefile:
VAR1 =
VAR2 = 100
some-target : bmakelib.default-if-blank( VAR1,foo VAR2,bar )
@echo 👉 VAR1=$(VAR1), VAR2=$(VAR2)
Shell:
Example 2
Makefile:
Shell:
$ make bmakelib.conf.default-if-blank.SILENT=no some-target
Using default value 'foo' for variable 'VAR1'.
✅ VAR1 is foo
Notes:
-
Set
bmakelib.conf.default-if-blank.SILENTto "no" to emit aninfomessage when using the default value. -
Currently there's no way to pass a value which contains spaces for a variable. That is, the following will have undesired effects:
bmakelib.conf.default-if-blank.SILENT
Controls whether bmakelib.default-if-blank should emit an info message when using the default
provided.
Precedence:
1. bmakelib.conf.default-if-blank.SILENT (Make variable)
2. BMAKELIB_CONF_DEFAULT_IF_BLANK_SILENT (environment variable)
3. yes (default)