From: Paul Barker <paul@pbarker.dev>
To: Nathan Chancellor <nathan@kernel.org>,
Nicolas Schier <nicolas.schier@linux.dev>,
Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>
Cc: llvm@lists.linux.dev, linux-kbuild@vger.kernel.org,
linux-kernel@vger.kernel.org, Paul Barker <paul@pbarker.dev>
Subject: [PATCH] gen_compile_commands: Look in KBUILD_OUTPUT if set
Date: Fri, 05 Sep 2025 11:17:43 +0100 [thread overview]
Message-ID: <20250905-gen_compile_commands-v1-1-9f5194542d4d@pbarker.dev> (raw)
If someone is already using the KBUILD_OUTPUT environment variable to
specify the directory where object files are placed, they shouldn't need
to repeat the same information to gen_compile_commands.py.
Signed-off-by: Paul Barker <paul@pbarker.dev>
---
scripts/clang-tools/gen_compile_commands.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/scripts/clang-tools/gen_compile_commands.py b/scripts/clang-tools/gen_compile_commands.py
index 96e6e46ad1a702cb0fad5d524a9a02d222b236ec..7b94a2ffba0b4d5f1290b51bd602fb3f33acce6a 100755
--- a/scripts/clang-tools/gen_compile_commands.py
+++ b/scripts/clang-tools/gen_compile_commands.py
@@ -39,8 +39,9 @@ def parse_arguments():
parser = argparse.ArgumentParser(description=usage)
directory_help = ('specify the output directory used for the kernel build '
- '(defaults to the working directory)')
- parser.add_argument('-d', '--directory', type=str, default='.',
+ '(defaults to $KBUILD_OUTPUT (if set) or the working directory)')
+ parser.add_argument('-d', '--directory', type=str,
+ default=os.environ.get('KBUILD_OUTPUT', '.'),
help=directory_help)
output_help = ('path to the output command database (defaults to ' +
---
base-commit: d69eb204c255c35abd9e8cb621484e8074c75eaa
change-id: 20250905-gen_compile_commands-b03d9c923fe5
Best regards,
--
Paul Barker
next reply other threads:[~2025-09-05 10:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-05 10:17 Paul Barker [this message]
2025-09-05 16:34 ` [PATCH] gen_compile_commands: Look in KBUILD_OUTPUT if set Justin Stitt
2025-09-05 17:26 ` Paul Barker
2025-09-05 18:02 ` Nathan Chancellor
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=20250905-gen_compile_commands-v1-1-9f5194542d4d@pbarker.dev \
--to=paul@pbarker.dev \
--cc=justinstitt@google.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=nick.desaulniers+lkml@gmail.com \
--cc=nicolas.schier@linux.dev \
/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).