From 27854a0a84cd2db9539b662a1f1fc95ef7409962 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 26 Jul 2016 15:05:35 +0200 Subject: build: add checksum target Add a new "checksum" make target which generates an sha256sums file over the image files produced in bin/targets/ and automatically call it during make world after the package index generation. The advantage of this new target is that it is guaranteed to run after the images, the SDK and the ImageBuilder archives have been generated to ensure that they all end up in the checksum file. Fixes FS#51. Uses sed to postprocess the OpenSSL digest output into an sha256sum command compatible format. Signed-off-by: Jo-Philipp Wich --- rules.mk | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'rules.mk') diff --git a/rules.mk b/rules.mk index 12a79ba30c..de24778614 100644 --- a/rules.mk +++ b/rules.mk @@ -371,6 +371,13 @@ define file_copy $(CP) $(1) $(2) endef +# Calculate sha256sum of any plain file within a given directory +# $(1) => Input directory +define sha256sums + (cd $(1); find . -maxdepth 1 -type f -not -name 'sha256sums' -printf "%P\n" | sort | \ + xargs openssl dgst -sha256 | sed -ne 's!^SHA256(\(.*\))= \(.*\)$$!\2 *\1!p' > sha256sums) +endef + # file extension ext=$(word $(words $(subst ., ,$(1))),$(subst ., ,$(1))) -- cgit v1.2.3