If the program outputs a file run_out/…, you can create a rule which have this file as a target (with the experimental dir stanza), the program.exe as a dependency, and an action which launch the program.exe.
Have I missed something ?
If you would have no real target, invent one, inside the action, put (progn (run ./program.exe) (run touch dummy_target)) where dummy_target is a target you have declared. The touch command create the file and make dune happy.
Here’s another approach: If it is acceptable to have a dune file in your target directory, you could do that and stick your rule there. Some setup like this:
- dune <= has your gen_rs.exe spec
- gen_rs.ml <= generates your rust files
- ... other data/ml files needed ...
- dune <= has the rule to generate rs files which will be placed here
I could imagine a proj_root/run_out/dune file looking like this: