compiledb
TLDR
Generate compilation database from make
SYNOPSIS
compiledb [options] command [args]
DESCRIPTION
compiledb generates a compilation database (compile_commands.json) from build commands. This database is used by tools like clangd, clang-tidy, and IDEs for code intelligence and static analysis.
The tool intercepts or parses make command output, extracting compiler invocations with their flags and source files. It supports both running builds and parsing existing build logs.
PARAMETERS
-n, --no-build
Parse make output without actually building.-p, --parse file
Parse existing build log file.-o, --output file
Output file (default: compile_commands.json).--exclude path
Exclude paths from database.-f, --full-path
Use full paths for source files.--command-style
Use command string instead of arguments array.-S, --strict
Exit with error on parse failures.
CAVEATS
Only captures commands from make output. May miss compiler calls not going through make. Complex build systems may need additional configuration. Does not work with all build systems.
HISTORY
compiledb was created to bridge the gap between make-based builds and modern C/C++ tooling that requires compilation databases. It emerged as the clangd and clang-tidy ecosystem grew in popularity in the late 2010s, providing a simpler alternative to cmake or bear for generating compile_commands.json.


