diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5c6e0689a851f01aeea23fd1a6204c9640b8e646..46bb1baa116f29d4bc4afb31994adf250faf7229 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -388,7 +388,7 @@ ocaml-versions-nightly:
     - sudo apt update
     - opam pin . -n
     - opam depext frama-c --with-test
-    - opam install --jobs 2 frama-c --with-test
+    - opam install --jobs 2 frama-c --with-test --with-doc
     - frama-c -version
   tags:
     - docker
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