summaryrefslogtreecommitdiff
path: root/scripts/mkmakefile
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2008-01-11 09:09:00 (GMT)
committerSam Ravnborg <sam@ravnborg.org>2008-01-28 22:14:38 (GMT)
commit1d3b3bfab121cdef07d19797f42f413dccdd65f0 (patch)
treedde27534e3eb66c4a4fe7810b8a6dd553c609cfd /scripts/mkmakefile
parentdf578e7d831b4d280bf7c621eafb737e78cd26eb (diff)
downloadlinux-fsl-qoriq-1d3b3bfab121cdef07d19797f42f413dccdd65f0.tar.xz
kbuild: scripts/mkmakefile: dynamic determination of output directory
Rather than fixing the output directory in the generated Makefile, determine it from the placement of Makefile. This allows moving the build tree around or accessing it through different mount paths. (The lastword definition is a compatibility one for make prior to 3.81; newer make will simply ignore it and use the [faster] built-in.) Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/mkmakefile')
-rw-r--r--scripts/mkmakefile10
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/mkmakefile b/scripts/mkmakefile
index e0f54b9..e65d8b3 100644
--- a/scripts/mkmakefile
+++ b/scripts/mkmakefile
@@ -25,8 +25,11 @@ cat << EOF > $2/Makefile
VERSION = $3
PATCHLEVEL = $4
-KERNELSRC := $1
-KERNELOUTPUT := $2
+lastword = \$(word \$(words \$(1)),\$(1))
+makedir := \$(dir \$(call lastword,\$(MAKEFILE_LIST)))
+
+MAKEARGS := -C $1
+MAKEARGS += O=\$(if \$(patsubst /%,,\$(makedir)),\$(CURDIR)/)\$(patsubst %/,%,\$(makedir))
MAKEFLAGS += --no-print-directory
@@ -35,10 +38,11 @@ MAKEFLAGS += --no-print-directory
all := \$(filter-out all Makefile,\$(MAKECMDGOALS))
all:
- \$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT) \$(all)
+ \$(MAKE) \$(MAKEARGS) \$(all)
Makefile:;
\$(all) %/: all
@:
+
EOF