Skip to contentSkip to conversation

mk/lib.mk: Sort wildcard expansion for determinism

PATCH New Richard Purdie 2 participants 2 messages Mar 2, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mk/lib.mk: Sort wildcard expansion for determinism

The order of the objects linked into libltp.a varies depending on the order of the files found on disk. This results in most ltp binaries differing depending on that order too.

Sort the wildcard expansion of *.c which leads to reproducible binaries.

include/mk/lib.mk +1 -0
Index: git/include/mk/lib.mk
===================================================================
@@ -50,6 +50,7 @@ endif
 MAKE_TARGETS	+= $(LIB)
 
 LIBSRCS		?= $(wildcard $(abs_srcdir)/*.c)
+LIBSRCS		:= $(sort $(LIBSRCS))
 LIBSRCS		:= $(abspath $(LIBSRCS))
 LIBSRCS		:= $(subst $(abs_srcdir)/,,$(wildcard $(LIBSRCS)))
 LIBSRCS		:= $(filter-out $(FILTER_OUT_LIBSRCS),$(LIBSRCS))