help-make
[Top][All Lists]
Advanced

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

Re: .for f in ${FOO} support?


From: mcmahill
Subject: Re: .for f in ${FOO} support?
Date: Fri, 20 Sep 2002 22:41:19 -0400 (EDT)

ok. I understand.  Thanks, this is a big help.  The one piece I haven't
figured out is how to make this work correctly in a makefile fragment that
a user might include.  Ie, I'd want to put this stuff in foo.mk and users
will do

include /usr/local/share/foo.mk

but in this case foo.mk doesn't know that the top level users makefile is
called 'Makefile'.  In fact it might have been anything 
(gmake -f mymfile).  Is there anyway in GNU make to figure out what the
top makefile was so I can get that
dynamic.mk: Makefile
dependencies right?

Thanks
-Dan


On Fri, 20 Sep 2002, Paul D. Smith wrote:

> %% address@hidden writes:
> 
>   m> I'm not sure I understand what the 'auto-re-exec' feature is.  I've
>   m> scanned over the manual and nothing is jumping out at me.  Can you
>   m> elaborate a little?
> 
> GNU make will try to rebuild all makefiles it reads, both normal
> "Makefile" etc., as well as any included makefiles.  If it can rebuild
> one or more of them, it will do so then re-exec itself to re-read them.
> 
> So, if you have dynamic make rules which can't be expressed as normal
> pattern or static pattern rules, then you can write a rule whose target
> is a makefile and whose command script generates it to contain whatever
> you need (typically explicit rules).
> 
> Then, you include it and Bob's your uncle.
> 
> So...
> 
>     dynamic.mk: Makefile
>             rm -f $@
>             @for f in $(FILES); do \
>                 .... >> $@; \
>              done
> 
>     include dynamic.mk
> 
> -- 
> -------------------------------------------------------------------------------
>  Paul D. Smith <address@hidden>          Find some GNU make tips at:
>  http://www.gnu.org                      http://make.paulandlesley.org
>  "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
> 





reply via email to

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