]> git.ipfire.org Git - thirdparty/git.git/blobdiff - Makefile
Merge branch 'nd/merge-quit'
[thirdparty/git.git] / Makefile
index 9fc617e38f99d16a6e4382297a7bb69530007982..6c3bfb1733e2b2851e4996506dd544a47534f037 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1169,8 +1169,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
@@ -2805,12 +2808,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; \