All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Suchanek <msuchanek@suse.de>
To: linux-kbuild@vger.kernel.org
Cc: Michal Suchanek <msuchanek@suse.de>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Michal Marek <michal.lkml@markovi.net>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] Revert "kbuild: merge scripts/mkmakefile to top Makefile"
Date: Wed, 26 May 2021 19:38:55 +0200	[thread overview]
Message-ID: <20210526173855.5963-1-msuchanek@suse.de> (raw)

This reverts commit 243b50c141d71fcf7b88e94474b3b9269f0b1f9d.

When packaging the kernel it is built in different place from the one in
which it will be installed. After build the makefile needs to be
regenerated with the target location but with mkmakefile merged into
Makefile tehre is no way to do that.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
 Makefile           | 15 +++------------
 scripts/mkmakefile | 17 +++++++++++++++++
 2 files changed, 20 insertions(+), 12 deletions(-)
 create mode 100755 scripts/mkmakefile

diff --git a/Makefile b/Makefile
index 58b086b30144..462899c1b5d7 100644
--- a/Makefile
+++ b/Makefile
@@ -573,24 +573,14 @@ scripts_basic:
 	$(Q)rm -f .tmp_quiet_recordmcount
 
 PHONY += outputmakefile
-ifdef building_out_of_srctree
 # Before starting out-of-tree build, make sure the source tree is clean.
 # outputmakefile generates a Makefile in the output directory, if using a
 # separate output directory. This allows convenient use of make in the
 # output directory.
 # At the same time when output Makefile generated, generate .gitignore to
 # ignore whole output directory
-
-quiet_cmd_makefile = GEN     $@
-      cmd_makefile = { \
-	echo "\# Automatically generated by $(srctree)/Makefile: don't edit"; \
-	echo "include $(srctree)/Makefile"; \
-	} > $@
-
-Makefile: FORCE
-	$(call cmd,makefile)
-
-outputmakefile: Makefile
+outputmakefile:
+ifdef building_out_of_srctree
 	$(Q)if [ -f $(srctree)/.config -o \
 		 -d $(srctree)/include/config -o \
 		 -d $(srctree)/arch/$(SRCARCH)/include/generated ]; then \
@@ -601,6 +591,7 @@ outputmakefile: Makefile
 		false; \
 	fi
 	$(Q)ln -fsn $(srctree) source
+	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree)
 	$(Q)test -e .gitignore || \
 	{ echo "# this is build directory, ignore it"; echo "*"; } > .gitignore
 endif
diff --git a/scripts/mkmakefile b/scripts/mkmakefile
new file mode 100755
index 000000000000..1cb174751429
--- /dev/null
+++ b/scripts/mkmakefile
@@ -0,0 +1,17 @@
+#!/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
+include $1/Makefile
+EOF
-- 
2.26.2


             reply	other threads:[~2021-05-26 17:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-26 17:38 Michal Suchanek [this message]
2021-05-26 18:56 ` [PATCH] Revert "kbuild: merge scripts/mkmakefile to top Makefile" Masahiro Yamada
2021-05-26 20:28   ` Michal Suchánek
2021-05-28 17:15     ` Masahiro Yamada
2021-05-29  5:35       ` Michal Suchánek
2021-06-02  9:45         ` Masahiro Yamada
2021-06-02 10:03           ` Michal Suchánek
2021-06-02 15:44             ` Masahiro Yamada
2021-06-02 17:59               ` Michal Suchánek
2021-06-02 18:35                 ` Masahiro Yamada
2021-06-17  7:57                   ` Michal Suchánek

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=20210526173855.5963-1-msuchanek@suse.de \
    --to=msuchanek@suse.de \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=michal.lkml@markovi.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.