提交 1d3b3bfa 编写于 作者: J Jan Beulich 提交者: Sam Ravnborg

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: NJan Beulich <jbeulich@novell.com>
Signed-off-by: NSam Ravnborg <sam@ravnborg.org>
上级 df578e7d
...@@ -25,8 +25,11 @@ cat << EOF > $2/Makefile ...@@ -25,8 +25,11 @@ cat << EOF > $2/Makefile
VERSION = $3 VERSION = $3
PATCHLEVEL = $4 PATCHLEVEL = $4
KERNELSRC := $1 lastword = \$(word \$(words \$(1)),\$(1))
KERNELOUTPUT := $2 makedir := \$(dir \$(call lastword,\$(MAKEFILE_LIST)))
MAKEARGS := -C $1
MAKEARGS += O=\$(if \$(patsubst /%,,\$(makedir)),\$(CURDIR)/)\$(patsubst %/,%,\$(makedir))
MAKEFLAGS += --no-print-directory MAKEFLAGS += --no-print-directory
...@@ -35,10 +38,11 @@ MAKEFLAGS += --no-print-directory ...@@ -35,10 +38,11 @@ MAKEFLAGS += --no-print-directory
all := \$(filter-out all Makefile,\$(MAKECMDGOALS)) all := \$(filter-out all Makefile,\$(MAKECMDGOALS))
all: all:
\$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT) \$(all) \$(MAKE) \$(MAKEARGS) \$(all)
Makefile:; Makefile:;
\$(all) %/: all \$(all) %/: all
@: @:
EOF EOF
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册