diff --git a/Makefile b/Makefile
index 962837b42d893195f58e1151da79a33d1e1af567..39951f046496d79fdd4333ad42ed245bb9599f80 100644
--- a/Makefile
+++ b/Makefile
@@ -33,6 +33,13 @@ $(error \
   "You should run ./configure first (or autoconf if there is no configure)")
 endif
 
+RELEASE?=no
+ifeq ($(RELEASE),yes)
+DUNE_BUILD_OPTS=--release
+else
+DUNE_BUILD_OPTS=
+endif
+
 ###################
 # Frama-C Version #
 ###################
@@ -43,7 +50,7 @@ VERSION_CODENAME:=$(shell $(CAT) VERSION_CODENAME)
 .PHONY: all
 
 all: config.sed
-	dune build @install
+	dune build $(DUNE_BUILD_OPTS) @install
 
 ifeq ($(HAS_DOT),yes)
 OPTDOT=Some \"$(DOT)\"
diff --git a/share/Makefile.testing b/share/Makefile.testing
index d5302120333a484182f3d818d05ff6e6b26fc035..352d58e1b5e0c7c7c282b014eb7b7ae3eb336021 100644
--- a/share/Makefile.testing
+++ b/share/Makefile.testing
@@ -57,7 +57,7 @@ PTESTS=frama-c-ptests
 else
 
 # PTESTS is internal
-PTESTS=dune exec --root ptests -- frama-c-ptests
+PTESTS=dune exec $(DUNE_BUILD_OPTS) --root ptests -- frama-c-ptests
 #PTESTS=dune exec --root ptests -- frama-c-ptests -v
 
 # Note: the public name of ptest.exe is frama-c-ptests
@@ -83,7 +83,7 @@ WTESTS=frama-c-wtests
 else
 
 # WTESTS is internal to Frama-C
-WTESTS=dune exec --root ptests -- frama-c-wtests
+WTESTS=dune exec $(DUNE_BUILD_OPTS) --root ptests -- frama-c-wtests
 
 # Note: the public name of wtest.exe is frama-c-wtests
 $(FRAMAC_WTESTS): ptests/wtests.ml