-
Notifications
You must be signed in to change notification settings - Fork 0
/
compdb.mk
17 lines (17 loc) · 788 Bytes
/
compdb.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
compile_commands.json:
@echo "[" > $@
@sed '$$d' $^ >> $@
@echo " }" >> $@
@echo "]" >> $@
%.compdb: %
@echo " {" > $@
@echo " \"command\":\"$(COMPDB_COMMAND) -c $*\", " >> $@
@echo " \"directory\":\"$(CURDIR)\"," >> $@
@echo " \"file\":\"$*\"" >> $@
@echo " }," >> $@
%.c.compdb: COMPDB_COMMAND=$(CC) $(CFLAGS) $(CPPFLAGS)
%.h.compdb: COMPDB_COMMAND=$(CC) $(CFLAGS) $(CPPFLAGS)
%.cc.compdb: COMPDB_COMMAND=$(CXX) $(CXXFLAGS) $(CPPFLAGS)
%.hh.compdb: COMPDB_COMMAND=$(CXX) $(CXXFLAGS) $(CPPFLAGS)
%.cpp.compdb: COMPDB_COMMAND=$(CXX) $(CXXFLAGS) $(CPPFLAGS)
%.hpp.compdb: COMPDB_COMMAND=$(CXX) $(CXXFLAGS) $(CPPFLAGS)