[coreboot-gerrit] Change in libhwbase[master]: Makefile: Add bincompare target

Nico Huber (Code Review) gerrit at coreboot.org
Sun Jun 17 23:33:53 CEST 2018


Nico Huber has uploaded this change for review. ( https://review.coreboot.org/27144


Change subject: Makefile: Add bincompare target
......................................................................

Makefile: Add bincompare target

Change-Id: I7d2dfc7a2e34851fe01a9d72e0d90db00a284eaf
Signed-off-by: Nico Huber <nico.h at gmx.de>
---
M Makefile
A Makefile.compare
2 files changed, 30 insertions(+), 1 deletion(-)



  git pull ssh://review.coreboot.org:29418/libhwbase refs/changes/44/27144/1

diff --git a/Makefile b/Makefile
index a25deb6..8b9ff08 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@
 DESTDIR ?= dest
 
 name ?= hw
-hw-install = Makefile Makefile.proof debug.adc gnat.adc spark.adc
+hw-install = Makefile Makefile.compare Makefile.proof debug.adc gnat.adc spark.adc
 
 top := $(CURDIR)
 cnf := .config
@@ -32,6 +32,7 @@
 	$(eval -include $($(dep)-dir)/config))
 -include $(cnf)
 
+include $(libhw-dir)/Makefile.compare
 include $(libhw-dir)/Makefile.proof
 
 ifeq ($(DEBUG),1)
diff --git a/Makefile.compare b/Makefile.compare
new file mode 100644
index 0000000..7a707c8
--- /dev/null
+++ b/Makefile.compare
@@ -0,0 +1,28 @@
+bincompare-configs := $(wildcard configs/*)
+bincompare-targets := $(addprefix bincompare-,$(notdir $(bincompare-configs)))
+
+$(bincompare-targets): bincompare-%: configs/%
+	$(MAKE) CFLAGS=-Os obj=$(objprefix)/$* cnf=configs/$*
+
+bincompare: ref := HEAD^
+bincompare:
+	rm -rf bincmp.ref/ bincmp.head/
+	[ "$$(git rev-parse $(ref))" = "$$(git rev-parse HEAD)" ] || {	\
+	git checkout $(ref) &&						\
+	$(MAKE) objprefix=bincmp.ref $(bincompare-targets) ||		\
+				{ git checkout HEAD@{1}; exit 1; } &&	\
+	git checkout HEAD@{1} &&					\
+	$(MAKE) objprefix=bincmp.head $(bincompare-targets) &&		\
+	res=0 &&							\
+	for t in $(patsubst bincompare-%,%,$(bincompare-targets));	\
+	do								\
+		b=$$t/$(notdir $(binary));				\
+		r=$$(objdump -d bincmp.ref/$$b | grep -v bincmp);	\
+		h=$$(objdump -d bincmp.head/$$b | grep -v bincmp);	\
+		if [ "$$r" != "$$h" ]; then				\
+			printf "Binaries for %s differ.\n" "$$t";	\
+			res=1;						\
+		fi;							\
+	done; exit $$res; }
+
+.PHONY: bincompare $(bincompare-targets)

-- 
To view, visit https://review.coreboot.org/27144
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: libhwbase
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7d2dfc7a2e34851fe01a9d72e0d90db00a284eaf
Gerrit-Change-Number: 27144
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h at gmx.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180617/1d24635b/attachment.html>


More information about the coreboot-gerrit mailing list