summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-05-19 07:45:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-05-19 07:45:28 (GMT)
commit6795fc8afd49ecc0ae57661a8858d6882108cef5 (patch)
tree8cc24b12d6bf4ad58416b78268d084a7d317b6eb /Makefile
parent82dca958dd8c3eba22653c605710c3ef6514958f (diff)
parentbcb4edf7af7f10878dd75ccfc3fc0f7596f2d658 (diff)
downloadgit-6795fc8afd49ecc0ae57661a8858d6882108cef5.zip
git-6795fc8afd49ecc0ae57661a8858d6882108cef5.tar.gz
git-6795fc8afd49ecc0ae57661a8858d6882108cef5.tar.bz2
Merge branch 'jk/cocci-batch'
Optionally "make coccicheck" can feed multiple source files to spatch, gaining performance while spending more memory. * jk/cocci-batch: coccicheck: make batch size of 0 mean "unlimited" coccicheck: optionally batch spatch invocations
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile19
1 files changed, 12 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index f965509..8a7e235 100644
--- a/Makefile
+++ b/Makefile
@@ -1171,8 +1171,11 @@ PTHREAD_CFLAGS =
SPARSE_FLAGS ?=
SP_EXTRA_FLAGS =
-# For the 'coccicheck' target
+# For the 'coccicheck' target; setting SPATCH_BATCH_SIZE higher will
+# usually result in less CPU usage at the cost of higher peak memory.
+# Setting it to 0 will feed all files in a single spatch invocation.
SPATCH_FLAGS = --all-includes --patch .
+SPATCH_BATCH_SIZE = 1
include config.mak.uname
-include config.mak.autogen
@@ -2807,12 +2810,14 @@ endif
%.cocci.patch: %.cocci $(COCCI_SOURCES)
@echo ' ' SPATCH $<; \
- ret=0; \
- for f in $(COCCI_SOURCES); do \
- $(SPATCH) --sp-file $< $$f $(SPATCH_FLAGS) || \
- { ret=$$?; break; }; \
- done >$@+ 2>$@.log; \
- if test $$ret != 0; \
+ if test $(SPATCH_BATCH_SIZE) = 0; then \
+ limit=; \
+ else \
+ limit='-n $(SPATCH_BATCH_SIZE)'; \
+ fi; \
+ if ! echo $(COCCI_SOURCES) | xargs $$limit \
+ $(SPATCH) --sp-file $< $(SPATCH_FLAGS) \
+ >$@+ 2>$@.log; \
then \
cat $@.log; \
exit 1; \