aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2008-01-11 04:09:00 -0500
committerSam Ravnborg <sam@ravnborg.org>2008-01-28 17:14:38 -0500
commit1d3b3bfab121cdef07d19797f42f413dccdd65f0 (patch)
treedde27534e3eb66c4a4fe7810b8a6dd553c609cfd /scripts
parentdf578e7d831b4d280bf7c621eafb737e78cd26eb (diff)
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')
-rw-r--r--scripts/mkmakefile10
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/mkmakefile b/scripts/mkmakefile
index e0f54b9d8fec..e65d8b33faa4 100644
--- a/scripts/mkmakefile
+++ b/scripts/mkmakefile
@@ -25,8 +25,11 @@ cat << EOF > $2/Makefile
25VERSION = $3 25VERSION = $3
26PATCHLEVEL = $4 26PATCHLEVEL = $4
27 27
28KERNELSRC := $1 28lastword = \$(word \$(words \$(1)),\$(1))
29KERNELOUTPUT := $2 29makedir := \$(dir \$(call lastword,\$(MAKEFILE_LIST)))
30
31MAKEARGS := -C $1
32MAKEARGS += O=\$(if \$(patsubst /%,,\$(makedir)),\$(CURDIR)/)\$(patsubst %/,%,\$(makedir))
30 33
31MAKEFLAGS += --no-print-directory 34MAKEFLAGS += --no-print-directory
32 35
@@ -35,10 +38,11 @@ MAKEFLAGS += --no-print-directory
35all := \$(filter-out all Makefile,\$(MAKECMDGOALS)) 38all := \$(filter-out all Makefile,\$(MAKECMDGOALS))
36 39
37all: 40all:
38 \$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT) \$(all) 41 \$(MAKE) \$(MAKEARGS) \$(all)
39 42
40Makefile:; 43Makefile:;
41 44
42\$(all) %/: all 45\$(all) %/: all
43 @: 46 @:
47
44EOF 48EOF