How to generate .merlin files for ocaml compiler?

I would like to generate .merlin files when reading the ocaml compiler sources. I run

git clone https://github.com/ocaml/ocaml.git
cd ocaml
./configure
make
dune build

The last command has a exit code of 1 and prints

File "asmcomp/dune", line 27, characters 0-549:
27 | (rule
28 |  (targets emit.ml)
29 |  (mode    fallback)
....42 |        (progn
43 |          (bash "echo \\# 1 \\\"`cat contains-input-name`\\\"")
44 |          (bash "%{dep:../tools/cvt_emit.exe} < `cat contains-input-name`"))))))
Error: Some of the targets of this fallback rule are present in the source
tree, and some are not. This is not allowed. Either none of the targets must
be present in the source tree, either they must all be.

The following targets are present:
- asmcomp/emit.ml

The following targets are not:
- asmcomp/contains-input-name

How do I generate .merlin files without error?

The OCaml repository provides instructions for using merlin: https://github.com/ocaml/ocaml/blob/trunk/HACKING.adoc#using-merlin

Specifically, you must do

./configure # if not already done
make clean && dune build @libs

Now dune fails with error:

File "ocamltest/dune", line 37, characters 0-292:
37 | (library
38 |  (name ocamltest_core_and_plugin)
39 |  (modes byte)
40 |  (wrapped false)
41 |  (flags (:standard -nostdlib))
42 |  (libraries ocamlcommon stdlib)
43 |  (modules (:standard \ options main))
44 |  (c_flags (-DCAML_INTERNALS -I%{project_root}/runtime)) ; fixme
45 |  (c_names run_unix run_stubs ocamltest_stdlib_stubs))
Error: Some modules don't have an implementation.
You need to add the following field to this stanza:

  (modules_without_implementation ocamltest_unix)
Done: 0/0 (jobs: 0)%                                                                                                                                                                                                                          

As far as I know, with the new injectivity syntax, the dune targets cannot work in current trunk.