Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a directory in a makefile

I'm using Visual Studio 2005 nmake, and I have a test makefile like this:

sometarget:
    -mkdir c:\testdir

I want to always create the directory, without having to specify 'sometarget'. For example, I can do this:

!if [if not exist c:\testdir\$(null) mkdir c:\testdir]
!endif

But that requires two lines, where I really only want to do the "-mkdir c:\testdir". If I just replace it with "-mkdir c:\testdir" I get an error from nmake - "fatal error U1034: syntax error : separator missing".

How can I always execute the mkdir, without messing about with !if [] stuff?

like image 951
Colen Avatar asked Dec 03 '22 08:12

Colen


1 Answers

I think this will work:

 -@ if NOT EXIST "dir" mkdir "dir"
like image 136
Aaron Saarela Avatar answered Jan 29 '23 06:01

Aaron Saarela