help-make
[Top][All Lists]
Advanced

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

Re: Using make to create directories


From: Paul Smith
Subject: Re: Using make to create directories
Date: Fri, 02 Oct 2009 09:13:44 -0400

On Fri, 2009-10-02 at 14:00 +0100, Ian Lynagh wrote:
> Hi all,
> 
> I would like to use make to create directories, something like this
> (which works):
> 
> # --------------
> default: a/b/c/
> 
> a/b/c/ : | a/b/
>       mkdir $@
> 
> a/b/ : | a/
>       mkdir $@
> 
> a/ : | ./
>       mkdir $@
> # --------------
> 
> but I don't want to have to have an explicit rule for every directory;

Why don't you just use "mkdir -p"?

        default: a/b/c/

        a/b/c/ : ; mkdir -p $@

??

To answer your question, there's no way to do that without using a
complicated expression combining $(foreach ...) and $(eval ...) and
probably a few other functions such as patsubst to turn / into space
etc.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.net
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

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