diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk index 6fec68b6e7cd..99fc97257748 100644 --- a/share/mk/bsd.dep.mk +++ b/share/mk/bsd.dep.mk @@ -5,6 +5,11 @@ # # +++ variables +++ # +# CLEANDEPENDDIRS Additional directories to remove for the cleandepend +# target. +# +# CLEANDEPENDFILES Additional files to remove for the cleandepend target. +# # CTAGS A tags file generation program [gtags] # # CTAGSFLAGS Options for ctags(1) [not set] @@ -27,7 +32,8 @@ # +++ targets +++ # # cleandepend: -# Remove depend and tags file +# remove ${CLEANDEPENDFILES}; remove ${CLEANDEPENDDIRS} and all +# contents. # # depend: # Make the dependencies for the source files, and store @@ -59,7 +65,7 @@ DEPENDFILE?= .depend .if ${MK_DIRDEPS_BUILD} == "no" .MAKE.DEPENDFILE= ${DEPENDFILE} .endif -DEPENDFILES= ${DEPENDFILE} ${DEPENDFILE}.* +CLEANDEPENDFILES= ${DEPENDFILE} ${DEPENDFILE}.* # Keep `tags' here, before SRCS are mangled below for `depend'. .if !target(tags) && defined(SRCS) && !defined(NO_TAGS) @@ -252,16 +258,20 @@ afterdepend: .endif .endif +.if ${CTAGS:T} == "gtags" +CLEANDEPENDFILES+= GPATH GRTAGS GSYMS GTAGS +.if defined(HTML) +CLEANDEPENDDIRS+= HTML +.endif +.else +CLEANDEPENDFILES+= tags +.endif .if !target(cleandepend) cleandepend: .if defined(SRCS) -.if ${CTAGS:T} == "gtags" - rm -f ${DEPENDFILES} GPATH GRTAGS GSYMS GTAGS -.if defined(HTML) - rm -rf HTML -.endif -.else - rm -f ${DEPENDFILES} tags + rm -f ${CLEANDEPENDFILES} +.if !empty(CLEANDEPENDDIRS) + rm -rf ${CLEANDEPENDDIRS} .endif .endif .endif