diff options
author | bdrewery <bdrewery@FreeBSD.org> | 2016-02-24 17:19:13 +0000 |
---|---|---|
committer | bdrewery <bdrewery@FreeBSD.org> | 2016-02-24 17:19:13 +0000 |
commit | 5c7565c5037cf7f805b96cf0d437d7fe38228568 (patch) | |
tree | 2033f51e1d8ef3d978199f133711d06b70b3822b | |
parent | 7171d0bbd82677749f4b5950ab3b4ff0cdf16a60 (diff) | |
download | FreeBSD-src-5c7565c5037cf7f805b96cf0d437d7fe38228568.zip FreeBSD-src-5c7565c5037cf7f805b96cf0d437d7fe38228568.tar.gz |
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
-rw-r--r-- | share/mk/bsd.dep.mk | 30 | ||||
-rw-r--r-- | share/mk/bsd.opts.mk | 9 | ||||
-rw-r--r-- | share/mk/local.meta.sys.mk | 1 | ||||
-rw-r--r-- | sys/conf/kern.opts.mk | 6 | ||||
-rw-r--r-- | sys/conf/kern.post.mk | 35 |
5 files changed, 59 insertions, 22 deletions
diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk index 2b9301e..78b2efb 100644 --- a/share/mk/bsd.dep.mk +++ b/share/mk/bsd.dep.mk @@ -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 diff --git a/share/mk/bsd.opts.mk b/share/mk/bsd.opts.mk index e2c56ac..390909e 100644 --- a/share/mk/bsd.opts.mk +++ b/share/mk/bsd.opts.mk @@ -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> # diff --git a/share/mk/local.meta.sys.mk b/share/mk/local.meta.sys.mk index 21b9c16..207fb75 100644 --- a/share/mk/local.meta.sys.mk +++ b/share/mk/local.meta.sys.mk @@ -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},} diff --git a/sys/conf/kern.opts.mk b/sys/conf/kern.opts.mk index 1a3a1fd..a1906cf 100644 --- a/sys/conf/kern.opts.mk +++ b/sys/conf/kern.opts.mk @@ -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. diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk index f16acda..082007a 100644 --- a/sys/conf/kern.post.mk +++ b/sys/conf/kern.post.mk @@ -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} |