Skip to content

Instantly share code, notes, and snippets.

@TypedLambda
Created November 16, 2022 13:19
Show Gist options
  • Save TypedLambda/0374841f065ac222ff3bdac50b5c81b1 to your computer and use it in GitHub Desktop.
Save TypedLambda/0374841f065ac222ff3bdac50b5c81b1 to your computer and use it in GitHub Desktop.
compile_commands.json generation for eclipse cdt / mcuxpresso build
# use 'compiledb' to create a 'compile_commands.json'
ifneq (,$(shell which compiledb 2>&1))
compile_commands.json: | ${C_SRCS}
${MAKE} -Bnwk build-only | sed -e 's#\\#\\\\\\\\#g' -e "s#'\"\\([^']*\\)\"'#\"\\\\\"\1\\\\\"\"#g" | compiledb -o $@
# hook into post build
post-build: | compile_commands.json
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment