Skip to content

Commit

Permalink
compile_commands.json: fix bear usage
Browse files Browse the repository at this point in the history
  • Loading branch information
rurban committed Feb 20, 2024
1 parent f2ad0d0 commit cfed9b0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
9 changes: 5 additions & 4 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,13 @@ check: $(TESTS) docs/index.md
@$(CXX) --version | head -n2
@echo $(CXX) $(CXXFLAGS)

all: check perf examples api.lst verify
all: check perf examples api.lst compile_commands.json verify

api.lst: $(H) GNUmakefile
perl -lne'/^static.*JOIN\(A, (\w+)\)(.+\))$$/ && print "$$ARGV: $$1 $$2"' ctl/*.h > $@

.cflags: ALWAYS
@echo "$(CC);$(CXX) $(CFLAGS)" >$@.tmp; cmp $@.tmp $@ || mv $@.tmp $@
@echo "$(CC);$(CXX) $(CFLAGS)" >$@.tmp; cmp $@.tmp $@ >/dev/null || mv $@.tmp $@
images:
./gen_images.sh

Expand Down Expand Up @@ -205,7 +205,8 @@ tests/perf/perf_compile_cc_algorithm: tests/perf/perf_compile_cc.cc
$(CXX) $(CXXFLAGS) -DALGORITHM -o $@ tests/perf/perf_compile_cc.cc

compile_commands.json : $(H) GNUmakefile
make clean; bear make
-make clean
bear -- make

examples: $(EXAMPLES)

Expand Down Expand Up @@ -234,7 +235,7 @@ tests/verify/%-2 : tests/verify/%-2.c $(H)
verify: $(VERIFY)

cppcheck:
cppcheck -j4 -I. tests/func/
cppcheck -j4 -I. --check-level=exhaustive tests/func/

MANPAGES = $(patsubst docs/%.md,docs/man/%.h.3, $(wildcard docs/*.md))

Expand Down
11 changes: 6 additions & 5 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ check: ${TESTS} docs/index.md
@${CXX} --version | head -n2
@echo ${CXX} ${CXXFLAGS}

all: check perf examples api.lst #verify
all: check perf examples api.lst compile_commands.json #verify

api.lst: $(H)
api.lst: $(H) makefile
grep '^JOIN(A, ' ctl/*.h | perl -pe 's/JOIN\(A, (\w+?)\)/ $1/' >$@
.cflags: ALWAYS
@echo "$(CC);$(CXX) $(CFLAGS)" >$@.tmp; cmp $@.tmp $@ || mv $@.tmp $@
@echo "$(CC);$(CXX) $(CFLAGS)" >$@.tmp; cmp $@.tmp $@ >/dev/null || mv $@.tmp $@
images:
./gen_images.sh

Expand Down Expand Up @@ -261,7 +261,7 @@ ${srcc2} : ${srcc2}.c .cflags ${H}
verify: ${VERIFY}

cppcheck:
cppcheck -j4 -I. tests/func/
cppcheck -j4 -I. --check-level=exhaustive tests/func/

#tests/func/%: tests/func/%.cc .cflags ${H}
# ${CXX} ${CXXFLAGS} -o $@ $@.cc
Expand Down Expand Up @@ -337,7 +337,8 @@ tests/func/test_int_vector: .cflags ${COMMON_H} tests/test.h ctl/vector.h \
${CXX} ${CXXFLAGS} -o $@ $@.cc

compile_commands.json : $(H) makefile
make clean; bear make
-$(MAKE) clean
bear -- $(MAKE)

asan:
$(MAKE) SANITIZE=1
Expand Down

0 comments on commit cfed9b0

Please sign in to comment.