svn commit: r305634 - head/share/mk

Simon J. Gerraty sjg at juniper.net
Sat Sep 10 20:04:59 UTC 2016


Bryan Drewery <bdrewery at FreeBSD.org> wrote:
> > +# we can afford to use cookies to prevent some targets
> > +# re-running needlessly
> > +META_COOKIE_TOUCH= touch ${COOKIE.${.TARGET}:U${.OBJDIR}/${.TARGET}}
> 
> Could you use ?= here please? I have a META_COOKIE_TOUCH in local.sys.mk

Sure.

> Also note that you need to remove this cookie immediately in any target
> that uses it.  I covered this a bit in my BSDCan presentation.  The
> problem is if meta mode determines that a target is outdated, then
> partially rebuilds the target, then fails before touching the cookie.
> The next build may not consider the target out-of-date anymore and fail
> to retry.
>
> Consider something like:
> foo: foo.c
> target_install:
> 	cp foo ${DESTDIR}/usr/bin/
> 	touch target_install
> 
> It may consider this target out-of-date due to foo rebuilding (and
> detected in target_install.meta), but the cp may fail.  The next build,
> target_install.meta was overwritten with the failed attempt, and is now
> newer than foo and still has its target_install cookie.  Nothing will

The mtime of the .meta file is not relevent as it is not the target
If foo is still newer than target_install and referenced by the the
.meta file the target will still be out-of-date

Sill, one could do things like:

.ERROR:
	${.ERROR_TARGET:Drm -f ${.ERROR_TARGET}}

or if multiple things to be done on .ERROR

.ERROR: rm-failed
rm-failed: .NOMETA
        ${.ERROR_TARGET:Drm -f ${.ERROR_TARGET}}

to ensure that any failed target is removed.

> cause it to retry copying, and it proceeds on with the build without
> properly failing again.  I hit this case in at least include/ (which
> went through a lot of further changes, finally of which was the removal
> of cookies in r300346) and some other cases which I don't recall the
> specifics for.


More information about the svn-src-all mailing list