Always the same code make all-dir-depends make run-dir-depends make build-dir-depends This is a suitable intermediate result that you can save, pass to tsort, and process further. It can answer various questions: in which order do you want to build things what depends on what