Messages in this thread | | | Date | Thu, 20 Jun 2019 12:23:45 -0700 | From | Tom Roeder <> | Subject | Re: [PATCH] gen_compile_command: Add support for separate KBUILD_OUTPUT directory |
| |
I can confirm that I can still run clang-tidy on the kernel using this new version of the script; it generates a version of compile_commands.json that works in my case.
On Thu, Jun 20, 2019 at 11:45:23AM -0700, Matthias Kaehlcke wrote: > gen_compile_command.py currently assumes that the .cmd files and the > source code live in the same directory, which is not the case when > a separate KBUILD_OUTPUT directory is used. > > Add a new option to specify the kbuild output directory. If the > option is not set the kernel source directory is used. > > Signed-off-by: Matthias Kaehlcke <mka@chromium.org> Reviewed-by: Tom Roeder <tmroeder@google.com> Tested-by: Tom Roeder <tmroeder@google.com>
> --- > Feel free to bikeshed about the option names ;-) > > scripts/gen_compile_commands.py | 28 +++++++++++++++++++--------- > 1 file changed, 19 insertions(+), 9 deletions(-) > > diff --git a/scripts/gen_compile_commands.py b/scripts/gen_compile_commands.py > index 7915823b92a5..5a738ec66cc7 100755 > --- a/scripts/gen_compile_commands.py > +++ b/scripts/gen_compile_commands.py > @@ -31,15 +31,21 @@ def parse_arguments(): > > Returns: > log_level: A logging level to filter log output. > - directory: The directory to search for .cmd files. > + source_directory: The kernel source directory. > + kbuild_output_directory: The directory to search for .cmd files. > output: Where to write the compile-commands JSON file. > """ > usage = 'Creates a compile_commands.json database from kernel .cmd files' > parser = argparse.ArgumentParser(description=usage) > > - directory_help = ('Path to the kernel source directory to search ' > + directory_help = ('Path to the kernel source directory' Minor detail: this needs a space after "directory" so that it reads "directory '". Otherwise, the output doesn't have a space before the parenthesis.
> '(defaults to the working directory)') > parser.add_argument('-d', '--directory', type=str, help=directory_help) > + kbuild_output_directory_help = ('Path to the directory to search for ' > + '.cmd files' Same comment here: this should be "files '", with a space before the ending quote character.
| |