4 ms·
Really? I mean, it pretty much just runs commands in sequence and/or parallel, right? Sorry, like I said, I don't think I really understand make. I mean, I ca
by DannoHung 12y ago
Really? I mean, it pretty much just runs commands in sequence and/or parallel, right?
Sorry, like I said, I don't think I really understand make.
I mean, I can understand that it's doing some checks to determine what commands to emit, but doesn't it all end up falling out as pretty much a straight "Yes? Do this. No? Do that. Do this and then this and then this. Do all these at the same time."
That's my mental model at the moment anyway.
- GauntletWizard 12y agoUltimately, make represents a dependency graph; Something that a shell language is not well prepared to represent. Yes, it's doing X, Y, and Z at the same time, but when X is done it can launch A and B, when Z finishes then C can also be started, but you don't want to run them all at the same time because of a max subprocesses limit. You don't know if X or Z will finish first, so you can't just launch C as soon as Z is done, nor do you want to waste time waiting for A and B to finish to launch C if Z is done. How do you express that in pure shell?
- barrkel 12y agox: y z x depends on y (meaning, if x is missing, or is a file that is older than y where y is also a file, it needs to be recreated). z is how to recreate x. Makefiles are programs that construct a dependency graph. The rest of makefile syntax is mostly about ways of generating variants of the above without being overly verbose, or reducing gruntwork when e.g. adding new header includes to existing source files. But this is the heart of it. Root the dependency graph somewhere, and as long as the dependencies are complete and correct, the minimal set of commands, and potential parallelism, can be calculated.