help-make
[Top][All Lists]

## Re: switching current working directory inside a makefile

 From: Paul Smith Subject: Re: switching current working directory inside a makefile Date: Thu, 29 May 2008 13:07:59 -0400

```On Thu, 2008-05-29 at 09:50 -0700, mangetsu wrote:
> subst K: D:\wibble\wobble
> cd /D K:
> Z:\tools\program.exe

> I was wondering if anyone know to execute the three lines correctly
> inside a single makefile?

You really want to ask on the address@hidden list since this is a
Windows-specific issue.  Also, there are lots of different ways to build
and run GNU make on windows so please specify what you're using (cygwin,
mingw, etc. etc.)

My limited knowledge of Windows leads me to believe that the working
directory is a function of the system (or at least the login) rather
than the process, like it is on UNIX.  So, changing directories like
that SHOULD work on Windows.  But, maybe the Windows port of GNU make
has some code to make this work like UNIX.

In UNIX you would have to run both commands in the same shell, so they
would have to be on the same line.  You would probably do it something
like:

subst K: D:\wibble\wobble && cd /D K: && Z:\tools\program.exe

I don't know if "&&" works the same way in Windows; you might have to
use ";" (does that even work)?

Anyway hopefully you get the idea, and maybe someone else who knows more