ABCD is a bash
tool that generates a JSON compilation database.
The JSON compilation database contains full information on how to parse a translation unit.
So that the tools based on the C/C++ Abstract Syntax Tree can parse a translation unit independently.
It's not easy to generate compilation database under the pure make
system.
Athough there are already some tools1 for this job, making them work well is difficult.
ABCD intercepts the implicit variables CC
and CXX
in order to receive the compilation commands from make
and shell
.2
And then ABCD parses the compilation commands and generates a JSON compilation database.
abcd.sh [make options and target(s)] [-- [-a] [-d] [-h] [-m mk_name] [-o db_file]]
-a use 'arguments' instead of 'command' field in compilation database
-d print debug message
-h display this help and exit
-m mk_name specify path or name of 'make' such as 'gmake'
-o db_file write output to the db_file('./compile_commands.json' by default)
Enter the directory you run make
generally, invoke abcd.sh
instead. For example,
/path/to/abcd.sh -Bkj <target> -- -o compile_commands.json
Already tested under Macosx Sierra 10.12.6 and Ubuntu 16.04.
If you find a bug, please report it to the issue tracker. Please give the detailed description such as OS, projects and so on.
Any suggestion and pull request is welcome :)
MIT.
1: Bear, compiledb-generator etc.
2: ABCD also supports 'Scons'-built projects whose 'Sconstruct' exposes CC/CXX:
/path/to/abcd.sh -j 8 <target> -- -m "scons" -o compile_commands.json