William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 1 | From 77c7963c7a0f1c455f20520d5c7b1ec9b17a44fb Mon Sep 17 00:00:00 2001 |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 2 | From: Alexander Kanavin <alex.kanavin@gmail.com> |
| 3 | Date: Wed, 23 Dec 2020 19:14:32 +0100 |
| 4 | Subject: [PATCH] Makefile: sort all wildcard file list expansions |
| 5 | |
| 6 | Otherwise the order is non-deterministic and breaks |
| 7 | reproducible builds. |
| 8 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 9 | Upstream-Status: Submitted [https://github.com/facebook/zstd/pull/2895] |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 10 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 11 | |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 12 | --- |
| 13 | programs/Makefile | 10 +++++----- |
| 14 | tests/Makefile | 4 ++-- |
| 15 | tests/fuzz/Makefile | 2 +- |
| 16 | 3 files changed, 8 insertions(+), 8 deletions(-) |
| 17 | |
| 18 | diff --git a/programs/Makefile b/programs/Makefile |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 19 | index 599fb02f..2c416467 100644 |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 20 | --- a/programs/Makefile |
| 21 | +++ b/programs/Makefile |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 22 | @@ -74,11 +74,11 @@ ZSTDLEGACY_DIR := $(ZSTDDIR)/legacy |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 23 | |
| 24 | vpath %.c $(ZSTDLIB_COMMON) $(ZSTDLIB_COMPRESS) $(ZSTDLIB_DECOMPRESS) $(ZDICT_DIR) $(ZSTDLEGACY_DIR) |
| 25 | |
| 26 | -ZSTDLIB_COMMON_C := $(wildcard $(ZSTDLIB_COMMON)/*.c) |
| 27 | -ZSTDLIB_COMPRESS_C := $(wildcard $(ZSTDLIB_COMPRESS)/*.c) |
| 28 | -ZSTDLIB_DECOMPRESS_C := $(wildcard $(ZSTDLIB_DECOMPRESS)/*.c) |
| 29 | +ZSTDLIB_COMMON_C := $(sort $(wildcard $(ZSTDLIB_COMMON)/*.c)) |
| 30 | +ZSTDLIB_COMPRESS_C := $(sort $(wildcard $(ZSTDLIB_COMPRESS)/*.c)) |
| 31 | +ZSTDLIB_DECOMPRESS_C := $(sort $(wildcard $(ZSTDLIB_DECOMPRESS)/*.c)) |
| 32 | ZSTDLIB_CORE_SRC := $(ZSTDLIB_DECOMPRESS_C) $(ZSTDLIB_COMMON_C) $(ZSTDLIB_COMPRESS_C) |
| 33 | -ZDICT_SRC := $(wildcard $(ZDICT_DIR)/*.c) |
| 34 | +ZDICT_SRC := $(sort $(wildcard $(ZDICT_DIR)/*.c)) |
| 35 | |
| 36 | ZSTD_LEGACY_SUPPORT ?= 5 |
| 37 | ZSTDLEGACY_SRC := |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 38 | @@ -93,7 +93,7 @@ ZSTDLIB_FULL_SRC = $(sort $(ZSTDLIB_CORE_SRC) $(ZSTDLEGACY_SRC) $(ZDICT_SRC)) |
| 39 | ZSTDLIB_LOCAL_SRC = $(notdir $(ZSTDLIB_FULL_SRC)) |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 40 | ZSTDLIB_LOCAL_OBJ := $(ZSTDLIB_LOCAL_SRC:.c=.o) |
| 41 | |
| 42 | -ZSTD_CLI_SRC := $(wildcard *.c) |
| 43 | +ZSTD_CLI_SRC := $(sort $(wildcard *.c)) |
| 44 | ZSTD_CLI_OBJ := $(ZSTD_CLI_SRC:.c=.o) |
| 45 | |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 46 | ZSTD_ALL_SRC = $(ZSTDLIB_LOCAL_SRC) $(ZSTD_CLI_SRC) |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 47 | diff --git a/tests/Makefile b/tests/Makefile |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 48 | index 85553007..b71cdba8 100644 |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 49 | --- a/tests/Makefile |
| 50 | +++ b/tests/Makefile |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 51 | @@ -49,7 +49,7 @@ ZSTDDECOMP_FILES := $(ZSTDDIR)/decompress/*.c |
| 52 | ZSTD_FILES := $(ZSTDDECOMP_FILES) $(ZSTDCOMMON_FILES) $(ZSTDCOMP_FILES) |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 53 | ZDICT_FILES := $(ZSTDDIR)/dictBuilder/*.c |
| 54 | |
| 55 | -ZSTD_F1 := $(wildcard $(ZSTD_FILES)) |
| 56 | +ZSTD_F1 := $(sort $(wildcard $(ZSTD_FILES))) |
| 57 | ZSTD_OBJ1 := $(subst $(ZSTDDIR)/common/,zstdm_,$(ZSTD_F1)) |
| 58 | ZSTD_OBJ2 := $(subst $(ZSTDDIR)/compress/,zstdc_,$(ZSTD_OBJ1)) |
| 59 | ZSTD_OBJ3 := $(subst $(ZSTDDIR)/decompress/,zstdd_,$(ZSTD_OBJ2)) |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 60 | @@ -202,7 +202,7 @@ bigdict: $(ZSTDMT_OBJECTS) $(PRGDIR)/datagen.c bigdict.c |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 61 | invalidDictionaries : $(ZSTD_OBJECTS) invalidDictionaries.c |
| 62 | |
| 63 | legacy : CPPFLAGS += -I$(ZSTDDIR)/legacy -DZSTD_LEGACY_SUPPORT=4 |
| 64 | -legacy : $(ZSTD_FILES) $(wildcard $(ZSTDDIR)/legacy/*.c) legacy.c |
| 65 | +legacy : $(ZSTD_FILES) $(sort $(wildcard $(ZSTDDIR)/legacy/*.c)) legacy.c |
| 66 | |
| 67 | decodecorpus : LDLIBS += -lm |
| 68 | decodecorpus : $(filter-out zstdc_zstd_compress.o, $(ZSTD_OBJECTS)) $(ZDICT_FILES) $(PRGDIR)/util.c $(PRGDIR)/timefn.c decodecorpus.c |
| 69 | diff --git a/tests/fuzz/Makefile b/tests/fuzz/Makefile |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 70 | index ccb574b7..b1cb2935 100644 |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 71 | --- a/tests/fuzz/Makefile |
| 72 | +++ b/tests/fuzz/Makefile |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 73 | @@ -62,7 +62,7 @@ FUZZ_SRC := \ |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 74 | $(ZSTDCOMP_SRC) \ |
| 75 | $(ZSTDDICT_SRC) \ |
| 76 | $(ZSTDLEGACY_SRC) |
| 77 | -FUZZ_SRC := $(wildcard $(FUZZ_SRC)) |
| 78 | +FUZZ_SRC := $(sort $(wildcard $(FUZZ_SRC))) |
| 79 | |
| 80 | FUZZ_D_OBJ1 := $(subst $(ZSTDDIR)/common/,d_lib_common_,$(FUZZ_SRC)) |
| 81 | FUZZ_D_OBJ2 := $(subst $(ZSTDDIR)/compress/,d_lib_compress_,$(FUZZ_D_OBJ1)) |