diff options
author | Jan Beulich <jbeulich@novell.com> | 2008-01-11 04:09:00 -0500 |
---|---|---|
committer | Sam Ravnborg <sam@ravnborg.org> | 2008-01-28 17:14:38 -0500 |
commit | 1d3b3bfab121cdef07d19797f42f413dccdd65f0 (patch) | |
tree | dde27534e3eb66c4a4fe7810b8a6dd553c609cfd /scripts/mkmakefile | |
parent | df578e7d831b4d280bf7c621eafb737e78cd26eb (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/mkmakefile')
-rw-r--r-- | scripts/mkmakefile | 10 |
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 | |||
25 | VERSION = $3 | 25 | VERSION = $3 |
26 | PATCHLEVEL = $4 | 26 | PATCHLEVEL = $4 |
27 | 27 | ||
28 | KERNELSRC := $1 | 28 | lastword = \$(word \$(words \$(1)),\$(1)) |
29 | KERNELOUTPUT := $2 | 29 | makedir := \$(dir \$(call lastword,\$(MAKEFILE_LIST))) |
30 | |||
31 | MAKEARGS := -C $1 | ||
32 | MAKEARGS += O=\$(if \$(patsubst /%,,\$(makedir)),\$(CURDIR)/)\$(patsubst %/,%,\$(makedir)) | ||
30 | 33 | ||
31 | MAKEFLAGS += --no-print-directory | 34 | MAKEFLAGS += --no-print-directory |
32 | 35 | ||
@@ -35,10 +38,11 @@ MAKEFLAGS += --no-print-directory | |||
35 | all := \$(filter-out all Makefile,\$(MAKECMDGOALS)) | 38 | all := \$(filter-out all Makefile,\$(MAKECMDGOALS)) |
36 | 39 | ||
37 | all: | 40 | all: |
38 | \$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT) \$(all) | 41 | \$(MAKE) \$(MAKEARGS) \$(all) |
39 | 42 | ||
40 | Makefile:; | 43 | Makefile:; |
41 | 44 | ||
42 | \$(all) %/: all | 45 | \$(all) %/: all |
43 | @: | 46 | @: |
47 | |||
44 | EOF | 48 | EOF |