help-make
[Top][All Lists]
Advanced

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

Re: exception to Paul's Second Rule?


From: Robert Mecklenburg
Subject: Re: exception to Paul's Second Rule?
Date: Thu, 16 Oct 2003 14:45:11 -0600

> From: "Noel Yap" <address@hidden>
> Robert Mecklenburg wrote:
> >
> >
> >   @mkdir -p $(dir $(dir $(dir $@)))
>
> This didn't work, $(dir $(dir $@)) returns the same thing as $(dir $@).

So much for not testing my code...


> > .PRECIOUS: %.mkdir
> > %.mkdir:
> >         @mkdir -p $(dir $@)
> >         @touch $@
>
> 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.

%.o: %.c %.mkdir

So I was thinking the target would be, say, "out/bar.o".  Now, with the
"slow" version it has prereq of "out/bar.mkdir" (In the slow version we omit
the .. path component.)  Then the command script executes:

    @mkdir -p $(dir out/bar.mkdir)
    @touch out/bar.mkdir

Cheers,
Robert





reply via email to

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