dune build @install works well for target directories but dune install fails.
See for instance this small repro:
(rule
(target foo)
(package p)
(action (progn
(run mkdir foo)
(run touch foo/bar))))
(install (package p) (section lib) (files foo))
and
$ dune build @install
$ echo $?
0
$ dune install
Installing /Users/thomas/.opam/system/lib/p/META
Installing /Users/thomas/.opam/system/lib/p/dune-package
Installing /Users/thomas/.opam/system/lib/p/foo
Error: Is a directory