diff --git a/opam b/opam
index 74395ea3e8071bcc99156d3da4601f23876cadbc..c489a0de0563416c8e50ec27b0fb2be531f37ceb 100644
--- a/opam
+++ b/opam
@@ -90,13 +90,18 @@ tags: [
 
 build: [
   ["bash" "dev/disable-plugins.sh" "e-acsl"] { os-family = "windows" }
-  ["dune" "build" "-j%{jobs}%" "--release" "--promote-install-files=false" "@install"]
-  [make "-C" "doc" "download"] {with-doc}
+  ["dune" "build" "-j%{jobs}%" "--release" "--promote-install-files=false"
+   "@install"
+   "@doc" { with-doc }
+  ]
 ]
 
 install: [
-  [make "PREFIX=%{prefix}%" "MANDIR=%{mandir}%" "install"]
-  [make "PREFIX=%{prefix}%" "-C" "doc" "install"] {with-doc}
+  [make
+   "PREFIX=%{prefix}%" "MANDIR=%{man}%"
+   "DOCDIR=%{doc}%" { with-doc }
+   "install"
+  ]
 ]
 
 remove: [
@@ -122,6 +127,7 @@ depends: [
   "ocaml" { >= "4.11.1" }
   "ocamlfind" # needed beyond build stage, used by -load-module
   "ocamlgraph" { >= "1.8.8" }
+  "odoc" { with-doc }
   "why3" { >= "1.6.0" }
   "yaml" { >= "3.0.0" }
   "yojson" {>= "1.6.0" & (>= "2.0.1" | !with-test)}
diff --git a/share/Makefile.documentation b/share/Makefile.documentation
index 47b6802b367e3fdc54fea9c2948a4f9d1df211d0..817de5190cb5f9692038652bbb5aa5bfadc48659 100644
--- a/share/Makefile.documentation
+++ b/share/Makefile.documentation
@@ -33,6 +33,14 @@ doc:
 	@echo "Generated Documentation:"
 	@echo "   file:///$(PWD)/_build/default/_doc/_html/index.html"
 
+ifneq (${DOCDIR},)
+
+install:: doc
+	@mkdir -p ${DOCDIR}/frama-c
+	@cp -r _build/default/_doc/_html/* ${DOCDIR}/frama-c
+
+endif
+
 ##########################################################################
 #                                                                        #
 # Generate Documentation for Server Requests and Protocols.              #
@@ -41,7 +49,7 @@ doc:
 
 .PHONY: server-doc-md server-doc-html server-doc
 
-ifeq (NO_BUILD_FRAMAC,yes)
+ifeq (${NO_BUILD_FRAMAC},yes)
 # Make sure that Frama-C is not rebuilt essentially for CI purpose
 server-doc-md:
 else