bug-make
[Top][All Lists]
Advanced

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

Re: multiple wildcards in a static pattern rule


From: Noel Yap
Subject: Re: multiple wildcards in a static pattern rule
Date: Thu, 30 Oct 2003 15:27:26 -0500

I'm not sure about your syntax.  I think you might mean:

$(ROOT)etc/dir1/%: %
        cp $< $@
        chmod 644 $@

and so on.

Anyway the way I'd go about this would be:

  $(foreach d,etc/dir1 etc/dir2 etc/dirN,$(eval $(ROOT)$(d)/%: % ; cp $< $@ && 
chmod 644 $@))

I haven't tested it, but it should at least be close to what I think you want.

HTH,
Noel
Ram Bhamidipaty wrote:
> 
> I have a series of rules like this in my Makefile:
> 
> $(ROOT)etc/dir1/%: $(ROOT)etc/dir1/%: %
>         cp $< $@
>         chmod 644 $@
> 
> $(ROOT)etc/dir2/%: $(ROOT)etc/dir2/%: %
>         cp $< $@
>         chmod 644 $@
> 
> ...
> 
> $(ROOT)etc/dirN/%: $(ROOT)etc/dirN/%: %
>         cp $< $@
>         chmod 644 $@
> 
> Is there a way to write all of these static pattern rules with one rule?
> 
> When I did a google search on this I saw that there was a patch submitted
> for that back in 1997, but there is no documentation in the make manuals
> that suggests that this feature has been incorporated into gnu make.
> 
> Thanks for any info?
> -Ram
> 
> _______________________________________________
> Bug-make mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-make

-- 
NOTICE: If received in error, please destroy and notify sender.  Sender does 
not waive confidentiality or privilege, and use is prohibited.




reply via email to

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