compiledb is a Python tool designed for generating Clang's JSON Compilation Database files, primarily for GNU make-based build systems. It targets large codebases that do not use CMake, which typically generates its own compilation database. The library is currently at version 0.10.7 and is actively maintained, with releases occurring as needed rather than on a strict schedule.
pip install compiledbNo compatibility data collected yet for this library.
The primary usage of compiledb is as a wrapper around your `make` command. It executes your build while intercepting and parsing the compilation commands to produce the `compile_commands.json` file. You can also generate the database from an existing build log.
Try generating a verbose build log using `make -Bnwk > build.log` and then parsing it explicitly with `compiledb --parse build.log`. Simplify the `Makefile` structure if possible.
Inspect the `make` output for problematic lines. Consider simplifying the shell commands within your `Makefile` or pre-processing the build log to remove lines that cause `bashlex` parsing issues. For Windows, ensure paths are handled correctly.
Manually adjust include paths in your `Makefile` to use forward slashes where possible, or post-process the generated `compile_commands.json` to normalize path separators.
Currently, there is no direct configuration within `compiledb` to enforce this grouping. You might need to use a post-processing script on `compile_commands.json` to reorder or merge these arguments for optimal VS Code integration.
Ensure that `compiledb` is run from the correct build directory. If `make` commands change directories, consider using `compiledb --build-dir <path>` or `compiledb --parse` with a log that has absolute paths.
Examine the `make` output around the indicated line number for unusual shell constructs. Try to simplify the `Makefile` command that causes the error or, if possible, use `make -Bnwk` to generate a log and manually clean up problematic lines before using `compiledb --parse`.
Prefer using `compiledb make` as it's the intended wrapper behavior. If direct parsing is necessary, ensure `make -Bnwk` is used to produce a verbose, non-building log, and be aware that some build systems might behave differently when their output is redirected.