Public
Authored by Jason Azze

Generate a compilation database for NTPsec to use in Sourcetrail

I wanted to look at NTPsec using Sourctrail. (see sourcetrail.com) Sourctrail likes to consume JSON compilation databases, compile_commands.json. You usually generate these with CMake, but NTPsec isn't set up for that. There is a project called B Ear (bear) that will let you generate a compile_commands.json file without CMake. I cloned the project and installed it.

git clone https://github.com/rizsotto/Bear.git
cd Bear/
cmake .
make all
sudo make install

Then I changed to my NTPsec source directory in order to use bear to generate the compilation db.

./waf distclean
CC="clang"
./waf configure
bear ./waf build
cat compile_commands.json #This should be full of good JSON.

I'm not sure the clang step is necessary. In fact, it's probably not. It was left over from a thinko I was having at the time. I've left it in because I know those steps work.

use-bear-to-generate-compilation-db.txt 31 Bytes
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment