delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/12/04:34:31

From: pjfarley AT dorsai DOT org (Peter J. Farley III)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Is this error due to make, bash, or me?
Date: Tue, 12 Aug 1997 03:00:16 GMT
Organization: None
Lines: 51
Message-ID: <33efcfca.2718091@news.dorsai.org>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 970811131919 DOT 7085E-100000 AT is>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> wrote:
<Snipped>
>...  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.

Mea maxima culpa!  A blatant case of not RTFM on my part.  I just
*assumed* that there weren't any "gotcha's" in DJGPP "make", and I got
the expected result of assuming out of turn.

>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.

As I said before, a complete failure to RTFM on my part.  I am
concerned, though, as to how this difference changes behavior for
ported *nix makefile's.  I will go back and do some serious RTFM
before I comment further on that aspect, though.

Thanks again for your patient answers.  They are much appreciated.

----------------------------------------------------
Peter J. Farley III (pjfarley AT dorsai DOT org)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019