Creating a custom debuggable file with dune

In my dune project, besides my lib directory I have a debugging directory containing just one ml file, called

In the (relatively infrequent) occasions when I need to do some debugging, I put the relevant piece of code in, and then compile it (along with all its dependencies in the lib directory) with the -g option, and finally link them into an executable that can then be given as argument to ocamldebug.

I would like to write the dune file in that debugging directory so that invoking dune build debugging (or some equally simple command) will do exactly the set of actions I described in the preceding paragraph (after having put the code in, that is ; this part I do myself by hand).

All I can think of so far is the following :

(libraries lib)

But I don’t know how to tell dune to compile the modules in lib with the -g option. A search for ocamldebug in the dune manual gave no results.

Dune already compiles everything with -g by default.