linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
To: Masahiro Yamada <masahiroy@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Nicolas Schier <nicolas@fjasle.eu>,
	Jonathan Corbet <corbet@lwn.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Cristian Ciocaltea <cristian.ciocaltea@collabora.com>,
	Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>,
	Vipin Sharma <vipinsh@google.com>,
	linux-kbuild@vger.kernel.org, linux-doc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH v3] scripts/tags.sh: choose which directories to exclude from being indexed
Date: Wed, 14 Dec 2022 09:26:15 +1300	[thread overview]
Message-ID: <Y5jf59VCL/HAt60q@mail.google.com> (raw)
In-Reply-To: <Y5fdgI4uTpXZQ9yn@mail.google.com>

It's common for drivers that share same physical components to also
duplicate source code (or at least portions of it). A good example is
both drivers/gpu/drm/amdgpu/* and drivers/gpu/drm/radeon/* have a header
file called atombios.h.

While their contents aren't the same, a lot of their structs have
the exact same names which makes navigating through the code base a bit
messy as cscope will show up 'references' across drivers which aren't
exactly correct.

Add IGNORE_DIRS variable, which specifies which directories
to be ignored from indexing.

Example:
        make ARCH=x86 IGNORE_DIRS="drivers/gpu/drm/radeon tools" cscope

Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
---
Changelog:

- v3: change commit message wording and rst syntax (Req Bagas Sanjaya)
      change makefile variable scope to global, use blank space
      separator and change variable name to IGNORE_DIRS.
      (Req: Vipin Sharma)
- v2: change approach to include everything unless specified by the 
  IGNOREDIRS variable: (Req: Vipin Sharma)
- v1: https://lore.kernel.org/lkml/Y5OKDvbGk4Kro6MK@mail.google.com/
---
 Documentation/kbuild/kbuild.rst | 7 +++++++
 scripts/tags.sh                 | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/Documentation/kbuild/kbuild.rst b/Documentation/kbuild/kbuild.rst
index 08f575e6236c..5202186728b4 100644
--- a/Documentation/kbuild/kbuild.rst
+++ b/Documentation/kbuild/kbuild.rst
@@ -278,6 +278,13 @@ To get all available archs you can also specify all. E.g.::
 
     $ make ALLSOURCE_ARCHS=all tags
 
+IGNORE_DIRS
+-----------
+For tags/TAGS/cscope targets, you can choose which directories won't
+be included in the databases, separated by blank space. E.g.::
+
+    $ make IGNORE_DIRS="drivers/gpu/drm/radeon tools" cscope
+
 KBUILD_BUILD_TIMESTAMP
 ----------------------
 Setting this to a date string overrides the timestamp used in the
diff --git a/scripts/tags.sh b/scripts/tags.sh
index e137cf15aae9..1ad45f17179a 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -17,6 +17,13 @@ ignore="$(echo "$RCS_FIND_IGNORE" | sed 's|\\||g' )"
 # tags and cscope files should also ignore MODVERSION *.mod.c files
 ignore="$ignore ( -name *.mod.c ) -prune -o"
 
+# ignore arbitrary directories
+if [ -n "${IGNORE_DIRS}" ]; then
+	for i in ${IGNORE_DIRS}; do
+		ignore="${ignore} ( -path $i ) -prune -o"
+	done
+fi
+
 # Use make KBUILD_ABS_SRCTREE=1 {tags|cscope}
 # to force full paths for a non-O= build
 if [ "${srctree}" = "." -o -z "${srctree}" ]; then
-- 
2.38.1


  reply	other threads:[~2022-12-13 20:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Y5T66yWNVAZNIaJ0@mail.google.com>
2022-12-10 23:02 ` [PATCH v2] scripts/tags.sh: choose which directories to exclude from being indexed Paulo Miguel Almeida
2022-12-11  4:21   ` Bagas Sanjaya
2022-12-11 20:27     ` Paulo Miguel Almeida
2022-12-12 21:27   ` Vipin Sharma
2022-12-12 21:59     ` Paulo Miguel Almeida
2022-12-12 22:32       ` Vipin Sharma
2022-12-13  2:03         ` Paulo Miguel Almeida
2022-12-13 20:26           ` Paulo Miguel Almeida [this message]
2022-12-14 17:40             ` [PATCH v3] " Vipin Sharma

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=Y5jf59VCL/HAt60q@mail.google.com \
    --to=paulo.miguel.almeida.rodenas@gmail.com \
    --cc=corbet@lwn.net \
    --cc=cristian.ciocaltea@collabora.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=nicolas@fjasle.eu \
    --cc=vipinsh@google.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).