make-w32
[Top][All Lists]
Advanced

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

Re: Make on XP - shell selection?


From: Eli Zaretskii
Subject: Re: Make on XP - shell selection?
Date: Sat, 20 Oct 2007 20:27:46 +0200

> From: "grischka" <address@hidden>
> Cc: <address@hidden>
> Date: Sat, 20 Oct 2007 17:08:38 +0200
> 
>     $ type makefile
>     SHELL = test.bat
>     all : ; @echo "$(SHELL)"
> 
>     $ gmake
>     "c:/tools/test.bat"
> 
> Obviously gmake resolves "test.bat" from my PATH which is wrong in 
> so far as no variable is supposed to change the value on its own.

Please suggest another way, if you can.  Whenever Make wants to use
the shell, it does this:

    shell = allocated_variable_expand_for_file ("$(SHELL)", file);

That is, it simply looks at its database of variables, and extracts
the value from there.  Unless we store there the full absolute file
name of the shell's executable when we see its definition, how will we
make sure Make uses that executable when the time comes to invoke
commands?

> Then, although SHELL now prints as "c:/tools/test.bat", gmake still 
> uses "cmd.exe" to run the 'echo' command.

Yes, values of SHELL other than the standard ones are not yet
supported in the Windows port.  Patches to support that are welcome.

> Unless someone happens to have "sh.exe" in the PATH, in which case
> it uses actually "test.bat" as shell.

These are marginal case, IMO, but I'm open to suggestions for a better
way.

> > then I don't see how Make can do better, since, unlike on Posix
> > platforms, there's no "/bin" directory on your garden-variety Windows
> > box.  So it looks along PATH, which is a reasonable thing to do, IMO.
> 
> Not really. If it's only to find "sh(.exe)" in the PATH instead of in
> "/bin" then it suffices to strip "/bin/" because then the OS can find
> it on it's own. Which makes sense of course, no matter.

It's not only for /bin/sh, it's for any program mentioned in SHELL.
And please don't forget that Windows doesn't look only along PATH when
it tries to find sh.exe, so doing what you suggest would introduce
another subtlety.





reply via email to

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