17f3dea24SPeter Wemm# $FreeBSD$ 253996fadSWolfram Schneider# 353996fadSWolfram Schneider# The include file <bsd.dep.mk> handles Makefile dependencies. 453996fadSWolfram Schneider# 553996fadSWolfram Schneider# 653996fadSWolfram Schneider# +++ variables +++ 753996fadSWolfram Schneider# 8ae038fc3SBryan Drewery# CLEANDEPENDDIRS Additional directories to remove for the cleandepend 9ae038fc3SBryan Drewery# target. 10ae038fc3SBryan Drewery# 11ae038fc3SBryan Drewery# CLEANDEPENDFILES Additional files to remove for the cleandepend target. 12ae038fc3SBryan Drewery# 13ccc4bab1SRuslan Ermilov# CTAGS A tags file generation program [gtags] 14ccc4bab1SRuslan Ermilov# 15ccc4bab1SRuslan Ermilov# CTAGSFLAGS Options for ctags(1) [not set] 16ccc4bab1SRuslan Ermilov# 1753996fadSWolfram Schneider# DEPENDFILE dependencies file [.depend] 1853996fadSWolfram Schneider# 19ccc4bab1SRuslan Ermilov# GTAGSFLAGS Options for gtags(1) [-o] 20ccc4bab1SRuslan Ermilov# 21ccc4bab1SRuslan Ermilov# HTAGSFLAGS Options for htags(1) [not set] 22ccc4bab1SRuslan Ermilov# 2353996fadSWolfram Schneider# SRCS List of source files (c, c++, assembler) 2453996fadSWolfram Schneider# 2511dc9298SRuslan Ermilov# DPSRCS List of source files which are needed for generating 2611dc9298SRuslan Ermilov# dependencies, ${SRCS} are always part of it. 2753996fadSWolfram Schneider# 2853996fadSWolfram Schneider# +++ targets +++ 2953996fadSWolfram Schneider# 3053996fadSWolfram Schneider# cleandepend: 31ae038fc3SBryan Drewery# remove ${CLEANDEPENDFILES}; remove ${CLEANDEPENDDIRS} and all 32ae038fc3SBryan Drewery# contents. 3353996fadSWolfram Schneider# 3453996fadSWolfram Schneider# depend: 3553996fadSWolfram Schneider# Make the dependencies for the source files, and store 3653996fadSWolfram Schneider# them in the file ${DEPENDFILE}. 3753996fadSWolfram Schneider# 3853996fadSWolfram Schneider# tags: 39ccc4bab1SRuslan Ermilov# In "ctags" mode, create a tags file for the source files. 40ccc4bab1SRuslan Ermilov# In "gtags" mode, create a (GLOBAL) gtags file for the 41ccc4bab1SRuslan Ermilov# source files. If HTML is defined, htags(1) is also run 42ccc4bab1SRuslan Ermilov# after gtags(1). 4353996fadSWolfram Schneider 445ffdf361SRuslan Ermilov.if !target(__<bsd.init.mk>__) 455ffdf361SRuslan Ermilov.error bsd.dep.mk cannot be included directly. 465ffdf361SRuslan Ermilov.endif 47b16495e7SWolfram Schneider 48ccc4bab1SRuslan ErmilovCTAGS?= gtags 49ccc4bab1SRuslan ErmilovCTAGSFLAGS?= 50ccc4bab1SRuslan ErmilovGTAGSFLAGS?= -o 51ccc4bab1SRuslan ErmilovHTAGSFLAGS?= 52ccc4bab1SRuslan Ermilov 53369737d7SBryan Drewery.if ${MK_DIRDEPS_BUILD} == "no" 54fc2c2cd9SBryan Drewery.MAKE.DEPENDFILE= ${DEPENDFILE} 55369737d7SBryan Drewery.endif 56caf1fb32SBryan DreweryCLEANDEPENDFILES+= ${DEPENDFILE} ${DEPENDFILE}.* 57b964b943SBryan Drewery.if ${MK_META_MODE} == "yes" 58b964b943SBryan DreweryCLEANDEPENDFILES+= *.meta 59b964b943SBryan Drewery.endif 60d14f862cSGarrett Wollman 61ccc4bab1SRuslan Ermilov# Keep `tags' here, before SRCS are mangled below for `depend'. 626260f1d8SRuslan Ermilov.if !target(tags) && defined(SRCS) && !defined(NO_TAGS) 63ccc4bab1SRuslan Ermilovtags: ${SRCS} 64213a4447SRuslan Ermilov.if ${CTAGS:T} == "gtags" 65ccc4bab1SRuslan Ermilov @cd ${.CURDIR} && ${CTAGS} ${GTAGSFLAGS} ${.OBJDIR} 66ccc4bab1SRuslan Ermilov.if defined(HTML) 67ccc4bab1SRuslan Ermilov @cd ${.CURDIR} && htags ${HTAGSFLAGS} -d ${.OBJDIR} ${.OBJDIR} 68ccc4bab1SRuslan Ermilov.endif 69213a4447SRuslan Ermilov.else 70213a4447SRuslan Ermilov @${CTAGS} ${CTAGSFLAGS} -f /dev/stdout \ 71213a4447SRuslan Ermilov ${.ALLSRC:N*.h} | sed "s;${.CURDIR}/;;" > ${.TARGET} 72ccc4bab1SRuslan Ermilov.endif 73ccc4bab1SRuslan Ermilov.endif 74ccc4bab1SRuslan Ermilov 75799483e4SBryan Drewery.if !empty(.MAKE.MODE:Mmeta) && empty(.MAKE.MODE:Mnofilemon) 76799483e4SBryan Drewery_meta_filemon= 1 77799483e4SBryan Drewery.endif 78396561c9SBryan Drewery# By default META_MODE is disabled in bmake if there is no OBJDIR 79396561c9SBryan Drewery# unless .MAKE.MODE contains "curdirOk=[^0nNfF]" 80396561c9SBryan Drewery.if defined(_meta_filemon) && ${.OBJDIR} == ${.CURDIR} && \ 81396561c9SBryan Drewery (empty(.MAKE.MODE:tl:Mcurdirok=*) || \ 82396561c9SBryan Drewery !empty(.MAKE.MODE:tl:Mcurdirok=[0NnFf]*)) 83396561c9SBryan Drewery.undef _meta_filemon 84396561c9SBryan Drewery.endif 85799483e4SBryan Drewery 86c30c436aSBryan Drewery# Skip reading .depend when not needed to speed up tree-walks and simple 87d7173250SBryan Drewery# lookups. See _SKIP_BUILD logic in bsd.init.mk for more details. 88799483e4SBryan Drewery# Also skip generating or including .depend.* files if in meta+filemon mode 89210ecc00SBryan Drewery# since it will track dependencies itself. OBJS_DEPEND_GUESS is still used 90210ecc00SBryan Drewery# for _meta_filemon but not for _SKIP_DEPEND. 91ecc39238SBryan Drewery.if !defined(NO_SKIP_DEPEND) && defined(_SKIP_BUILD) 92210ecc00SBryan Drewery_SKIP_DEPEND= 1 93210ecc00SBryan Drewery.endif 94e65dd92bSBryan Drewery.if ${MK_DIRDEPS_BUILD} == "no" 95210ecc00SBryan Drewery.if defined(_SKIP_DEPEND) || defined(_meta_filemon) 969fb02a70SBryan Drewery.MAKE.DEPENDFILE= /dev/null 979fb02a70SBryan Drewery.endif 989fb02a70SBryan Drewery.endif 999fb02a70SBryan Drewery 1002ec8b6deSBruce Evans.if defined(SRCS) 1012ec8b6deSBruce EvansCLEANFILES?= 1022ec8b6deSBruce Evans 1038a152f97SRui Paulo.for _S in ${SRCS:N*.[dhly]} 1042506d700SSimon J. GerratyOBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.o+= ${_S} 105d7beff08SBryan Drewery.endfor 1066b14fdfaSRuslan Ermilov 1079f65e34fSRui Paulo# Lexical analyzers 1082ec8b6deSBruce Evans.for _LSRC in ${SRCS:M*.l:N*/*} 109484933a9SRuslan Ermilov.for _LC in ${_LSRC:R}.c 1105852ae2dSBryan Drewery${_LC}: ${_LSRC} 1118f812fecSDag-Erling Smørgrav ${LEX} ${LFLAGS} -o${.TARGET} ${.ALLSRC} 112919154d9SBryan DreweryOBJS_DEPEND_GUESS.${_LC:R}.o+= ${_LC} 1132ec8b6deSBruce EvansSRCS:= ${SRCS:S/${_LSRC}/${_LC}/} 114484933a9SRuslan ErmilovCLEANFILES+= ${_LC} 1152ec8b6deSBruce Evans.endfor 1162ec8b6deSBruce Evans.endfor 1172ec8b6deSBruce Evans 1189f65e34fSRui Paulo# Yacc grammars 1192ec8b6deSBruce Evans.for _YSRC in ${SRCS:M*.y:N*/*} 120484933a9SRuslan Ermilov.for _YC in ${_YSRC:R}.c 1212ec8b6deSBruce EvansSRCS:= ${SRCS:S/${_YSRC}/${_YC}/} 122484933a9SRuslan ErmilovCLEANFILES+= ${_YC} 12365d2bdc6SRuslan Ermilov.if !empty(YFLAGS:M-d) && !empty(SRCS:My.tab.h) 1242ec8b6deSBruce Evans.ORDER: ${_YC} y.tab.h 12592edc966SBryan Dreweryy.tab.h: .NOMETA 1262ec8b6deSBruce Evans${_YC} y.tab.h: ${_YSRC} 1272ec8b6deSBruce Evans ${YACC} ${YFLAGS} ${.ALLSRC} 1282ec8b6deSBruce Evans cp y.tab.c ${_YC} 129484933a9SRuslan ErmilovCLEANFILES+= y.tab.c y.tab.h 13065d2bdc6SRuslan Ermilov.elif !empty(YFLAGS:M-d) 131484933a9SRuslan Ermilov.for _YH in ${_YC:R}.h 1325444d429SBryan Drewery.ORDER: ${_YC} ${_YH} 13392edc966SBryan Drewery${_YH}: .NOMETA 1345444d429SBryan Drewery${_YC} ${_YH}: ${_YSRC} 1352ec8b6deSBruce Evans ${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC} 136484933a9SRuslan ErmilovSRCS+= ${_YH} 137484933a9SRuslan ErmilovCLEANFILES+= ${_YH} 1382ec8b6deSBruce Evans.endfor 1392ec8b6deSBruce Evans.else 1405852ae2dSBryan Drewery${_YC}: ${_YSRC} 1412ec8b6deSBruce Evans ${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC} 1422ec8b6deSBruce Evans.endif 143919154d9SBryan DreweryOBJS_DEPEND_GUESS.${_YC:R}.o+= ${_YC} 1442ec8b6deSBruce Evans.endfor 1452ec8b6deSBruce Evans.endfor 1469f65e34fSRui Paulo 1479f65e34fSRui Paulo# DTrace probe definitions 148ff0f36e7SRui Paulo.if ${SRCS:M*.d} 1495439a715SMark JohnstonCFLAGS+= -I${.OBJDIR} 150ff0f36e7SRui Paulo.endif 1519f65e34fSRui Paulo.for _DSRC in ${SRCS:M*.d:N*/*} 152ff0f36e7SRui Paulo.for _D in ${_DSRC:R} 153cfa5f2beSBryan DrewerySRCS+= ${_D}.h 1545852ae2dSBryan Drewery${_D}.h: ${_DSRC} 1550c76c8aaSMark Johnston ${DTRACE} ${DTRACEFLAGS} -h -s ${.ALLSRC} 156e9083b2dSMark JohnstonSRCS:= ${SRCS:S/^${_DSRC}$//} 157d8b63155SRui PauloOBJS+= ${_D}.o 1589b646f25SRui PauloCLEANFILES+= ${_D}.h ${_D}.o 1595852ae2dSBryan Drewery${_D}.o: ${_DSRC} ${OBJS:S/^${_D}.o$//} 160a298c279SBryan Drewery @rm -f ${.TARGET} 161cfa5f2beSBryan Drewery ${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC:N*.h} 1629b646f25SRui Paulo.if defined(LIB) 163db08bfceSKonstantin BelousovCLEANFILES+= ${_D}.pico ${_D}.po ${_D}.nossppico 1642b4da8aaSMarcel Moolenaar${_D}.pico: ${_DSRC} ${SOBJS:S/^${_D}.pico$//} 165a298c279SBryan Drewery @rm -f ${.TARGET} 166cfa5f2beSBryan Drewery ${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC:N*.h} 1675852ae2dSBryan Drewery${_D}.po: ${_DSRC} ${POBJS:S/^${_D}.po$//} 168a298c279SBryan Drewery @rm -f ${.TARGET} 169cfa5f2beSBryan Drewery ${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC:N*.h} 170db08bfceSKonstantin Belousov${_D}.nossppico: ${_DSRC} ${SOBJS:S/^${_D}.nossppico$//} 171db08bfceSKonstantin Belousov @rm -f ${.TARGET} 172db08bfceSKonstantin Belousov ${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC:N*.h} 173ff0f36e7SRui Paulo.endif 1749f65e34fSRui Paulo.endfor 1759f65e34fSRui Paulo.endfor 176*ee4eeb32SBryan Drewery.endif # defined(SRCS) 177b9964333SBryan Drewery 178e32a2cbeSBryan Drewery.if ${MAKE_VERSION} < 20160220 179b9964333SBryan DreweryDEPEND_MP?= -MP 180e32a2cbeSBryan Drewery.endif 181b9964333SBryan Drewery# Handle OBJS=../somefile.o hacks. Just replace '/' rather than use :T to 182b9964333SBryan Drewery# avoid collisions. 183b9964333SBryan DreweryDEPEND_FILTER= C,/,_,g 184*ee4eeb32SBryan Drewery.if !empty(OBJS) 185*ee4eeb32SBryan DreweryDEPENDOBJS+= ${OBJS} 186*ee4eeb32SBryan Drewery.else 187649fed8eSBryan DreweryDEPENDSRCS+= ${SRCS:M*.[cSC]} ${SRCS:M*.cxx} ${SRCS:M*.cpp} ${SRCS:M*.cc} 188a854949fSBryan DreweryDEPENDSRCS+= ${DPSRCS:M*.[cSC]} ${SRCS:M*.cxx} ${SRCS:M*.cpp} ${SRCS:M*.cc} 18970ca9ec4SBryan Drewery.if !empty(DEPENDSRCS) 1902506d700SSimon J. GerratyDEPENDOBJS+= ${DEPENDSRCS:${OBJS_SRCS_FILTER:ts:}:S,$,.o,} 19170ca9ec4SBryan Drewery.endif 192*ee4eeb32SBryan Drewery.endif # !empty(OBJS) 1933d04f5a9SBryan Drewery.if !empty(DEPENDOBJS) 194068306e9SBryan DreweryDEPENDFILES+= ${DEPENDOBJS:O:u:${DEPEND_FILTER}:C/^/${DEPENDFILE}./} 1953d04f5a9SBryan Drewery.endif 196210ecc00SBryan Drewery.if defined(_SKIP_DEPEND) 197210ecc00SBryan Drewery# Don't bother statting any .meta files for .depend* 198210ecc00SBryan Drewery${DEPENDOBJS}: .NOMETA 199210ecc00SBryan Drewery${DEPENDFILE}: .NOMETA 200210ecc00SBryan Drewery# Unset these to avoid looping/statting on them later. 201210ecc00SBryan Drewery.undef DEPENDSRCS 202210ecc00SBryan Drewery.undef DEPENDOBJS 203068306e9SBryan Drewery.undef DEPENDFILES 204210ecc00SBryan Drewery.endif # defined(_SKIP_DEPEND) 205b9964333SBryan DreweryDEPEND_CFLAGS+= -MD ${DEPEND_MP} -MF${DEPENDFILE}.${.TARGET:${DEPEND_FILTER}} 206b9964333SBryan DreweryDEPEND_CFLAGS+= -MT${.TARGET} 20770ca9ec4SBryan Drewery.if !defined(_meta_filemon) 208c2fd1d01SBryan Drewery.if !empty(DEPEND_CFLAGS) 20910f696a5SBryan Drewery# Only add in DEPEND_CFLAGS for CFLAGS on files we expect from DEPENDOBJS 21010f696a5SBryan Drewery# as those are the only ones we will include. 2117c0c104bSBryan DreweryDEPEND_CFLAGS_CONDITION= "${DEPENDOBJS:${DEPEND_FILTER}:M${.TARGET:${DEPEND_FILTER}}}" != "" 21210f696a5SBryan DreweryCFLAGS+= ${${DEPEND_CFLAGS_CONDITION}:?${DEPEND_CFLAGS}:} 21310f696a5SBryan Drewery.endif 214068306e9SBryan Drewery.for __depend_obj in ${DEPENDFILES} 215e32a2cbeSBryan Drewery.if ${MAKE_VERSION} < 20160220 216e9508dc2SBryan Drewery.sinclude "${.OBJDIR}/${__depend_obj}" 217e32a2cbeSBryan Drewery.else 218e32a2cbeSBryan Drewery.dinclude "${.OBJDIR}/${__depend_obj}" 219e32a2cbeSBryan Drewery.endif 220b9964333SBryan Drewery.endfor 22170ca9ec4SBryan Drewery.endif # !defined(_meta_filemon) 2222ec8b6deSBruce Evans 22334d39d2cSBryan Drewery.if ${MK_DIRDEPS_BUILD} == "yes" && ${.MAKE.DEPENDFILE} != "/dev/null" 224b9cd412eSBryan Drewery# Prevent meta.autodep.mk from tracking "local dependencies". 225b9cd412eSBryan Drewery.depend: 2267750ad47SMarcel Moolenaar.include <meta.autodep.mk> 22770ca9ec4SBryan Drewery# If using filemon then _EXTRADEPEND is skipped since it is not needed. 228799483e4SBryan Drewery.if defined(_meta_filemon) 2297750ad47SMarcel Moolenaar# this depend: bypasses that below 2307750ad47SMarcel Moolenaar# the dependency helps when bootstrapping 2317750ad47SMarcel Moolenaardepend: beforedepend ${DPSRCS} ${SRCS} afterdepend 2327750ad47SMarcel Moolenaarbeforedepend: 2337750ad47SMarcel Moolenaarafterdepend: beforedepend 2347750ad47SMarcel Moolenaar.endif 23570ca9ec4SBryan Drewery.endif 2367750ad47SMarcel Moolenaar 237d7beff08SBryan Drewery# Guess some dependencies for when no ${DEPENDFILE}.OBJ is generated yet. 23870ca9ec4SBryan Drewery# For meta+filemon the .meta file is checked for since it is the dependency 23970ca9ec4SBryan Drewery# file used. 240d7beff08SBryan Drewery.for __obj in ${DEPENDOBJS:O:u} 2417c0c104bSBryan Drewery# If the obj has any '/', then replace with '_'. For meta files, this is 2427c0c104bSBryan Drewery# mimicing what bmake's meta_name() does and adding in the full path 2437c0c104bSBryan Drewery# as well to ensure that the expected meta file is read. 2447c0c104bSBryan Drewery.if ${__obj:M*/*} 2452a8176cbSBryan Drewery.if ${MAKE_VERSION} < 20171028 2467c0c104bSBryan Drewery_meta_obj= ${.OBJDIR:C,/,_,g}_${__obj:C,/,_,g}.meta 2477c0c104bSBryan Drewery.else 2482a8176cbSBryan Drewery_meta_obj= ${__obj:C,/,_,g}.meta 2492a8176cbSBryan Drewery.endif # ${MAKE_VERSION} < 20171028 2502a8176cbSBryan Drewery.else 2517c0c104bSBryan Drewery_meta_obj= ${__obj}.meta 2522a8176cbSBryan Drewery.endif # ${__obj:M*/*} 2537c0c104bSBryan Drewery_dep_obj= ${DEPENDFILE}.${__obj:${DEPEND_FILTER}} 254711019f7SBryan Drewery.if defined(_meta_filemon) 255711019f7SBryan Drewery_depfile= ${.OBJDIR}/${_meta_obj} 256711019f7SBryan Drewery.else 257711019f7SBryan Drewery_depfile= ${.OBJDIR}/${_dep_obj} 258711019f7SBryan Drewery.endif 259f39f6a56SBryan Drewery.if !exists(${_depfile}) || defined(_meta_filemon) 260f39f6a56SBryan Drewery# - Headers are normally built in beforebuild when included in DPSRCS or SRCS. 261f39f6a56SBryan Drewery# So we don't need it as a guessed dependency (it may lead to cyclic problems 262f39f6a56SBryan Drewery# if custom rules are defined). The only time this causes a problem is when 263f39f6a56SBryan Drewery# 'make foo.o' is ran. 264f39f6a56SBryan Drewery# - For meta mode we still need to know which file to depend on to avoid 2653b828e44SBryan Drewery# ambiguous suffix transformation rules from .PATH. Meta mode does not 266f39f6a56SBryan Drewery# use .depend files when filemon is in use. 2673b828e44SBryan Drewery${__obj}: ${OBJS_DEPEND_GUESS:N*.h} 268c155deccSBryan Drewery${__obj}: ${OBJS_DEPEND_GUESS.${__obj}} 269f39f6a56SBryan Drewery.endif # !exists(${_depfile}) || defined(_meta_filemon) 270d7beff08SBryan Drewery.endfor 271b9cd412eSBryan Drewery 272b9cd412eSBryan Drewery# Always run 'make depend' to generate dependencies early and to avoid the 273b9cd412eSBryan Drewery# need for manually running it. The dirdeps build should only do this in 274b9cd412eSBryan Drewery# sub-makes though since MAKELEVEL0 is for dirdeps calculations. 275b9cd412eSBryan Drewery.if ${MK_DIRDEPS_BUILD} == "no" || ${.MAKE.LEVEL} > 0 276b9cd412eSBryan Drewerybeforebuild: depend 277d7beff08SBryan Drewery.endif 278d7beff08SBryan Drewery 279d14f862cSGarrett Wollman.if !target(depend) 280d14f862cSGarrett Wollman.if defined(SRCS) 281b25a566dSRuslan Ermilovdepend: beforedepend ${DEPENDFILE} afterdepend 282b16495e7SWolfram Schneider 2837750ad47SMarcel Moolenaar# Tell bmake not to look for generated files via .PATH 284068306e9SBryan Drewery.NOPATH: ${DEPENDFILE} ${DEPENDFILES} 2857750ad47SMarcel Moolenaar 286497e8091SBryan Drewery# A .depend file will only be generated if there are commands in 287799483e4SBryan Drewery# beforedepend/_EXTRADEPEND/afterdepend The _EXTRADEPEND target is 288799483e4SBryan Drewery# ignored if using meta+filemon since it handles all dependencies. The other 289799483e4SBryan Drewery# targets are kept as they be used for generating something. The target is 290799483e4SBryan Drewery# kept to allow 'make depend' to generate files. 291a854949fSBryan Drewery${DEPENDFILE}: ${SRCS} ${DPSRCS} 292210ecc00SBryan Drewery.if !defined(_SKIP_DEPEND) 293987c375fSBryan Drewery.if exists(${.OBJDIR}/${DEPENDFILE}) || \ 294799483e4SBryan Drewery ((commands(beforedepend) || \ 295799483e4SBryan Drewery (!defined(_meta_filemon) && commands(_EXTRADEPEND)) || \ 296987c375fSBryan Drewery commands(afterdepend)) && !empty(.MAKE.MODE:Mmeta)) 297b16495e7SWolfram Schneider rm -f ${DEPENDFILE} 29880f9a973SBryan Drewery.endif 299210ecc00SBryan Drewery.endif 300799483e4SBryan Drewery.if !defined(_meta_filemon) && target(_EXTRADEPEND) 30170e82473SRuslan Ermilov_EXTRADEPEND: .USE 3020cfacc86SRuslan Ermilov${DEPENDFILE}: _EXTRADEPEND 303663e9677SBruce Evans.endif 304b16495e7SWolfram Schneider 30597fe7f47SJordan K. Hubbard.ORDER: ${DEPENDFILE} afterdepend 306d14f862cSGarrett Wollman.else 307b25a566dSRuslan Ermilovdepend: beforedepend afterdepend 308d14f862cSGarrett Wollman.endif 309d14f862cSGarrett Wollman.if !target(beforedepend) 310d14f862cSGarrett Wollmanbeforedepend: 31197fe7f47SJordan K. Hubbard.else 31297fe7f47SJordan K. Hubbard.ORDER: beforedepend ${DEPENDFILE} 31397fe7f47SJordan K. Hubbard.ORDER: beforedepend afterdepend 314d14f862cSGarrett Wollman.endif 315d14f862cSGarrett Wollman.if !target(afterdepend) 316d14f862cSGarrett Wollmanafterdepend: 317d14f862cSGarrett Wollman.endif 318d14f862cSGarrett Wollman.endif 319d14f862cSGarrett Wollman 3203d437ee2SBryan Drewery.if defined(SRCS) 321ae038fc3SBryan Drewery.if ${CTAGS:T} == "gtags" 322ae038fc3SBryan DreweryCLEANDEPENDFILES+= GPATH GRTAGS GSYMS GTAGS 323ae038fc3SBryan Drewery.if defined(HTML) 324ae038fc3SBryan DreweryCLEANDEPENDDIRS+= HTML 325ae038fc3SBryan Drewery.endif 326ae038fc3SBryan Drewery.else 327ae038fc3SBryan DreweryCLEANDEPENDFILES+= tags 328ae038fc3SBryan Drewery.endif 3293d437ee2SBryan Drewery.endif 330cd9a2f5cSJordan K. Hubbard.if !target(cleandepend) 331b25a566dSRuslan Ermilovcleandepend: 3323d437ee2SBryan Drewery.if !empty(CLEANDEPENDFILES) 333ae038fc3SBryan Drewery rm -f ${CLEANDEPENDFILES} 3343d437ee2SBryan Drewery.endif 335ae038fc3SBryan Drewery.if !empty(CLEANDEPENDDIRS) 336ae038fc3SBryan Drewery rm -rf ${CLEANDEPENDDIRS} 3376eb5e456SJordan K. Hubbard.endif 338cd9a2f5cSJordan K. Hubbard.endif 339190348aeSBryan Drewery.ORDER: cleandepend all 340190348aeSBryan Drewery.ORDER: cleandepend depend 341b284f322SBryan Drewery.if ${MK_AUTO_OBJ} == "yes" 342b284f322SBryan Drewery.ORDER: cleanobj depend 343b284f322SBryan Drewery.ORDER: cleandir depend 344b284f322SBryan Drewery.endif 3456e02167bSRuslan Ermilov 3466e02167bSRuslan Ermilov.if !target(checkdpadd) && (defined(DPADD) || defined(LDADD)) 34741ae64f3SEnji Cooper_LDADD_FROM_DPADD= ${DPADD:R:T:C;^lib(.*)$;-l\1;g} 34841ae64f3SEnji Cooper# Ignore -Wl,--start-group/-Wl,--end-group as it might be required in the 34941ae64f3SEnji Cooper# LDADD list due to unresolved symbols 35041ae64f3SEnji Cooper_LDADD_CANONICALIZED= ${LDADD:N:R:T:C;^lib(.*)$;-l\1;g:N-Wl,--[es]*-group} 3516e02167bSRuslan Ermilovcheckdpadd: 3522e3c6179SBruce Evans.if ${_LDADD_FROM_DPADD} != ${_LDADD_CANONICALIZED} 3532e3c6179SBruce Evans @echo ${.CURDIR} 3542e3c6179SBruce Evans @echo "DPADD -> ${_LDADD_FROM_DPADD}" 3552e3c6179SBruce Evans @echo "LDADD -> ${_LDADD_CANONICALIZED}" 3562e3c6179SBruce Evans.endif 3576e02167bSRuslan Ermilov.endif 358