Skip to content

Commit a7eb552

Browse files
authored
build: Only set OCAMLPARAM if BUILD_OCAMLPARAM is defined (#3594)
Setting the value of OCAMLPARAM in the workspace file is useful for CI, but annoying for local development as OCAMLPARAM is a good way to selectively enable features when testing. This patch sets the value of OCAMLPARAM while building the stdlib or compiler to the value of BUILD_OCAMLPARAM, unless BUILD_OCAMLPARAM is not defined.
1 parent c38d822 commit a7eb552

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Makefile.common-jst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ define dune_boot_context
2525
(env-vars ("OCAMLPARAM" ""))))))
2626
endef
2727

28+
ifneq ($(origin BUILD_OCAMLPARAM), undefined)
29+
ENV_VARS := (env-vars ("OCAMLPARAM" "$(BUILD_OCAMLPARAM)"))
30+
else
31+
ENV_VARS :=
32+
endif
33+
2834
define dune_runtime_stdlib_context
2935
(lang dune 2.8)
3036
(context (default
@@ -35,7 +41,7 @@ define dune_runtime_stdlib_context
3541
(OCAMLLIB ("$(CURDIR)/_build/_bootinstall/lib/ocaml")))
3642
(env (_
3743
(flags (:standard -warn-error +A -alert -unsafe_multidomain))
38-
(env-vars ("OCAMLPARAM" "$(BUILD_OCAMLPARAM)"))))))
44+
$(ENV_VARS)))))
3945
endef
4046

4147
define dune_main_context
@@ -50,7 +56,7 @@ define dune_main_context
5056
(flags (:standard -warn-error +A -alert -unsafe_multidomain))
5157
; We never want to build the compiler itself with AddressSanitizer enabled.
5258
(ocamlopt_flags (:standard -fno-asan))
53-
(env-vars ("OCAMLPARAM" "$(BUILD_OCAMLPARAM)"))))))
59+
$(ENV_VARS)))))
5460
endef
5561

5662

0 commit comments

Comments
 (0)