Add 'make coverity' target.

Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
Peter Jones 2017-09-26 14:19:45 -04:00 committed by Peter Jones
parent b681123a87
commit d184bf1075
5 changed files with 71 additions and 6 deletions

1
.gitignore vendored
View File

@ -25,3 +25,4 @@ shim_cert.h
*.srl.old
*.tar.*
version.c
cov-int/

48
Make.coverity Normal file
View File

@ -0,0 +1,48 @@
COV_EMAIL=$(call get-config,coverity.email)
COV_TOKEN=$(call get-config,coverity.token)
COV_URL=$(call get-config,coverity.url)
COV_FILE=$(NAME)-coverity-$(VERSION)-$(COMMIT_ID).tar.bz2
cov-int : clean-shim-objs
make $(DASHJ) Cryptlib/OpenSSL/libopenssl.a Cryptlib/libcryptlib.a
cov-build --dir cov-int make $(DASHJ) all
cov-int-all : clean
cov-build --dir cov-int make $(DASHJ) all
cov-clean :
@rm -vf $(NAME)-coverity-*.tar.*
@if [[ -d cov-int ]]; then rm -rf cov-int && echo "removed 'cov-int'"; fi
cov-file : | $(COV_FILE)
$(COV_FILE) : | cov-int
tar caf $@ cov-int
cov-upload :
@if [[ -n "$(COV_URL)" ]] && \
[[ -n "$(COV_TOKEN)" ]] && \
[[ -n "$(COV_EMAIL)" ]] ; \
then \
echo curl --form token=$(COV_TOKEN) --form email="$(COV_EMAIL)" --form file=@"$(COV_FILE)" --form version=$(VERSION).1 --form description="$(COMMIT_ID)" "$(COV_URL)" ; \
curl --form token=$(COV_TOKEN) --form email="$(COV_EMAIL)" --form file=@"$(COV_FILE)" --form version=$(VERSION).1 --form description="$(COMMIT_ID)" "$(COV_URL)" ; \
else \
echo Coverity output is in $(COV_FILE) ; \
fi
coverity : | cov-test
coverity : cov-int cov-file cov-upload
coverity-all : | cov-test
coverity-all : cov-int-all cov-file cov-upload
clean : | cov-clean
COV_BUILD ?= $(shell x=$$(which --skip-alias --skip-functions cov-build 2>/dev/null) ; [ -n "$$x" ] && echo 1)
ifeq ($(COV_BUILD),)
COV_BUILD_ERROR = $(error cov-build not found)
endif
cov-test : ; $(COV_BUILD_ERROR)
.PHONY : coverity cov-upload cov-clean cov-file cov-test

View File

@ -1,4 +1,5 @@
CC = $(CROSS_COMPILE)gcc
COMPILER ?= gcc
CC = $(CROSS_COMPILE)$(COMPILER)
LD = $(CROSS_COMPILE)ld
OBJCOPY = $(CROSS_COMPILE)objcopy
OPENSSL ?= openssl
@ -20,6 +21,7 @@ DEBUGINFO ?= $(prefix)/lib/debug/
DEBUGSOURCE ?= $(prefix)/src/debug/
OSLABEL ?= $(EFIDIR)
DEFAULT_LOADER ?= \\\\grub$(ARCH_SUFFIX).efi
DASHJ ?= -j$(shell echo $$(($$(grep -c "^model name" /proc/cpuinfo) + 1)))
ARCH ?= $(shell $(CC) -dumpmachine | cut -f1 -d- | sed s,i[3456789]86,ia32,)
OBJCOPY_GTE224 = $(shell expr `$(OBJCOPY) --version |grep ^"GNU objcopy" | sed 's/^.*\((.*)\|version\) //g' | cut -f1-2 -d.` \>= 2.24)

3
Make.rules Normal file
View File

@ -0,0 +1,3 @@
define get-config
$(shell git config --local --get "shim.$(1)")
endef

View File

@ -1,3 +1,6 @@
default : all
NAME = shim
VERSION = 14
ifneq ($(origin RELEASE),undefined)
DASHRELEASE ?= -$(RELEASE)
@ -8,10 +11,15 @@ endif
ifeq ($(MAKELEVEL),0)
TOPDIR ?= $(shell pwd)
endif
ifeq ($(TOPDIR),)
override TOPDIR := $(shell pwd)
endif
override TOPDIR := $(abspath $(TOPDIR))
VPATH = $(TOPDIR)
include $(TOPDIR)/Make.defaults
include $(TOPDIR)/Make.rules
include $(TOPDIR)/Make.coverity
TARGETS = $(SHIMNAME)
TARGETS += $(SHIMNAME).debug $(MMNAME).debug $(FBNAME).debug
@ -211,13 +219,16 @@ else
$(PESIGN) -n certdb -i $< -c "shim" -s -o $@ -f
endif
clean: OBJS=$(wildcard *.o)
clean:
clean-shim-objs:
$(MAKE) -C lib -f $(TOPDIR)/lib/Makefile clean
@rm -rvf $(TARGET) *.o $(SHIM_OBJS) $(MOK_OBJS) $(FALLBACK_OBJS) $(KEYS) certdb $(BOOTCSVNAME)
@rm -vf *.debug *.so *.efi *.efi.* *.tar.* version.c buildid
@rm -vf Cryptlib/*.[oa] Cryptlib/*/*.[oa]
@git clean -f -d -e 'Cryptlib/OpenSSL/*'
clean: clean-shim-objs
$(MAKE) -C Cryptlib -f $(TOPDIR)/Cryptlib/Makefile clean
$(MAKE) -C Cryptlib/OpenSSL -f $(TOPDIR)/Cryptlib/OpenSSL/Makefile clean
$(MAKE) -C lib -f $(TOPDIR)/lib/Makefile clean
rm -rf $(TARGET) $(OBJS) $(MOK_OBJS) $(FALLBACK_OBJS) $(KEYS) certdb $(BOOTCSVNAME)
rm -f *.debug *.so *.efi *.efi.* *.tar.* version.c buildid
GITTAG = $(VERSION)