diff options
author | Benoît Thébaudeau <benoit.thebaudeau@advansee.com> | 2013-04-11 09:35:54 +0000 |
---|---|---|
committer | Albert ARIBAUD <albert.u.boot@aribaud.net> | 2013-04-12 07:55:07 +0200 |
commit | 120ae6091d44dae9b63f4c4e2a14ba7b15432bbb (patch) | |
tree | 79062a4b879a5268f86a09b6f3b42503a012dccf | |
parent | 5c6db120fc184bae7a344a4e5da83b21164b59a6 (diff) | |
download | u-boot-imx-120ae6091d44dae9b63f4c4e2a14ba7b15432bbb.zip u-boot-imx-120ae6091d44dae9b63f4c4e2a14ba7b15432bbb.tar.gz u-boot-imx-120ae6091d44dae9b63f4c4e2a14ba7b15432bbb.tar.bz2 |
Makefile: Move SHELL setup to config.mk
make never uses the SHELL variable from the environment. Instead, it
uses /bin/sh, or the value assigned to the SHELL variable by the Makefile. This
makes the export of the SHELL variable useless for sub-makes (but still useful
for the environment of recipes). However, we want all makes to use the same
shell.
This patch fixes this issue by moving the SHELL variable setup and export to the
top config.mk, so that all Makefile-s including it use the same shell.
Since BASH is used by default, this makes it possible to use things
like 'echo -e ...' in sub-makes, which would otherwise fail e.g. with /bin/sh
symlinked to /bin/dash on Ubuntu.
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Reviewed-by: Tom Rini <trini@ti.com>
-rw-r--r-- | Makefile | 7 | ||||
-rw-r--r-- | config.mk | 7 |
2 files changed, 8 insertions, 6 deletions
@@ -46,12 +46,7 @@ HOSTARCH := $(shell uname -m | \ HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \ sed -e 's/\(cygwin\).*/cygwin/') -# 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 +export HOSTARCH HOSTOS # Deal with colliding definitions from tcsh etc. VENDOR= @@ -23,6 +23,13 @@ ######################################################################### +# 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 SHELL + ifeq ($(CURDIR),$(SRCTREE)) dir := else |