[Top][All Lists]

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

Re: Filtering ${.VARIABLES} ?

From: Frazer Worley
Subject: Re: Filtering ${.VARIABLES} ?
Date: Fri, 22 Jun 2007 11:01:25 -0400

The GMSL is news to me ... looks like it'll be very useful indeed ;-)

Thanks for the help fellas


On 6/22/07, Dave Korn < address@hidden> wrote:
On 22 June 2007 12:38, Frazer Worley wrote:

> VERBOSITY=                BRIEF
> PROJECT_TAG=              btc
> define dump_variable
> endef
> dumpvars:
>   $(foreach i,${.VARIABLES},\
>     $(if $(filter file,$(origin $i)),\
>       $(info $i),\
>     )\
>   )
> Problem is though - that it reports "dump_variable" also ... which is a
> user defined macro rather than a simple variable.

  A macro IS a simple variable.  There is absolutely no difference between the
two.  The multi-line define syntax can be used to define a simple variable and
a function can be defined on a single line using '=' deferred assignment, and
in your example above you could write $(call VERBOSITY) just as validly as
$(call dump_variable)

> So I'd like to filter out all macros and just report the variables. I've
> tried using a $(filter ...) based
> on the variable name - macros are always lowercase named - but the filter
> doesn't seem to support
> regexps. .... so that doesn't work.

  Ah, so although there is no qualitative difference between functions and
variables, you have a naming scheme you are using that will allow you to
distinguish them.  Then you can make it work: you need a $(lower ...)
function, and you need to do a $(foreach var,$(.VARIABLES},...), and in the
foreach you need to test if $(lower $(var)) and $(var) are different or the
same, and only append the text of $(var) if they're not the same.  You should
be able to find functions in GMSL that'll help you with this.

Can't think of a witty .sigline today....

reply via email to

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