help-make
[Top][All Lists]
Advanced

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

Re: how to use a different /bin/sh with GNU Make?


From: David Boyce
Subject: Re: how to use a different /bin/sh with GNU Make?
Date: Tue, 13 Oct 2015 12:23:23 -0700

I haven’t followed this whole thread, so apologies if I missed
something, but you should be able to simply override SHELL on the
command line and it will propagate into child makes. Example below.
Also, for the debugging you’re trying to do: there’s an old series
called “Ask Mr Make” (google it) with lots of useful techniques. I
think his article “Tracing Rule Execution”
(http://www.cmcrossroads.com/article/tracing-rule-execution-gnu-make)
might be illuminating about ways to do this without hacking make or
/bin/sh.

% cat Makefile
ifeq ($(MAKELEVEL),5)
  $(error "that's plenty")
endif

all:
        @echo "SHELL=$(SHELL) at make level $(MAKELEVEL)"
        address@hidden(MAKE) --no-print-directory

% make SHELL=/bin/zsh
SHELL=/bin/zsh at make level 0
SHELL=/bin/zsh at make level 1
SHELL=/bin/zsh at make level 2
SHELL=/bin/zsh at make level 3
SHELL=/bin/zsh at make level 4
Makefile:2: *** "that's plenty".  Stop.
Makefile:6: recipe for target 'all' failed
make[4]: [all] Error 2 (ignored)

On Tue, Oct 13, 2015 at 11:59 AM, Mark Galeck <address@hidden> wrote:
> Yes I agree it is terrible to replace /bin/anything permanently, or during 
> boot.  But for me this is all just a temporary trick to achieve some 
> temporary result, and then I will revert.  And my modification to /bin/sh is 
> benign - it merely writes to some file not used for other purpose, every time 
> it interprets a command.  I can't modify Makefiles - this is a "marketing" 
> not technical issue.  Technically I could just like you suggested, do it 
> automatically.  But for certain marketing reasons, I have to be able to say 
> "no Makefiles have been modified, or, there were very minimal changes - like, 
> one line had to be modified".
> It sounds like the simplest thing to do to keep marketing happy and do what I 
> need, is to hack Make a little.
> Thank you again.
>       From: Reinier Post <address@hidden>
>  To: address@hidden
>  Sent: Tuesday, October 13, 2015 11:45 AM
>  Subject: Re: how to use a different /bin/sh with GNU Make?
>
> On Tue Oct 13 12:16:48 2015, address@hidden (Mark Galeck) wrote:
>> I mean, I guess my big problem is this.
>> I have a massively GNU Make recursive system.  (Yes I know it is a bad 
>> thing;  I did not write it myself).
>> I hacked a shell to do some custom stuff, and I want to use the hacked shell 
>> with GNU Make.
>
> I think it is a terrible idea to replace anything in /bin or /usr/bin
> with something custom.  Just don't.  /bin/sh is heavily used by your OS
> (e.g. during boot), you don't want to break any assumption anything
> you didn't write has on how it behaves.
>
>> I can't very well use the SHELL hack, because that would mean, I
>> would have to modify every single Makefile, of which there are
>> gazillions.
>
> Something like
>
>   find . -name Makefile | xargs -d'\n' perl -i.orig -0pe 's#^#SHELL = 
> /usr/local/bin/customsh$/#'
>
> should do the trick.
>
> If you don't want to modify make itself, that is.
>
> --
> Reinier Post
> TU Eindhoven
>
>
>
> _______________________________________________
> Help-make mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-make
>
>
> _______________________________________________
> Help-make mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-make



reply via email to

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