Skip to content

Commit

Permalink
Makefile: avoid overzealous removal of compile_commands.json (#1157)
Browse files Browse the repository at this point in the history
Our logic to generate a compilation database is copied (almost
verbatim) from Git's Makefile,

However, one difference is that before creating compile_commands.json
we always remove it.
This doesn't seem very useful, plus it thwarts the logic two lines
below to overwrite compile_commands.json only if we successfully
created a non-empty file.  I believe I added this while debugging
this logic.

I'm not sure in which scenarios this actually makes a difference,
but it seems wrong to keep it.
  • Loading branch information
krobelus authored Nov 11, 2021
1 parent 614493b commit 2246530
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ doc-html: $(HTMLDOC)
ifeq ($(GENERATE_COMPILATION_DATABASE),yes)
all: compile_commands.json
compile_commands.json:
@rm -f $@
$(QUIET_GEN)sed -e '1s/^/[/' -e '$$s/,$$/]/' $(compdb_dir)/*.o.json > $@+
@if test -s $@+; then mv $@+ $@; else $(RM) $@+; fi
endif
Expand Down

0 comments on commit 2246530

Please sign in to comment.