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]}
|
2016-06-15 23:57:32 +00:00
|
|
|
OBJS_DEPEND_GUESS.${_S:R}.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}
|
2014-07-20 14:49:24 +00:00
|
|
|
${LEX} ${LFLAGS} -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)
|
1998-05-11 15:37:13 +00:00
|
|
|
.ORDER: ${_YC} y.tab.h
|
2016-06-03 19:25:41 +00:00
|
|
|
y.tab.h: .NOMETA
|
1998-05-11 15:37:13 +00:00
|
|
|
${_YC} y.tab.h: ${_YSRC}
|
|
|
|
${YACC} ${YFLAGS} ${.ALLSRC}
|
|
|
|
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
|
2016-01-27 01:33:26 +00:00
|
|
|
.ORDER: ${_YC} ${_YH}
|
2016-06-03 19:25:41 +00:00
|
|
|
${_YH}: .NOMETA
|
2016-01-27 01:33:26 +00:00
|
|
|
${_YC} ${_YH}: ${_YSRC}
|
1998-05-11 15:37:13 +00:00
|
|
|
${YACC} ${YFLAGS} -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}
|
1998-05-11 15:37:13 +00:00
|
|
|
${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC}
|
|
|
|
.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)
|
2016-09-24 15:11:27 +00:00
|
|
|
CLEANFILES+= ${_D}.pico ${_D}.po
|
|
|
|
${_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}
|
2014-07-12 00:54:34 +00:00
|
|
|
.endif
|
2014-07-05 20:08:35 +00:00
|
|
|
.endfor
|
|
|
|
.endfor
|
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
|
2016-02-24 17:19:13 +00:00
|
|
|
DEPENDSRCS= ${SRCS:M*.[cSC]} ${SRCS:M*.cxx} ${SRCS:M*.cpp} ${SRCS:M*.cc}
|
|
|
|
.if !empty(DEPENDSRCS)
|
|
|
|
DEPENDOBJS+= ${DEPENDSRCS:R:S,$,.o,}
|
|
|
|
.endif
|
|
|
|
DEPENDFILES_OBJS= ${DEPENDOBJS:O:u:${DEPEND_FILTER}:C/^/${DEPENDFILE}./}
|
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
|
|
|
|
.undef DEPENDFILES_OBJS
|
|
|
|
.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
|
2016-01-15 22:08:51 +00:00
|
|
|
.for __depend_obj in ${DEPENDFILES_OBJS}
|
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)
|
2015-12-07 16:08:19 +00:00
|
|
|
.endif # defined(SRCS)
|
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*/*}
|
|
|
|
_meta_obj= ${.OBJDIR:C,/,_,g}_${__obj:C,/,_,g}.meta
|
|
|
|
.else
|
|
|
|
_meta_obj= ${__obj}.meta
|
|
|
|
.endif
|
|
|
|
_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
|
|
|
|
.if !exists(${_depfile})
|
2016-02-24 17:19:05 +00:00
|
|
|
${__obj}: ${OBJS_DEPEND_GUESS}
|
|
|
|
${__obj}: ${OBJS_DEPEND_GUESS.${__obj}}
|
2016-05-21 01:31:48 +00:00
|
|
|
.elif defined(_meta_filemon)
|
|
|
|
# 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
|
2016-06-15 23:57:50 +00:00
|
|
|
# use .depend files. We really only need source files, not headers since
|
|
|
|
# they are typically in SRCS/beforebuild already. For target-specific
|
|
|
|
# guesses do include headers though since they may not be in SRCS.
|
2016-05-21 01:31:48 +00:00
|
|
|
${__obj}: ${OBJS_DEPEND_GUESS:N*.h}
|
2016-06-15 23:57:50 +00:00
|
|
|
${__obj}: ${OBJS_DEPEND_GUESS.${__obj}}
|
2017-07-24 23:32:36 +00:00
|
|
|
.endif # !exists(${_depfile})
|
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
|
Add a FAST_DEPEND option, off by default, which speeds up the build significantly.
This speeds up buildworld by 16% on my system and buildkernel by 35%.
Rather than calling mkdep(1), which is just a wrapper around 'cc -E',
use the modern -MD -MT -MF flags to gather and generate dependencies during
compilation. This flag was introduced in GCC "a long time ago", in GCC 3.0,
and is also supported by Clang. (It appears that ICC also supports this but I
do not have access to test it). This avoids running the preprocessor *twice*
for every build, in both 'make depend' and 'make all'. This is especially
noticeable when using ccache since it does not cache preprocessor results from
mkdep(1) / 'cc -E', but still speeds up compilation with the -MD flags.
For 'make depend' a tree-walk is still done to ensure that all DPSRCS
are generated when expected, and that beforedepend/afterdepend and
_EXTRADEPEND are all still respected. In time this may change but for now
I've been conservative. The time for a tree-walk with -j combined with
SUBDIR_PARALLEL is not significant. For example, it takes about 9 seconds
with -j15 to walk all of src/ for 'make depend' now on my system.
A .depend file is still generated with the various rules that apply to
the final target, or custom rules. Otherwise there are now
per-built-object-file .depend files, such as .depend.filename.o. These
are included directly by make rather than populating .depend with a loop
and .depend lines, which only added overhead to the now almost-NOP 'make
depend' phase.
Before this I experimented with having mkdep(1) called in parallel per-file.
While this improved the kernel and lib/libc 'make depend' phase, it resulted
in slower build times overall.
The -M flags are removed from CFLAGS when linking since they have no effect.
Enabling this by default, for src or out-of-src, can be done once more testing
has been done, such as a ports exp-run, and with more compilers.
The system I used for testing was:
WITNESS
Build options: -j20 WITH_LLDB=yes WITH_DEBUG_FILES=yes WITH_FAST_DEPEND=yes
DISK: ZFS 3-way mirror with very slow disks using SSD l2arc/log.
The arc was fully populated with src tree files.
RAM: 76GiB
CPU: Intel(R) Xeon(R) CPU L5520 @2.27GHz
2 package(s) x 4 core(s) x 2 SMT threads = hw.ncpu=16
buildworld:
x buildworld-before
+ buildworld-fastdep
+-------------------------------------------------------------------------------+
|+ |
|+ |
|+ xx x|
| |_MA___||
|A |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 3744.13 3794.31 3752.25 3763.5633 26.935139
+ 3 3153.34 3155.16 3154.2 3154.2333 0.91045776
Difference at 95.0% confidence
-609.33 +/- 43.1943
-16.1902% +/- 1.1477%
(Student's t, pooled s = 19.0569)
buildkernel:
x buildkernel-before
+ buildkernel-fastdep
+-------------------------------------------------------------------------------+
|+ x |
|++ xx|
| A||
|A| |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 571.57 573.94 571.79 572.43333 1.3094401
+ 3 369.12 370.57 369.3 369.66333 0.79033748
Difference at 95.0% confidence
-202.77 +/- 2.45131
-35.4225% +/- 0.428227%
(Student's t, pooled s = 1.0815)
Sponsored by: EMC / Isilon Storage Division
MFC after: 3 weeks
Relnotes: yes
2015-11-06 04:45:29 +00:00
|
|
|
.NOPATH: ${DEPENDFILE} ${DEPENDFILES_OBJS}
|
2012-08-22 19:25:57 +00:00
|
|
|
|
2004-01-13 17:37:45 +00:00
|
|
|
DPSRCS+= ${SRCS}
|
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.
|
2016-06-03 19:25:36 +00:00
|
|
|
${DEPENDFILE}: ${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
|
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
|