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
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to