help-make
[Top][All Lists]
Advanced

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

Re: folder deps


From: Noel Yap
Subject: Re: folder deps
Date: Wed, 29 Jun 2005 18:03:39 -0400
User-agent: Mozilla Thunderbird 0.5 (Windows/20040212)

Have you tried using order dependencies?  For example:

%/.:
        mkdir -p $@

$(MY_FILE): $(dirname $(MY_FILE))/.


HTH,
Noel

Dan Oelke wrote:

Adam,

I ran into almost the same problem.
I had directories that I wanted the makefile to generate, but if I made the things in the directories dependent on the directories then I was constantly (and needlessly) rebuilding the world.

I *just* solved it by not making those things in the directories dependent on the directory itself. Instead I just force a creation of the directory every time make is invoked by using := and $(shell). mkdir failures are silently ignored. For a small number of directories this isn't a big performance hit. The only thing that worries me is silently ignoring the mkdir failures. I ignore them because it fails once the directory is already there.
Thanks to John Grahm-Cumming for writing up the idea of using := and shell.

Using your example - it would now look something like this.

       # Create folders.
       #$(INTDIR) $(OUTDIR):
       #        mkdir -p $@
    DUMMY := $(shell mkdir -p $(INTDIR) 2>&1)
    DUMMY := $(shell mkdir -p $(OUTDIR) 2>&1)

       # Run definitions through the encoder.
$(TARGET): $(OUTDIR) $(ENCODER) @echo "Generating Output..."
               $(ENCODER) gen.def $(OUTDIR)


Hope this helps.


_______________________________________________
Help-make mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-make




reply via email to

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