| | 63 | |
| | 64 | ---- |
| | 65 | |
| | 66 | I agree that having the dependency generation and make layers separate would be a good thing, but I don't know if that's 100% feasible. Consider that the only time we will have a complete dependency graph is when the build is nearly done. So, I don't really think we should try to build the graph at all (at least, in the direct sense). |
| | 67 | |
| | 68 | Here's the pseudocode for the algorithm I have in my head: |
| | 69 | |
| | 70 | {{{ |
| | 71 | |
| | 72 | for every target file T: |
| | 73 | |
| | 74 | find the rule chain R that will build the file. (there should only be one) |
| | 75 | |
| | 76 | starting from the final entry in the rule chain (e.g. the .chs.pp->.chs rule) and working backwards: |
| | 77 | |
| | 78 | call the current source file A, and the target file B. (e.g. A=.chs.pp, B=.chs) |
| | 79 | if B is older than A: |
| | 80 | for each file D that is needed to build B from A: |
| | 81 | if D is already on the stack, bail out |
| | 82 | otherwise, recurse on D |
| | 83 | compile B |
| | 84 | |
| | 85 | }}} |
| | 86 | |
| | 87 | Of course, other things are needed, but I think this is a good starting point. |