|
From: | Elmar Kurgpold |
Subject: | Re: Checking that required variables have been set |
Date: | Wed, 25 Jun 2008 17:44:32 -0700 |
On Wed, Jun 25, 2008 at 4:13 PM, Elmar Kurgpold <address@hidden> wrote:Ah, that's because I used $(origin) to avoid expanding the variable.
> I get the same output, but now I see the problem. This code will work if the
> var is not in the include file at all, but it will ignore vars that have
> empty strings. So if you added:
>
> SOMETHING_ELSE=
>
> ...then the code below would show no error. I'll have to make sure these
> vars have a value. Almost there..
To *exactly* mimic ifndef, use this:
missing = $(foreach var,${required},$(if $(value ${var}),,${var})
Given these:
empty=
nothing=${empty}
that'll report 'empty' as missing but *won't* report 'nothing' as
missing, just like the ifndef test would.
If you want to treat both 'empty' and 'nothing' as missing, then use this:
missing = $(foreach var,${required},$(if ${${var}},,${var})
(Note that the $(value) function used by the version at top was added
in GNU make 3.80)
Philip Guenther
_______________________________________________
Help-make mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-make
[Prev in Thread] | Current Thread | [Next in Thread] |