Tool for generating clang/LLVM's JSON Compilation Database file for
make
-based build systems.
It's aimed mainly at non-cmake (cmake already generates compilation database)
large codebases. Inspired by projects like YCM-Generator and Bear,
but it's supposed to be faster (mainly with large projects), since it doesn't need a
clean build (as the current available tools do) to get the compile commands, to achieve
this it uses the make options -Bnk
to generate the compilation database file. Also,
it's more cross-compiling friendly than YCM-generator's fake-toolchanin approach.
- Python >= 2.7
- GNU make ( >= version?)
Generate compile_commands.json
using compiledb's "make wrapper" script,
executing Makefile target all
:
$ compiledb-make all > compile_commands.json
Generate compile_commands.json
using compiledb's "make wrapper" script,
using custom_makefile.mk
as main Makefile:
$ compiledb-make -f custom_makefile.mk > compile_commands.json
Genrate compile_commands.json
for some AOSP module (assuming you're running
the script from the root of AOSP tree):
$ compiledb-aosp -o compile_commands.json <aosp/module/path>
Parse a build log file and prints the compilation database to stdout:
$ compiledb-parser . < build-log.txt
I've implemented it basically because I needed to index some AOSP's
modules for navigating and studying purposes (after having no satisfatory results with
current tools such as YCM-Generator and Bear). So I've reworked
YCM-Generator, which resulted in compiledb-gen-parser
and used successfully to
generate compilation database for some AOSP modules in ~1min running in a [Docker][docker]
container and then I've been able to use some great tools such as Vim + YouCompleteMe +
rtags + chromatica.nvim with the codebase.
Even though it's working ok in my environment, with AOSP 5.0, etc, it's still a work in progress and not well tested yet. So, give it a try! Report the issues you got, and maybe send some PR's :)
- Windows not supported yet (at least not tested yet in Cygwin/MinGW)
- Tested only on Linux (Arch Linux) so far
GNU GPLv3