[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Recursively making directories
From: |
John Graham-Cumming |
Subject: |
Re: Recursively making directories |
Date: |
Wed, 20 Sep 2006 08:33:45 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040208 Thunderbird/0.5 Mnenhy/0.6.0.104 |
Norman Wilson wrote:
After working this out I had another flash of inspiration. I can make
each directory depend on it's parent and thus do away with the -p flag
to mkdir:
%/.: | %/../.
mkdir $(@D)
However this doesn't work. So is this a bug or a feature. If it's a
feature can someone explain the rules.
Suppose that you write
foo/bar/baz: | foo/bar/.
and run it. Then the % matches against foo/bar with order-only
prerequisite foo/bar/../. which GNU make then tries to build, but it
_does not_ collapse the path and hence cannot find a rule to make that.
The other problem is that GNU Make also avoid recursing through the same
rule and hence even if you did make this 'work' (say by wrapping the
prerequisite in $$(realpath) and using second expansion) it still
wouldn't work.
I guess -p doesn't look so bad after all.
BTW. If you are interested in directory creation ideas you can read my
column in CM Basics 'Making directories in GNU Make' here:
http://www.cmcrossroads.com/content/view/6936/120/
John.
--
John Graham-Cumming
address@hidden
Home: http://www.jgc.org/
Blog: http://www.jgc.org/blog/
POPFile: http://getpopfile.org/
GNU Make Standard Library: http://gmsl.sf.net/
GNU Make Debugger: http://gmd.sf.net/
Fast, Parallel Builds: http://www.electric-cloud.com/
Sign up for my Spam and Anti-spam Newsletter
at http://www.jgc.org/
Help out in the fight against spam
http://www.spamorham.org/