mirror of
https://github.com/git/git.git
synced 2024-11-24 02:17:02 +08:00
add coccicheck make target
Provide a simple way to run Coccinelle against all source files, in the form of a Makefile target. Running "make coccicheck" applies each .cocci file in contrib/coccinelle/ on all source files. It generates a .patch file for each .cocci file, containing the actual changes for effecting the transformations described by the semantic patches. Non-empty .patch files are reported. They can be applied to the work tree using "patch -p0", but should be checked to e.g. make sure they don't screw up formatting or create circular references. Coccinelle's diagnostic output (stderr) is piped into .log files. Linux has a much more elaborate make target of the same name; let's start nice and easy. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
76d156766f
commit
63f0a758a0
14
Makefile
14
Makefile
@ -456,6 +456,7 @@ CURL_CONFIG = curl-config
|
|||||||
PTHREAD_LIBS = -lpthread
|
PTHREAD_LIBS = -lpthread
|
||||||
PTHREAD_CFLAGS =
|
PTHREAD_CFLAGS =
|
||||||
GCOV = gcov
|
GCOV = gcov
|
||||||
|
SPATCH = spatch
|
||||||
|
|
||||||
export TCL_PATH TCLTK_PATH
|
export TCL_PATH TCLTK_PATH
|
||||||
|
|
||||||
@ -2296,6 +2297,18 @@ check: common-cmds.h
|
|||||||
exit 1; \
|
exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
C_SOURCES = $(patsubst %.o,%.c,$(C_OBJ))
|
||||||
|
%.cocci.patch: %.cocci $(C_SOURCES)
|
||||||
|
@echo ' ' SPATCH $<; \
|
||||||
|
for f in $(C_SOURCES); do \
|
||||||
|
$(SPATCH) --sp-file $< $$f; \
|
||||||
|
done >$@ 2>$@.log; \
|
||||||
|
if test -s $@; \
|
||||||
|
then \
|
||||||
|
echo ' ' SPATCH result: $@; \
|
||||||
|
fi
|
||||||
|
coccicheck: $(patsubst %.cocci,%.cocci.patch,$(wildcard contrib/coccinelle/*.cocci))
|
||||||
|
|
||||||
### Installation rules
|
### Installation rules
|
||||||
|
|
||||||
ifneq ($(filter /%,$(firstword $(template_dir))),)
|
ifneq ($(filter /%,$(firstword $(template_dir))),)
|
||||||
@ -2487,6 +2500,7 @@ clean: profile-clean coverage-clean
|
|||||||
$(RM) -r $(GIT_TARNAME) .doc-tmp-dir
|
$(RM) -r $(GIT_TARNAME) .doc-tmp-dir
|
||||||
$(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
|
$(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
|
||||||
$(RM) $(htmldocs).tar.gz $(manpages).tar.gz
|
$(RM) $(htmldocs).tar.gz $(manpages).tar.gz
|
||||||
|
$(RM) contrib/coccinelle/*.cocci.patch*
|
||||||
$(MAKE) -C Documentation/ clean
|
$(MAKE) -C Documentation/ clean
|
||||||
ifndef NO_PERL
|
ifndef NO_PERL
|
||||||
$(MAKE) -C gitweb clean
|
$(MAKE) -C gitweb clean
|
||||||
|
Loading…
Reference in New Issue
Block a user