Skip to contentSkip to conversation

Use bash for default GNU Make shell application

PATCH New Peter Tyser 2 participants 2 messages Nov 12, 2008 – Dec 8, 2008 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Use bash for default GNU Make shell application

Some Make script commands rely on bash-specific features so default to bash for the SHELL variable with a fallback to the standard sh shell

---
Commands such as these from the top-level Makefile failed on my Ubuntu 7.04 system which has the sh shell as a symlink to /bin/dash:

	@rm -f $(obj)tools/{fdt_wip.c,libfdt_internal.h}

Eugene O'Brien caught the same issue in this thread:
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/48047/focus=48048

 Makefile |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
Makefile +6 -1
index d8b1f58..cf82551 100644
@@ -44,7 +44,12 @@ HOSTARCH := $(shell uname -m | \
 HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
 	    sed -e 's/\(cygwin\).*/cygwin/')
 
-export	HOSTARCH HOSTOS
+# Set shell to bash if possible, otherwise fall back to sh
+SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
+	else if [ -x /bin/bash ]; then echo /bin/bash; \
+	else echo sh; fi; fi)
+
+export	HOSTARCH HOSTOS SHELL
 
 # Deal with colliding definitions from tcsh etc.
 VENDOR=
Signature · 1 line
1.6.0.2.GIT
#1 lore raw

PATCH 1/1 Use bash for default GNU Make shell application

Dear Peter Tyser,

Quoted 9 lines · In message <[email protected]> you wrote:

Some Make script commands rely on bash-specific features so default to bash for the SHELL variable with a fallback to the standard sh shell

---
Commands such as these from the top-level Makefile failed on my Ubuntu 7.04 system which has the sh shell as a symlink to /bin/dash:

Quoted 7 lines
	@rm -f $(obj)tools/{fdt_wip.c,libfdt_internal.h}

Eugene O'Brien caught the same issue in this thread:
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/48047/focus=48048

 Makefile |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Accident: A condition in which presence of mind is good, but  absence
of body is better.