• Jan Beulich's avatar
    kbuild: fix mkmakefile · 96678281
    Jan Beulich authored
    With the current way of generating the Makefile in the output directory
    for builds outside of the source tree, specifying real targets (rather
    than phony ones) doesn't work in an already (partially) built tree, as
    the stub Makefile doesn't have any dependency information available.
    Thus, all targets where files may actually exist must be listed
    explicitly and, due to what I'd call a make misbehavior, directory
    targets must then also be special cased.
    Signed-Off-By: default avatarJan Beulich <jbeulich@novell.com>
    Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
    96678281
mkmakefile 648 Bytes
#!/bin/sh
# Generates a small Makefile used in the root of the output
# directory, to allow make to be started from there.
# The Makefile also allow for more convinient build of external modules

# Usage
# $1 - Kernel src directory
# $2 - Output directory
# $3 - version
# $4 - patchlevel


cat << EOF
# Automatically generated by $0: don't edit

VERSION = $3
PATCHLEVEL = $4

KERNELSRC    := $1
KERNELOUTPUT := $2

MAKEFLAGS += --no-print-directory

.PHONY: all \$(MAKECMDGOALS)

all:
	\$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT)

Makefile:;

\$(filter-out all Makefile,\$(MAKECMDGOALS)) %/:
	\$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT) \$@
EOF