Hook the meta/nofilemon build into using FAST_DEPEND.

FAST_DEPEND is intended to be the "skip 'make depend' and mkdep"
feature.  Since DIRDEPS_BUILD does this already with some of its own
hacks, and filemon doesn't need this, and nofilemon does, teach it how
to handle each of these cases.

In meta+filemon mode filemon will handle dependencies itself via the
meta mode logic in bmake.  We still want to set MK_FAST_DEPEND=yes to
enable some logic that indicates that 'make depend' is skipped in the
traditional sense.  The actual .depend.* files will be skipped.

When nofilemon is set though we still need to track and generate dependencies.

Sponsored by:	EMC / Isilon Storage Division
This commit is contained in:
Bryan Drewery 2016-02-24 17:19:13 +00:00
parent 68add21344
commit 70ca9ec4b9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=295987
5 changed files with 59 additions and 22 deletions

View File

@ -173,14 +173,24 @@ ${_D}.po: ${_DSRC} ${POBJS:S/^${_D}.po$//}
.endfor
.if ${MK_FAST_DEPEND} == "yes" && \
(${.MAKE.MODE:Mmeta} == "" || ${.MAKE.MODE:Mnofilemon} != "")
.if !empty(.MAKE.MODE:Mmeta) && empty(.MAKE.MODE:Mnofilemon)
_meta_filemon= 1
.endif
.if ${MK_FAST_DEPEND} == "yes"
DEPEND_MP?= -MP
# Handle OBJS=../somefile.o hacks. Just replace '/' rather than use :T to
# avoid collisions.
DEPEND_FILTER= C,/,_,g
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}./}
DEPEND_CFLAGS+= -MD ${DEPEND_MP} -MF${DEPENDFILE}.${.TARGET:${DEPEND_FILTER}}
DEPEND_CFLAGS+= -MT${.TARGET}
# Skip generating or including .depend.* files if in meta+filemon mode since
# it will track dependencies itself. OBJS_DEPEND_GUESS is still used though.
.if !defined(_meta_filemon)
.if defined(.PARSEDIR)
# Only add in DEPEND_CFLAGS for CFLAGS on files we expect from DEPENDOBJS
# as those are the only ones we will include.
@ -189,34 +199,34 @@ CFLAGS+= ${${DEPEND_CFLAGS_CONDITION}:?${DEPEND_CFLAGS}:}
.else
CFLAGS+= ${DEPEND_CFLAGS}
.endif
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}./}
.if !defined(_SKIP_READ_DEPEND)
.for __depend_obj in ${DEPENDFILES_OBJS}
.sinclude "${__depend_obj}"
.endfor
.endif # !defined(_SKIP_READ_DEPEND)
.endif # !defined(_meta_filemon)
.endif # ${MK_FAST_DEPEND} == "yes"
.endif # defined(SRCS)
.if ${MK_DIRDEPS_BUILD} == "yes"
.include <meta.autodep.mk>
# If using filemon then _EXTRADEPEND is skipped since it is not needed.
.if empty(.MAKE.MODE:Mnofilemon)
# this depend: bypasses that below
# the dependency helps when bootstrapping
depend: beforedepend ${DPSRCS} ${SRCS} afterdepend
beforedepend:
afterdepend: beforedepend
.endif
.endif
# Guess some dependencies for when no ${DEPENDFILE}.OBJ is generated yet.
# Done here to support meta mode as well which does not always need
# the CFLAGS modifications or .depend.* included.
# For meta+filemon the .meta file is checked for since it is the dependency
# file used.
.if ${MK_FAST_DEPEND} == "yes"
.for __obj in ${DEPENDOBJS:O:u}
.if !exists(${.OBJDIR}/${DEPENDFILE}.${__obj})
.if (defined(_meta_filemon) && !exists(${.OBJDIR}/${__obj}.meta)) || \
(!defined(_meta_filemon) && !exists(${.OBJDIR}/${DEPENDFILE}.${__obj}))
${__obj}: ${OBJS_DEPEND_GUESS}
${__obj}: ${OBJS_DEPEND_GUESS.${__obj}}
.endif

View File

@ -77,7 +77,14 @@ __DEFAULT_NO_OPTIONS = \
__DEFAULT_DEPENDENT_OPTIONS = \
STAGING_MAN/STAGING \
STAGING_PROG/STAGING \
# Enable FAST_DEPEND by default for the meta build.
.if !empty(.MAKE.MODE:Mmeta)
__DEFAULT_YES_OPTIONS+= FAST_DEPEND
__DEFAULT_NO_OPTIONS:= ${__DEFAULT_NO_OPTIONS:NFAST_DEPEND}
.endif
.include <bsd.mkopt.mk>
#

View File

@ -6,6 +6,7 @@
# we need this until there is an alternative
MK_INSTALL_AS_USER= yes
MK_FAST_DEPEND= yes
_default_makeobjdir=$${.CURDIR:S,^$${SRCTOP},$${OBJTOP},}

View File

@ -49,6 +49,12 @@ __DEFAULT_NO_OPTIONS = \
NAND \
OFED
# Enable FAST_DEPEND by default for the meta build.
.if !empty(.MAKE.MODE:Unormal:Mmeta)
__DEFAULT_YES_OPTIONS+= FAST_DEPEND
__DEFAULT_NO_OPTIONS:= ${__DEFAULT_NO_OPTIONS:NFAST_DEPEND}
.endif
# Some options are totally broken on some architectures. We disable
# them. If you need to enable them on an experimental basis, you
# must change this code.

View File

@ -226,10 +226,17 @@ SRCS= assym.s vnode_if.h ${BEFORE_DEPEND} ${CFILES} \
${SYSTEM_CFILES} ${GEN_CFILES} ${SFILES} \
${MFILES:T:S/.m$/.h/}
DEPENDFILES= .depend .depend.*
.if ${MK_FAST_DEPEND} == "yes" && \
(${.MAKE.MODE:Unormal:Mmeta} == "" || ${.MAKE.MODE:Unormal:Mnofilemon} != "")
# Skip generating or including .depend.* files if in meta+filemon mode since
# it will track dependencies itself. OBJS_DEPEND_GUESS is still used though.
.if !empty(.MAKE.MODE:Unormal:Mmeta) && empty(.MAKE.MODE:Unormal:Mnofilemon)
_meta_filemon= 1
.endif
.if ${MK_FAST_DEPEND} == "yes"
DEPENDOBJS+= ${SYSTEM_OBJS} genassym.o
DEPENDFILES_OBJS= ${DEPENDOBJS:O:u:C/^/.depend./}
DEPEND_CFLAGS+= -MD -MP -MF.depend.${.TARGET}
DEPEND_CFLAGS+= -MT${.TARGET}
.if !defined(_meta_filemon)
.if defined(.PARSEDIR)
# Only add in DEPEND_CFLAGS for CFLAGS on files we expect from DEPENDOBJS
# as those are the only ones we will include.
@ -238,22 +245,28 @@ CFLAGS+= ${${DEPEND_CFLAGS_CONDITION}:?${DEPEND_CFLAGS}:}
.else
CFLAGS+= ${DEPEND_CFLAGS}
.endif
DEPENDOBJS+= ${SYSTEM_OBJS} genassym.o
DEPENDFILES_OBJS= ${DEPENDOBJS:O:u:C/^/.depend./}
.if !defined(_SKIP_READ_DEPEND)
.for __obj in ${DEPENDOBJS}
.if exists(${.OBJDIR}/.depend.${__obj})
.include ".depend.${__obj}"
.else
# Guess some dependencies for when no .depend.OBJ is generated yet.
.for __depend_obj in ${DEPENDFILES_OBJS}
.sinclude "${__depend_obj}"
.endfor
.endif # !defined(_SKIP_READ_DEPEND)
.endif # !defined(_meta_filemon)
.endif # ${MK_FAST_DEPEND} == "yes"
# Guess some dependencies for when no ${DEPENDFILE}.OBJ is generated yet.
# For meta+filemon the .meta file is checked for since it is the dependency
# file used.
.if ${MK_FAST_DEPEND} == "yes"
.for __obj in ${DEPENDOBJS:O:u}
.if (defined(_meta_filemon) && !exists(${.OBJDIR}/${__obj}.meta)) || \
(!defined(_meta_filemon) && !exists(${.OBJDIR}/.depend.${__obj}))
.if ${SYSTEM_OBJS:M${__obj}}
${__obj}: ${OBJS_DEPEND_GUESS}
.endif
${__obj}: ${OBJS_DEPEND_GUESS.${__obj}}
.endif
.endfor
.endif # !defined(_SKIP_READ_DEPEND)
.endif # ${MK_FAST_DEPEND} == "yes"
.endif
.NOPATH: .depend ${DEPENDFILES_OBJS}