xref: /freebsd/contrib/bmake/mk/meta.autodep.mk (revision 548bfc56eb0b2cefa0fb8dc2478240bfef610309)
1c59c3bf3SSimon J. Gerraty# SPDX-License-Identifier: BSD-2-Clause
2c59c3bf3SSimon J. Gerraty#
3*548bfc56SSimon J. Gerraty# $Id: meta.autodep.mk,v 1.63 2024/04/24 18:56:41 sjg Exp $
43cbdda60SSimon J. Gerraty
53cbdda60SSimon J. Gerraty#
63cbdda60SSimon J. Gerraty#	@(#) Copyright (c) 2010, Simon J. Gerraty
73cbdda60SSimon J. Gerraty#
83cbdda60SSimon J. Gerraty#	This file is provided in the hope that it will
93cbdda60SSimon J. Gerraty#	be of use.  There is absolutely NO WARRANTY.
103cbdda60SSimon J. Gerraty#	Permission to copy, redistribute or otherwise
113cbdda60SSimon J. Gerraty#	use this file is hereby granted provided that
123cbdda60SSimon J. Gerraty#	the above copyright notice and this notice are
133cbdda60SSimon J. Gerraty#	left intact.
143cbdda60SSimon J. Gerraty#
153cbdda60SSimon J. Gerraty#	Please send copies of changes and bug-fixes to:
163cbdda60SSimon J. Gerraty#	sjg@crufty.net
173cbdda60SSimon J. Gerraty#
183cbdda60SSimon J. Gerraty
193cbdda60SSimon J. Gerraty_this ?= ${.PARSEFILE}
203cbdda60SSimon J. Gerraty.if !target(__${_this}__)
213cbdda60SSimon J. Gerraty__${_this}__: .NOTMAIN
223cbdda60SSimon J. Gerraty
23e48f47ddSSimon J. Gerraty.-include <local.autodep.mk>
243cbdda60SSimon J. Gerraty
252eae894cSSimon J. GerratyPICO?= .pico
262eae894cSSimon J. Gerraty
273cbdda60SSimon J. Gerraty.if defined(SRCS)
2812904384SSimon J. Gerraty.if ${MAKE_VERSION:U0} >= 20211212
29c59c3bf3SSimon J. GerratyOBJ_SUFFIXES += ${.SUFFIXES:M*o}
3012904384SSimon J. Gerraty.else
313cbdda60SSimon J. Gerraty# it would be nice to be able to query .SUFFIXES
32c59c3bf3SSimon J. GerratyOBJ_SUFFIXES += .o .po .lo ${PICO}
3312904384SSimon J. Gerraty.endif
343cbdda60SSimon J. Gerraty
353cbdda60SSimon J. Gerraty# explicit dependencies help short-circuit .SUFFIX searches
363cbdda60SSimon J. GerratySRCS_DEP_FILTER+= N*.[hly]
373cbdda60SSimon J. Gerraty.for s in ${SRCS:${SRCS_DEP_FILTER:O:u:ts:}}
38c59c3bf3SSimon J. Gerraty.for e in ${OBJ_SUFFIXES:O:u}
393cbdda60SSimon J. Gerraty.if !target(${s:T:R}$e)
403cbdda60SSimon J. Gerraty${s:T:R}$e: $s
413cbdda60SSimon J. Gerraty.endif
423cbdda60SSimon J. Gerraty.endfor
433cbdda60SSimon J. Gerraty.endfor
443cbdda60SSimon J. Gerraty.endif
453cbdda60SSimon J. Gerraty
463cbdda60SSimon J. Gerraty.if make(gendirdeps)
473cbdda60SSimon J. Gerraty# you are supposed to know what you are doing!
483cbdda60SSimon J. GerratyUPDATE_DEPENDFILE = yes
493cbdda60SSimon J. Gerraty.elif !empty(.TARGETS) && !make(all)
503cbdda60SSimon J. Gerraty# do not update the *depend* files
513cbdda60SSimon J. Gerraty# unless we are building the entire directory or the default target.
523cbdda60SSimon J. Gerraty# NO means don't update .depend - or Makefile.depend*
533cbdda60SSimon J. Gerraty# no means update .depend but not Makefile.depend*
543cbdda60SSimon J. GerratyUPDATE_DEPENDFILE = NO
553cbdda60SSimon J. Gerraty.elif ${.MAKEFLAGS:M-k} != ""
563cbdda60SSimon J. Gerraty# it is a bad idea to update anything
573cbdda60SSimon J. GerratyUPDATE_DEPENDFILE = NO
583cbdda60SSimon J. Gerraty.endif
593cbdda60SSimon J. Gerraty
603cbdda60SSimon J. Gerraty_CURDIR ?= ${.CURDIR}
61ac3446e9SSimon J. Gerraty_OBJDIR ?= ${.OBJDIR}
62ac3446e9SSimon J. Gerraty_OBJTOP ?= ${OBJTOP}
63ac3446e9SSimon J. Gerraty_OBJROOT ?= ${OBJROOT:U${_OBJTOP}}
643cbdda60SSimon J. Gerraty_DEPENDFILE := ${_CURDIR}/${.MAKE.DEPENDFILE:T}
653cbdda60SSimon J. Gerraty
662c3632d1SSimon J. Gerraty.if ${.MAKE.LEVEL} > 0
67e48f47ddSSimon J. Gerraty# do not allow auto update if we ever built this dir without filemon
68e48f47ddSSimon J. GerratyNO_FILEMON_COOKIE = .nofilemon
69e48f47ddSSimon J. GerratyCLEANFILES += ${NO_FILEMON_COOKIE}
70e48f47ddSSimon J. Gerraty.if ${.MAKE.MODE:Uno:Mnofilemon} != ""
71e48f47ddSSimon J. GerratyUPDATE_DEPENDFILE = NO
72e48f47ddSSimon J. Gerratyall: ${NO_FILEMON_COOKIE}
73e48f47ddSSimon J. Gerraty${NO_FILEMON_COOKIE}: .NOMETA
74e48f47ddSSimon J. Gerraty	@echo UPDATE_DEPENDFILE=NO > ${.TARGET}
75e48f47ddSSimon J. Gerraty.elif exists(${NO_FILEMON_COOKIE})
76e48f47ddSSimon J. GerratyUPDATE_DEPENDFILE = NO
77e48f47ddSSimon J. Gerraty.warning ${RELDIR} built with nofilemon; UPDATE_DEPENDFILE=NO
78e48f47ddSSimon J. Gerraty.endif
79e48f47ddSSimon J. Gerraty.endif
80e48f47ddSSimon J. Gerraty
813cbdda60SSimon J. Gerraty.if ${.MAKE.LEVEL} == 0
823cbdda60SSimon J. GerratyUPDATE_DEPENDFILE = NO
833cbdda60SSimon J. Gerraty.endif
843cbdda60SSimon J. Gerraty.if !exists(${_DEPENDFILE})
853cbdda60SSimon J. Gerraty_bootstrap_dirdeps = yes
863cbdda60SSimon J. Gerraty.endif
873cbdda60SSimon J. Gerraty_bootstrap_dirdeps ?= no
883cbdda60SSimon J. GerratyUPDATE_DEPENDFILE ?= yes
893cbdda60SSimon J. Gerraty
903cbdda60SSimon J. Gerraty.if ${DEBUG_AUTODEP:Uno:@m@${RELDIR:M$m}@} != ""
913cbdda60SSimon J. Gerraty.info ${_DEPENDFILE:S,${SRCTOP}/,,} update=${UPDATE_DEPENDFILE}
923cbdda60SSimon J. Gerraty.endif
933cbdda60SSimon J. Gerraty
943cbdda60SSimon J. Gerraty.if !empty(XMAKE_META_FILE)
953cbdda60SSimon J. Gerraty.if exists(${.OBJDIR}/${XMAKE_META_FILE})
963cbdda60SSimon J. Gerraty# we cannot get accurate dependencies from an update build
973cbdda60SSimon J. GerratyUPDATE_DEPENDFILE = NO
983cbdda60SSimon J. Gerraty.else
993cbdda60SSimon J. GerratyMETA_XTRAS += ${XMAKE_META_FILE}
1003cbdda60SSimon J. Gerraty.endif
1013cbdda60SSimon J. Gerraty.endif
1023cbdda60SSimon J. Gerraty
1033cbdda60SSimon J. Gerraty.if ${_bootstrap_dirdeps} == "yes" || exists(${_DEPENDFILE})
1043cbdda60SSimon J. Gerraty# if it isn't supposed to be touched by us the Makefile should have
1053cbdda60SSimon J. Gerraty# UPDATE_DEPENDFILE = no
1063cbdda60SSimon J. GerratyWANT_UPDATE_DEPENDFILE ?= yes
1073cbdda60SSimon J. Gerraty.endif
1083cbdda60SSimon J. Gerraty
1093cbdda60SSimon J. Gerraty.if ${WANT_UPDATE_DEPENDFILE:Uno:tl} != "no"
110be19d90bSSimon J. Gerraty.if ${.MAKE.MODE:Uno:Mmeta*} == "" || ${.MAKE.MODE:Uno:M*read*} != ""
1113cbdda60SSimon J. GerratyUPDATE_DEPENDFILE = no
1123cbdda60SSimon J. Gerraty.endif
1133cbdda60SSimon J. Gerraty
1143cbdda60SSimon J. Gerraty.if ${DEBUG_AUTODEP:Uno:@m@${RELDIR:M$m}@} != ""
1153cbdda60SSimon J. Gerraty.info ${_DEPENDFILE:S,${SRCTOP}/,,} update=${UPDATE_DEPENDFILE}
1163cbdda60SSimon J. Gerraty.endif
1173cbdda60SSimon J. Gerraty
1183cbdda60SSimon J. Gerraty.if ${UPDATE_DEPENDFILE:tl} == "yes"
1193cbdda60SSimon J. Gerraty# sometimes we want .meta files generated to aid debugging/error detection
1203cbdda60SSimon J. Gerraty# but do not want to consider them for dependencies
1213cbdda60SSimon J. Gerraty# for example the result of running configure
1223cbdda60SSimon J. Gerraty# just make sure this is not empty
1233cbdda60SSimon J. GerratyMETA_FILE_FILTER ?= N.meta
1244c620fe5SSimon J. Gerraty# never consider these
1254c620fe5SSimon J. GerratyMETA_FILE_FILTER += Ndirdeps.cache*
1263cbdda60SSimon J. Gerraty
1273cbdda60SSimon J. Gerraty.if !empty(DPADD)
1283cbdda60SSimon J. Gerraty# if we have any non-libs in DPADD,
1293cbdda60SSimon J. Gerraty# they probably need to be paid attention to
1303cbdda60SSimon J. Gerraty.if !empty(DPLIBS)
1313cbdda60SSimon J. GerratyFORCE_DPADD = ${DPADD:${DPLIBS:${M_ListToSkip}}:${DPADD_LAST:${M_ListToSkip}}}
1323cbdda60SSimon J. Gerraty.else
1333cbdda60SSimon J. Gerraty_nonlibs := ${DPADD:T:Nlib*:N*include}
1343cbdda60SSimon J. Gerraty.if !empty(_nonlibs)
1353cbdda60SSimon J. GerratyFORCE_DPADD += ${_nonlibs:@x@${DPADD:M*/$x}@}
1363cbdda60SSimon J. Gerraty.endif
1373cbdda60SSimon J. Gerraty.endif
1383cbdda60SSimon J. Gerraty.endif
1393cbdda60SSimon J. Gerraty
1403cbdda60SSimon J. Gerraty.if !make(gendirdeps)
1413cbdda60SSimon J. Gerraty.END:	gendirdeps
1423cbdda60SSimon J. Gerraty.endif
1433cbdda60SSimon J. Gerraty
144c1d01b5fSSimon J. Gerraty.if ${LOCAL_DEPENDS_GUARD:U} == "no"
145c1d01b5fSSimon J. Gerraty.depend:
146c1d01b5fSSimon J. Gerraty.endif
147c1d01b5fSSimon J. Gerraty
1483cbdda60SSimon J. Gerraty# if we don't have OBJS, then .depend isn't useful
1493cbdda60SSimon J. Gerraty.if !target(.depend) && (!empty(OBJS) || ${.ALLTARGETS:M*.o} != "")
1503cbdda60SSimon J. Gerraty# some makefiles and/or targets contain
1513cbdda60SSimon J. Gerraty# circular dependencies if you dig too deep
1523cbdda60SSimon J. Gerraty# (as meta mode is apt to do)
1535bcb7424SSimon J. Gerraty# so we provide a means of suppressing them.
1543cbdda60SSimon J. Gerraty# the input to the loop below is target: dependency
1553cbdda60SSimon J. Gerraty# with just one dependency per line.
1563cbdda60SSimon J. Gerraty# Also some targets are not really local, or use random names.
1573cbdda60SSimon J. Gerraty# Use local.autodep.mk to provide local additions!
1583cbdda60SSimon J. GerratySUPPRESS_DEPEND += \
1593cbdda60SSimon J. Gerraty	${SB:S,/,_,g}* \
1603cbdda60SSimon J. Gerraty	*:y.tab.c \
1613cbdda60SSimon J. Gerraty	*.c:*.c \
1623cbdda60SSimon J. Gerraty	*.h:*.h
1633cbdda60SSimon J. Gerraty
1643cbdda60SSimon J. Gerraty.NOPATH:	.depend
1653cbdda60SSimon J. Gerraty# we use ${.MAKE.META.CREATED} to trigger an update but
1663cbdda60SSimon J. Gerraty# we process using ${.MAKE.META.FILES}
1673cbdda60SSimon J. Gerraty# the double $$ defers initial evaluation
1683cbdda60SSimon J. Gerraty# if necessary, we fake .po dependencies, just so the result
1693cbdda60SSimon J. Gerraty# in Makefile.depend* is stable
1705bcb7424SSimon J. Gerraty# The current objdir may be referred to in various ways
1713cbdda60SSimon J. GerratyOBJDIR_REFS += ${.OBJDIR} ${.OBJDIR:tA} ${_OBJDIR} ${RELOBJTOP}/${RELDIR}
1723cbdda60SSimon J. Gerraty_depend = .depend
1733cbdda60SSimon J. Gerraty# it would be nice to be able to get .SUFFIXES as ${.SUFFIXES}
1743cbdda60SSimon J. Gerraty# we actually only care about the .SUFFIXES of files that might be
1753cbdda60SSimon J. Gerraty# generated by tools like yacc.
17612904384SSimon J. Gerraty.if ${MAKE_VERSION:U0} >= 20211212
17712904384SSimon J. GerratyDEPEND_SUFFIXES += ${.SUFFIXES:N.sh:N*[0-9aFfglopmnrSsty]}
17812904384SSimon J. Gerraty.else
1793cbdda60SSimon J. GerratyDEPEND_SUFFIXES += .c .h .cpp .hpp .cxx .hxx .cc .hh
18012904384SSimon J. Gerraty.endif
1813cbdda60SSimon J. Gerraty.depend: .NOMETA $${.MAKE.META.CREATED} ${_this}
1823cbdda60SSimon J. Gerraty	@echo "Updating $@: ${.OODATE:T:[1..8]}"
1834fde40d9SSimon J. Gerraty	@${EGREP:Uegrep} -i '^R .*\.(${DEPEND_SUFFIXES:tl:O:u:S,^.,,:ts|})$$' /dev/null ${.MAKE.META.FILES:T:O:u:${META_FILE_FILTER:ts:}:M*o.meta} | \
1843cbdda60SSimon J. Gerraty	sed -e 's, \./, ,${OBJDIR_REFS:O:u:@d@;s, $d/, ,@};/\//d' \
1853cbdda60SSimon J. Gerraty		-e 's,^\([^/][^/]*\).meta...[0-9]* ,\1: ,' | \
1863cbdda60SSimon J. Gerraty	sort -u | \
1873cbdda60SSimon J. Gerraty	while read t d; do \
1883cbdda60SSimon J. Gerraty		case "$$d:" in $$t) continue;; esac; \
1893cbdda60SSimon J. Gerraty		case "$$t$$d" in ${SUPPRESS_DEPEND:U.:O:u:ts|}) continue;; esac; \
1903cbdda60SSimon J. Gerraty		echo $$t $$d; \
1913cbdda60SSimon J. Gerraty	done > $@.${.MAKE.PID}
1923cbdda60SSimon J. Gerraty	@case "${.MAKE.META.FILES:T:M*.po.*}" in \
1933cbdda60SSimon J. Gerraty	*.po.*) mv $@.${.MAKE.PID} $@;; \
1943cbdda60SSimon J. Gerraty	*) { cat $@.${.MAKE.PID}; \
195c59c3bf3SSimon J. Gerraty	sed ${OBJ_SUFFIXES:N.o:N.po:@o@-e 's,\$o:,.o:,'@} \
196e2eeea75SSimon J. Gerraty		-e 's,\.o:,.po:,' $@.${.MAKE.PID}; } | sort -u > $@; \
1973cbdda60SSimon J. Gerraty	rm -f $@.${.MAKE.PID};; \
1983cbdda60SSimon J. Gerraty	esac
1993cbdda60SSimon J. Gerraty.else
2003cbdda60SSimon J. Gerraty# make sure this exists
2013cbdda60SSimon J. Gerraty.depend:
2023cbdda60SSimon J. Gerraty# do _not_ assume that .depend is in any fit state for us to use
2033cbdda60SSimon J. GerratyCAT_DEPEND = /dev/null
2043cbdda60SSimon J. Gerraty.if ${.MAKE.LEVEL} > 0
2053cbdda60SSimon J. Gerraty.export CAT_DEPEND
2063cbdda60SSimon J. Gerraty.endif
2073cbdda60SSimon J. Gerraty_depend =
2083cbdda60SSimon J. Gerraty.endif
2093cbdda60SSimon J. Gerraty
2103cbdda60SSimon J. Gerraty.if ${DEBUG_AUTODEP:Uno:@m@${RELDIR:M$m}@} != ""
2113cbdda60SSimon J. Gerraty.info ${_DEPENDFILE:S,${SRCTOP}/,,} _depend=${_depend}
2123cbdda60SSimon J. Gerraty.endif
2133cbdda60SSimon J. Gerraty
2145bcb7424SSimon J. Gerraty.if ${UPDATE_DEPENDFILE} == "yes"
215148ee845SSimon J. Gerratygendirdeps:	beforegendirdeps .WAIT ${_DEPENDFILE}
216148ee845SSimon J. Gerratybeforegendirdeps:
2175bcb7424SSimon J. Gerraty.endif
2183cbdda60SSimon J. Gerraty
2193cbdda60SSimon J. Gerraty.if !target(${_DEPENDFILE})
2203cbdda60SSimon J. Gerraty.if ${_bootstrap_dirdeps} == "yes"
2213cbdda60SSimon J. Gerraty# We are boot-strapping a new directory
2223cbdda60SSimon J. Gerraty# Use DPADD to seed DIRDEPS
2233cbdda60SSimon J. Gerraty.if !empty(DPADD)
2243cbdda60SSimon J. Gerraty# anything which matches ${_OBJROOT}* but not ${_OBJTOP}*
2253cbdda60SSimon J. Gerraty# needs to be qualified in DIRDEPS
2263cbdda60SSimon J. Gerraty# The pseudo machine "host" is used for HOST_TARGET
227ac3446e9SSimon J. GerratyDIRDEPS += \
2283cbdda60SSimon J. Gerraty	${DPADD:M${_OBJTOP}*:H:C,${_OBJTOP}[^/]*/,,:N.:O:u} \
2293bebe729SSimon J. Gerraty	${DPADD:M${_OBJROOT}*:N${_OBJTOP}*:N${STAGE_ROOT:U${_OBJTOP}}/*:H:S,${_OBJROOT},,:C,^([^/]+)/(.*),\2.\1,:S,${HOST_TARGET}$,host,:N.*:O:u}
2303cbdda60SSimon J. Gerraty
2313cbdda60SSimon J. Gerraty.endif
2323cbdda60SSimon J. Gerraty.endif
2333cbdda60SSimon J. Gerraty
2343cbdda60SSimon J. Gerraty_gendirdeps_mutex =
2353cbdda60SSimon J. Gerraty.if defined(NEED_GENDIRDEPS_MUTEX)
2363cbdda60SSimon J. Gerraty# If a src dir gets built with multiple object dirs,
2373cbdda60SSimon J. Gerraty# we need a mutex.  Obviously, this is best avoided.
2383cbdda60SSimon J. Gerraty# Note if .MAKE.DEPENDFILE is common for all ${MACHINE}
2393cbdda60SSimon J. Gerraty# you either need to mutex, or ensure only one machine builds at a time!
2403cbdda60SSimon J. Gerraty# lockf is an example of a suitable tool
2413cbdda60SSimon J. GerratyLOCKF ?= /usr/bin/lockf
2423cbdda60SSimon J. Gerraty.if exists(${LOCKF})
2433cbdda60SSimon J. GerratyGENDIRDEPS_MUTEXER ?= ${LOCKF} -k
2443cbdda60SSimon J. Gerraty.endif
2453cbdda60SSimon J. Gerraty.if empty(GENDIRDEPS_MUTEXER)
2463cbdda60SSimon J. Gerraty.error NEED_GENDIRDEPS_MUTEX defined, but GENDIRDEPS_MUTEXER not set
2473cbdda60SSimon J. Gerraty.else
2483cbdda60SSimon J. Gerraty_gendirdeps_mutex = ${GENDIRDEPS_MUTEXER} ${GENDIRDEPS_MUTEX:U${_CURDIR}/Makefile}
2493cbdda60SSimon J. Gerraty.endif
2503cbdda60SSimon J. Gerraty.endif
2513cbdda60SSimon J. Gerraty
2523cbdda60SSimon J. Gerraty# If we have META_XTRAS we most likely did not create them
2533cbdda60SSimon J. Gerraty# but we need to behave as if we did.
2543cbdda60SSimon J. Gerraty# Avoid adding glob patterns to .MAKE.META.CREATED though.
2553cbdda60SSimon J. Gerraty.MAKE.META.CREATED += ${META_XTRAS:N*\**:O:u}
2563cbdda60SSimon J. Gerraty
2573cbdda60SSimon J. Gerraty.if make(gendirdeps)
2583cbdda60SSimon J. GerratyMETA_FILES = *.meta
2593cbdda60SSimon J. Gerraty.elif ${OPTIMIZE_OBJECT_META_FILES:Uno:tl} == "no"
2603cbdda60SSimon J. GerratyMETA_FILES = ${.MAKE.META.FILES:T:N.depend*:O:u}
2613cbdda60SSimon J. Gerraty.else
2622eae894cSSimon J. Gerraty# if we have 1000's of .o.meta, ${PICO}.meta etc we need only look at one set
2633cbdda60SSimon J. Gerraty# it is left as an exercise for the reader to work out what this does
2643cbdda60SSimon J. GerratyMETA_FILES = ${.MAKE.META.FILES:T:N.depend*:N*o.meta:O:u} \
2653cbdda60SSimon J. Gerraty	${.MAKE.META.FILES:T:M*.${.MAKE.META.FILES:M*o.meta:R:E:O:u:[1]}.meta:O:u}
2663cbdda60SSimon J. Gerraty.endif
2673cbdda60SSimon J. Gerraty
2683cbdda60SSimon J. Gerraty.if ${DEBUG_AUTODEP:Uno:@m@${RELDIR:M$m}@} != ""
2693cbdda60SSimon J. Gerraty.info ${_DEPENDFILE:S,${SRCTOP}/,,}: ${_depend} ${.PARSEDIR}/gendirdeps.mk ${META2DEPS} xtras=${META_XTRAS}
2703cbdda60SSimon J. Gerraty.endif
2713cbdda60SSimon J. Gerraty
272494f7191SSimon J. Gerraty.if ${.MAKE.LEVEL} > 0
273494f7191SSimon J. Gerraty.if ${UPDATE_DEPENDFILE} == "yes"
274494f7191SSimon J. Gerraty.-include <${.CURDIR}/${.MAKE.DEPENDFILE_PREFIX}.options>
275494f7191SSimon J. Gerraty.endif
276494f7191SSimon J. Gerraty.if !empty(GENDIRDEPS_FILTER)
2773cbdda60SSimon J. Gerraty.export GENDIRDEPS_FILTER
2783cbdda60SSimon J. Gerraty.endif
2792eae894cSSimon J. Gerraty# export to avoid blowing command line limit
2802eae894cSSimon J. GerratyMETA_FILES := ${META_XTRAS:U:O:u} ${META_FILES:U:T:O:u:${META_FILE_FILTER:ts:}}
2812eae894cSSimon J. Gerraty.export META_FILES
282494f7191SSimon J. Gerraty.endif
2833cbdda60SSimon J. Gerraty
2843cbdda60SSimon J. Gerraty# we might have .../ in MAKESYSPATH
2853cbdda60SSimon J. Gerraty_makesyspath:= ${_PARSEDIR}
2863cbdda60SSimon J. Gerraty${_DEPENDFILE}: ${_depend} ${.PARSEDIR}/gendirdeps.mk  ${META2DEPS} $${.MAKE.META.CREATED}
2873cbdda60SSimon J. Gerraty	@echo Checking $@: ${.OODATE:T:[1..8]}
288e22fef7dSSimon J. Gerraty	@(cd . && ${GENDIRDEPS_ENV} \
2893cbdda60SSimon J. Gerraty	SKIP_GENDIRDEPS='${SKIP_GENDIRDEPS:O:u}' \
2903cbdda60SSimon J. Gerraty	DPADD='${FORCE_DPADD:O:u}' ${_gendirdeps_mutex} \
2913cbdda60SSimon J. Gerraty	MAKESYSPATH=${_makesyspath} \
2922eae894cSSimon J. Gerraty	${.MAKE} -f gendirdeps.mk RELDIR=${RELDIR} _DEPENDFILE=${_DEPENDFILE})
2933cbdda60SSimon J. Gerraty	@test -s $@ && touch $@; :
2943cbdda60SSimon J. Gerraty.endif
2953cbdda60SSimon J. Gerraty
2963cbdda60SSimon J. Gerraty.endif
2973cbdda60SSimon J. Gerraty.endif
2983cbdda60SSimon J. Gerraty
2993cbdda60SSimon J. Gerraty.if ${_bootstrap_dirdeps} == "yes"
300db29cad8SSimon J. GerratyDIRDEPS+= ${RELDIR}.${TARGET_SPEC:U${MACHINE}}
3013cbdda60SSimon J. Gerraty# make sure this is included at least once
3023cbdda60SSimon J. Gerraty.include <dirdeps.mk>
3033cbdda60SSimon J. Gerraty.else
3043cbdda60SSimon J. Gerraty${_DEPENDFILE}: .PRECIOUS
3053cbdda60SSimon J. Gerraty.endif
3063cbdda60SSimon J. Gerraty
3073cbdda60SSimon J. GerratyCLEANFILES += *.meta filemon.* *.db
3085bcb7424SSimon J. Gerraty
3095bcb7424SSimon J. Gerraty# these make it easy to gather some stats
310d5e0a182SSimon J. Gerratynow_utc ?= ${%s:L:localtime}
311*548bfc56SSimon J. Gerraty.if !defined(start_utc)
3125bcb7424SSimon J. Gerratystart_utc := ${now_utc}
313*548bfc56SSimon J. Gerraty.endif
3145bcb7424SSimon J. Gerraty
3155bcb7424SSimon J. Gerratymeta_stats= meta=${empty(.MAKE.META.FILES):?0:${.MAKE.META.FILES:[#]}} \
3165bcb7424SSimon J. Gerraty	created=${empty(.MAKE.META.CREATED):?0:${.MAKE.META.CREATED:[#]}}
3175bcb7424SSimon J. Gerraty
318b0c40a00SSimon J. Gerraty.if !target(_reldir_finish)
3195bcb7424SSimon J. Gerraty#.END: _reldir_finish
3205bcb7424SSimon J. Gerraty.if target(gendirdeps)
3215bcb7424SSimon J. Gerraty_reldir_finish: gendirdeps
3225bcb7424SSimon J. Gerraty.endif
3235bcb7424SSimon J. Gerraty_reldir_finish: .NOMETA
3245bcb7424SSimon J. Gerraty	@echo "${TIME_STAMP} Finished ${RELDIR}.${TARGET_SPEC} seconds=$$(( ${now_utc} - ${start_utc} )) ${meta_stats}"
325b0c40a00SSimon J. Gerraty.endif
3265bcb7424SSimon J. Gerraty
327b0c40a00SSimon J. Gerraty.if !target(_reldir_failed)
3285bcb7424SSimon J. Gerraty#.ERROR: _reldir_failed
3295bcb7424SSimon J. Gerraty_reldir_failed: .NOMETA
3305bcb7424SSimon J. Gerraty	@echo "${TIME_STAMP} Failed ${RELDIR}.${TARGET_SPEC} seconds=$$(( ${now_utc} - ${start_utc} )) ${meta_stats}"
331b0c40a00SSimon J. Gerraty.endif
3325bcb7424SSimon J. Gerraty
3332c3632d1SSimon J. Gerraty.if !defined(WITHOUT_META_STATS) && ${.MAKE.LEVEL} > 0
3345bcb7424SSimon J. Gerraty.END: _reldir_finish
3355bcb7424SSimon J. Gerraty.ERROR: _reldir_failed
3365bcb7424SSimon J. Gerraty.endif
3375bcb7424SSimon J. Gerraty
338c59c3bf3SSimon J. Gerraty.-include <ccm.dep.mk>
339c59c3bf3SSimon J. Gerraty
3403cbdda60SSimon J. Gerraty.endif
341