From ec29f04b5fabd05cdf65f80b33bf27aaaaedafc6 Mon Sep 17 00:00:00 2001 From: Matt Whitlock Date: Tue, 15 Sep 2020 18:54:02 -0400 Subject: [PATCH] Makefile: sort input filenames to SHA256STAMP Make's 'wildcard' function returns matching file paths in an unpredictable order, thereby causing false mismatches in the produced SHA256STAMPs from system to system. This commit sorts the file paths given to 'cat' to make the stamps deterministic. Changelog-Fixed: The build system no longer spuriously regenerates generated sources due to differences in `readdir`(3) sort order. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ed1b2f820..22e636b8b 100644 --- a/Makefile +++ b/Makefile @@ -264,9 +264,9 @@ endif # Git doesn't maintain timestamps, so we only regen if sources actually changed: # We place the SHA inside some generated files so we can tell if they need updating. # Usage: $(call SHA256STAMP_CHANGED) -SHA256STAMP_CHANGED = [ x"`sed -n 's/.*SHA256STAMP://p' $@ 2>/dev/null`" != x"`cat $(filter-out FORCE,$^) | sha256sum | cut -c1-64`" ] +SHA256STAMP_CHANGED = [ x"`sed -n 's/.*SHA256STAMP://p' $@ 2>/dev/null`" != x"`cat $(sort $(filter-out FORCE,$^)) | sha256sum | cut -c1-64`" ] # Usage: $(call SHA256STAMP,commentprefix) -SHA256STAMP = echo '$(1) SHA256STAMP:'`cat $(filter-out FORCE,$^) | sha256sum | cut -c1-64` >> $@ +SHA256STAMP = echo '$(1) SHA256STAMP:'`cat $(sort $(filter-out FORCE,$^)) | sha256sum | cut -c1-64` >> $@ # generate-wire.py --page [header|impl] hdrfilename wirename < csv > file %_wiregen.h: %_wire.csv $(WIRE_GEN_DEPS)