• Masahiro Yamada's avatar
    gen_compile_commands: do not support .cmd files under tools/ directory · 6ca4c6d2
    Masahiro Yamada authored
    The tools/ directory uses a different build system, and the format of
    .cmd files is different because the tools builds run in a different
    work directory.
    
    Supporting two formats compilicates the script.
    
    The only loss by this change is objtool.
    
    Also, rename the confusing variable 'relative_path' because it is
    not necessarily a relative path. When the output directory is not
    the direct child of the source tree (e.g. O=foo/bar), it is an
    absolute path. Rename it to 'file_path'.
    
    os.path.join(root_directory, file_path) works whether the file_path
    is relative or not. If file_path is already absolute, it returns it
    as-is.
    
    I used os.path.abspath() to normalize file paths. If you run this
    script against the kernel built with O=foo option, the file_path
    contains '../' patterns. os.path.abspath() fixes up 'foo/bar/../baz'
    into 'foo/baz', and produces a cleaner commands_database.json.
    Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
    Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
    6ca4c6d2
gen_compile_commands.py 4.87 KB