summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorPeter Korsgaard <jacmet@sunsite.dk>2009-12-13 22:58:49 +0100
committerPeter Korsgaard <jacmet@sunsite.dk>2009-12-13 22:58:49 +0100
commitf7a501e13ccf76814743ea7a5b46606762505c34 (patch)
tree22843af7c2122c7f2991021a421bff0d88f1f261 /Makefile
parent617aa4995a2ea97e9663cac26744d67ea726745a (diff)
downloadbuildroot-novena-f7a501e13ccf76814743ea7a5b46606762505c34.tar.gz
buildroot-novena-f7a501e13ccf76814743ea7a5b46606762505c34.zip
Makefile: fix build if CDPATH is set in environment
Reported by Bjørn Forsman <bjorn.forsman@gmail.com>. If CDPATH is set in the environment, cd <dir> will print the absolute path of <dir>, causing various trouble (The most critical being BASE_DIR ending up as <path> <path> which breaks basically everything). Fix it by clearing CDPATH. Notice that export doesn't affect the environment of $(shell ..) calls, so explicitly throw away any output from cd in the BASE_DIR shell call. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile7
1 files changed, 6 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index bf04773d2..5b71051c1 100644
--- a/Makefile
+++ b/Makefile
@@ -232,7 +232,12 @@ else
MAKEOVERRIDES =
endif
-BASE_DIR := $(shell mkdir -p $(O) && cd $(O) && pwd)
+# bash prints the name of the directory on 'cd <dir>' if CDPATH is
+# set, so unset it here to not cause problems. Notice that the export
+# line doesn't affect the environment of $(shell ..) calls, so
+# explictly throw away any output from 'cd' here.
+export CDPATH:=
+BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd)
$(if $(BASE_DIR),, $(error output directory "$(O)" does not exist))
DL_DIR=$(call qstrip,$(BR2_DL_DIR))