On 12/15/09, Shaun Jackman <sjack...@bcgsc.ca> wrote:
> How in make do I achieve the equivalent of
>
>  if defined(a) || defined(b)
>

You can be explicit and use two ifdefs:

tmp=0
ifdef a
 tmp=1
endif

ifdef b
 tmp=1
endif

ifeq ($(tmp),1)
 do stuff
endif

Or if you just want to see if either variable is non-empty, you can do
something like:

ifneq (,$(a)$(b))
 do stuff
endif

That will execute if either variable is non-empty.

Note that these aren't equivalent in all cases. If 'a' is empty and
b=$(a), then the first case will be true (since 'b' is defined), but
in the single ifneq test it will be false since both variables expand
to be empty. So I guess it depends on what you mean by "defined".

-Mike


_______________________________________________
Help-make mailing list
Help-make@gnu.org
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to