[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250905-gen_compile_commands-v1-1-9f5194542d4d@pbarker.dev>
Date: Fri, 05 Sep 2025 11:17:43 +0100
From: Paul Barker <paul@...rker.dev>
To: Nathan Chancellor <nathan@...nel.org>,
Nicolas Schier <nicolas.schier@...ux.dev>,
Nick Desaulniers <nick.desaulniers+lkml@...il.com>,
Bill Wendling <morbo@...gle.com>, Justin Stitt <justinstitt@...gle.com>
Cc: llvm@...ts.linux.dev, linux-kbuild@...r.kernel.org,
linux-kernel@...r.kernel.org, Paul Barker <paul@...rker.dev>
Subject: [PATCH] gen_compile_commands: Look in KBUILD_OUTPUT if set
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@...rker.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
Powered by blists - more mailing lists