Evening all,
I have created a small libc implementation, and to build it, I am using a Python script to generate a build.ninja file. The full project can be seen here:
https://github.com/nullplan/sirius
For the most part, I am satisfied with the result, but using the clean tool causes error messages. The project is written in C, and I want to support out-of-tree builds, so I have created a build rule "md" which just creates a directory, then listed all directories as being built with the md rule with no inputs, and finally all object files get an order-only dependency on their output directory.
This reliably creates the directories before running the compilers, but the clean tool tries to remove the directories before removing the object files, which doesn't work and fails with ENOTEMPTY. If I run the clean tool multiple times, eventually it gets rid of all directories, and of course I can just remove the build directory, or if building in the git repo, I can clean it with git.
Still, I wonder if I can change something about the generated build file to make the clean tool work. Specifically, it would have to know that it cannot delete a directory while there are still files in there, so not before deleting the dependents, and not before the subdirectories (which right now are not modeled in the build.ninja at all).
Ciao,
Markus