help-make
[Top][All Lists]
Advanced

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

switching current working directory inside a makefile


From: mangetsu
Subject: switching current working directory inside a makefile
Date: Thu, 29 May 2008 09:50:14 -0700 (PDT)

I am using the Windows port of GNU Make.

I have a program that runs over a set of diretories and generates some
output. In order for the output to be generated correctly the program needs
to be called from the root directory of the drive (the reasons for this are
complicated but the program is beyond my control, so I can't change this
behaviour).
The way I normally achieve this is to subst the root of the directory
subtree, that I want to run the program over, to a drive and then change
into that drive, before calling the program.
E.g., if I want to run it over D:\wibble\wobble, I do the following:

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

This program is a part of a process of creating the final result, and I'm
now trying to automate the process by using a make file (some steps take a
long time to run and not all steps need to be re-run each time, so a
makefiles seems the ideal way to go). I've got most of it down, but I am
having trouble running the above lines inside the make file.

'cd /D K:' executes without errors, but the next line,
'z:\tools\program.exe' is still called from the directory where the makefile
is located.

I know I can change the current working directory when calling make using
--derectory option, but the above program needs to be called several times
on different diretory trees, so using this is not an option unless I put
each call in a separate make file and call those recursively, which is not
desirable.

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

Thanks in advance,

Mangetsu
-- 
View this message in context: 
http://www.nabble.com/switching-current-working-directory-inside-a-makefile-tp17540767p17540767.html
Sent from the Gnu - Make - Help mailing list archive at Nabble.com.





reply via email to

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