Last active
October 24, 2017 18:38
-
-
Save presuku/9aea6725da3a20ce109bb17f7f9bb0dd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## make compile_commands.json for clangd | |
MK_C_C_JSON_PWD := `pwd` | |
MK_C_C_JSON_SRCS := $(ALL_SRC) | |
MK_C_C_JSON_CFLAGS := $(ALL_CFLAGS) | |
mk_c_c_json-clean: | |
@-rm -f compile_commands.json | |
mk_c_c_json: mk_c_c_json-clean | |
@echo "[" > compile_commands.json | |
@for i in $(MK_C_C_JSON_SRCS) ; do \ | |
echo "{\n\ | |
\"directory\": \"$(MK_C_C_JSON_PWD)\",\n\ | |
\"command\": \"/usr/bin/cc $(MK_C_C_JSON_CFLAGS) -o /tmp/$$i.o -c $(MK_C_C_JSON_PWD)/$$i\",\n\ | |
\"file\": \"$(MK_C_C_JSON_PWD)/$$i\"\n\ | |
}," >> compile_commands.json ;\ | |
done | |
@sed -i '$$d' compile_commands.json | |
@echo "}\n]\n" >> compile_commands.json | |
mk_compile_commands.json: mk_c_c_json | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment