I have (library (c_names a)), which will process an a.c. This a.c does #include "a.h". Dune already has a rule to generate this a.h with (rule (target a.h) (deps a.input) (action (with-stdout-to %{target} (system "some-command < a.input")))).
How do I tell dune to process the rule to generate a.h before it starts processing a.c?
Unfortunately it does not work for me in my attempt to convert lablgl to dune. One C file includes other, generated C files. Maybe this makes a difference?
Ah yes, that’s why. Renaming the generated file to .h would make it work. We are also preparing a change to make compilation of C sources more flexible: https://github.com/ocaml/dune/pull/2659. With this, you will be able to declare additional dependencies for .c files. However, it is not fine grained, i.e. the dependencies are for all .c files so the generated file would still have to be renamed, for instance to .c-gen.
Do you know that LablGL only provides deprecated features of OpenGL?
It is not possible to make forward compatible programming with it in its current state. Are you planning to make evolve it to handle the modern OpenGL?
It is a build dependency of other packages, so I have little choice. Fortunately the current make(1) based build happens to work, so converting to dune is just a learning exercise.