If your make is GNU-make and all defined variables contain a non-whitespace character,
ifdef VAR1 && VAR2 && VAR3
can be written as
ifneq ($(and $(VAR1),$(VAR2),$(VAR3)),)
On a related note, it is likely that the function requires version 3.81 or later.
In case some certain variables can be empty strings, if we prepare the following functions:
ifndef_any_of = $(filter undefined,$(foreach v,$(1),$(origin $(v)))) ifdef_any_of = $(filter-out undefined,$(foreach v,$(1),$(origin $(v))))
then the following conditions are satisfied:
ifdef VAR1 || VAR2 ifdef VAR1 && VAR2
can be written accordingly using the call function:
ifneq ($(call ifdef_any_of,VAR1 VAR2),) ifeq ($(call ifndef_any_of,VAR1 VAR2),)
Ise Wisteria Apr 07 '11 at 19:52 2011-04-07 19:52
source share