From da001d9d75f2cac4ebc577d362a21ebff58080c6 Mon Sep 17 00:00:00 2001 From: Tom Davies Date: Thu, 28 Apr 2022 06:31:02 -0700 Subject: make: Allow OTP to be built deterministically Add a --enable-deterministic-build to the configure script, which sets ERL_DETERMINISTIC=yes throughout the relevant Makefiles, which then invoke the relevant build stages with the +deterministic option. This addresses absolute paths being included in generated .erl files and compiled .beam files that resulted in builds from different source directories generating different artefacts (which is a component of the issue in erlang#4482). I think it would make sense to make this the default at some stage, but I've put the change behind a flag for now to decouple making deterministic OTP builds possible from making them the default. Having +deterministic set results in compiler options being removed from the module info for modules where this options was used. This may have other implications for users of OTP. For tests themselves, +determinism is not set, since many test cases depend on accessing the test module's compilation options, or other features not available in deterministic mode, in order to configure themselves. For tests of the determinism feature specifically, +deterministic must be explicitly passed to the compiler within the relevant test cases. --- lib/asn1/src/Makefile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'lib/asn1/src/Makefile') diff --git a/lib/asn1/src/Makefile b/lib/asn1/src/Makefile index 6d02075576..9e13d02c8a 100644 --- a/lib/asn1/src/Makefile +++ b/lib/asn1/src/Makefile @@ -102,7 +102,13 @@ ERL_COMPILE_FLAGS += \ -I$(ERL_TOP)/lib/stdlib \ -Werror -YRL_FLAGS = +ifeq ($(ERL_DETERMINISTIC),yes) + YRL_FLAGS = +deterministic + DETERMINISM_FLAG = +deterministic +else + YRL_FLAGS = + DETERMINISM_FLAG = +endif # ---------------------------------------------------- # Targets @@ -182,10 +188,10 @@ asn1ct_rtt.erl: prepare_templates.$(EMULATOR) $(RT_TEMPLATES_TARGET) $(RT_TEMPLATES_TARGET) prepare_templates.$(EMULATOR): prepare_templates.erl - $(V_ERLC) prepare_templates.erl + $(V_ERLC) $(DETERMINISM_FLAG) prepare_templates.erl asn1rtt_%.$(EMULATOR): asn1rtt_%.erl - $(V_ERLC) +debug_info $< + $(V_ERLC) +debug_info $(DETERMINISM_FLAG) $< $(EVAL_CT_MODULES:%=%.erl): prepare_templates.$(EMULATOR) \ $(EBIN)/asn1ct_rtt.$(EMULATOR) \ -- cgit v1.2.1