Skip to content

Instantly share code, notes, and snippets.

@kha-dinh
Created September 30, 2023 03:36
Show Gist options
  • Select an option

  • Save kha-dinh/8bddce58d81b79a81823ec9ad42fc411 to your computer and use it in GitHub Desktop.

Select an option

Save kha-dinh/8bddce58d81b79a81823ec9ad42fc411 to your computer and use it in GitHub Desktop.
Generate compilation database on MacOS for non-CMake projects without bear

Somehow bear did not work on my setup. Here is an alternative that collects the build log and use compiledb to generate compile_commands.json

First generate the build log by tracing executed commands

gmake SHELL='sh -x' 2>&1 | tee make.txt

Now we parse the build log:

compiledb --parse make.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment