From patchwork Tue Feb 19 09:33:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10819579 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6FC096CB for ; Tue, 19 Feb 2019 09:33:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E3CF2B85D for ; Tue, 19 Feb 2019 09:33:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 523B02C014; Tue, 19 Feb 2019 09:33:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D91652B85D for ; Tue, 19 Feb 2019 09:33:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725767AbfBSJdf (ORCPT ); Tue, 19 Feb 2019 04:33:35 -0500 Received: from conuserg-09.nifty.com ([210.131.2.76]:52939 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725763AbfBSJdf (ORCPT ); Tue, 19 Feb 2019 04:33:35 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id x1J9XBkO002572; Tue, 19 Feb 2019 18:33:13 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com x1J9XBkO002572 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1550568794; bh=6wrERf29hesZXgquMmrDWBzvVksZP5BU5OXJ1r+sURQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U2L+ckxPzqR3/OKKx4x8xdvNNP0cs6m2bw/kKVa2BlY57bgG4qKLLa+cmOplneZAr bXv25/29kCDxo1dANx4lQJqloag4X0haUF3BAM/ZnEk9dRR5thhbHvJyUCCmWWX5s3 zFYkNXZJXMfBGO1ONrNq6QCmvL2imiBAZZR0gsKYmTmRuJPWz0OE4QFIsg2RoqPnzK 8x0QzJ9ooPaHLLS+/08WQAn3NYzd+lJSfjS4PiXN9Aj5CC8ShgYiEZDZ0+TyTX+uG+ IUEkI+TibQhR/mvemANw9KJWokorKgyy+eTV9uks8WYi6ZhKsWAyoaASAxghlAQzg/ KFOUidpbpdfJQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Kieran Bingham , Masahiro Yamada , Jan Kiszka , linux-kernel@vger.kernel.org Subject: [PATCH 5/5] scripts/gdb: refactor rules for symlink creation Date: Tue, 19 Feb 2019 18:33:06 +0900 Message-Id: <1550568787-18710-5-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1550568787-18710-1-git-send-email-yamada.masahiro@socionext.com> References: <1550568787-18710-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Kieran Bingham --- 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