项目作者: lyonlh

项目描述 :
Pure shell tool for generating JSON compilation database
高级语言: Shell
项目地址: git://github.com/lyonlh/ABCD.git
创建时间: 2018-03-06T09:47:15Z
项目社区:https://github.com/lyonlh/ABCD

开源协议:MIT License

下载


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

  1. abcd.sh [make options and target(s)] [-- [-a] [-d] [-h] [-m mk_name] [-o db_file]]
  2. -a use 'arguments' instead of 'command' field in compilation database
  3. -d print debug message
  4. -h display this help and exit
  5. -m mk_name specify path or name of 'make' such as 'gmake'
  6. -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,

  1. /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:

  1. /path/to/abcd.sh -j 8 <target> -- -m "scons" -o compile_commands.json