xref: /freebsd/sys/contrib/openzfs/config/CppCheck.am (revision a90b9d0159070121c221b966469c3e36d912bf82)
1#
2# cppcheck for userspace – nodist_*_SOURCES are kernel code and cppcheck goes crazy on them.
3#
4
5PHONY += cppcheck
6
7CPPCHECKFLAGS  = --std=c99 --quiet --max-configs=1 --error-exitcode=2
8CPPCHECKFLAGS += --inline-suppr -U_KERNEL
9
10CPPCHECKDIRS    =
11CPPCHECKTARGETS =
12
13cppcheck-recursive-%:
14	$(MAKE) -C $(subst cppcheck-recursive-,,$@) cppcheck
15
16_CTGT = $(subst cppcheck-for-,,$@)
17cppcheck-for-%:
18	@[ -n "$($(_CTGT)_SOURCES)$(dist_$(_CTGT)_SOURCES)" ]
19	$(CPPCHECK) -j$(CPU_COUNT) $(CPPCHECKFLAGS) $(patsubst -U%,,$(patsubst -D%,,$(filter-out $(AM_CPPFLAGS_NOCHECK),$(or $($(_CTGT)_CPPFLAGS),$(AM_CPPFLAGS))))) $($(_CTGT)_SOURCES) $(dist_$(_CTGT)_SOURCES)
20
21cppcheck: $(addprefix cppcheck-for-,$(subst -,_,$(subst .,_,$(subst /,_,$(CPPCHECKTARGETS))))) $(addprefix cppcheck-recursive-,$(CPPCHECKDIRS))
22