Mail Archives: djgpp/1997/08/11/06:20:44
On Sun, 10 Aug 1997, Peter J. Farley III wrote:
> Curiouser and curiouser. I have been experimenting, and the following
> works, while my original does not. I changed the directory name, too,
> in case the name "test" might be mis-interpreted:
>
> sh.exe/stest$ cat makefile
> echo :
> echo ${SHELL}
> recurs :
> make cshell SHELL=/bin/sh
> cshell :
> echo ${SHELL}
> sh -c "if test -f makefile; then echo cshell; fi"
This is the expected behavior, although it might seem
counter-intuitive at first. The Mother of All Your Problems is that
you use SHELL=/bin/sh incorrectly. The DJGPP port of Make only sets
$SHELL to the actual pathname if you put the line SHELL=/bin/sh *in
the Makefile*, like so:
SHELL=/bin/sh
echo :
echo ${SHELL}
recurs :
make cshell
cshell :
echo ${SHELL}
if test -f makefile ; then echo cshell ; fi
In this example, Make will set SHELL to h:/bin/sh.exe, and everything
will work.
However, in your original Makefile you set SHELL on the sub-make
command-line, which is entirely different. From the file README.dos
in the Make distribution:
Note that the above special handling of "SHELL=" only happens
for Makefiles; if you set $SHELL in the environment or on the
Make command line, you are expected to give the complete
pathname of the shell, including the filename extension.
Note the last part: ``including the filename extension''. You need to
say "make cshell SHELL=/bin/sh.exe", then it would have worked. The
crucial hint to the cause of your problem is that "echo ${SHELL}"
prints "/bin/sh" instead of "/bin/sh.exe". When Make tries to invoke
that program, it fails because there's no file "/bin/sh"; hence you
get "Error -1".
The reason why "sh -c" miraculously makes this work is obvious: Make
searches along the PATH for the programs it invokes, whereas it
doesn't do so for the value of $SHELL, which is supposed to be a fully
qualified pathname, including the extension.
- Raw text -