[Top][All Lists]

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

Re: exception to Paul's Second Rule?

From: Noel Yap
Subject: Re: exception to Paul's Second Rule?
Date: Thu, 16 Oct 2003 16:38:49 -0400

Robert Mecklenburg wrote:
> > From: "Noel Yap" <address@hidden>
> >
> > .PRECIOUS: %/../...
> > %/../...:
> > @mkdir -p $(dir $(patsubst %/,%,$(dir $(@D))))  &&  : >> $(dir $(patsubst
> %/,%,$(dir $(@D))))$(@F)
> Is there a reason why you didn't use either of:
>   @mkdir -p $(dir $(dir $(dir $@)))

This didn't work, $(dir $(dir $@)) returns the same thing as $(dir $@).

>   @mkdir -p $(dir $(patsubst %/../...,%,$@))

I like this much better.  I'll do this.

> I haven't tried them, but I assume they work. ;-)

I'm pretty sure the second one should work.

> I don't care for the file name you've chosen! ;-)  Would something like
> ".creator" be easier on the eyes?  In fact, changing the code from the "fast
> lane" to the "slow lane" yields:

Funny, the originator of this idea was using ".created".

> .PRECIOUS: %.mkdir
> %.mkdir:
>         @mkdir -p $(dir $@)
>         @touch $@
> Now I grant you, the "cool factor" of yours is way beyond the "slow"
> version, but this one actually follows Paul's second rule at the cost of
> more files created and visible to the user.  (Not a trivial cost, I admit.)

Although this works, it doesn't work the way one would want.  Here's why:

Let's say you have:

%.o: %.c %.o/../.mkdir

When the %.mkdir rule above gets invoked for, say aoeu.o, it'll create the 
directory aoeu.o.  Definitely not what you want.  Unless I'm missing something.

> A very interesting idea!

Thanks, I wish I could take credit for it, but someone over here came up with 

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]