make-w32
[Top][All Lists]

## Re: Shell commands in makefile not working (running Windows XP)

 From: Eli Zaretskii Subject: Re: Shell commands in makefile not working (running Windows XP) Date: 13 Aug 2003 08:04:51 +0200

> Date: Tue, 12 Aug 2003 12:33:29 -0700
>
> The console makefile simply has to parse the text file of line delimited
> source file names into a variable, so it knows what files to "build". This
> should be VERY straightforward using the shell command.
>
>
>
> srcFiles = \$(shell type srcFiles.txt)
>
>
>
> that command should populate srcFiles with a series of space delimited
> filenames (since the description of shell in GNU make says that when using
> shell, all carriage returns and end of line characters are converted to
> spaces). However, subsequent echo calls show that srcFiles remains EMPTY,
> thus the shell call is not working. Another thing, even though there is no
> SHELL environment variable, 'make' sets it to sh.exe. Even if I call make
> with the "-e" argument (which ignores environmental variables) and override
> SHELL=%SystemRoot%\system32\cmd.exe, echoing \$(SHELL) still brings up
> sh.exe. This is very confusing, and I have tried everything I can think of,

You probably have a sh.exe somewhere on your PATH.  Try this:

srcFiles = \$(shell cmd.exe /c type srcFiles.txt)

Morale: on a DOS/Windows system, never assume that commands that are
built into the Windows shell can be run without invoking that shell
explicitly.

Btw, if your batch file produces the list of file names, why do you
need to go thru a temporary file srcFiles.txt instead of catching the
output of the batch file directly.  E.g., doesn't the following work
for you:

srcFiles = \$(shell cmd.exe /c NMAKE-BuildUtilityScript.bat)

?  (I'm assuming that the batch file can be modified to print the
list of file names to the standard output instead of a file.)