summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-11-01 22:35:45 (GMT)
committerTaylor Blau <me@ttaylorr.com>2022-11-03 01:22:16 (GMT)
commite603a140aed8fc362320d949bfc0b47adcefc32f (patch)
tree8496bdd5841432d3ceeaed3832a2b30cf34e9440 /Makefile
parent895ae7ae2a9c5d10ed6ead4766721772b93634b0 (diff)
downloadgit-e603a140aed8fc362320d949bfc0b47adcefc32f.zip
git-e603a140aed8fc362320d949bfc0b47adcefc32f.tar.gz
git-e603a140aed8fc362320d949bfc0b47adcefc32f.tar.bz2
Makefile: add ability to TAB-complete cocci *.patch rules
Declare the contrib/coccinelle/<rule>.cocci.patch rules in such a way as to allow TAB-completion, and slightly optimize the Makefile by cutting down on the number of $(wildcard) in favor of defining "coccicheck" and "coccicheck-pending" in terms of the same incrementally filtered list. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile17
1 files changed, 14 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index e5fcf96..5d4e55a 100644
--- a/Makefile
+++ b/Makefile
@@ -3139,9 +3139,20 @@ check: $(GENERATED_H)
exit 1; \
fi
+COCCI_GLOB = $(wildcard contrib/coccinelle/*.cocci)
+COCCI_RULES = $(COCCI_GLOB)
+
+COCCICHECK_PENDING = $(filter %.pending.cocci,$(COCCI_RULES))
+COCCICHECK = $(filter-out $(COCCICHECK_PENDING),$(COCCI_RULES))
+
+COCCICHECK_PATCHES = $(COCCICHECK:%=%.patch)
+COCCICHECK_PATCHES_PENDING = $(COCCICHECK_PENDING:%=%.patch)
+
COCCI_TEST_RES = $(wildcard contrib/coccinelle/tests/*.res)
-%.cocci.patch: %.cocci $(COCCI_SOURCES)
+COCCI_PATCHES = $(COCCI_RULES:%=%.patch)
+$(COCCI_PATCHES): $(COCCI_SOURCES)
+$(COCCI_PATCHES): %.patch: %
$(QUIET_SPATCH) \
if test $(SPATCH_BATCH_SIZE) = 0; then \
limit=; \
@@ -3178,11 +3189,11 @@ $(COCCI_TEST_RES_GEN): .build/contrib/coccinelle/tests/%.res : contrib/coccinell
coccicheck-test: $(COCCI_TEST_RES_GEN)
coccicheck: coccicheck-test
-coccicheck: $(addsuffix .patch,$(filter-out %.pending.cocci,$(wildcard contrib/coccinelle/*.cocci)))
+coccicheck: $(COCCICHECK_PATCHES)
# See contrib/coccinelle/README
coccicheck-pending: coccicheck-test
-coccicheck-pending: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.pending.cocci))
+coccicheck-pending: $(COCCICHECK_PATCHES_PENDING)
.PHONY: coccicheck coccicheck-pending