Skip to content

Commit

Permalink
Makefile: add compile_commands.json target
Browse files Browse the repository at this point in the history
  • Loading branch information
gportay committed Mar 12, 2024
1 parent e5f51cb commit f98d9aa
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,25 @@ fuzzer: scandir.o
fuzzer: fuzzer.o
$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@

.PHONY: compile_commands.json
compile_commands.json:
@( echo '['; \
$(foreach c,$(wildcard *.c),\
echo ' {'; \
echo ' "directory": "$(CURDIR)",'; \
echo ' "command": "$(COMPILE.c) $(CFLAGS) $(CPPFAGLS) $(TARGET_ARCH) -o $(c:.c=.o) $(c)",'; \
echo ' "file": "$(c)",'; \
echo ' "output": "$(c:.c=.o)"'; \
echo ' },'; \
) \
echo ' {'; \
echo ' "directory": "$(CURDIR)",'; \
echo ' "command": "true",'; \
echo ' "file": "iamroot.h",'; \
echo ' "output": "libiamroot.so"'; \
echo ' }'; \
echo ']' ) >$@

%.1: %.1.adoc
asciidoctor -b manpage -o $@ $<

Expand Down

0 comments on commit f98d9aa

Please sign in to comment.