[Top][All Lists]

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

RE: Useful patch for GNUmake on Windows

From: Martin Oberhuber
Subject: RE: Useful patch for GNUmake on Windows
Date: Wed, 18 Sep 2002 16:12:34 +0200

Hi all,

following the E-Mail thread so far, I guess that I should clarify
things again. First of all, thanks to Paul: right, the SHELL 
environment variable is not honored by gmake, whereas a SHELL macro 
inside a Makefile is taken into account.

Setting the SHELL macro in the Makefile to a fixed path doesn't
make sense if you want to have a portable makefile.

What you can do is set the SHELL macro on the commandline:
   gmake SHELL=E:/Apps/gnu-win32/sh.exe myTarget

but having to do this every time is sort of cumbersome. One 
wants the make system to be intelligent enough to find the 
shell that makes most sense for it.

At this point I'd like to note that even with my patch, a SHELL 
macro inside the makefile or on the gmake commandline is still
used: the only thing I have changed is that not only the system
PATH is searched for whatever the user specified as his SHELL,
but also the directory where gmake.exe is installed. It's just
sort of implicitly adding "./" in front of the PATH.

So, the current approach is to search for "sh.exe" in the System
PATH and fallback to cmd.exe if no shell is found. This is already
pretty good. It only fails if there are multiple sh.exe on your
system and you want to be sure that the "right one" is always 
One option to make sure this works is to set the PATH correctly.
But if you are using multiple different build environments with
multiple PATH settings to different toolchains, this is cumbersome
as well (and sometimes even impossible, as in our case).

Therefore I propose to use my patch, which first searches for
sh.exe in the same directory where gmake.exe is installed.
This ensures that a user can create a proper environment
consisting of gmake.exe and sh.exe, where always the correct
shell is used.

Hope that clarifies things,

> -----Original Message-----
> From: Paul D. Smith [mailto:address@hidden
> Sent: Wednesday, September 18, 2002 16:00
> To: address@hidden
> Cc: Martin Oberhuber
> Subject: Re: Useful patch for GNUmake on Windows
> %% Earnie Boyd <address@hidden> writes:
>   eb> I'm not sure that the Windows port is any different, 
> however, doesn't
>   eb> gmake itself have a SHELL variable it honors?
> Sure.  What I mean is that make doesn't accept the value of the SHELL
> variable from the invoker's environment.  It must be set inside the
> makefile.
> What Martin is pointing out is that if SHELL is set in the makefile
> you've introduced a portability concern, if someone wants to put their
> make somewhere else...
> -- 
> --------------------------------------------------------------
> -----------------
>  Paul D. Smith <address@hidden>          Find some GNU make tips at:
>  "Please remain calm...I may be mad, but I am a 
> professional." --Mad Scientist

reply via email to

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