From patchwork Wed May 26 17:38:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Suchanek X-Patchwork-Id: 12282473 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C038C47082 for ; Wed, 26 May 2021 17:39:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5A711613CA for ; Wed, 26 May 2021 17:39:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234614AbhEZRkv (ORCPT ); Wed, 26 May 2021 13:40:51 -0400 Received: from mx2.suse.de ([195.135.220.15]:46854 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234588AbhEZRkl (ORCPT ); Wed, 26 May 2021 13:40:41 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1622050748; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ZUa2ajN4n6dAwvXL49SJ79dqRohBxVCl8r/IG+iC/fU=; b=mUXykzBEyqbkEOhnt5txnbxEf9w16hbJU6BR5Ke41oG+yFwASYY8Ita7gLkZ8CNHtPNkzn j2+WCUj1lcTTGeLiNboRBf+O+mslTZ59nXfnR5fQlIR6eeJkAQjc4URQr5dc5IgwmQZh3P GLsGEsLVFsvLVogpK48JbvmyINrDfcw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1622050748; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ZUa2ajN4n6dAwvXL49SJ79dqRohBxVCl8r/IG+iC/fU=; b=OJQgvRATxY9RlOYacjyxcAAybTFR5FOWQzeE+te70+8Uodl/5AsxrnwPpXpHx3MmlwjJiT KriRUWRT0ccjHBBQ== Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 8B7A2AEB3; Wed, 26 May 2021 17:39:08 +0000 (UTC) From: Michal Suchanek To: linux-kbuild@vger.kernel.org Cc: Michal Suchanek , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH] Revert "kbuild: merge scripts/mkmakefile to top Makefile" Date: Wed, 26 May 2021 19:38:55 +0200 Message-Id: <20210526173855.5963-1-msuchanek@suse.de> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org 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 --- 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