If the given variable is blank, sets its value to the provided default.
Makefile:
VAR1 =
VAR2 = 100
some-target : bmakelib.default-if-blank( VAR1,foo VAR2,bar )
@echo 👉 VAR1=$(VAR1), VAR2=$(VAR2)
Shell:
$ make some-target
👉 VAR1=foo, VAR2=100
Makefile:
some-target : bmakelib.default-if-blank( VAR1,foo )
@echo ✅ VAR1 is $(VAR1)
Shell:
$ make bmakelib.conf.default-if-blank.SILENT=no some-target
Using default value 'foo' for variable 'VAR1'.
✅ VAR1 is foo
-
Set
bmakelib.conf.default-if-blank.SILENT
to "no" to emit aninfo
message 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:
some-target : bmakelib.default-if-blank( VAR1,hello world )
Controls whether bmakelib.default-if-blank
should emit an info message when using the default
provided.
Default is "yes" which means do NOT emit. Set to "no" to make it behave otherwise.