linux/scripts/mkmakefile
Masahiro Yamada e07cf4fd7d kbuild: mkmakefile: do not check the generated Makefile marker
This hunk was added to avoid accidental overwrite of the top Makefile
in case O= points to the top of the source tree.

As commit 4f1127e204 ("kbuild: fix infinite make recursion"),
it caused some troubles in the past because Kbuild assumes O=
as out-of-tree build, while it actually works in the source tree.

Now this works more properly; if O= points to the source directory,
it is handled as in-tree build. So, this sanity check is unneeded.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-04-02 23:27:38 +09:00

34 lines
700 B
Bash
Executable File

#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# 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
if [ "${quiet}" != "silent_" ]; then
echo " GEN Makefile"
fi
cat << EOF > Makefile
# Automatically generated by $0: don't edit
ifeq ("\$(origin V)", "command line")
VERBOSE := \$(V)
endif
ifneq (\$(VERBOSE),1)
Q := @
endif
MAKEFLAGS += --no-print-directory
.PHONY: __sub-make \$(MAKECMDGOALS)
__sub-make:
\$(Q)\$(MAKE) -C $1 O=\$(CURDIR) \$(MAKECMDGOALS)
\$(filter-out __sub-make, \$(MAKECMDGOALS)): __sub-make
@:
EOF