Skip to content
/ ABCD Public

Pure shell tool for generating JSON compilation database

License

Notifications You must be signed in to change notification settings

lyonlh/ABCD

Repository files navigation

A Builder of Compilation Database

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.

Why

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.

How it works

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.

Usage

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

Testing

Already tested under Macosx Sierra 10.12.6 and Ubuntu 16.04.

Issues

If you find a bug, please report it to the issue tracker. Please give the detailed description such as OS, projects and so on.

Contribution

Any suggestion and pull request is welcome :)

License

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    

About

Pure shell tool for generating JSON compilation database

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages