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
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to