Commit 2eaf5fa1 authored by Vaibhav Gupta's avatar Vaibhav Gupta

Makefiles: Add cppcheck and flawfinder

Signed-off-by: 's avatarVaibhav Gupta <vaibhav.gupta@cern.ch>
parent a657a13d
...@@ -13,7 +13,7 @@ all clean cleanall install: $(DIRS) ...@@ -13,7 +13,7 @@ all clean cleanall install: $(DIRS)
modules modules_install: modules modules_install:
@$(MAKE) -C drivers/fmc/ $@ @$(MAKE) -C drivers/fmc/ $@
cppcheck: flawfinder cppcheck:
@$(MAKE) -C tools $@ for d in $(C_DIRS); do $(MAKE) -C $$d $@ || exit 1; done
.PHONY: sources srpm modules modules_install clean all cppcheck tools .PHONY: modules modules_install clean all cppcheck flawfinder $(DIRS)
...@@ -12,6 +12,9 @@ KERNELSRC ?= /lib/modules/$(shell uname -r)/build ...@@ -12,6 +12,9 @@ KERNELSRC ?= /lib/modules/$(shell uname -r)/build
export CONFIG_FMC=m export CONFIG_FMC=m
CPPCHECK ?= cppcheck
FLAWFINDER ?= flawfinder
all: modules all: modules
clean modules help modules_install coccicheck: clean modules help modules_install coccicheck:
...@@ -21,4 +24,10 @@ cleanall: clean ...@@ -21,4 +24,10 @@ cleanall: clean
install: modules_install install: modules_install
.PHONY: all modules clean help install modules_install cppcheck:
$(CPPCHECK) -q -I. -I$(KERNELSRC)/include --enable=all *.c *.h
flawfinder:
$(FLAWFINDER) -SQDC --error-level=5 .
.PHONY: all modules clean help install modules_install cppcheck flawfinder
...@@ -22,6 +22,7 @@ LDFLAGS = -L$(LIB) ...@@ -22,6 +22,7 @@ LDFLAGS = -L$(LIB)
LDLIBS = -lfmc LDLIBS = -lfmc
CPPCHECK ?= cppcheck CPPCHECK ?= cppcheck
FLAWFINDER ?= flawfinder
all: $(TOOLS) all: $(TOOLS)
...@@ -43,4 +44,7 @@ cppcheck: ...@@ -43,4 +44,7 @@ cppcheck:
@$(MAKE) -C $(LIB) $@ @$(MAKE) -C $(LIB) $@
$(CPPCHECK) -q -I. -I$(LIB) --suppress=missingIncludeSystem --enable=all *.c *.h --error-exitcode=1 $(CPPCHECK) -q -I. -I$(LIB) --suppress=missingIncludeSystem --enable=all *.c *.h --error-exitcode=1
flawfinder:
$(FLAWFINDER) -SQDC --error-level=6 .
.PHONY: cppcheck clean cleanall install all .PHONY: cppcheck clean cleanall install all
...@@ -23,7 +23,9 @@ CFLAGS += -DGIT_VERSION="\"$(GIT_VERSION)\"" ...@@ -23,7 +23,9 @@ CFLAGS += -DGIT_VERSION="\"$(GIT_VERSION)\""
CFLAGS += $(EXTRACFLAGS) CFLAGS += $(EXTRACFLAGS)
DESTDIR ?= /usr/local DESTDIR ?= /usr/local
CPPCHECK ?= cppcheck CPPCHECK ?= cppcheck
FLAWFINDER ?= flawfinder
all: lib all: lib
...@@ -61,4 +63,10 @@ cppcheck: ...@@ -61,4 +63,10 @@ cppcheck:
-include .depend -include .depend
.PHONY: cppcheck all lib clean clanall install modules_install cppcheck:
$(CPPCHECK) -q -I. --enable=all *.c *.h
flawfinder:
$(FLAWFINDER) -SQDC --error-level=6 .
.PHONY: cppcheck all lib clean clanall install modules_install flawfinder
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