From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steve Tell To: Bo Forslund Cc: guile-gtk list Subject: Re: SMP problems with examples/Makefile.am Date: Sat, 29 Dec 2001 21:13:00 -0000 Message-ID: References: <3C2E863A.BE4C0EF7@abc.se> X-SW-Source: 2001-q4/msg00037.html Message-ID: <20011229211300.TKH8DyIvo9D1vinycSxSygYq2yihGK5jclZEIp2fAIw@z> On Sun, 30 Dec 2001, Bo Forslund wrote: > Makefile built by the original Makefile.am containing the lines > > foo-glue.c: foo.defs > build-guile-gtk glue $< >tmp && mv tmp $@ > > main.c: foo.defs > build-guile-gtk main $< >tmp && mv tmp $@ I believe the point of the " >tmp && mv tmp $@" construct is that the final target $@ is not touched unless build-guile-gtk completes successfully with a zero exit status. "A && B" is sh for "run A, and if successful then run B" If build-guile-gtk aborts due to signal or error, a subsequent make will still find foo-glue.c or main.c out of date and rebuild them completely, not being fooled by a recent modification time on an empty or incomplete file. Using a parallel make, both rules can execute at once and stomp on each other writing to the same "tmp" file simultaneously. Perhaps best would be to use different temporary file names, say based on (but not the same as) the final target name: > foo-glue.c: foo.defs > build-guile-gtk glue $< >$@.new && mv $@.new $@ > > main.c: foo.defs > build-guile-gtk main $< >$@.new && mv $@.new $@ -- Steve Tell tell@telltronics.org