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@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)