summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Make.coverity48
-rw-r--r--Make.defaults4
-rw-r--r--Make.rules3
-rw-r--r--Makefile21
5 files changed, 71 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore
index d0d91293..3a655726 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,3 +25,4 @@ shim_cert.h
*.srl.old
*.tar.*
version.c
+cov-int/
diff --git a/Make.coverity b/Make.coverity
new file mode 100644
index 00000000..1ffeced3
--- /dev/null
+++ b/Make.coverity
@@ -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
diff --git a/Make.defaults b/Make.defaults
index fdbf35f0..b5a39fe5 100644
--- a/Make.defaults
+++ b/Make.defaults
@@ -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)
diff --git a/Make.rules b/Make.rules
new file mode 100644
index 00000000..2f1d4a7b
--- /dev/null
+++ b/Make.rules
@@ -0,0 +1,3 @@
+define get-config
+$(shell git config --local --get "shim.$(1)")
+endef
diff --git a/Makefile b/Makefile
index c3dbf8b5..ee318fb3 100644
--- a/Makefile
+++ b/Makefile
@@ -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)