Date: Sun, 21 Oct 2012 15:49:57 +1100 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Marcel Moolenaar <marcel@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r241790 - head/share/mk Message-ID: <20121021151723.D926@besplex.bde.org> In-Reply-To: <201210202244.q9KMiMer023523@svn.freebsd.org> References: <201210202244.q9KMiMer023523@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 20 Oct 2012, Marcel Moolenaar wrote: > Log: > Revert r241752. The claim that it's more correct while at the same time > causing a build breakage is interesting to say the least. Does it work to do: > Modified: head/share/mk/bsd.dep.mk > ============================================================================== > --- head/share/mk/bsd.dep.mk Sat Oct 20 19:38:22 2012 (r241789) > +++ head/share/mk/bsd.dep.mk Sat Oct 20 22:44:22 2012 (r241790) > @@ -95,17 +95,16 @@ CLEANFILES+= ${_LC} > SRCS:= ${SRCS:S/${_YSRC}/${_YC}/} > CLEANFILES+= ${_YC} > .if !empty(YFLAGS:M-d) && !empty(SRCS:My.tab.h) > -y.tab.h: ${_YSRC} > +.ORDER: ${_YC} y.tab.h (1) Change the order of the files here, so that it is expected that ${_YC} ends up newer than y.tab.h. > +${_YC} y.tab.h: ${_YSRC} > ${YACC} ${YFLAGS} ${.ALLSRC} > -${_YC}: y.tab.h > cp y.tab.c ${_YC} (2) After the cp, add "sleep 0.1; touch ${_YC}" to try to ensure that the file that is expected to be newer actually is newer. Shouldn't be needed after (1). Without (1), touch y.tab.h instead, but it seems more natural for the .c file to end up newer. > CLEANFILES+= y.tab.c y.tab.h > .elif !empty(YFLAGS:M-d) > .for _YH in ${_YC:R}.h > -${_YH}: ${_YSRC} > +${_YH}: ${_YC} > +${_YC}: ${_YSRC} > ${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC} > -${_YC}: ${_YH} > - @touch ${.TARGET} This only reverts to the previous buggy version. It is still missing the .ORDER directive and just shuffles the order in the bogus dependency chain. (3) After restoring the .ORDER directive, reverse the order of the files in it. (4) After the yacc command, add "sleep 0.1; touch ${_YSRC}". Now there is no cp to touch the .c file, so we must do something to try to ensure that it is newer. We could also append an empty line to it and not have to sleep for a while to ensure that clock used by touch(1) is in advance of the clock used by the kernel for timestamps (appending the empty line uses the kernel timestamp clock, which is the same as the one used for setting the mtime for y.tab.h, except in exotic cases like someone changing vfs.timestamp.precision or stepping the clock backwards underneath us. Otherwise, the sleep might even need to be N + 0.1 seconds, where N is the file system granularity in seconds and 0.1 is a safety margin for incoherent clocks (enugh for HZ = 10). N != 0 would be needed if we needed a time strictly later, but I think make only needs non-strictly later. > SRCS+= ${_YH} > CLEANFILES+= ${_YH} > .endfor > Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20121021151723.D926>