diff options
-rw-r--r-- | share/mk/bsd.dep.mk | 23 | ||||
-rw-r--r-- | share/mk/bsd.lib.mk | 2 | ||||
-rw-r--r-- | share/mk/bsd.opts.mk | 1 | ||||
-rw-r--r-- | share/mk/bsd.prog.mk | 8 | ||||
-rw-r--r-- | sys/conf/kern.opts.mk | 1 | ||||
-rw-r--r-- | sys/conf/kern.post.mk | 37 | ||||
-rw-r--r-- | tools/build/options/WITH_FAST_DEPEND | 7 |
7 files changed, 63 insertions, 16 deletions
diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk index 965f703..8cc814d 100644 --- a/share/mk/bsd.dep.mk +++ b/share/mk/bsd.dep.mk @@ -54,6 +54,18 @@ MKDEPCMD?= CC='${CC} ${DEPFLAGS}' mkdep MKDEPCMD?= mkdep .endif DEPENDFILE?= .depend +DEPENDFILES= ${DEPENDFILE} +.if ${MK_FAST_DEPEND} == "yes" +DEPENDFILES+= ${DEPENDFILE}.* +DEPEND_CFLAGS+= -MD -MP -MF${DEPENDFILE}.${.TARGET} +DEPEND_CFLAGS+= -MT${.TARGET} +CFLAGS+= ${DEPEND_CFLAGS} +DEPENDOBJS+= ${OBJS} ${POBJS} ${SOBJS} +.for __obj in ${DEPENDOBJS:O:u} +.sinclude "${DEPENDFILE}.${__obj}" +DEPENDFILES_OBJS+= ${DEPENDFILE}.${__obj} +.endfor +.endif # ${MK_FAST_DEPEND} == "yes" # Keep `tags' here, before SRCS are mangled below for `depend'. .if !target(tags) && defined(SRCS) && !defined(NO_TAGS) @@ -161,7 +173,7 @@ afterdepend: beforedepend depend: beforedepend ${DEPENDFILE} afterdepend # Tell bmake not to look for generated files via .PATH -.NOPATH: ${DEPENDFILE} +.NOPATH: ${DEPENDFILE} ${DEPENDFILES_OBJS} # Different types of sources are compiled with slightly different flags. # Split up the sources, and filter out headers and non-applicable flags. @@ -172,6 +184,7 @@ MKDEP_CXXFLAGS= ${CXXFLAGS:M-nostdinc*} ${CXXFLAGS:M-[BIDU]*} \ DPSRCS+= ${SRCS} ${DEPENDFILE}: ${DPSRCS} +.if ${MK_FAST_DEPEND} == "no" rm -f ${DEPENDFILE} .if !empty(DPSRCS:M*.[cS]) ${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \ @@ -182,7 +195,11 @@ ${DEPENDFILE}: ${DPSRCS} ${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \ ${MKDEP_CXXFLAGS} \ ${.ALLSRC:M*.cc} ${.ALLSRC:M*.C} ${.ALLSRC:M*.cpp} ${.ALLSRC:M*.cxx} +.else .endif +.else + : > ${.TARGET} +.endif # ${MK_FAST_DEPEND} == "no" .if target(_EXTRADEPEND) _EXTRADEPEND: .USE ${DEPENDFILE}: _EXTRADEPEND @@ -207,12 +224,12 @@ afterdepend: cleandepend: .if defined(SRCS) .if ${CTAGS:T} == "gtags" - rm -f ${DEPENDFILE} GPATH GRTAGS GSYMS GTAGS + rm -f ${DEPENDFILES} GPATH GRTAGS GSYMS GTAGS .if defined(HTML) rm -rf HTML .endif .else - rm -f ${DEPENDFILE} tags + rm -f ${DEPENDFILES} tags .endif .endif .endif diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index e906ab7..579e36c 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -305,10 +305,12 @@ all: _manpages .endif _EXTRADEPEND: +.if ${MK_FAST_DEPEND} == "no" @TMP=_depend$$$$; \ sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.So:/' < ${DEPENDFILE} \ > $$TMP; \ mv $$TMP ${DEPENDFILE} +.endif .if !defined(NO_EXTRADEPEND) && defined(SHLIB_NAME) .if defined(DPADD) && !empty(DPADD) echo ${SHLIB_NAME_FULL}: ${DPADD} >> ${DEPENDFILE} diff --git a/share/mk/bsd.opts.mk b/share/mk/bsd.opts.mk index 88f5196..a1f4cce 100644 --- a/share/mk/bsd.opts.mk +++ b/share/mk/bsd.opts.mk @@ -66,6 +66,7 @@ __DEFAULT_YES_OPTIONS = \ WARNS __DEFAULT_NO_OPTIONS = \ + FAST_DEPEND \ CTF \ DEBUG_FILES \ INSTALL_AS_USER \ diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index fbb6922..37ede4c9 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -82,9 +82,9 @@ ${PROG_FULL}: beforelinking .endif ${PROG_FULL}: ${OBJS} .if defined(PROG_CXX) - ${CXX} ${CXXFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD} + ${CXX} ${CXXFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD} .else - ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD} + ${CC} ${CFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD} .endif .if ${MK_CTF} != "no" ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS} @@ -112,9 +112,9 @@ ${PROG_FULL}: beforelinking .endif ${PROG_FULL}: ${OBJS} .if defined(PROG_CXX) - ${CXX} ${CXXFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD} + ${CXX} ${CXXFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD} .else - ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD} + ${CC} ${CFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD} .endif .if ${MK_CTF} != "no" ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS} diff --git a/sys/conf/kern.opts.mk b/sys/conf/kern.opts.mk index f94ffb7..2e77c4f 100644 --- a/sys/conf/kern.opts.mk +++ b/sys/conf/kern.opts.mk @@ -45,6 +45,7 @@ __DEFAULT_YES_OPTIONS = \ __DEFAULT_NO_OPTIONS = \ EISA \ + FAST_DEPEND \ NAND \ OFED diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk index ddf828e..bf24d17 100644 --- a/sys/conf/kern.post.mk +++ b/sys/conf/kern.post.mk @@ -198,18 +198,37 @@ kernel-depend: .depend SRCS= assym.s vnode_if.h ${BEFORE_DEPEND} ${CFILES} \ ${SYSTEM_CFILES} ${GEN_CFILES} ${SFILES} \ ${MFILES:T:S/.m$/.h/} +DEPENDFILES= .depend +.if ${MK_FAST_DEPEND} == "yes" +DEPENDFILES+= .depend.* +DEPEND_CFLAGS+= -MD -MP -MF.depend.${.TARGET} +DEPEND_CFLAGS+= -MT${.TARGET} +CFLAGS+= ${DEPEND_CFLAGS} +DEPENDOBJS+= ${SYSTEM_OBJS} +.for __obj in ${DEPENDOBJS:O:u} +.sinclude ".depend.${__obj}" +DEPENDFILES_OBJS+= .depend.${__obj} +.endfor +.endif # ${MK_FAST_DEPEND} == "yes" + +.NOPATH: .depend ${DEPENDFILES_OBJS} + .depend: .PRECIOUS ${SRCS} - rm -f .newdep +.if ${MK_FAST_DEPEND} == "no" + rm -f ${.TARGET}.tmp ${MAKE} -V CFILES_NOCDDL -V SYSTEM_CFILES -V GEN_CFILES | \ - MKDEP_CPP="${CC} -E" CC="${CC}" xargs mkdep -a -f .newdep ${CFLAGS} + CC="${CC}" xargs mkdep -a -f ${.TARGET}.tmp ${CFLAGS} ${MAKE} -V CFILES_CDDL | \ - MKDEP_CPP="${CC} -E" CC="${CC}" xargs mkdep -a -f .newdep ${ZFS_CFLAGS} ${FBT_CFLAGS} ${DTRACE_CFLAGS} + CC="${CC}" xargs mkdep -a -f ${.TARGET}.tmp ${ZFS_CFLAGS} \ + ${FBT_CFLAGS} ${DTRACE_CFLAGS} ${MAKE} -V SFILES_NOCDDL | \ - MKDEP_CPP="${CC} -E" xargs mkdep -a -f .newdep ${ASM_CFLAGS} + CC="${CC}" xargs mkdep -a -f ${.TARGET}.tmp ${ASM_CFLAGS} ${MAKE} -V SFILES_CDDL | \ - MKDEP_CPP="${CC} -E" xargs mkdep -a -f .newdep ${ZFS_ASM_CFLAGS} - rm -f .depend - mv .newdep .depend + CC="${CC}" xargs mkdep -a -f ${.TARGET}.tmp ${ZFS_ASM_CFLAGS} + mv ${.TARGET}.tmp ${.TARGET} +.else + : > ${.TARGET} +.endif _ILINKS= machine .if ${MACHINE} != ${MACHINE_CPUARCH} && ${MACHINE} != "arm64" @@ -237,8 +256,8 @@ ${_ILINKS}: ln -s $$path ${.TARGET} # .depend needs include links so we remove them only together. -kernel-cleandepend: - rm -f .depend ${_ILINKS} +kernel-cleandepend: .PHONY + rm -f ${DEPENDFILES} ${_ILINKS} kernel-tags: @[ -f .depend ] || { echo "you must make depend first"; exit 1; } diff --git a/tools/build/options/WITH_FAST_DEPEND b/tools/build/options/WITH_FAST_DEPEND new file mode 100644 index 0000000..2597a36 --- /dev/null +++ b/tools/build/options/WITH_FAST_DEPEND @@ -0,0 +1,7 @@ +.\" $FreeBSD$ +Set to generate +.Sy .depend +files in the build during compilation instead of the +historial +.Xr mkdep 1 +call during the "make depend" phase. |