From: Kieran Bingham <kieran.bingham@ideasonboard.com>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
Jan Kiszka <jan.kiszka@siemens.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 5/5] scripts/gdb: refactor rules for symlink creation
Date: Wed, 27 Feb 2019 13:02:11 +0000 [thread overview]
Message-ID: <ae17de18-a839-f2dd-cf45-bb4fd5a6a7ee@ideasonboard.com> (raw)
In-Reply-To: <CAK7LNATtUnSV-OKnrH+xvmWU1scJCCFr-EH-qJ_5djhgwf8BpA@mail.gmail.com>
Hi Yamada-san,
On 27/02/2019 12:32, Masahiro Yamada wrote:
> Hi Kieran,
>
>
> On Wed, Feb 27, 2019 at 8:56 PM Kieran Bingham
> <kieran.bingham@ideasonboard.com> 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 <yamada.masahiro@socionext.com>
>>> ---
>>>
>>> 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)
>
Thank you - that makes it very clear.
Thanks again for you work :)
--
Kieran
>
>> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
>>
>> --
>> Regards
>> --
>> Kieran
>
>
>
--
Regards
--
Kieran
next prev parent reply other threads:[~2019-02-27 13:02 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-19 9:33 [PATCH 1/5] scripts/gdb: delay generation of gdb constants.py Masahiro Yamada
2019-02-19 9:33 ` [PATCH 2/5] kbuild: remove unimportant comments from ./Kbuild Masahiro Yamada
2019-02-27 11:33 ` Kieran Bingham
2019-02-19 9:33 ` [PATCH 3/5] scripts/gdb: do not descend into scripts/gdb from scripts Masahiro Yamada
2019-02-27 11:44 ` Kieran Bingham
2019-02-27 12:38 ` Masahiro Yamada
2019-02-19 9:33 ` [PATCH 4/5] kbuild: create symlink to vmlinux-gdb.py in scripts_gdb target Masahiro Yamada
2019-02-27 11:48 ` Kieran Bingham
2019-02-19 9:33 ` [PATCH 5/5] scripts/gdb: refactor rules for symlink creation Masahiro Yamada
2019-02-27 11:55 ` Kieran Bingham
2019-02-27 12:32 ` Masahiro Yamada
2019-02-27 13:02 ` Kieran Bingham [this message]
2019-02-27 11:31 ` [PATCH 1/5] scripts/gdb: delay generation of gdb constants.py Kieran Bingham
2019-02-27 12:42 ` Masahiro Yamada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ae17de18-a839-f2dd-cf45-bb4fd5a6a7ee@ideasonboard.com \
--to=kieran.bingham@ideasonboard.com \
--cc=jan.kiszka@siemens.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=yamada.masahiro@socionext.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).