Process targets in depth-first order in all target-wise generators
In !1889 (merged) and !2224 (merged), the VS 10+ and Xcode generators learned to process targets within a directory in an order such that a given target is not generated until all of its dependencies have been generated. Generalize this approach to the VS 9 generator, GHS, and Makefile generators. This will later be useful to avoid unnecessary duplication of custom commands.
This is not necessary for the Ninja generators because they produce a monolithic global graph and do not have target-wise buildsystems anyway.