Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp1739884img; Wed, 27 Feb 2019 04:42:42 -0800 (PST) X-Google-Smtp-Source: AHgI3IZWi0tSoKnC+MF+ZqCw5aBPHbq7XATbsUkjS1gXOOJ5Ma87yIOjO4wps5vmQYMWIjnjOfDE X-Received: by 2002:a63:4e1a:: with SMTP id c26mr2782038pgb.175.1551271362913; Wed, 27 Feb 2019 04:42:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551271362; cv=none; d=google.com; s=arc-20160816; b=rFw5S8v6XHD5SyrTY6tOCMzQQeMP4QXfu2MfFMfOdaZY9yArnS4XaejoTao5RPPPyG DDkpMzd/os8dYzSr7kQwJS8n8fE+QeGlAIPaIBy21S0+3ZasJ2ruj0loDNNgAQfttNO3 s4JpULIsW7lm3uKKQ40bfkmusVDc6ltRoT5Hz7oYrp7ZBYdf19ypFPZ4ZYpTNCL0fBtd N1uFeOhfBhjSwZr0WaSG4lqLjIXUu+MVqBD5VtYKA56GZQzirSeJQx0shXBcXONFPGb5 2fIi8XPQ6Rt19vCu4BG5aqcVw7GC4V3wMCNYlZgmePzgGyBkfaUBxTDfM8Y8RrPh3FwI pYuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=uPI57JCwxYuuy6+IDDYCSlExpT6Xshlch+VQcNQKq4M=; b=YJVM4mQnjYisBk048pCFoMHN9CqAffeppri67C9YdVrnZmNSMVRBN8wcwM0oUsZX/t OReDACuNT1b8+2LUASstNYAvQJzlpNBe9HVJDRORoBXZXtZOZTKnhnP69Z2SHqx8wLIP EkmDWBdL/ZFlk5A2REF0HuVCMuNf+yESBzcxInC6kFrlR4CpvtP6qepiUZEJZJ4vo3u0 l9NAZs5M5m/dbnfGAtDeVEti6huiWOvjwmDnIX+OuDCcvGySv+wWng0se5RjFJy88Uoo OKMIAzcV8n1TfhC1ohdszao7u785VyFEItIDIT7HY11UwNJ2n+a+Lc+uN7dqABlTkZ/O SrqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=QLN8H6wX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 39si15408788ple.354.2019.02.27.04.42.28; Wed, 27 Feb 2019 04:42:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=QLN8H6wX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729969AbfB0MdK (ORCPT + 99 others); Wed, 27 Feb 2019 07:33:10 -0500 Received: from conssluserg-06.nifty.com ([210.131.2.91]:30419 "EHLO conssluserg-06.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729645AbfB0MdJ (ORCPT ); Wed, 27 Feb 2019 07:33:09 -0500 Received: from mail-ua1-f43.google.com (mail-ua1-f43.google.com [209.85.222.43]) (authenticated) by conssluserg-06.nifty.com with ESMTP id x1RCWjix013863; Wed, 27 Feb 2019 21:32:46 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com x1RCWjix013863 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1551270766; bh=uPI57JCwxYuuy6+IDDYCSlExpT6Xshlch+VQcNQKq4M=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=QLN8H6wXl2AkIwHFm8ue0YxukKCg+fbNVUSrg/KDqpLdxoeWPzFvtlQ7wd50gLInE +Fhi5BXo9Y5+4O2MCbLt+/fxZPvqhsV4AOsJzYQlD/6ebJhHlVn+kWj6GbAY6bmtyA gqW2aT5rxTbfR26E/OQx4o/GRstXPZOomPxaCHNK+xzDwt/OBmBgkxxFo9VidhAF1H LnxXN2OfdF9jxOKf/4j1akg9ccWgTB5mAvf1shO60kl2o4JSCeKFdtaHNYVQZuhj5U vW9ZGmw0TwVWn5NZDE2CbTcmspmyTSo/hoSP705XUlWdLG45iAjTTINAxgET0WX1Ff Axh/lLElNyLMw== X-Nifty-SrcIP: [209.85.222.43] Received: by mail-ua1-f43.google.com with SMTP id q17so15158699uam.0; Wed, 27 Feb 2019 04:32:45 -0800 (PST) X-Gm-Message-State: APjAAAVMUklO0sFhXB91lpp9nJq3maGKeQPqQg/uSa7ev4pmJvwQwwaY bZSrPxQqRcF2gw+c+bKj+rTSF89B1QjS2Ya7jds= X-Received: by 2002:ab0:648c:: with SMTP id p12mr1874315uam.93.1551270764533; Wed, 27 Feb 2019 04:32:44 -0800 (PST) MIME-Version: 1.0 References: <1550568787-18710-1-git-send-email-yamada.masahiro@socionext.com> <1550568787-18710-5-git-send-email-yamada.masahiro@socionext.com> In-Reply-To: From: Masahiro Yamada Date: Wed, 27 Feb 2019 21:32:08 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 5/5] scripts/gdb: refactor rules for symlink creation To: kieran.bingham@ideasonboard.com Cc: Linux Kbuild mailing list , Jan Kiszka , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Kieran, On Wed, Feb 27, 2019 at 8:56 PM Kieran Bingham wrote: > > Hi Yamada-san, > > On 19/02/2019 09:33, Masahiro Yamada wrote: > > gdb-scripts is not a real object, but (ab)used like a phony target. > > > > Rewrite the code in a more Kbuild-ish way. Add symlinks to extra-y > > and use if_changed. > > > > Signed-off-by: Masahiro Yamada > > --- > > > > scripts/gdb/linux/Makefile | 18 +++++++++++------- > > 1 file changed, 11 insertions(+), 7 deletions(-) > > > > diff --git a/scripts/gdb/linux/Makefile b/scripts/gdb/linux/Makefile > > index 7545806..3df395a 100644 > > --- a/scripts/gdb/linux/Makefile > > +++ b/scripts/gdb/linux/Makefile > > @@ -1,13 +1,17 @@ > > # SPDX-License-Identifier: GPL-2.0 > > -always := gdb-scripts > > > > -SRCTREE := $(abspath $(srctree)) > > - > > -$(obj)/gdb-scripts: > > ifneq ($(KBUILD_SRC),) > > - $(Q)ln -fsn $(SRCTREE)/$(obj)/*.py $(objtree)/$(obj) > > + > > +symlinks := $(patsubst $(srctree)/$(src)/%,%,$(wildcard $(srctree)/$(src)/*.py)) > > + > > +quiet_cmd_symlink = SYMLINK $@ > > + cmd_symlink = ln -fsn $(patsubst $(obj)/%,$(abspath $(srctree))/$(src)/%,$@) $@ > > + > > +extra-y += $(symlinks) > > +$(addprefix $(obj)/, $(symlinks)): FORCE > > + $(call if_changed,symlink) > > + > > endif > > - @: > > > > quiet_cmd_gen_constants_py = GEN $@ > > cmd_gen_constants_py = \ > > @@ -18,4 +22,4 @@ extra-y += constants.py > > $(obj)/constants.py: $(src)/constants.py.in FORCE > > $(call if_changed_dep,gen_constants_py) > > > > -clean-files := *.pyc *.pyo $(if $(KBUILD_SRC),*.py) > > +clean-files := *.pyc *.pyo > > Perhaps this answers my earlier question. > I guess the extra-y hook is somehow handling the clean up of these files? > > Aha - yes, I've just found it in > > Documentation/kbuild/makefiles.txt: > > === 5 Kbuild clean infrastructure > > ... > > Kbuild knows targets listed in $(hostprogs-y), $(hostprogs-m), $(always), $(extra-y) and $(targets). They are all deleted during "make clean". > > Perfect, so this is much better. Exactly. If you are interested in the real code, see scripts/Makefile.clean __clean-files := $(extra-y) $(extra-m) $(extra-) \ $(always) $(targets) $(clean-files) \ $(hostprogs-y) $(hostprogs-m) $(hostprogs-) \ $(hostlibs-y) $(hostlibs-m) $(hostlibs-) \ $(hostcxxlibs-y) $(hostcxxlibs-m) > Reviewed-by: Kieran Bingham > > -- > Regards > -- > Kieran -- Best Regards Masahiro Yamada