delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/12/00:45:41

From: mauch AT uni-duisburg DOT de (Michael Mauch)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Is this error due to make, bash, or me?
Date: Tue, 12 Aug 1997 02:26:17 +0200
Organization: Home, sweet home (via Gesamthochschule Duisburg)
Lines: 91
Message-ID: <5soai8$lkp$1@news-hrz.uni-duisburg.de>
References: <33ecc994 DOT 6044679 AT news DOT dorsai DOT org> <33ee1957 DOT 6811386 AT news DOT dorsai DOT org>
NNTP-Posting-Host: ppp57.uni-duisburg.de
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Sun, 10 Aug 1997 19:52:34 GMT, pjfarley AT dorsai DOT org (Peter J. Farley
III) wrote:

> Curiouser and curiouser.  I have been experimenting, and the following
> works, while my original does not.

I think it's either a problem of GNU make or a problem of you and me not
knowing how to write makefiles. Bash has nothing to do with it - the
same problem happens with plain command.com of DOS.

Your problematic lines were:

> cshell  :
>         echo ${SHELL}
>         if test -f makefile; then echo cshell; fi

This doesn't work, because make does not pass this last line to the
shell, so you changed this last line to

> 	  sh -c "if test -f makefile; then echo cshell; fi"

and everything worked fine.
You can see the same problem with command.com:

cshell  :
	echo ${COMSPEC}
	if exist makefile echo cshell

And again, prepending a `$(COMSPEC) /c ´ to this line works.

Maybe we misconfigured make in some way?

The node "execution" of make.info says:
>>>
   The program used as the shell is taken from the variable `SHELL'.
By default, the program `/bin/sh' is used.

   Unlike most variables, the variable `SHELL' is never set from the
environment.  This is because the `SHELL' environment variable is used
to specify your personal choice of shell program for interactive use.
It would be very bad for personal choices like this to affect the
functioning of makefiles.  *Note Variables from the Environment:
Environment.
<<<

I think this is part of the problem. make does not even seem to use the
SHELL variable when given on the command line (it prints it if you use
"echo ${SHELL}", but it does not actually use it for spawning the
shell). As soon as you put a line

SHELL = /bin/sh

in the makefile, it works - but only if you don't supply a SHELL=/bin/sh
on the command line. Very strange.

For command.com, it is

SHELL = c:/command.com

Ok, looking in my djgpp.env file, I have a line

SHELL=%DJDIR%/bin/sh

in the global (unnamed) section at the beginning. If I disable this
line, the makefile works fine. Because this change would affect all
DJGPP programs, I put into my djgpp.env the following lines that affect
only make and gmake:

[make]
SHELL=

[gmake]
SHELL=

Now everything works fine - but only with command.com. Even inside bash,
make passes shell commands to command.com, not to sh. I have not found a
way to change this, other than having a line "SHELL = /bin/sh" in the
makefile.

I think that this behaviour of make contradicts the statement
"Unlike most variables, the variable `SHELL' is never set from the
environment." in the make.info file.

Maybe someone else knows how to get around this problem.

Regards...
		Michael
-- 
Spammers: ask ideasexchange AT answerme DOT com for free info
about how to explode your business.
hoefner AT ddv DOT de wants to learn more about spam and UCE. Please help him.

- Raw text -


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