From: "Jan Beulich" <jbeulich@novell.com>
To: <sam@ravnborg.org>
Cc: <linux-kernel@vger.kernel.org>
Subject: [PATCH] scripts/mkmakefile: dynamic determination of output directory
Date: Fri, 11 Jan 2008 09:09:00 +0000 [thread overview]
Message-ID: <4787403C.76E4.0078.0@novell.com> (raw)
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
next reply other threads:[~2008-01-11 9:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-11 9:09 Jan Beulich [this message]
2008-01-11 20:09 ` [PATCH] scripts/mkmakefile: dynamic determination of output directory Sam Ravnborg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4787403C.76E4.0078.0@novell.com \
--to=jbeulich@novell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sam@ravnborg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox