Re: [PATCH v2] gen_compile_command: Add support for separate KBUILD_OUTPUT directory

From: Masahiro Yamada
Date: Thu Jul 04 2019 - 01:09:29 EST


On Tue, Jun 25, 2019 at 1:31 AM Matthias Kaehlcke <mka@xxxxxxxxxxxx> 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 this the kbuild output directory. If the
> option is not set the kernel source directory is used.

I do not understand this patch.

In my understanding, this tool already provides
-d, --directory option, which is supposed to point to
the kbuild output directory, not a source directory.


This works except under tools/.



> - entry = process_line(directory, dirpath,
> + entry = process_line(source_directory, dirpath,
> result.group(1), result.group(2))

This is wrong.

result.group(2) returns the relative path to the output tree
instead of the source tree.
(or absolute path).


[Example of breakage]

$ make -j8 O=foo defconfig all
$ scripts/gen_compile_commands.py -d . -k foo
WARNING: Found 0 entries. Have you compiled the kernel?






--
Best Regards
Masahiro Yamada