Skip to content

Instantly share code, notes, and snippets.

@MrThanlon
Created August 17, 2022 08:35
Show Gist options
  • Save MrThanlon/3a534a7e12c3ac918bb5259b27a92f91 to your computer and use it in GitHub Desktop.
Save MrThanlon/3a534a7e12c3ac918bb5259b27a92f91 to your computer and use it in GitHub Desktop.
compile_commands.json for Makefile
make --always-make --dry-run \
| grep -wE 'gcc|g\+\+' \
| grep -w '\-c' \
| jq -nR '[inputs|{directory:".", command:., file: match(" [^ ]+$").string[1:]}]' \
> compile_commands.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment