4 ms·
> But make is a tool that does two things and does them simple and well: it tracks dependencies between files, and [...] Last I checked, make only handled depe
by jjnoakes 7y ago
> But make is a tool that does two things and does them simple and well: it tracks dependencies between files, and [...]
Last I checked, make only handled dependencies with multiple inputs and a single output.
If your build step's command produced more than one output and you wanted to model that in your DAG you had to resort to some questionable incantations that never really worked perfectly (or rely on non portable constructs).
- cmm 7y agofirstly, the upcoming version of GNU Make will indeed support multiple outputs in non-pattern rules (pattern rules always supported this, but pattern rules, uhh, have their own problems), using &: instead of :, resolving a bug from 2004. don't you just love the solid pace of those old GNU projects. secondly, working around this was never very hard, albeit ugly: pretend your rule builds just one of the targets and have the other products depend on that one and simply touch themselves up to its timestamp.
- deleted 7y ago[deleted]
- jjnoakes 7y agoI disagree with the characterization that this is "not very hard" (and my initial assessment was "questionable incantations" which I think is also accurate): https://www.gnu.org/software/automake/manual/html_node/Multiple-Outputs.html https://www.gnu.org/software/automake/manual/html_node/Multi... Definitely not handled "simple and well" as posited by the OP.
- cmm 7y agothe horrible contortions listed on the linked page are required for the pathological "some of the targets that are built together got deleted, but the primary one did not" case, which in my experience Does Not Happen (or when it does, it is a symptom of deeply suspect practices -- like shitting where you ea^W^W^W^Wkeeping build artifacts and sources in the same directory, or relying on manually deleting artifacts to force a rebuild instead of getting the bloody dependencies right in the first place, etc.)
- cmm 7y ago(I guess what I'm trying to say here is that the 80% solution is not nearly as hard as that linked page makes it seem).
- kazinator 7y agoPOSIX make doesn't specify any feature for multiple outputs. Some rather obscure makes that you and I will never get to use have had the feature. GNU Make has, for a long time, supported multiple outputs in pattern rules. Pattern rules have the limitation that the files involved have to be organized around a common stem. If you can make your situation fit this restriction, then you can effectively have multi-target rules by way of pattern instantiation, and this will work with even old versions of GNU Make. Some two months ago I added the feature to GNU Make to express direct rules with multiple outputs. http://git.savannah.gnu.org/cgit/make.git/commit/?id=8c888d95f61814dd698bf76126a9079234080d77 http://git.savannah.gnu.org/cgit/make.git/commit/?id=8c888d9... So bleeding edge GNU Make lets you do: y.tab.c y.tab.h y.output &: parser.y ... It had to be done via a bit of new syntax because x y z : w already has a meaning: it means that x, y and z independently depend on w, not as a group built together.