summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Make.scan-build20
-rw-r--r--Makefile1
3 files changed, 22 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 3a655726..312a0e3a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,3 +26,4 @@ shim_cert.h
*.tar.*
version.c
cov-int/
+scan-results/
diff --git a/Make.scan-build b/Make.scan-build
new file mode 100644
index 00000000..e110b3e1
--- /dev/null
+++ b/Make.scan-build
@@ -0,0 +1,20 @@
+SCAN_BUILD ?= $(shell x=$$(which --skip-alias --skip-functions scan-build 2>/dev/null) ; [ -n "$$x" ] && echo 1)
+ifeq ($(SCAN_BUILD),)
+ SCAN_BUILD_ERROR = $(error scan-build not found)
+endif
+
+scan-test : ; $(SCAN_BUILD_ERROR)
+
+scan-clean :
+ @if [[ -d scan-results ]]; then rm -rf scan-results && echo "removed 'scan-results'"; fi
+
+scan-build : | scan-test
+scan-build : clean-shim-objs
+ make $(DASHJ) Cryptlib/OpenSSL/libopenssl.a Cryptlib/libcryptlib.a
+ scan-build -o scan-results make $(DASHJ) all
+
+scan-build-all : | scan-test
+scan-build-all : clean
+ scan-build -o scan-results make $(DASHJ) all
+
+.PHONY : scan-build scan-clean
diff --git a/Makefile b/Makefile
index ee318fb3..6db144c5 100644
--- a/Makefile
+++ b/Makefile
@@ -20,6 +20,7 @@ VPATH = $(TOPDIR)
include $(TOPDIR)/Make.defaults
include $(TOPDIR)/Make.rules
include $(TOPDIR)/Make.coverity
+include $(TOPDIR)/Make.scan-build
TARGETS = $(SHIMNAME)
TARGETS += $(SHIMNAME).debug $(MMNAME).debug $(FBNAME).debug