Skip to content

Commit

Permalink
make: Add target for compile_commands.json
Browse files Browse the repository at this point in the history
As a convenience, add a make target to create compile_commands.json to
feed clangd for LSP support. Requires bear.
  • Loading branch information
dehanj committed Oct 11, 2024
1 parent 49c5917 commit 86aff11
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
*.a
*.o
*.bin
*.elf
*.elf

# Clangd
compile_commands.json
.cache
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ clean:
rm -f $(LIBS) $(LIBOBJS) libcrt0/crt0.o
rm -f libmonocypher.a $(MONOOBJS)

# Create compile_commands.json for clangd and LSP
.PHONY: clangd
clangd: compile_commands.json
compile_commands.json:
$(MAKE) clean
bear -- make all

# Uses ../.clang-format
FMTFILES=include/tkey/*.h libcommon/*.c
.PHONY: fmt
Expand Down

0 comments on commit 86aff11

Please sign in to comment.