Previously we wrote out the build rules alphabetically and grouped by target type. So e.g. the build rule for a framework would be created before that of an application bundle.
While it worked, it didn’t allow e.g. the preferences framework to depend on the mate executables (for copying to its resources section) since the build rules for mate would be created after that of the preferences framework.
We now do a topological sort on the dependency graph (by shelling out to ‘tsort’) to make the build system more flexible.