Use FORCE target instead of .PHONY

Use the FORCE target around cppcheck tasks. The FORCE target, while less
explicit about what it is, acts sane around pattern-based recipes.
parent c1277c90
......@@ -77,7 +77,6 @@ $(1): LINK_LIBRARIES += -L$(O)/lib -Wl,-R$(abspath $(O)/lib) $$(addprefix -l,$$(
$(1): $$(patsubst %,$(O)/lib/lib%.so,$$($(2)_LOCAL_LIBS))
endif
.PHONY: cppcheck-$(1) cppcheck-all
cppcheck-$$(notdir $$(basename $(1))): $$(patsubst %,$(S)/$(3)%.c,$$(filter-out %.embed,$$($(2)_MODULES)))
endef
......@@ -89,7 +88,7 @@ endef
# $(eval $(call REGISTER_BIN,binary_name,src/path/to/directory))
define REGISTER_BIN
.PHONY: cppcheck
.PHONY: cppcheck cppcheck-all
ifneq (,$(findstring ^$(RESTRICT),^$(1)))
TARGETS += $(O)/$(1)
......@@ -230,6 +229,11 @@ $(O)/lua_lib/%:
$(Q)mkdir -p $(dir $@)
$(Q)$(LUAC) -o $@ $<
cppcheck-%:
# An empty target without any prereqs. This one is „remade“ every time, triggering
# anything that depends on it, just like .PHONY. Except that it works well with
# generic/static rules.
FORCE:
cppcheck-%: FORCE
$(M) CCPC $@
$(Q)cppcheck --enable=style --enable=warning --std=c99 --suppress=allocaCalled --suppress=obsoleteFunctionsalloca --template='{file}:{line},{severity},{id},{message}' --inline-suppr --error-exitcode=1 -q $^
$(Q)cppcheck --enable=style --enable=warning --std=c99 --suppress=allocaCalled --suppress=obsoleteFunctionsalloca --template='{file}:{line},{severity},{id},{message}' --inline-suppr --error-exitcode=1 -q $(filter-out FORCE,$^)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment