How to turn makefile into JSON Compilation Database?

DuckQueen picture DuckQueen · Jan 15, 2014 · Viewed 16.5k times · Source

Say we have make files (not cmake/premake/ninja etc) for our project that do work for gcc and clang. We want to generate out from them JSON Compilation Database to feed it into clang-modernize tool. How to do such thing? (is there any parser in clang infrastructure or some script with usage like make CC='cc_args.py gcc' CXX='cc_args.py g++' or some other tool)?

Answer

Etan Reisner picture Etan Reisner · Jan 21, 2014

I have no personal experience with it but Bear seems to be targeted to your scenario. (It was linked from the clang-modernize site.)