Is there a way, or should I leave those rules to Makefiles?
Looking at e.g. https://dune.readthedocs.io/en/stable/dune-files.html#coq-pp suggests that can be expressed using
rule — but the translation seems to require writing by hand one rule per each target.
The implementation seems to be https://github.com/ocaml/dune/blob/6d83f12d59abd4237cc19bbb00415dc1354bff0e/src/dune_rules/coq_rules.ml#L438-L448, which seems to confirm the idea.
An option (not my favorite, but still) is to write a little ml program that spits all the dune rules (one per file) and then include the generated file. This is where I learnt it: https://tarides.com/blog/2019-05-09-an-introduction-to-ocaml-ppx-ecosystem#testing-your-ppx
Ah, no OCaml required, and it has advantages over sticking to make.
That’s great, thanks! One more question:
can I generate and include the file in the same run, or does dune force the build script to be static?
I can easily run the generator from a step elsewhere, so this isn’t a big deal..
However, even after reading https://github.com/ocaml/dune’s README, I am not sure I understand the rationale for omitting such a feature.
We do plan to lift this restriction eventually. It’s a bit tough unfortunately.
Last updated: Oct 16 2021 at 09:07 UTC