3 ms·
Make is good at traversing and resolving a dependency graph; the problem is that we are forced to write said dependency graph. It's no hardship for small projec
by andreareina 9y ago
Make is good at traversing and resolving a dependency graph; the problem is that we are forced to write said dependency graph. It's no hardship for small projects, but as projects grow and the dependency graph becomes annoying and/or difficult to manage by hand, we turn to automatic solutions -- and we should. Except that pattern substitution doesn't cut it, we really need a way to programmatically generate dependencies given a source file.
- pja 9y agoFortunately, compiler writers have noticed this problem, and C/C++ compilers will spit out makefile snippets which define the dependencies for a given file. See the sample makefile above by danaliv.
- andreareina 9y agoYeah, the comments by '__david__ and 'danaliv would be welcome news if I ever wrote C/C++ again.
- JdeBP 9y agoThey are, however, insufficient for the whole task. * https://news.ycombinator.com/item?id=15060146 https://news.ycombinator.com/item?id=15060146
- xfer 9y agoFor programming languages, it should be builtin in some form for you(build systems) to extract the dependency relations. Unfortunately C/C++ are not designed for this. But some programming languages do make it possible to be automated. For other use cases, there is no generic way to automate this process.