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: grischka
Subject: Re: Make on XP - shell selection?
Date: Sun, 21 Oct 2007 14:25:14 +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?

I don't see the problem. If make needs to examine or adjust the shell
filename for technical reasons then it much better does that with the
expanded result of SHELL. It can look for it in the PATH if neccessary,
and decide from the filename whether it is comspec or sh-like or
non-standard.

Basically, in job.c:construct_command_argv:

    shell = allocated_variable_expand_for_file ("$(SHELL)", file);
    #ifdef WINDOWS32
      w32_adjust_shell_and_set_mode_flags (&shell);
    #endif

Then SHELL can be a normal variable again except that it is initialized
at startup to some default. Just the same as with the unixy port.

We can initialize SHELL either fixed to COMSPEC, or fixed to "sh",
optionally from the environment (SHELL or MAKESHELL), or based on PATH
search as currently (which I think is evil, though).

As 'default shell' on windows is a political question, I can only 
vote. I think a good compromise is COMSPEC as default, and MAKESHELL 
from the environment if set. It means dependency on environment too, 
but at least if you set it you know you have set it, and it does not 
change if you change PATH. So there is less surprise.

As sh is not available by default on windows systems I think it is
reasonable that someone who knows where to find and how to use a
native "sh" port, also should not have problems to set MAKESHELL once.
(we don't talk about cygwin/msys here, these toolchains configure for
a unixy make that uses sh by default anyway)

--- grischka





reply via email to

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