aboutsummaryrefslogtreecommitdiffstats
path: root/config/CppCheck.am
blob: 89a067d814ff1a296af07c283ac844999846b031 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#
# cppcheck for userspace – nodist_*_SOURCES are kernel code and cppcheck goes crazy on them.
#

PHONY += cppcheck

CPPCHECKFLAGS  = --std=c99 --quiet --max-configs=1 --error-exitcode=2
CPPCHECKFLAGS += --inline-suppr -U_KERNEL

CPPCHECKDIRS    =
CPPCHECKTARGETS =

cppcheck-recursive-%:
	$(MAKE) -C $(subst cppcheck-recursive-,,$@) cppcheck

_CTGT = $(subst cppcheck-for-,,$@)
cppcheck-for-%:
	@[ -n "$($(_CTGT)_SOURCES)$(dist_$(_CTGT)_SOURCES)" ]
	$(CPPCHECK) -j$(CPU_COUNT) $(CPPCHECKFLAGS) $(patsubst -U%,,$(patsubst -D%,,$(filter-out $(AM_CPPFLAGS_NOCHECK),$(or $($(_CTGT)_CPPFLAGS),$(AM_CPPFLAGS))))) $($(_CTGT)_SOURCES) $(dist_$(_CTGT)_SOURCES)

cppcheck: $(addprefix cppcheck-for-,$(subst -,_,$(subst .,_,$(subst /,_,$(CPPCHECKTARGETS))))) $(addprefix cppcheck-recursive-,$(CPPCHECKDIRS))