Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp72643pxj; Wed, 26 May 2021 16:31:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8CrVa7ip+2qBeom2fc6KDH/QwDdoTdM2pwyWVoRAAgns63STUObJA9fQBjbYhjHCsFV83 X-Received: by 2002:a17:907:2d0d:: with SMTP id gs13mr764728ejc.266.1622071885916; Wed, 26 May 2021 16:31:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622071885; cv=none; d=google.com; s=arc-20160816; b=jzdwFLAUsQiJEB7pLTQSBSMEm8oJyePqusb0PwW23Hj4P4u5giu7eo4yFuhXCLaoon FH++ogiflujBi8KVo3REzHgzSSWJC+vU9JJvmPfQ5Up+ytZ6zn8+0jXwvI3MyHwEvi+X iBvhVouIk3gcCdaSOzvKhB+uoOjWNOeYwiphNTYkxUG4va/3V4ua8VpTWvJzSzX/teA7 EZkL57U+rS18+kMtGR11adhXRBOjZFyjb9BKk/uqPzDvM3TkZ0X7MgwYC+558N4ELy8r CCa5vcs41oUq+whewy8+foaDQYiKJ5FgHr2khMEjjKrSIM9PrvQL5NW0b+mT5fC8vE7z JtIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature:dkim-filter; bh=NN3uizu18LOsD2OJJBJbklEODfdUKmhpXgu1RLcjpa0=; b=DXI3G0QzZPVkZNNOzenUCdGVA/1U2wVJf/CeUAUQJQCvOPrqy/qr8EzKSFx70IG6Yb iGahLr9i0d5UN2f1aF4MqfHo7RiYNJK2RLRq4blsN5hk9y73Me3emyDyXSfivsCkeTjk cdt/g+ckpG16fm4uKrq+in0ClQPJNzNvMstbYJ8tCKdTojXYkDJvpMVkez/TCydWiaZx afxqPYFpNpA7vHP/qlqXNZdmVK5ovwhFhLG1juyDt6SPFT0ctosq1STuv93MfMD01imZ U2owcEZI65PbW9SiR6gv8bRep7q6xQbth4oWwc9DOQkRapnHAqLsFGayUB59VRH8dAan rF+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Cx1sdfY7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h15si303778eds.519.2021.05.26.16.30.52; Wed, 26 May 2021 16:31:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Cx1sdfY7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233517AbhEZS7J (ORCPT + 99 others); Wed, 26 May 2021 14:59:09 -0400 Received: from conssluserg-03.nifty.com ([210.131.2.82]:37319 "EHLO conssluserg-03.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234954AbhEZS7F (ORCPT ); Wed, 26 May 2021 14:59:05 -0400 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) (authenticated) by conssluserg-03.nifty.com with ESMTP id 14QIvInR013596; Thu, 27 May 2021 03:57:19 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-03.nifty.com 14QIvInR013596 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1622055439; bh=NN3uizu18LOsD2OJJBJbklEODfdUKmhpXgu1RLcjpa0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Cx1sdfY7QTpbjKWBkRxlxW97rR/1qvbBRcTHIvLydjUyRgxJANf1NpY0Wv0yXE/L5 CVUfYmQpUiw/Pdats08+HuMyAFl6kifRE+wbOdHwl0IRQIal+KWRnEYjKTtzHdXRxb QbvO2NSF0n0wpE3ST61A1HNqpuW4srwBws4YVZT02FeZitSANO5/ZmP1TzTDSqNA4j BvbEiz+cyam7rdwn0KHOpkVmjLcwJnm1bxRD929t2m+q1sxOZ1f4bbMTObf0/4DJ36 Pxq4k0uCdUkTvSTJo4SJAS3tkZaAZkEBLSXpUGfeIBeN90iS7ynuxGVWGnOrDUGvFx 3nDWTKOvrBu/A== X-Nifty-SrcIP: [209.85.216.50] Received: by mail-pj1-f50.google.com with SMTP id h20-20020a17090aa894b029015db8f3969eso893153pjq.3; Wed, 26 May 2021 11:57:19 -0700 (PDT) X-Gm-Message-State: AOAM531DQ0JAayoa/WUqPIfijyg8xlC1e8AdwK7Oo0hzrrjJ9MhOhAVj ojA34aPrp4jAtHTCuimPVhKI6f/xEIWNXRyg6jU= X-Received: by 2002:a17:902:541:b029:f0:3187:409b with SMTP id 59-20020a1709020541b02900f03187409bmr37293476plf.47.1622055438343; Wed, 26 May 2021 11:57:18 -0700 (PDT) MIME-Version: 1.0 References: <20210526173855.5963-1-msuchanek@suse.de> In-Reply-To: <20210526173855.5963-1-msuchanek@suse.de> From: Masahiro Yamada Date: Thu, 27 May 2021 03:56:41 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] Revert "kbuild: merge scripts/mkmakefile to top Makefile" To: Michal Suchanek Cc: Linux Kbuild mailing list , Michal Marek , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 27, 2021 at 2:39 AM Michal Suchanek wrote: > > 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 My patch was not working as expected regardless of packaging. Does the following fix-up work for you? diff --git a/Makefile b/Makefile index 54bb019a7da3..504327207d66 100644 --- a/Makefile +++ b/Makefile @@ -552,16 +552,13 @@ ifdef building_out_of_srctree # At the same time when output Makefile generated, generate .gitignore to # ignore whole output directory -quiet_cmd_makefile = GEN $@ +quiet_cmd_makefile = GEN Makefile cmd_makefile = { \ echo "\# Automatically generated by $(srctree)/Makefile: don't edit"; \ echo "include $(srctree)/Makefile"; \ - } > $@ + } > Makefile -Makefile: FORCE - $(call cmd,makefile) - -outputmakefile: Makefile +outputmakefile: $(Q)if [ -f $(srctree)/.config -o \ -d $(srctree)/include/config -o \ -d $(srctree)/arch/$(SRCARCH)/include/generated ]; then \ @@ -572,6 +569,7 @@ outputmakefile: Makefile false; \ fi $(Q)ln -fsn $(srctree) source + $(call cmd,makefile) $(Q)test -e .gitignore || \ { echo "# this is build directory, ignore it"; echo "*"; } > .gitignore endif > --- > 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 > -- Best Regards Masahiro Yamada