[U-Boot] [PATCH] Use bash for default GNU Make shell application

Peter Tyser ptyser at xes-inc.com
Wed Nov 12 19:33:20 CET 2008


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

Signed-off-by: Peter Tyser <ptyser at xes-inc.com>
---
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(-)

diff --git a/Makefile b/Makefile
index d8b1f58..cf82551 100644
--- a/Makefile
+++ b/Makefile
@@ -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=
-- 
1.6.0.2.GIT



More information about the U-Boot mailing list