* [PATCH] scripts/mkmakefile: dynamic determination of output directory
@ 2008-01-11 9:09 Jan Beulich
2008-01-11 20:09 ` Sam Ravnborg
0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2008-01-11 9:09 UTC (permalink / raw)
To: sam; +Cc: linux-kernel
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>
---
scripts/mkmakefile | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
--- linux-2.6.24-rc7/scripts/mkmakefile 2008-01-10 16:55:30.000000000 +0100
+++ 2.6.24-rc7-mkmakefile-objdir/scripts/mkmakefile 2008-01-08 12:35:11.000000000 +0100
@@ -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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] scripts/mkmakefile: dynamic determination of output directory
2008-01-11 9:09 [PATCH] scripts/mkmakefile: dynamic determination of output directory Jan Beulich
@ 2008-01-11 20:09 ` Sam Ravnborg
0 siblings, 0 replies; 2+ messages in thread
From: Sam Ravnborg @ 2008-01-11 20:09 UTC (permalink / raw)
To: Jan Beulich; +Cc: linux-kernel
On Fri, Jan 11, 2008 at 09:09:00AM +0000, Jan Beulich wrote:
> 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.)
Thanks, applied.
Sam
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-01-11 20:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-11 9:09 [PATCH] scripts/mkmakefile: dynamic determination of output directory Jan Beulich
2008-01-11 20:09 ` Sam Ravnborg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox