1999-08-28 00:22:10 +00:00
|
|
|
# $FreeBSD$
|
1996-05-25 23:09:49 +00:00
|
|
|
#
|
|
|
|
# The include file <bsd.dep.mk> handles Makefile dependencies.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# +++ variables +++
|
|
|
|
#
|
2016-02-16 19:11:17 +00:00
|
|
|
# CLEANDEPENDDIRS Additional directories to remove for the cleandepend
|
|
|
|
# target.
|
|
|
|
#
|
|
|
|
# CLEANDEPENDFILES Additional files to remove for the cleandepend target.
|
|
|
|
#
|
2002-10-17 13:48:13 +00:00
|
|
|
# CTAGS A tags file generation program [gtags]
|
|
|
|
#
|
|
|
|
# CTAGSFLAGS Options for ctags(1) [not set]
|
|
|
|
#
|
1996-05-25 23:09:49 +00:00
|
|
|
# DEPENDFILE dependencies file [.depend]
|
|
|
|
#
|
2002-10-17 13:48:13 +00:00
|
|
|
# GTAGSFLAGS Options for gtags(1) [-o]
|
|
|
|
#
|
|
|
|
# HTAGSFLAGS Options for htags(1) [not set]
|
|
|
|
#
|
1996-05-25 23:09:49 +00:00
|
|
|
# SRCS List of source files (c, c++, assembler)
|
|
|
|
#
|
2004-01-13 17:37:45 +00:00
|
|
|
# DPSRCS List of source files which are needed for generating
|
|
|
|
# dependencies, ${SRCS} are always part of it.
|
1996-05-25 23:09:49 +00:00
|
|
|
#
|
|
|
|
# +++ targets +++
|
|
|
|
#
|
|
|
|
# cleandepend:
|
2016-02-16 19:11:17 +00:00
|
|
|
# remove ${CLEANDEPENDFILES}; remove ${CLEANDEPENDDIRS} and all
|
|
|
|
# contents.
|
1996-05-25 23:09:49 +00:00
|
|
|
#
|
|
|
|
# depend:
|
|
|
|
# Make the dependencies for the source files, and store
|
|
|
|
# them in the file ${DEPENDFILE}.
|
|
|
|
#
|
|
|
|
# tags:
|
2002-10-17 13:48:13 +00:00
|
|
|
# In "ctags" mode, create a tags file for the source files.
|
|
|
|
# In "gtags" mode, create a (GLOBAL) gtags file for the
|
|
|
|
# source files. If HTML is defined, htags(1) is also run
|
|
|
|
# after gtags(1).
|
1996-05-25 23:09:49 +00:00
|
|
|
|
2002-04-22 10:04:41 +00:00
|
|
|
.if !target(__<bsd.init.mk>__)
|
|
|
|
.error bsd.dep.mk cannot be included directly.
|
|
|
|
.endif
|
1996-04-01 18:58:28 +00:00
|
|
|
|
2002-10-17 13:48:13 +00:00
|
|
|
CTAGS?= gtags
|
|
|
|
CTAGSFLAGS?=
|
|
|
|
GTAGSFLAGS?= -o
|
|
|
|
HTAGSFLAGS?=
|
|
|
|
|
2016-01-27 01:24:05 +00:00
|
|
|
.if ${MK_DIRDEPS_BUILD} == "no"
|
2016-01-25 22:29:44 +00:00
|
|
|
.MAKE.DEPENDFILE= ${DEPENDFILE}
|
2016-01-27 01:24:05 +00:00
|
|
|
.endif
|
2016-02-26 01:52:33 +00:00
|
|
|
CLEANDEPENDFILES+= ${DEPENDFILE} ${DEPENDFILE}.*
|
2016-04-18 18:12:12 +00:00
|
|
|
.if ${MK_META_MODE} == "yes"
|
|
|
|
CLEANDEPENDFILES+= *.meta
|
|
|
|
.endif
|
1994-08-04 21:10:08 +00:00
|
|
|
|
2002-10-17 13:48:13 +00:00
|
|
|
# Keep `tags' here, before SRCS are mangled below for `depend'.
|
2004-12-21 09:43:25 +00:00
|
|
|
.if !target(tags) && defined(SRCS) && !defined(NO_TAGS)
|
2002-10-17 13:48:13 +00:00
|
|
|
tags: ${SRCS}
|
2010-01-18 15:58:02 +00:00
|
|
|
.if ${CTAGS:T} == "gtags"
|
2002-10-17 13:48:13 +00:00
|
|
|
@cd ${.CURDIR} && ${CTAGS} ${GTAGSFLAGS} ${.OBJDIR}
|
|
|
|
.if defined(HTML)
|
|
|
|
@cd ${.CURDIR} && htags ${HTAGSFLAGS} -d ${.OBJDIR} ${.OBJDIR}
|
|
|
|
.endif
|
2010-01-18 15:58:02 +00:00
|
|
|
.else
|
|
|
|
@${CTAGS} ${CTAGSFLAGS} -f /dev/stdout \
|
|
|
|
${.ALLSRC:N*.h} | sed "s;${.CURDIR}/;;" > ${.TARGET}
|
2002-10-17 13:48:13 +00:00
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
2016-06-21 21:55:03 +00:00
|
|
|
.if !empty(.MAKE.MODE:Mmeta) && empty(.MAKE.MODE:Mnofilemon)
|
|
|
|
_meta_filemon= 1
|
|
|
|
.endif
|
2017-03-17 18:08:36 +00:00
|
|
|
# By default META_MODE is disabled in bmake if there is no OBJDIR
|
|
|
|
# unless .MAKE.MODE contains "curdirOk=[^0nNfF]"
|
|
|
|
.if defined(_meta_filemon) && ${.OBJDIR} == ${.CURDIR} && \
|
|
|
|
(empty(.MAKE.MODE:tl:Mcurdirok=*) || \
|
|
|
|
!empty(.MAKE.MODE:tl:Mcurdirok=[0NnFf]*))
|
|
|
|
.undef _meta_filemon
|
|
|
|
.endif
|
2016-06-21 21:55:03 +00:00
|
|
|
|
2016-08-23 19:37:18 +00:00
|
|
|
# Skip reading .depend when not needed to speed up tree-walks and simple
|
2016-11-13 00:11:02 +00:00
|
|
|
# lookups. See _SKIP_BUILD logic in bsd.init.mk for more details.
|
2016-06-21 21:55:03 +00:00
|
|
|
# Also skip generating or including .depend.* files if in meta+filemon mode
|
2017-06-22 05:34:41 +00:00
|
|
|
# since it will track dependencies itself. OBJS_DEPEND_GUESS is still used
|
|
|
|
# for _meta_filemon but not for _SKIP_DEPEND.
|
2017-07-25 16:46:12 +00:00
|
|
|
.if !defined(NO_SKIP_DEPEND) && defined(_SKIP_BUILD)
|
2017-06-22 05:34:41 +00:00
|
|
|
_SKIP_DEPEND= 1
|
|
|
|
.endif
|
2017-06-21 20:10:58 +00:00
|
|
|
.if ${MK_DIRDEPS_BUILD} == "no"
|
2017-06-22 05:34:41 +00:00
|
|
|
.if defined(_SKIP_DEPEND) || defined(_meta_filemon)
|
2016-02-19 00:41:24 +00:00
|
|
|
.MAKE.DEPENDFILE= /dev/null
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
1998-05-11 15:37:13 +00:00
|
|
|
.if defined(SRCS)
|
|
|
|
CLEANFILES?=
|
|
|
|
|
2014-08-11 21:42:06 +00:00
|
|
|
.for _S in ${SRCS:N*.[dhly]}
|
2017-09-16 05:42:27 +00:00
|
|
|
OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.o+= ${_S}
|
2016-02-24 17:19:05 +00:00
|
|
|
.endfor
|
2004-01-17 18:51:55 +00:00
|
|
|
|
2014-07-05 20:08:35 +00:00
|
|
|
# Lexical analyzers
|
1998-05-11 15:37:13 +00:00
|
|
|
.for _LSRC in ${SRCS:M*.l:N*/*}
|
2004-01-12 15:29:47 +00:00
|
|
|
.for _LC in ${_LSRC:R}.c
|
2016-06-03 19:25:36 +00:00
|
|
|
${_LC}: ${_LSRC}
|
2019-11-15 21:19:06 +00:00
|
|
|
${LEX} ${LFLAGS} ${LFLAGS.${_LSRC}} -o${.TARGET} ${.ALLSRC}
|
2016-06-15 23:57:32 +00:00
|
|
|
OBJS_DEPEND_GUESS.${_LC:R}.o+= ${_LC}
|
1998-05-11 15:37:13 +00:00
|
|
|
SRCS:= ${SRCS:S/${_LSRC}/${_LC}/}
|
2004-01-12 15:29:47 +00:00
|
|
|
CLEANFILES+= ${_LC}
|
1998-05-11 15:37:13 +00:00
|
|
|
.endfor
|
|
|
|
.endfor
|
|
|
|
|
2014-07-05 20:08:35 +00:00
|
|
|
# Yacc grammars
|
1998-05-11 15:37:13 +00:00
|
|
|
.for _YSRC in ${SRCS:M*.y:N*/*}
|
2004-01-12 15:29:47 +00:00
|
|
|
.for _YC in ${_YSRC:R}.c
|
1998-05-11 15:37:13 +00:00
|
|
|
SRCS:= ${SRCS:S/${_YSRC}/${_YC}/}
|
2004-01-12 15:29:47 +00:00
|
|
|
CLEANFILES+= ${_YC}
|
2004-01-27 23:22:15 +00:00
|
|
|
.if !empty(YFLAGS:M-d) && !empty(SRCS:My.tab.h)
|
2019-07-19 00:15:25 +00:00
|
|
|
# Multi-output targets both expect a .meta file and will fight over it. Only
|
|
|
|
# allow it on the .c file instead.
|
|
|
|
y.tab.h: ${_YC} .NOMETA
|
|
|
|
# Force rebuild the .c file if any of its other outputs are missing.
|
|
|
|
.if !exists(y.tab.h)
|
|
|
|
${_YC}: .PHONY .META
|
|
|
|
.endif
|
|
|
|
${_YC}: ${_YSRC}
|
2019-11-15 21:19:06 +00:00
|
|
|
${YACC} ${YFLAGS} ${YFLAGS.${_YSRC}} ${.ALLSRC}
|
1998-05-11 15:37:13 +00:00
|
|
|
cp y.tab.c ${_YC}
|
2004-01-12 15:29:47 +00:00
|
|
|
CLEANFILES+= y.tab.c y.tab.h
|
2004-01-27 23:22:15 +00:00
|
|
|
.elif !empty(YFLAGS:M-d)
|
2004-01-12 15:29:47 +00:00
|
|
|
.for _YH in ${_YC:R}.h
|
2019-07-19 00:15:25 +00:00
|
|
|
# Multi-output targets both expect a .meta file and will fight over it. Only
|
|
|
|
# allow it on the .c file instead.
|
|
|
|
${_YH}: ${_YC} .NOMETA
|
|
|
|
# Force rebuild the .c file if any of its other outputs are missing.
|
|
|
|
.if !exists(${_YH})
|
|
|
|
${_YC}: .PHONY .META
|
|
|
|
.endif
|
|
|
|
${_YC}: ${_YSRC}
|
2019-11-15 21:19:06 +00:00
|
|
|
${YACC} ${YFLAGS} ${YFLAGS.${_YSRC}} -o ${_YC} ${.ALLSRC}
|
2004-01-12 15:29:47 +00:00
|
|
|
SRCS+= ${_YH}
|
|
|
|
CLEANFILES+= ${_YH}
|
1998-05-11 15:37:13 +00:00
|
|
|
.endfor
|
|
|
|
.else
|
2016-06-03 19:25:36 +00:00
|
|
|
${_YC}: ${_YSRC}
|
2019-11-15 21:19:06 +00:00
|
|
|
${YACC} ${YFLAGS} ${YFLAGS.${_YSRC}} -o ${_YC} ${.ALLSRC}
|
1998-05-11 15:37:13 +00:00
|
|
|
.endif
|
2016-06-15 23:57:32 +00:00
|
|
|
OBJS_DEPEND_GUESS.${_YC:R}.o+= ${_YC}
|
1998-05-11 15:37:13 +00:00
|
|
|
.endfor
|
|
|
|
.endfor
|
2014-07-05 20:08:35 +00:00
|
|
|
|
|
|
|
# DTrace probe definitions
|
2014-07-12 00:54:34 +00:00
|
|
|
.if ${SRCS:M*.d}
|
2014-09-02 23:43:06 +00:00
|
|
|
CFLAGS+= -I${.OBJDIR}
|
2014-07-12 00:54:34 +00:00
|
|
|
.endif
|
2014-07-05 20:08:35 +00:00
|
|
|
.for _DSRC in ${SRCS:M*.d:N*/*}
|
2014-07-12 00:54:34 +00:00
|
|
|
.for _D in ${_DSRC:R}
|
2016-01-25 22:29:41 +00:00
|
|
|
SRCS+= ${_D}.h
|
2016-06-03 19:25:36 +00:00
|
|
|
${_D}.h: ${_DSRC}
|
2015-04-08 02:43:05 +00:00
|
|
|
${DTRACE} ${DTRACEFLAGS} -h -s ${.ALLSRC}
|
2014-10-21 04:30:00 +00:00
|
|
|
SRCS:= ${SRCS:S/^${_DSRC}$//}
|
2014-07-12 01:06:29 +00:00
|
|
|
OBJS+= ${_D}.o
|
2014-08-10 06:43:40 +00:00
|
|
|
CLEANFILES+= ${_D}.h ${_D}.o
|
2016-06-03 19:25:36 +00:00
|
|
|
${_D}.o: ${_DSRC} ${OBJS:S/^${_D}.o$//}
|
2016-01-25 22:29:32 +00:00
|
|
|
@rm -f ${.TARGET}
|
2016-01-25 22:29:41 +00:00
|
|
|
${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC:N*.h}
|
2014-08-10 06:43:40 +00:00
|
|
|
.if defined(LIB)
|
2018-05-09 10:28:24 +00:00
|
|
|
CLEANFILES+= ${_D}.pico ${_D}.po ${_D}.nossppico
|
2016-09-24 15:11:27 +00:00
|
|
|
${_D}.pico: ${_DSRC} ${SOBJS:S/^${_D}.pico$//}
|
2016-01-25 22:29:32 +00:00
|
|
|
@rm -f ${.TARGET}
|
2016-01-25 22:29:41 +00:00
|
|
|
${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC:N*.h}
|
2016-06-03 19:25:36 +00:00
|
|
|
${_D}.po: ${_DSRC} ${POBJS:S/^${_D}.po$//}
|
2016-01-25 22:29:32 +00:00
|
|
|
@rm -f ${.TARGET}
|
2016-01-25 22:29:41 +00:00
|
|
|
${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC:N*.h}
|
2018-05-09 10:28:24 +00:00
|
|
|
${_D}.nossppico: ${_DSRC} ${SOBJS:S/^${_D}.nossppico$//}
|
|
|
|
@rm -f ${.TARGET}
|
|
|
|
${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC:N*.h}
|
2014-07-12 00:54:34 +00:00
|
|
|
.endif
|
2014-07-05 20:08:35 +00:00
|
|
|
.endfor
|
|
|
|
.endfor
|
2019-06-15 17:08:35 +00:00
|
|
|
.endif # defined(SRCS)
|
2015-12-07 16:08:19 +00:00
|
|
|
|
2016-03-11 04:09:56 +00:00
|
|
|
.if ${MAKE_VERSION} < 20160220
|
2015-12-07 16:08:19 +00:00
|
|
|
DEPEND_MP?= -MP
|
2016-03-11 04:09:56 +00:00
|
|
|
.endif
|
2015-12-07 16:08:19 +00:00
|
|
|
# Handle OBJS=../somefile.o hacks. Just replace '/' rather than use :T to
|
|
|
|
# avoid collisions.
|
|
|
|
DEPEND_FILTER= C,/,_,g
|
2019-06-15 17:08:35 +00:00
|
|
|
.if !empty(OBJS)
|
|
|
|
DEPENDOBJS+= ${OBJS}
|
|
|
|
.else
|
2017-12-05 02:23:30 +00:00
|
|
|
DEPENDSRCS+= ${SRCS:M*.[cSC]} ${SRCS:M*.cxx} ${SRCS:M*.cpp} ${SRCS:M*.cc}
|
2019-10-19 21:44:33 +00:00
|
|
|
DEPENDSRCS+= ${DPSRCS:M*.[cSC]} ${DPSRCS:M*.cxx} ${DPSRCS:M*.cpp} ${DPSRCS:M*.cc}
|
2016-02-24 17:19:13 +00:00
|
|
|
.if !empty(DEPENDSRCS)
|
2017-09-16 05:42:27 +00:00
|
|
|
DEPENDOBJS+= ${DEPENDSRCS:${OBJS_SRCS_FILTER:ts:}:S,$,.o,}
|
2016-02-24 17:19:13 +00:00
|
|
|
.endif
|
2019-06-15 17:08:35 +00:00
|
|
|
.endif # !empty(OBJS)
|
2019-06-15 17:08:21 +00:00
|
|
|
.if !empty(DEPENDOBJS)
|
2017-11-10 20:09:11 +00:00
|
|
|
DEPENDFILES+= ${DEPENDOBJS:O:u:${DEPEND_FILTER}:C/^/${DEPENDFILE}./}
|
2019-06-15 17:08:21 +00:00
|
|
|
.endif
|
2017-06-22 05:34:41 +00:00
|
|
|
.if defined(_SKIP_DEPEND)
|
|
|
|
# Don't bother statting any .meta files for .depend*
|
|
|
|
${DEPENDOBJS}: .NOMETA
|
|
|
|
${DEPENDFILE}: .NOMETA
|
|
|
|
# Unset these to avoid looping/statting on them later.
|
|
|
|
.undef DEPENDSRCS
|
|
|
|
.undef DEPENDOBJS
|
2017-11-10 20:09:11 +00:00
|
|
|
.undef DEPENDFILES
|
2017-06-22 05:34:41 +00:00
|
|
|
.endif # defined(_SKIP_DEPEND)
|
2015-12-07 16:08:19 +00:00
|
|
|
DEPEND_CFLAGS+= -MD ${DEPEND_MP} -MF${DEPENDFILE}.${.TARGET:${DEPEND_FILTER}}
|
|
|
|
DEPEND_CFLAGS+= -MT${.TARGET}
|
2016-02-24 17:19:13 +00:00
|
|
|
.if !defined(_meta_filemon)
|
2017-07-24 23:32:40 +00:00
|
|
|
.if !empty(DEPEND_CFLAGS)
|
2015-12-07 16:08:22 +00:00
|
|
|
# Only add in DEPEND_CFLAGS for CFLAGS on files we expect from DEPENDOBJS
|
|
|
|
# as those are the only ones we will include.
|
2016-09-01 17:36:52 +00:00
|
|
|
DEPEND_CFLAGS_CONDITION= "${DEPENDOBJS:${DEPEND_FILTER}:M${.TARGET:${DEPEND_FILTER}}}" != ""
|
2015-12-07 16:08:22 +00:00
|
|
|
CFLAGS+= ${${DEPEND_CFLAGS_CONDITION}:?${DEPEND_CFLAGS}:}
|
|
|
|
.endif
|
2017-11-10 20:09:11 +00:00
|
|
|
.for __depend_obj in ${DEPENDFILES}
|
2016-03-11 04:09:56 +00:00
|
|
|
.if ${MAKE_VERSION} < 20160220
|
2016-02-29 21:10:47 +00:00
|
|
|
.sinclude "${.OBJDIR}/${__depend_obj}"
|
2016-03-11 04:09:56 +00:00
|
|
|
.else
|
|
|
|
.dinclude "${.OBJDIR}/${__depend_obj}"
|
|
|
|
.endif
|
2015-12-07 16:08:19 +00:00
|
|
|
.endfor
|
2016-02-24 17:19:13 +00:00
|
|
|
.endif # !defined(_meta_filemon)
|
1998-05-11 15:37:13 +00:00
|
|
|
|
2016-11-13 00:11:05 +00:00
|
|
|
.if ${MK_DIRDEPS_BUILD} == "yes" && ${.MAKE.DEPENDFILE} != "/dev/null"
|
2016-02-24 17:19:18 +00:00
|
|
|
# Prevent meta.autodep.mk from tracking "local dependencies".
|
|
|
|
.depend:
|
2012-08-22 19:25:57 +00:00
|
|
|
.include <meta.autodep.mk>
|
2016-02-24 17:19:13 +00:00
|
|
|
# If using filemon then _EXTRADEPEND is skipped since it is not needed.
|
2016-06-21 21:55:03 +00:00
|
|
|
.if defined(_meta_filemon)
|
2012-08-22 19:25:57 +00:00
|
|
|
# this depend: bypasses that below
|
|
|
|
# the dependency helps when bootstrapping
|
|
|
|
depend: beforedepend ${DPSRCS} ${SRCS} afterdepend
|
|
|
|
beforedepend:
|
|
|
|
afterdepend: beforedepend
|
|
|
|
.endif
|
2016-02-24 17:19:13 +00:00
|
|
|
.endif
|
2012-08-22 19:25:57 +00:00
|
|
|
|
2016-02-24 17:19:05 +00:00
|
|
|
# Guess some dependencies for when no ${DEPENDFILE}.OBJ is generated yet.
|
2016-02-24 17:19:13 +00:00
|
|
|
# For meta+filemon the .meta file is checked for since it is the dependency
|
|
|
|
# file used.
|
2016-02-24 17:19:05 +00:00
|
|
|
.for __obj in ${DEPENDOBJS:O:u}
|
2016-09-01 17:36:52 +00:00
|
|
|
# If the obj has any '/', then replace with '_'. For meta files, this is
|
|
|
|
# mimicing what bmake's meta_name() does and adding in the full path
|
|
|
|
# as well to ensure that the expected meta file is read.
|
|
|
|
.if ${__obj:M*/*}
|
2017-11-08 18:02:01 +00:00
|
|
|
.if ${MAKE_VERSION} < 20171028
|
2016-09-01 17:36:52 +00:00
|
|
|
_meta_obj= ${.OBJDIR:C,/,_,g}_${__obj:C,/,_,g}.meta
|
|
|
|
.else
|
2017-11-08 18:02:01 +00:00
|
|
|
_meta_obj= ${__obj:C,/,_,g}.meta
|
|
|
|
.endif # ${MAKE_VERSION} < 20171028
|
|
|
|
.else
|
2016-09-01 17:36:52 +00:00
|
|
|
_meta_obj= ${__obj}.meta
|
2017-11-08 18:02:01 +00:00
|
|
|
.endif # ${__obj:M*/*}
|
2016-09-01 17:36:52 +00:00
|
|
|
_dep_obj= ${DEPENDFILE}.${__obj:${DEPEND_FILTER}}
|
2017-07-24 23:32:36 +00:00
|
|
|
.if defined(_meta_filemon)
|
|
|
|
_depfile= ${.OBJDIR}/${_meta_obj}
|
|
|
|
.else
|
|
|
|
_depfile= ${.OBJDIR}/${_dep_obj}
|
|
|
|
.endif
|
2019-06-15 17:08:02 +00:00
|
|
|
.if !exists(${_depfile}) || defined(_meta_filemon)
|
|
|
|
# - Headers are normally built in beforebuild when included in DPSRCS or SRCS.
|
|
|
|
# So we don't need it as a guessed dependency (it may lead to cyclic problems
|
|
|
|
# if custom rules are defined). The only time this causes a problem is when
|
|
|
|
# 'make foo.o' is ran.
|
|
|
|
# - For meta mode we still need to know which file to depend on to avoid
|
|
|
|
# ambiguous suffix transformation rules from .PATH. Meta mode does not
|
|
|
|
# use .depend files when filemon is in use.
|
2019-06-18 22:00:38 +00:00
|
|
|
.if !target(${__obj})
|
|
|
|
${__obj}: ${OBJS_DEPEND_GUESS}
|
|
|
|
.endif
|
2016-06-15 23:57:50 +00:00
|
|
|
${__obj}: ${OBJS_DEPEND_GUESS.${__obj}}
|
2019-06-15 17:08:02 +00:00
|
|
|
.endif # !exists(${_depfile}) || defined(_meta_filemon)
|
2016-02-24 17:19:05 +00:00
|
|
|
.endfor
|
2016-02-24 17:19:18 +00:00
|
|
|
|
|
|
|
# Always run 'make depend' to generate dependencies early and to avoid the
|
|
|
|
# need for manually running it. The dirdeps build should only do this in
|
|
|
|
# sub-makes though since MAKELEVEL0 is for dirdeps calculations.
|
|
|
|
.if ${MK_DIRDEPS_BUILD} == "no" || ${.MAKE.LEVEL} > 0
|
|
|
|
beforebuild: depend
|
2016-02-24 17:19:05 +00:00
|
|
|
.endif
|
|
|
|
|
1994-08-04 21:10:08 +00:00
|
|
|
.if !target(depend)
|
|
|
|
.if defined(SRCS)
|
2002-04-23 09:03:56 +00:00
|
|
|
depend: beforedepend ${DEPENDFILE} afterdepend
|
1996-04-01 18:58:28 +00:00
|
|
|
|
2012-08-22 19:25:57 +00:00
|
|
|
# Tell bmake not to look for generated files via .PATH
|
2017-11-10 20:09:11 +00:00
|
|
|
.NOPATH: ${DEPENDFILE} ${DEPENDFILES}
|
2012-08-22 19:25:57 +00:00
|
|
|
|
2016-03-30 23:50:23 +00:00
|
|
|
# A .depend file will only be generated if there are commands in
|
2016-06-21 21:55:03 +00:00
|
|
|
# beforedepend/_EXTRADEPEND/afterdepend The _EXTRADEPEND target is
|
|
|
|
# ignored if using meta+filemon since it handles all dependencies. The other
|
|
|
|
# targets are kept as they be used for generating something. The target is
|
|
|
|
# kept to allow 'make depend' to generate files.
|
2017-12-05 02:23:33 +00:00
|
|
|
${DEPENDFILE}: ${SRCS} ${DPSRCS}
|
2017-06-22 05:34:41 +00:00
|
|
|
.if !defined(_SKIP_DEPEND)
|
2016-06-03 21:35:19 +00:00
|
|
|
.if exists(${.OBJDIR}/${DEPENDFILE}) || \
|
2016-06-21 21:55:03 +00:00
|
|
|
((commands(beforedepend) || \
|
|
|
|
(!defined(_meta_filemon) && commands(_EXTRADEPEND)) || \
|
2016-06-03 21:35:19 +00:00
|
|
|
commands(afterdepend)) && !empty(.MAKE.MODE:Mmeta))
|
1996-04-01 18:58:28 +00:00
|
|
|
rm -f ${DEPENDFILE}
|
2016-02-24 20:28:45 +00:00
|
|
|
.endif
|
2017-06-22 05:34:41 +00:00
|
|
|
.endif
|
2016-06-21 21:55:03 +00:00
|
|
|
.if !defined(_meta_filemon) && target(_EXTRADEPEND)
|
2002-04-17 05:42:18 +00:00
|
|
|
_EXTRADEPEND: .USE
|
2002-04-16 12:27:07 +00:00
|
|
|
${DEPENDFILE}: _EXTRADEPEND
|
1997-04-09 16:10:27 +00:00
|
|
|
.endif
|
1996-04-01 18:58:28 +00:00
|
|
|
|
1997-10-05 09:40:24 +00:00
|
|
|
.ORDER: ${DEPENDFILE} afterdepend
|
1994-08-04 21:10:08 +00:00
|
|
|
.else
|
2002-04-23 09:03:56 +00:00
|
|
|
depend: beforedepend afterdepend
|
1994-08-04 21:10:08 +00:00
|
|
|
.endif
|
|
|
|
.if !target(beforedepend)
|
|
|
|
beforedepend:
|
1997-10-05 09:40:24 +00:00
|
|
|
.else
|
|
|
|
.ORDER: beforedepend ${DEPENDFILE}
|
|
|
|
.ORDER: beforedepend afterdepend
|
1994-08-04 21:10:08 +00:00
|
|
|
.endif
|
|
|
|
.if !target(afterdepend)
|
|
|
|
afterdepend:
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
2016-02-24 17:18:55 +00:00
|
|
|
.if defined(SRCS)
|
2010-01-18 15:58:02 +00:00
|
|
|
.if ${CTAGS:T} == "gtags"
|
2016-02-16 19:11:17 +00:00
|
|
|
CLEANDEPENDFILES+= GPATH GRTAGS GSYMS GTAGS
|
1997-04-13 06:44:25 +00:00
|
|
|
.if defined(HTML)
|
2016-02-16 19:11:17 +00:00
|
|
|
CLEANDEPENDDIRS+= HTML
|
2002-10-17 13:48:13 +00:00
|
|
|
.endif
|
2010-01-18 15:41:55 +00:00
|
|
|
.else
|
2016-02-16 19:11:17 +00:00
|
|
|
CLEANDEPENDFILES+= tags
|
|
|
|
.endif
|
2016-02-24 17:18:55 +00:00
|
|
|
.endif
|
2016-02-16 19:11:17 +00:00
|
|
|
.if !target(cleandepend)
|
|
|
|
cleandepend:
|
2016-02-24 17:18:55 +00:00
|
|
|
.if !empty(CLEANDEPENDFILES)
|
2016-02-16 19:11:17 +00:00
|
|
|
rm -f ${CLEANDEPENDFILES}
|
2016-02-24 17:18:55 +00:00
|
|
|
.endif
|
2016-02-16 19:11:17 +00:00
|
|
|
.if !empty(CLEANDEPENDDIRS)
|
|
|
|
rm -rf ${CLEANDEPENDDIRS}
|
1997-04-13 06:44:25 +00:00
|
|
|
.endif
|
1996-06-24 04:26:21 +00:00
|
|
|
.endif
|
2016-08-29 18:31:34 +00:00
|
|
|
.ORDER: cleandepend all
|
|
|
|
.ORDER: cleandepend depend
|
2017-11-05 00:12:12 +00:00
|
|
|
.if ${MK_AUTO_OBJ} == "yes"
|
|
|
|
.ORDER: cleanobj depend
|
|
|
|
.ORDER: cleandir depend
|
|
|
|
.endif
|
2002-07-03 12:44:06 +00:00
|
|
|
|
|
|
|
.if !target(checkdpadd) && (defined(DPADD) || defined(LDADD))
|
2014-09-10 07:55:51 +00:00
|
|
|
_LDADD_FROM_DPADD= ${DPADD:R:T:C;^lib(.*)$;-l\1;g}
|
|
|
|
# Ignore -Wl,--start-group/-Wl,--end-group as it might be required in the
|
|
|
|
# LDADD list due to unresolved symbols
|
|
|
|
_LDADD_CANONICALIZED= ${LDADD:N:R:T:C;^lib(.*)$;-l\1;g:N-Wl,--[es]*-group}
|
2002-07-03 12:44:06 +00:00
|
|
|
checkdpadd:
|
2003-07-03 11:43:57 +00:00
|
|
|
.if ${_LDADD_FROM_DPADD} != ${_LDADD_CANONICALIZED}
|
|
|
|
@echo ${.CURDIR}
|
|
|
|
@echo "DPADD -> ${_LDADD_FROM_DPADD}"
|
|
|
|
@echo "LDADD -> ${_LDADD_CANONICALIZED}"
|
|
|
|
.endif
|
2002-07-03 12:44:06 +00:00
|
|
|
.endif
|