help-make
[Top][All Lists]
Advanced

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

Re: Making directories on windows XP


From: Dave Hylands
Subject: Re: Making directories on windows XP
Date: Fri, 11 Mar 2005 09:51:28 -0800

Hi Mark,

> I'm trying to do a simple thing, make a non-existing directory, and I'm 
> having great difficulty. I'm using windows XP, the standard command 
> shell and I have cygwin installed. My make version is GNU Make 3.80. 
>
> In my directory structure, neither build, or build/vc02 exist to begin with,
> I want to create the build/vc02 directory. 

Since you're using cygwin (this also works under MinGW), you can use
the mkdir -p c:/dir/subdir. The problem is without the -p option you
would need to do

mkdir c:/mj/vc++/build
mkdir c:/mj/vc++/build/vc02 

mkdir -p will automatically create all subdirectories and missing
parents, and won't complain if they already exist. Contrary to popular
belief, you don't need to change the slashes for most windows
programs, just cmd.exe. So if you're running a standalone mkdir.exe
then forward slashes will work just fine.

cmd /c mkdir c:/foo

will complain (because mkdir is a builtin in cmd.exe). If you're using
a cygwin make (which is using sh or bash) then you won't have any
troubles with the forward slashes.

I don't think I would use a rule like:

% : 

though. I've been using something like this:

mkdir_obj: $(OBJ_DIR)
.PHONY: mkdir_obj

$(OBJ_DIR):
        @echo "Making directory $(OBJ_DIR) ..."
        @mkdir -p $(OBJ_DIR)

and then adding mkdir_obj as a prerequisite for one of my psuedo
targets like this:

MyApp: mkdir_obj MyApp.exe
.PHONY: MyApp

MyApp.exe : $(OBJ_FILES)
    ....

-- 
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/




reply via email to

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