Changeset View
Changeset View
Standalone View
Standalone View
share/mk/bsd.dep.mk
Show All 14 Lines | |||||
# CTAGSFLAGS Options for ctags(1) [not set] | # CTAGSFLAGS Options for ctags(1) [not set] | ||||
# | # | ||||
# DEPENDFILE dependencies file [.depend] | # DEPENDFILE dependencies file [.depend] | ||||
# | # | ||||
# GTAGSFLAGS Options for gtags(1) [-o] | # GTAGSFLAGS Options for gtags(1) [-o] | ||||
# | # | ||||
# HTAGSFLAGS Options for htags(1) [not set] | # HTAGSFLAGS Options for htags(1) [not set] | ||||
# | # | ||||
# MKDEP Options for ${MKDEPCMD} [not set] | |||||
# | |||||
# MKDEPCMD Makefile dependency list program [mkdep] | |||||
# | |||||
# SRCS List of source files (c, c++, assembler) | # SRCS List of source files (c, c++, assembler) | ||||
# | # | ||||
# DPSRCS List of source files which are needed for generating | # DPSRCS List of source files which are needed for generating | ||||
# dependencies, ${SRCS} are always part of it. | # dependencies, ${SRCS} are always part of it. | ||||
# | # | ||||
# +++ targets +++ | # +++ targets +++ | ||||
# | # | ||||
# cleandepend: | # cleandepend: | ||||
Show All 14 Lines | |||||
.error bsd.dep.mk cannot be included directly. | .error bsd.dep.mk cannot be included directly. | ||||
.endif | .endif | ||||
CTAGS?= gtags | CTAGS?= gtags | ||||
CTAGSFLAGS?= | CTAGSFLAGS?= | ||||
GTAGSFLAGS?= -o | GTAGSFLAGS?= -o | ||||
HTAGSFLAGS?= | HTAGSFLAGS?= | ||||
_MKDEPCC:= ${CC:N${CCACHE_BIN}} | |||||
# XXX: DEPFLAGS can come out once Makefile.inc1 properly passes down | |||||
# CXXFLAGS. | |||||
.if !empty(DEPFLAGS) | |||||
_MKDEPCC+= ${DEPFLAGS} | |||||
.endif | |||||
MKDEPCMD?= CC='${_MKDEPCC}' mkdep | |||||
.if ${MK_DIRDEPS_BUILD} == "no" | .if ${MK_DIRDEPS_BUILD} == "no" | ||||
.MAKE.DEPENDFILE= ${DEPENDFILE} | .MAKE.DEPENDFILE= ${DEPENDFILE} | ||||
.endif | .endif | ||||
CLEANDEPENDFILES+= ${DEPENDFILE} ${DEPENDFILE}.* | CLEANDEPENDFILES+= ${DEPENDFILE} ${DEPENDFILE}.* | ||||
# Keep `tags' here, before SRCS are mangled below for `depend'. | # Keep `tags' here, before SRCS are mangled below for `depend'. | ||||
.if !target(tags) && defined(SRCS) && !defined(NO_TAGS) | .if !target(tags) && defined(SRCS) && !defined(NO_TAGS) | ||||
tags: ${SRCS} | tags: ${SRCS} | ||||
Show All 18 Lines | |||||
.endif | .endif | ||||
.endif | .endif | ||||
.if defined(SRCS) | .if defined(SRCS) | ||||
CLEANFILES?= | CLEANFILES?= | ||||
.for _S in ${SRCS:N*.[dhly]} | .for _S in ${SRCS:N*.[dhly]} | ||||
OBJS_DEPEND_GUESS.${_S:R}.o= ${_S} | OBJS_DEPEND_GUESS.${_S:R}.o= ${_S} | ||||
.if ${MK_FAST_DEPEND} == "no" && !exists(${.OBJDIR}/${DEPENDFILE}) | |||||
${_S:R}.o: ${OBJS_DEPEND_GUESS.${_S:R}.o} | |||||
.endif | |||||
.endfor | .endfor | ||||
# Lexical analyzers | # Lexical analyzers | ||||
.for _LSRC in ${SRCS:M*.l:N*/*} | .for _LSRC in ${SRCS:M*.l:N*/*} | ||||
.for _LC in ${_LSRC:R}.c | .for _LC in ${_LSRC:R}.c | ||||
${_LC}: ${_LSRC} | ${_LC}: ${_LSRC} | ||||
${LEX} ${LFLAGS} -o${.TARGET} ${.ALLSRC} | ${LEX} ${LFLAGS} -o${.TARGET} ${.ALLSRC} | ||||
OBJS_DEPEND_GUESS.${_LC:R}.o= ${_LC} | OBJS_DEPEND_GUESS.${_LC:R}.o= ${_LC} | ||||
.if ${MK_FAST_DEPEND} == "no" && !exists(${.OBJDIR}/${DEPENDFILE}) | |||||
${_LC:R}.o: ${OBJS_DEPEND_GUESS.${_LC:R}.o} | |||||
.endif | |||||
SRCS:= ${SRCS:S/${_LSRC}/${_LC}/} | SRCS:= ${SRCS:S/${_LSRC}/${_LC}/} | ||||
CLEANFILES+= ${_LC} | CLEANFILES+= ${_LC} | ||||
.endfor | .endfor | ||||
.endfor | .endfor | ||||
# Yacc grammars | # Yacc grammars | ||||
.for _YSRC in ${SRCS:M*.y:N*/*} | .for _YSRC in ${SRCS:M*.y:N*/*} | ||||
.for _YC in ${_YSRC:R}.c | .for _YC in ${_YSRC:R}.c | ||||
Show All 13 Lines | |||||
SRCS+= ${_YH} | SRCS+= ${_YH} | ||||
CLEANFILES+= ${_YH} | CLEANFILES+= ${_YH} | ||||
.endfor | .endfor | ||||
.else | .else | ||||
${_YC}: ${_YSRC} | ${_YC}: ${_YSRC} | ||||
${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC} | ${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC} | ||||
.endif | .endif | ||||
OBJS_DEPEND_GUESS.${_YC:R}.o= ${_YC} | OBJS_DEPEND_GUESS.${_YC:R}.o= ${_YC} | ||||
.if ${MK_FAST_DEPEND} == "no" && !exists(${.OBJDIR}/${DEPENDFILE}) | |||||
${_YC:R}.o: ${OBJS_DEPEND_GUESS.${_YC:R}.o} | |||||
.endif | |||||
.endfor | .endfor | ||||
.endfor | .endfor | ||||
# DTrace probe definitions | # DTrace probe definitions | ||||
.if ${SRCS:M*.d} | .if ${SRCS:M*.d} | ||||
CFLAGS+= -I${.OBJDIR} | CFLAGS+= -I${.OBJDIR} | ||||
.endif | .endif | ||||
.for _DSRC in ${SRCS:M*.d:N*/*} | .for _DSRC in ${SRCS:M*.d:N*/*} | ||||
Show All 18 Lines | |||||
.endif | .endif | ||||
.endfor | .endfor | ||||
.endfor | .endfor | ||||
.if !empty(.MAKE.MODE:Mmeta) && empty(.MAKE.MODE:Mnofilemon) | .if !empty(.MAKE.MODE:Mmeta) && empty(.MAKE.MODE:Mnofilemon) | ||||
_meta_filemon= 1 | _meta_filemon= 1 | ||||
.endif | .endif | ||||
.if ${MK_FAST_DEPEND} == "yes" | |||||
.if ${MAKE_VERSION} < 20160220 | .if ${MAKE_VERSION} < 20160220 | ||||
DEPEND_MP?= -MP | DEPEND_MP?= -MP | ||||
.endif | .endif | ||||
# Handle OBJS=../somefile.o hacks. Just replace '/' rather than use :T to | # Handle OBJS=../somefile.o hacks. Just replace '/' rather than use :T to | ||||
# avoid collisions. | # avoid collisions. | ||||
DEPEND_FILTER= C,/,_,g | DEPEND_FILTER= C,/,_,g | ||||
DEPENDSRCS= ${SRCS:M*.[cSC]} ${SRCS:M*.cxx} ${SRCS:M*.cpp} ${SRCS:M*.cc} | DEPENDSRCS= ${SRCS:M*.[cSC]} ${SRCS:M*.cxx} ${SRCS:M*.cpp} ${SRCS:M*.cc} | ||||
.if !empty(DEPENDSRCS) | .if !empty(DEPENDSRCS) | ||||
Show All 18 Lines | |||||
.if ${MAKE_VERSION} < 20160220 | .if ${MAKE_VERSION} < 20160220 | ||||
.sinclude "${.OBJDIR}/${__depend_obj}" | .sinclude "${.OBJDIR}/${__depend_obj}" | ||||
.else | .else | ||||
.dinclude "${.OBJDIR}/${__depend_obj}" | .dinclude "${.OBJDIR}/${__depend_obj}" | ||||
.endif | .endif | ||||
.endfor | .endfor | ||||
.endif # !defined(_SKIP_READ_DEPEND) | .endif # !defined(_SKIP_READ_DEPEND) | ||||
.endif # !defined(_meta_filemon) | .endif # !defined(_meta_filemon) | ||||
.endif # ${MK_FAST_DEPEND} == "yes" | |||||
.endif # defined(SRCS) | .endif # defined(SRCS) | ||||
.if ${MK_DIRDEPS_BUILD} == "yes" | .if ${MK_DIRDEPS_BUILD} == "yes" | ||||
# Prevent meta.autodep.mk from tracking "local dependencies". | # Prevent meta.autodep.mk from tracking "local dependencies". | ||||
.depend: | .depend: | ||||
.include <meta.autodep.mk> | .include <meta.autodep.mk> | ||||
# If using filemon then _EXTRADEPEND is skipped since it is not needed. | # If using filemon then _EXTRADEPEND is skipped since it is not needed. | ||||
.if empty(.MAKE.MODE:Mnofilemon) | .if empty(.MAKE.MODE:Mnofilemon) | ||||
# this depend: bypasses that below | # this depend: bypasses that below | ||||
# the dependency helps when bootstrapping | # the dependency helps when bootstrapping | ||||
depend: beforedepend ${DPSRCS} ${SRCS} afterdepend | depend: beforedepend ${DPSRCS} ${SRCS} afterdepend | ||||
beforedepend: | beforedepend: | ||||
afterdepend: beforedepend | afterdepend: beforedepend | ||||
.endif | .endif | ||||
.endif | .endif | ||||
# Guess some dependencies for when no ${DEPENDFILE}.OBJ is generated yet. | # 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 | # For meta+filemon the .meta file is checked for since it is the dependency | ||||
# file used. | # file used. | ||||
.if ${MK_FAST_DEPEND} == "yes" | |||||
.for __obj in ${DEPENDOBJS:O:u} | .for __obj in ${DEPENDOBJS:O:u} | ||||
.if (defined(_meta_filemon) && !exists(${.OBJDIR}/${__obj}.meta)) || \ | .if (defined(_meta_filemon) && !exists(${.OBJDIR}/${__obj}.meta)) || \ | ||||
(!defined(_meta_filemon) && !exists(${.OBJDIR}/${DEPENDFILE}.${__obj})) | (!defined(_meta_filemon) && !exists(${.OBJDIR}/${DEPENDFILE}.${__obj})) | ||||
${__obj}: ${OBJS_DEPEND_GUESS} | ${__obj}: ${OBJS_DEPEND_GUESS} | ||||
${__obj}: ${OBJS_DEPEND_GUESS.${__obj}} | ${__obj}: ${OBJS_DEPEND_GUESS.${__obj}} | ||||
.endif | .endif | ||||
.endfor | .endfor | ||||
# Always run 'make depend' to generate dependencies early and to avoid the | # 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 | # need for manually running it. The dirdeps build should only do this in | ||||
# sub-makes though since MAKELEVEL0 is for dirdeps calculations. | # sub-makes though since MAKELEVEL0 is for dirdeps calculations. | ||||
.if ${MK_DIRDEPS_BUILD} == "no" || ${.MAKE.LEVEL} > 0 | .if ${MK_DIRDEPS_BUILD} == "no" || ${.MAKE.LEVEL} > 0 | ||||
beforebuild: depend | beforebuild: depend | ||||
.endif | .endif | ||||
.endif # ${MK_FAST_DEPEND} == "yes" | |||||
.if !target(depend) | .if !target(depend) | ||||
.if defined(SRCS) | .if defined(SRCS) | ||||
depend: beforedepend ${DEPENDFILE} afterdepend | depend: beforedepend ${DEPENDFILE} afterdepend | ||||
# Tell bmake not to look for generated files via .PATH | # Tell bmake not to look for generated files via .PATH | ||||
.NOPATH: ${DEPENDFILE} ${DEPENDFILES_OBJS} | .NOPATH: ${DEPENDFILE} ${DEPENDFILES_OBJS} | ||||
.if ${MK_FAST_DEPEND} == "no" | |||||
# Capture -include from CFLAGS. | |||||
# This could be simpler with bmake :tW but needs to support fmake for MFC. | |||||
_CFLAGS_INCLUDES= ${CFLAGS:Q:S/\\ /,/g:C/-include,/-include%/g:C/,/ /g:M-include*:C/%/ /g} | |||||
_CXXFLAGS_INCLUDES= ${CXXFLAGS:Q:S/\\ /,/g:C/-include,/-include%/g:C/,/ /g:M-include*:C/%/ /g} | |||||
# Different types of sources are compiled with slightly different flags. | |||||
# Split up the sources, and filter out headers and non-applicable flags. | |||||
MKDEP_CFLAGS= ${CFLAGS:M-nostdinc*} ${CFLAGS:M-[BIDU]*} ${CFLAGS:M-std=*} \ | |||||
${CFLAGS:M-ansi} ${_CFLAGS_INCLUDES} | |||||
MKDEP_CXXFLAGS= ${CXXFLAGS:M-nostdinc*} ${CXXFLAGS:M-[BIDU]*} \ | |||||
${CXXFLAGS:M-std=*} ${CXXFLAGS:M-ansi} ${CXXFLAGS:M-stdlib=*} \ | |||||
${_CXXFLAGS_INCLUDES} | |||||
.endif # ${MK_FAST_DEPEND} == "no" | |||||
DPSRCS+= ${SRCS} | DPSRCS+= ${SRCS} | ||||
# FAST_DEPEND will only generate a .depend if _EXTRADEPEND is used but | # A .depend file will only be generated if there are commands in | ||||
# the target is created to allow 'make depend' to generate files. | # beforedepend/_EXTRADEPEND/afterdepend. The target is kept | ||||
# to allow 'make depend' to generate files. | |||||
${DEPENDFILE}: ${DPSRCS} | ${DEPENDFILE}: ${DPSRCS} | ||||
.if exists(${.OBJDIR}/${DEPENDFILE}) | .if exists(${.OBJDIR}/${DEPENDFILE}) | ||||
rm -f ${DEPENDFILE} | rm -f ${DEPENDFILE} | ||||
.endif | .endif | ||||
.if ${MK_FAST_DEPEND} == "no" | |||||
.if !empty(DPSRCS:M*.[cS]) | |||||
${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \ | |||||
${MKDEP_CFLAGS} ${.ALLSRC:M*.[cS]} | |||||
.endif | |||||
.if !empty(DPSRCS:M*.cc) || !empty(DPSRCS:M*.C) || !empty(DPSRCS:M*.cpp) || \ | |||||
!empty(DPSRCS:M*.cxx) | |||||
${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \ | |||||
${MKDEP_CXXFLAGS} \ | |||||
${.ALLSRC:M*.cc} ${.ALLSRC:M*.C} ${.ALLSRC:M*.cpp} ${.ALLSRC:M*.cxx} | |||||
.else | |||||
.endif | |||||
.endif # ${MK_FAST_DEPEND} == "no" | |||||
.if target(_EXTRADEPEND) | .if target(_EXTRADEPEND) | ||||
_EXTRADEPEND: .USE | _EXTRADEPEND: .USE | ||||
${DEPENDFILE}: _EXTRADEPEND | ${DEPENDFILE}: _EXTRADEPEND | ||||
.endif | .endif | ||||
.ORDER: ${DEPENDFILE} afterdepend | .ORDER: ${DEPENDFILE} afterdepend | ||||
.else | .else | ||||
depend: beforedepend afterdepend | depend: beforedepend afterdepend | ||||
▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines |