Skip to content

Commit

Permalink
kbuild: scripts/mkmakefile: dynamic determination of output directory
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jan Beulich authored and Sam Ravnborg committed Jan 28, 2008
1 parent df578e7 commit 1d3b3bf
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions scripts/mkmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit 1d3b3bf

Please sign in to comment.