Skip to content

Commit e603a14

Browse files
avarttaylorr
authored andcommitted
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 <[email protected]> Signed-off-by: Taylor Blau <[email protected]>
1 parent 895ae7a commit e603a14

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

Makefile

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3139,9 +3139,20 @@ check: $(GENERATED_H)
31393139
exit 1; \
31403140
fi
31413141

3142+
COCCI_GLOB = $(wildcard contrib/coccinelle/*.cocci)
3143+
COCCI_RULES = $(COCCI_GLOB)
3144+
3145+
COCCICHECK_PENDING = $(filter %.pending.cocci,$(COCCI_RULES))
3146+
COCCICHECK = $(filter-out $(COCCICHECK_PENDING),$(COCCI_RULES))
3147+
3148+
COCCICHECK_PATCHES = $(COCCICHECK:%=%.patch)
3149+
COCCICHECK_PATCHES_PENDING = $(COCCICHECK_PENDING:%=%.patch)
3150+
31423151
COCCI_TEST_RES = $(wildcard contrib/coccinelle/tests/*.res)
31433152

3144-
%.cocci.patch: %.cocci $(COCCI_SOURCES)
3153+
COCCI_PATCHES = $(COCCI_RULES:%=%.patch)
3154+
$(COCCI_PATCHES): $(COCCI_SOURCES)
3155+
$(COCCI_PATCHES): %.patch: %
31453156
$(QUIET_SPATCH) \
31463157
if test $(SPATCH_BATCH_SIZE) = 0; then \
31473158
limit=; \
@@ -3178,11 +3189,11 @@ $(COCCI_TEST_RES_GEN): .build/contrib/coccinelle/tests/%.res : contrib/coccinell
31783189
coccicheck-test: $(COCCI_TEST_RES_GEN)
31793190

31803191
coccicheck: coccicheck-test
3181-
coccicheck: $(addsuffix .patch,$(filter-out %.pending.cocci,$(wildcard contrib/coccinelle/*.cocci)))
3192+
coccicheck: $(COCCICHECK_PATCHES)
31823193

31833194
# See contrib/coccinelle/README
31843195
coccicheck-pending: coccicheck-test
3185-
coccicheck-pending: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.pending.cocci))
3196+
coccicheck-pending: $(COCCICHECK_PATCHES_PENDING)
31863197

31873198
.PHONY: coccicheck coccicheck-pending
31883199

0 commit comments

Comments
 (0)