> instead of a touch-file, use a tar-file ! Yeah, one of my company's makefiles uses a similar intermediate file to good effect. We've been using the touch-file or "sentinel" solution elsewhere for years. I'd previously suggested replacing the sentinels with tar files so we could get rid of all the hackery we have to address the problem Tom raised about non-existent targets. We have a macro that's used to convert missing source file names to the name of the corresponding sentinel file and then code to force that sentinel to rebuild. It's complicated, ugly and fragile.
What really motivated me to reply, however, was: > Note the crucial -m in the extracting tar I would have made that mistake, so thanks for pointing it out before I stepped on the rake! -----Original Message----- From: bug-make-bounces+mdorey=bluearc....@gnu.org [mailto:bug-make-bounces+mdorey=bluearc....@gnu.org] On Behalf Of Edward Welbourne Sent: Tuesday, March 02, 2010 02:45 To: tom honermann Cc: bug-make@gnu.org Subject: Re: Static multiple target rules > I've been struggling for some time now with how to write rules for > commands that generate multiple targets A familiar and annoying problem: make really believes in commands that generate just one (relevant) file, and doesn't fit so well with ones that generate several. > The next thing to try is using a proxy or timestamp file: > > yacc.ts: grammar.y > yacc -d -v $^ > touch $@ > > y.tab.h y.tab.c y.output: yacc.ts A quarter of an hour after reading your mail, I had a mildly perverted idea: instead of a touch-file, use a tar-file ! The problem you point to is when the touch file exists but the files we want don't: we need a command for the rule that declares their dependency on it; and that command needs to be able to generate the outputs from the fake file. yacc.ts: grammar.y yacc -d -v $^ tar cf $@ y.tab.h y.tab.c y.output y.tab.h y.tab.c y.output: yacc.ts tar xf $< -m Note the crucial -m in the extracting tar, so that we touch the outputs after the tar-file has been created, thereby avoiding re-extracting every time we run make. Not sure how well that'd work but it *looks* like it should ... and it should generalise reasonably well. Unfortunately I can't, just yet, see how to turn it into a pattern rule for general .y file processing, Eddy. _______________________________________________ Bug-make mailing list Bug-make@gnu.org http://lists.gnu.org/mailman/listinfo/bug-make _______________________________________________ Bug-make mailing list Bug-make@gnu.org http://lists.gnu.org/mailman/listinfo/bug-make