build: Add simple compile_commands.json generation
This can be used with a clangd server to get code completion and cross references in editor. To simplify the generation, create .cmd files for most object files while building that contains the base directory and command that was used when compiling it. A very simple gen_compile_commands.py is provided which will read one or more build directories and generate the compile_commands.json file for it. Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
This commit is contained in:
parent
733069fd4c
commit
619ff3d2e8
3 changed files with 60 additions and 0 deletions
|
@ -83,13 +83,16 @@ _make_dirs:
|
|||
@mkdir -p $(sort $(_DIRS))
|
||||
|
||||
$(BUILDDIR)/$(PROJ)/src/%.o: $(ROOTDIR)src/%.c $(CONFIG_FILE) | _make_dirs
|
||||
@echo $(CURDIR): '$(CC) -c -o $@ $(CFLAGS) $<' >$@.cmd
|
||||
$(Q)$(CC) -c -o $@ $(CFLAGS) $<
|
||||
@$(E) " CC " $<
|
||||
$(BUILDDIR)/$(PROJ)/%.o: %.c $(CONFIG_FILE) | _make_dirs
|
||||
@echo $(CURDIR): '$(CC) -c -o $@ $(CFLAGS) $<' >$@.cmd
|
||||
$(Q)$(CC) -c -o $@ $(CFLAGS) $<
|
||||
@$(E) " CC " $<
|
||||
# for the fuzzing tests
|
||||
$(BUILDDIR)/$(PROJ)/wpa_supplicant/%.o: $(ROOTDIR)wpa_supplicant/%.c $(CONFIG_FILE) | _make_dirs
|
||||
@echo $(CURDIR): '$(CC) -c -o $@ $(CFLAGS) $<' >$@.cmd
|
||||
$(Q)$(CC) -c -o $@ $(CFLAGS) $<
|
||||
@$(E) " CC " $<
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue