Changeset View
Changeset View
Standalone View
Standalone View
head/share/mk/meta.autodep.mk
# $FreeBSD$ | # $FreeBSD$ | ||||
# $Id: meta.autodep.mk,v 1.50 2018/06/08 01:25:31 sjg Exp $ | # $Id: meta.autodep.mk,v 1.53 2020/11/08 05:47:56 sjg Exp $ | ||||
# | # | ||||
# @(#) Copyright (c) 2010, Simon J. Gerraty | # @(#) Copyright (c) 2010, Simon J. Gerraty | ||||
# | # | ||||
# This file is provided in the hope that it will | # This file is provided in the hope that it will | ||||
# be of use. There is absolutely NO WARRANTY. | # be of use. There is absolutely NO WARRANTY. | ||||
# Permission to copy, redistribute or otherwise | # Permission to copy, redistribute or otherwise | ||||
# use this file is hereby granted provided that | # use this file is hereby granted provided that | ||||
# the above copyright notice and this notice are | # the above copyright notice and this notice are | ||||
# left intact. | # left intact. | ||||
# | # | ||||
# Please send copies of changes and bug-fixes to: | # Please send copies of changes and bug-fixes to: | ||||
# sjg@crufty.net | # sjg@crufty.net | ||||
# | # | ||||
_this ?= ${.PARSEFILE} | _this ?= ${.PARSEFILE} | ||||
.if !target(__${_this}__) | .if !target(__${_this}__) | ||||
__${_this}__: .NOTMAIN | __${_this}__: .NOTMAIN | ||||
.-include <local.autodep.mk> | .-include <local.autodep.mk> | ||||
PICO?= .pico | PICO?= .pico | ||||
NOSSPPICO?= .nossppico | |||||
.if defined(SRCS) | .if defined(SRCS) | ||||
# it would be nice to be able to query .SUFFIXES | # it would be nice to be able to query .SUFFIXES | ||||
OBJ_EXTENSIONS+= .o .po .lo ${PICO} ${NOSSPPICO} | OBJ_EXTENSIONS+= .o .po .lo ${PICO} | ||||
# explicit dependencies help short-circuit .SUFFIX searches | # explicit dependencies help short-circuit .SUFFIX searches | ||||
SRCS_DEP_FILTER+= N*.[hly] | SRCS_DEP_FILTER+= N*.[hly] | ||||
.for s in ${SRCS:${SRCS_DEP_FILTER:O:u:ts:}} | .for s in ${SRCS:${SRCS_DEP_FILTER:O:u:ts:}} | ||||
.for e in ${OBJ_EXTENSIONS:O:u} | .for e in ${OBJ_EXTENSIONS:O:u} | ||||
.if !target(${s:T:R}$e) | .if !target(${s:T:R}$e) | ||||
${s:T:R}$e: $s | ${s:T:R}$e: $s | ||||
.endif | .endif | ||||
Show All 16 Lines | |||||
.endif | .endif | ||||
_CURDIR ?= ${.CURDIR} | _CURDIR ?= ${.CURDIR} | ||||
_OBJDIR ?= ${.OBJDIR} | _OBJDIR ?= ${.OBJDIR} | ||||
_OBJTOP ?= ${OBJTOP} | _OBJTOP ?= ${OBJTOP} | ||||
_OBJROOT ?= ${OBJROOT:U${_OBJTOP}} | _OBJROOT ?= ${OBJROOT:U${_OBJTOP}} | ||||
_DEPENDFILE := ${_CURDIR}/${.MAKE.DEPENDFILE:T} | _DEPENDFILE := ${_CURDIR}/${.MAKE.DEPENDFILE:T} | ||||
.if ${.MAKE.LEVEL} > 0 || ${BUILD_AT_LEVEL0:Uyes:tl} == "yes" | .if ${.MAKE.LEVEL} > 0 | ||||
# do not allow auto update if we ever built this dir without filemon | # do not allow auto update if we ever built this dir without filemon | ||||
NO_FILEMON_COOKIE = .nofilemon | NO_FILEMON_COOKIE = .nofilemon | ||||
CLEANFILES += ${NO_FILEMON_COOKIE} | CLEANFILES += ${NO_FILEMON_COOKIE} | ||||
.if ${.MAKE.MODE:Uno:Mnofilemon} != "" | .if ${.MAKE.MODE:Uno:Mnofilemon} != "" | ||||
UPDATE_DEPENDFILE = NO | UPDATE_DEPENDFILE = NO | ||||
all: ${NO_FILEMON_COOKIE} | all: ${NO_FILEMON_COOKIE} | ||||
${NO_FILEMON_COOKIE}: .NOMETA | ${NO_FILEMON_COOKIE}: .NOMETA | ||||
@echo UPDATE_DEPENDFILE=NO > ${.TARGET} | @echo UPDATE_DEPENDFILE=NO > ${.TARGET} | ||||
.elif exists(${NO_FILEMON_COOKIE}) | .elif exists(${NO_FILEMON_COOKIE}) | ||||
UPDATE_DEPENDFILE = NO | UPDATE_DEPENDFILE = NO | ||||
.warning ${RELDIR} built with nofilemon; UPDATE_DEPENDFILE=NO | .warning ${RELDIR} built with nofilemon; UPDATE_DEPENDFILE=NO | ||||
.endif | .endif | ||||
.endif | .endif | ||||
.if ${.MAKE.LEVEL} == 0 | .if ${.MAKE.LEVEL} == 0 | ||||
.if ${BUILD_AT_LEVEL0:Uyes:tl} == "no" | |||||
UPDATE_DEPENDFILE = NO | UPDATE_DEPENDFILE = NO | ||||
.endif | .endif | ||||
.endif | |||||
.if !exists(${_DEPENDFILE}) | .if !exists(${_DEPENDFILE}) | ||||
_bootstrap_dirdeps = yes | _bootstrap_dirdeps = yes | ||||
.endif | .endif | ||||
_bootstrap_dirdeps ?= no | _bootstrap_dirdeps ?= no | ||||
UPDATE_DEPENDFILE ?= yes | UPDATE_DEPENDFILE ?= yes | ||||
.if ${DEBUG_AUTODEP:Uno:@m@${RELDIR:M$m}@} != "" | .if ${DEBUG_AUTODEP:Uno:@m@${RELDIR:M$m}@} != "" | ||||
.info ${_DEPENDFILE:S,${SRCTOP}/,,} update=${UPDATE_DEPENDFILE} | .info ${_DEPENDFILE:S,${SRCTOP}/,,} update=${UPDATE_DEPENDFILE} | ||||
▲ Show 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | .depend: .NOMETA $${.MAKE.META.CREATED} ${_this} | ||||
while read t d; do \ | while read t d; do \ | ||||
case "$$d:" in $$t) continue;; esac; \ | case "$$d:" in $$t) continue;; esac; \ | ||||
case "$$t$$d" in ${SUPPRESS_DEPEND:U.:O:u:ts|}) continue;; esac; \ | case "$$t$$d" in ${SUPPRESS_DEPEND:U.:O:u:ts|}) continue;; esac; \ | ||||
echo $$t $$d; \ | echo $$t $$d; \ | ||||
done > $@.${.MAKE.PID} | done > $@.${.MAKE.PID} | ||||
@case "${.MAKE.META.FILES:T:M*.po.*}" in \ | @case "${.MAKE.META.FILES:T:M*.po.*}" in \ | ||||
*.po.*) mv $@.${.MAKE.PID} $@;; \ | *.po.*) mv $@.${.MAKE.PID} $@;; \ | ||||
*) { cat $@.${.MAKE.PID}; \ | *) { cat $@.${.MAKE.PID}; \ | ||||
sed 's,\${NOSSPPICO}:,.o:,;s,\${PICO}:,.o:,;s,\.o:,.po:,' $@.${.MAKE.PID}; } | sort -u > $@; \ | sed ${OBJ_EXTENSIONS:N.o:N.po:@o@-e 's,\$o:,.o:,'@} \ | ||||
-e 's,\.o:,.po:,' $@.${.MAKE.PID}; } | sort -u > $@; \ | |||||
rm -f $@.${.MAKE.PID};; \ | rm -f $@.${.MAKE.PID};; \ | ||||
esac | esac | ||||
.else | .else | ||||
# make sure this exists | # make sure this exists | ||||
.depend: | .depend: | ||||
# do _not_ assume that .depend is in any fit state for us to use | # do _not_ assume that .depend is in any fit state for us to use | ||||
CAT_DEPEND = /dev/null | CAT_DEPEND = /dev/null | ||||
.if ${.MAKE.LEVEL} > 0 | .if ${.MAKE.LEVEL} > 0 | ||||
▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | ${_DEPENDFILE}: ${_depend} ${.PARSEDIR}/gendirdeps.mk ${META2DEPS} $${.MAKE.META.CREATED} | ||||
${.MAKE} -f gendirdeps.mk RELDIR=${RELDIR} _DEPENDFILE=${_DEPENDFILE}) | ${.MAKE} -f gendirdeps.mk RELDIR=${RELDIR} _DEPENDFILE=${_DEPENDFILE}) | ||||
@test -s $@ && touch $@; : | @test -s $@ && touch $@; : | ||||
.endif | .endif | ||||
.endif | .endif | ||||
.endif | .endif | ||||
.if ${_bootstrap_dirdeps} == "yes" | .if ${_bootstrap_dirdeps} == "yes" | ||||
.if ${BUILD_AT_LEVEL0:Uno} == "no" | |||||
DIRDEPS+= ${RELDIR}.${TARGET_SPEC:U${MACHINE}} | DIRDEPS+= ${RELDIR}.${TARGET_SPEC:U${MACHINE}} | ||||
.endif | |||||
# make sure this is included at least once | # make sure this is included at least once | ||||
.include <dirdeps.mk> | .include <dirdeps.mk> | ||||
.else | .else | ||||
${_DEPENDFILE}: .PRECIOUS | ${_DEPENDFILE}: .PRECIOUS | ||||
.endif | .endif | ||||
CLEANFILES += *.meta filemon.* *.db | CLEANFILES += *.meta filemon.* *.db | ||||
Show All 10 Lines | |||||
.endif | .endif | ||||
_reldir_finish: .NOMETA | _reldir_finish: .NOMETA | ||||
@echo "${TIME_STAMP} Finished ${RELDIR}.${TARGET_SPEC} seconds=$$(( ${now_utc} - ${start_utc} )) ${meta_stats}" | @echo "${TIME_STAMP} Finished ${RELDIR}.${TARGET_SPEC} seconds=$$(( ${now_utc} - ${start_utc} )) ${meta_stats}" | ||||
#.ERROR: _reldir_failed | #.ERROR: _reldir_failed | ||||
_reldir_failed: .NOMETA | _reldir_failed: .NOMETA | ||||
@echo "${TIME_STAMP} Failed ${RELDIR}.${TARGET_SPEC} seconds=$$(( ${now_utc} - ${start_utc} )) ${meta_stats}" | @echo "${TIME_STAMP} Failed ${RELDIR}.${TARGET_SPEC} seconds=$$(( ${now_utc} - ${start_utc} )) ${meta_stats}" | ||||
.if defined(WITH_META_STATS) && ${.MAKE.LEVEL} > 0 | .if !defined(WITHOUT_META_STATS) && ${.MAKE.LEVEL} > 0 | ||||
.END: _reldir_finish | .END: _reldir_finish | ||||
.ERROR: _reldir_failed | .ERROR: _reldir_failed | ||||
.endif | .endif | ||||
.endif | .endif |