From mboxrd@z Thu Jan 1 00:00:00 1970 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=-14.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 AF5B9C47082 for ; Wed, 26 May 2021 18:57:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 91F40613C3 for ; Wed, 26 May 2021 18:57:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234359AbhEZS7K (ORCPT ); Wed, 26 May 2021 14:59:10 -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-Google-Smtp-Source: ABdhPJwoN1jqNDwfWlBwbeTmvHyGhwLZTNgX7yKuXsP3pPKF/oAwsPcbRD/Yg+G4of87PhlWGt4xYl1CCv6IA2dojIQ= 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