From: Hilko Bengen Date: Wed, 9 Dec 2020 14:10:03 +0100 Subject: Enforce order on wildcard operations for reproducible builds --- Makefile | 76 ++++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/Makefile b/Makefile index f84d43c..71abdbf 100644 --- a/Makefile +++ b/Makefile @@ -117,85 +117,85 @@ LIBNAME = capstone DEP_ARM = -DEP_ARM += $(wildcard arch/ARM/ARM*.inc) +DEP_ARM += $(sort $(wildcard arch/ARM/ARM*.inc)) LIBOBJ_ARM = ifneq (,$(findstring arm,$(CAPSTONE_ARCHS))) CFLAGS += -DCAPSTONE_HAS_ARM - LIBSRC_ARM += $(wildcard arch/ARM/ARM*.c) + LIBSRC_ARM += $(sort $(wildcard arch/ARM/ARM*.c)) LIBOBJ_ARM += $(LIBSRC_ARM:%.c=$(OBJDIR)/%.o) endif DEP_ARM64 = -DEP_ARM64 += $(wildcard arch/AArch64/AArch64*.inc) +DEP_ARM64 += $(sort $(wildcard arch/AArch64/AArch64*.inc)) LIBOBJ_ARM64 = ifneq (,$(findstring aarch64,$(CAPSTONE_ARCHS))) CFLAGS += -DCAPSTONE_HAS_ARM64 - LIBSRC_ARM64 += $(wildcard arch/AArch64/AArch64*.c) + LIBSRC_ARM64 += $(sort $(wildcard arch/AArch64/AArch64*.c)) LIBOBJ_ARM64 += $(LIBSRC_ARM64:%.c=$(OBJDIR)/%.o) endif DEP_M68K = -DEP_M68K += $(wildcard arch/M68K/M68K*.inc) -DEP_M68K += $(wildcard arch/M68K/M68K*.h) +DEP_M68K += $(sort $(wildcard arch/M68K/M68K*.inc)) +DEP_M68K += $(sort $(wildcard arch/M68K/M68K*.h)) LIBOBJ_M68K = ifneq (,$(findstring m68k,$(CAPSTONE_ARCHS))) CFLAGS += -DCAPSTONE_HAS_M68K - LIBSRC_M68K += $(wildcard arch/M68K/M68K*.c) + LIBSRC_M68K += $(sort $(wildcard arch/M68K/M68K*.c)) LIBOBJ_M68K += $(LIBSRC_M68K:%.c=$(OBJDIR)/%.o) endif DEP_MIPS = -DEP_MIPS += $(wildcard arch/Mips/Mips*.inc) +DEP_MIPS += $(sort $(wildcard arch/Mips/Mips*.inc)) LIBOBJ_MIPS = ifneq (,$(findstring mips,$(CAPSTONE_ARCHS))) CFLAGS += -DCAPSTONE_HAS_MIPS - LIBSRC_MIPS += $(wildcard arch/Mips/Mips*.c) + LIBSRC_MIPS += $(sort $(wildcard arch/Mips/Mips*.c)) LIBOBJ_MIPS += $(LIBSRC_MIPS:%.c=$(OBJDIR)/%.o) endif -DEP_SH = $(wildcard arch/SH/SH*.inc) +DEP_SH = $(sort $(wildcard arch/SH/SH*.inc)) LIBOBJ_SH = ifneq (,$(findstring sh,$(CAPSTONE_ARCHS))) CFLAGS += -DCAPSTONE_HAS_SH - LIBSRC_SH += $(wildcard arch/SH/SH*.c) + LIBSRC_SH += $(sort $(wildcard arch/SH/SH*.c)) LIBOBJ_SH += $(LIBSRC_SH:%.c=$(OBJDIR)/%.o) endif DEP_PPC = -DEP_PPC += $(wildcard arch/PowerPC/PPC*.inc) +DEP_PPC += $(sort $(wildcard arch/PowerPC/PPC*.inc)) LIBOBJ_PPC = ifneq (,$(findstring powerpc,$(CAPSTONE_ARCHS))) CFLAGS += -DCAPSTONE_HAS_POWERPC - LIBSRC_PPC += $(wildcard arch/PowerPC/PPC*.c) + LIBSRC_PPC += $(sort $(wildcard arch/PowerPC/PPC*.c)) LIBOBJ_PPC += $(LIBSRC_PPC:%.c=$(OBJDIR)/%.o) endif DEP_SPARC = -DEP_SPARC += $(wildcard arch/Sparc/Sparc*.inc) +DEP_SPARC += $(sort $(wildcard arch/Sparc/Sparc*.inc)) LIBOBJ_SPARC = ifneq (,$(findstring sparc,$(CAPSTONE_ARCHS))) CFLAGS += -DCAPSTONE_HAS_SPARC - LIBSRC_SPARC += $(wildcard arch/Sparc/Sparc*.c) + LIBSRC_SPARC += $(sort $(wildcard arch/Sparc/Sparc*.c)) LIBOBJ_SPARC += $(LIBSRC_SPARC:%.c=$(OBJDIR)/%.o) endif DEP_SYSZ = -DEP_SYSZ += $(wildcard arch/SystemZ/SystemZ*.inc) +DEP_SYSZ += $(sort $(wildcard arch/SystemZ/SystemZ*.inc)) LIBOBJ_SYSZ = ifneq (,$(findstring systemz,$(CAPSTONE_ARCHS))) CFLAGS += -DCAPSTONE_HAS_SYSZ - LIBSRC_SYSZ += $(wildcard arch/SystemZ/SystemZ*.c) + LIBSRC_SYSZ += $(sort $(wildcard arch/SystemZ/SystemZ*.c)) LIBOBJ_SYSZ += $(LIBSRC_SYSZ:%.c=$(OBJDIR)/%.o) endif @@ -209,7 +209,7 @@ endif DEP_X86 = -DEP_X86 += $(wildcard arch/X86/X86*.inc) +DEP_X86 += $(sort $(wildcard arch/X86/X86*.inc)) LIBOBJ_X86 = ifneq (,$(findstring x86,$(CAPSTONE_ARCHS))) @@ -230,97 +230,97 @@ endif DEP_XCORE = -DEP_XCORE += $(wildcard arch/XCore/XCore*.inc) +DEP_XCORE += $(sort $(wildcard arch/XCore/XCore*.inc)) LIBOBJ_XCORE = ifneq (,$(findstring xcore,$(CAPSTONE_ARCHS))) CFLAGS += -DCAPSTONE_HAS_XCORE - LIBSRC_XCORE += $(wildcard arch/XCore/XCore*.c) + LIBSRC_XCORE += $(sort $(wildcard arch/XCore/XCore*.c)) LIBOBJ_XCORE += $(LIBSRC_XCORE:%.c=$(OBJDIR)/%.o) endif DEP_TMS320C64X = -DEP_TMS320C64X += $(wildcard arch/TMS320C64x/TMS320C64x*.inc) +DEP_TMS320C64X += $(sort $(wildcard arch/TMS320C64x/TMS320C64x*.inc)) LIBOBJ_TMS320C64X = ifneq (,$(findstring tms320c64x,$(CAPSTONE_ARCHS))) CFLAGS += -DCAPSTONE_HAS_TMS320C64X - LIBSRC_TMS320C64X += $(wildcard arch/TMS320C64x/TMS320C64x*.c) + LIBSRC_TMS320C64X += $(sort $(wildcard arch/TMS320C64x/TMS320C64x*.c)) LIBOBJ_TMS320C64X += $(LIBSRC_TMS320C64X:%.c=$(OBJDIR)/%.o) endif DEP_M680X = -DEP_M680X += $(wildcard arch/M680X/*.inc) -DEP_M680X += $(wildcard arch/M680X/M680X*.h) +DEP_M680X += $(sort $(wildcard arch/M680X/*.inc)) +DEP_M680X += $(sort $(wildcard arch/M680X/M680X*.h)) LIBOBJ_M680X = ifneq (,$(findstring m680x,$(CAPSTONE_ARCHS))) CFLAGS += -DCAPSTONE_HAS_M680X - LIBSRC_M680X += $(wildcard arch/M680X/*.c) + LIBSRC_M680X += $(sort $(wildcard arch/M680X/*.c)) LIBOBJ_M680X += $(LIBSRC_M680X:%.c=$(OBJDIR)/%.o) endif DEP_EVM = -DEP_EVM += $(wildcard arch/EVM/EVM*.inc) +DEP_EVM += $(sort $(wildcard arch/EVM/EVM*.inc)) LIBOBJ_EVM = ifneq (,$(findstring evm,$(CAPSTONE_ARCHS))) CFLAGS += -DCAPSTONE_HAS_EVM - LIBSRC_EVM += $(wildcard arch/EVM/EVM*.c) + LIBSRC_EVM += $(sort $(wildcard arch/EVM/EVM*.c)) LIBOBJ_EVM += $(LIBSRC_EVM:%.c=$(OBJDIR)/%.o) endif DEP_RISCV = -DEP_RISCV += $(wildcard arch/RISCV/RISCV*.inc) +DEP_RISCV += $(sort $(wildcard arch/RISCV/RISCV*.inc)) LIBOBJ_RISCV = ifneq (,$(findstring riscv,$(CAPSTONE_ARCHS))) CFLAGS += -DCAPSTONE_HAS_RISCV - LIBSRC_RISCV += $(wildcard arch/RISCV/RISCV*.c) + LIBSRC_RISCV += $(sort $(wildcard arch/RISCV/RISCV*.c)) LIBOBJ_RISCV += $(LIBSRC_RISCV:%.c=$(OBJDIR)/%.o) endif DEP_WASM = -DEP_WASM += $(wildcard arch/WASM/WASM*.inc) +DEP_WASM += $(sort $(wildcard arch/WASM/WASM*.inc)) LIBOBJ_WASM = ifneq (,$(findstring wasm,$(CAPSTONE_ARCHS))) CFLAGS += -DCAPSTONE_HAS_WASM - LIBSRC_WASM += $(wildcard arch/WASM/WASM*.c) + LIBSRC_WASM += $(sort $(wildcard arch/WASM/WASM*.c)) LIBOBJ_WASM += $(LIBSRC_WASM:%.c=$(OBJDIR)/%.o) endif DEP_MOS65XX = -DEP_MOS65XX += $(wildcard arch/MOS65XX/MOS65XX*.inc) +DEP_MOS65XX += $(sort $(wildcard arch/MOS65XX/MOS65XX*.inc)) LIBOBJ_MOS65XX = ifneq (,$(findstring mos65xx,$(CAPSTONE_ARCHS))) CFLAGS += -DCAPSTONE_HAS_MOS65XX - LIBSRC_MOS65XX += $(wildcard arch/MOS65XX/MOS65XX*.c) + LIBSRC_MOS65XX += $(sort $(wildcard arch/MOS65XX/MOS65XX*.c)) LIBOBJ_MOS65XX += $(LIBSRC_MOS65XX:%.c=$(OBJDIR)/%.o) endif DEP_BPF = -DEP_BPF += $(wildcard arch/BPF/BPF*.inc) +DEP_BPF += $(sort $(wildcard arch/BPF/BPF*.inc)) LIBOBJ_BPF = ifneq (,$(findstring bpf,$(CAPSTONE_ARCHS))) CFLAGS += -DCAPSTONE_HAS_BPF - LIBSRC_BPF += $(wildcard arch/BPF/BPF*.c) + LIBSRC_BPF += $(sort $(wildcard arch/BPF/BPF*.c)) LIBOBJ_BPF += $(LIBSRC_BPF:%.c=$(OBJDIR)/%.o) endif DEP_TRICORE = -DEP_TRICORE +=$(wildcard arch/TriCore/TriCore*.inc) +DEP_TRICORE +=$(sort $(wildcard arch/TriCore/TriCore*.inc)) LIBOBJ_TRICORE = ifneq (,$(findstring tricore,$(CAPSTONE_ARCHS))) CFLAGS += -DCAPSTONE_HAS_TRICORE - LIBSRC_TRICORE += $(wildcard arch/TriCore/TriCore*.c) + LIBSRC_TRICORE += $(sort $(wildcard arch/TriCore/TriCore*.c)) LIBOBJ_TRICORE += $(LIBSRC_TRICORE:%.c=$(OBJDIR)/%.o) endif @@ -578,7 +578,7 @@ fuzztest: ./suite/fuzz/fuzz_disasm $(FUZZ_INPUTS) fuzzallcorp: -ifneq ($(wildcard suite/fuzz/corpus-libFuzzer-capstone_fuzz_disasmnext-latest),) +ifneq ($(sort $(wildcard suite/fuzz/corpus-libFuzzer-capstone_fuzz_disasmnext-latest)),) ./suite/fuzz/fuzz_bindisasm suite/fuzz/corpus-libFuzzer-capstone_fuzz_disasmnext-latest/ > fuzz_bindisasm.log || (tail -1 fuzz_bindisasm.log; false) else @echo "Skipping tests on whole corpus"