help-make
[Top][All Lists]
Advanced

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

Re: forcing a rule


From: Boris Kolpackov
Subject: Re: forcing a rule
Date: Fri, 2 Apr 2004 16:37:57 +0000 (UTC)
User-agent: nn/6.6.5+RFC1522

Noel Yap <address@hidden> writes:

> .PHONY: install
> install: install/common/make/file
> 
> install/common/%: | install/common/.
> 
> install/common/.:
>       @echo create install/common
> 
> %/.:
>       @echo mkdir -p $(@)
> 
> install/common/make/%: src/make/% | install/common/make/.
>       @echo install -m 444 $(<) $(@)
> 
> src/make/file:
> 
> 
> which produces the following:
> 
> $ gmake
> mkdir -p install/common/make/.
> install -m 444 src/make/file install/common/make/file
> 
> 
> I'd like to produce:
> 
> $ gmake
> create install/common
> mkdir -p install/common/make/.
> install -m 444 src/make/file install/common/make/file
> 
> 
> without having to have:
> 
> install/common/make/.: | install/common/.
> 
> 
> Is this possible?

Sure, everything is possible ;-). Just change 

%/.:
        @echo mkdir -p $(@)

to be

%/.: | $$(dir\ %).
        @echo mkdir $(@)

Now '%/.' depends on it's subdirectory. In your case it 
would expand to 

install/common/make/.: | install/common/.

Which is what you need, right? There is a little catch, 
however. Make doesn't do double expansion in implicit
rules. If you don't mind patching your make you can find
a patch that implements double expansion here:

 http://www.kolpackov.net/projects/make/bk/

hth,
-boris






reply via email to

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