Generate compile_commands.json from GNU make output online
Stuck in getting a compile_commands.json out of a C/C++ project using GNU make as the build tool? Copy the make output and paste above and download it, that's it. 😱
To get the output right and efficient, I recommend building projects by the command make clean && make -nw
, which will print the directories. It also works perfectly with projects like Redis, which hides the build details from the terminal using ANSI escape code.
Happy playing GNU make C/C++ projects with Emacs/VSCode/CLion/clang-tidy/Sourcetrail etc!
🔊I'm considering making this as a API service for $5/mo, so that you can just pipe the output into a curl
command. Email me 🥷if you're interested.
Additional resources about compilation database: