make-w32
[Top][All Lists]
Advanced

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

Re: setting SHELL variable


From: Eli Zaretskii
Subject: Re: setting SHELL variable
Date: Fri, 29 Jul 2005 16:40:34 +0300

> Date: Thu, 28 Jul 2005 17:06:07 -0700
> From: Jonathan Baccash <address@hidden>
> 
> I'm having a helluva time setting the SHELL variable in GNU Make 3.81beta3.
> 
> I do this:
> $(warning SHELL=$(SHELL))
> SHELL := cmd.exe
> $(warning SHELL=$(SHELL))
> 
> And I get:
> Makefile:1: SHELL=C:/mks/mksnt/sh.exe
> Makefile:3: SHELL=C:/mks/mksnt/sh.exe
> 
> However, I notice that the behavior for simple commands before setting
> SHELL is the behavior of sh.exe, and the behavior for simple commands
> after setting SHELL is the behavior of cmd.exe.  Is this the expected
> behavior or not?

Yes, I think this is expected behavior: you are neglecting the fact
that Make first reads the entire Makefile, and at that time all the
variables are set and all the non-command parts are evaluated.  Then
it proceeds to running the commands for the rules that need to be
executed, and it is at that time that the variables are used.

So you cannot in general have different values of SHELL in different
parts of a Makefile.  In particular, the exact place where you set
SHELL (or any other variable) does not matter: they are all set and
evaluated before the first command runs.

Having said that, if you really want different values of SHELL for
different targets, you can use the target-specific values for
variables, like this:

foo: SHELL = c:/mks/mksnt/sh.exe
bar: SHELL = c:/WINDOWS/System32/cmd.exe

If the above does not help you, please post a complete Makefile that
gives you trouble and explain what you want to do and what doesn't
work.




reply via email to

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