help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Checking that required variables have been set


From: Elmar Kurgpold
Subject: Re: Checking that required variables have been set
Date: Wed, 25 Jun 2008 17:44:32 -0700

That's it! Thank you so much, my code is much cleaner now.

Elmar

On Wed, Jun 25, 2008 at 5:28 PM, Philip Guenther <address@hidden> wrote:
On Wed, Jun 25, 2008 at 4:13 PM, Elmar Kurgpold <address@hidden> wrote:
> 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..

Ah, that's because I used $(origin) to avoid expanding the variable.
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



--
Elmar Kurgpold
Dreamsonics
address@hidden
Mobile: 415-871-5915
Fax: 509-355-8234
reply via email to

[Prev in Thread] Current Thread [Next in Thread]