From 64dd2ee656bb0005524d781c28e4c227d6bc5a22 Mon Sep 17 00:00:00 2001 From: ru Date: Thu, 17 Oct 2002 13:48:13 +0000 Subject: Added the new variable CTAGS which, if set to "ctags", reverts to creating the tags file using ctags(1). Defaults to "gtags". Made GTAGSFLAGS and HTAGSFLAGS overrideable, added CTAGSFLAGS. Folded bsd.prog.mk version of `tags' into bsd.dep.mk. PR: bin/42852 --- share/mk/bsd.dep.mk | 54 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 17 deletions(-) (limited to 'share/mk/bsd.dep.mk') diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk index fc6ed71..70e54f6 100644 --- a/share/mk/bsd.dep.mk +++ b/share/mk/bsd.dep.mk @@ -5,8 +5,16 @@ # # +++ variables +++ # +# CTAGS A tags file generation program [gtags] +# +# CTAGSFLAGS Options for ctags(1) [not set] +# # DEPENDFILE dependencies file [.depend] # +# GTAGSFLAGS Options for gtags(1) [-o] +# +# HTAGSFLAGS Options for htags(1) [not set] +# # MKDEP Options for ${MKDEPCMD} [not set] # # MKDEPCMD Makefile dependency list program [mkdep] @@ -24,13 +32,20 @@ # them in the file ${DEPENDFILE}. # # tags: -# Create a (GLOBAL) gtags file for the source files. -# If HTML is defined, htags is also run after gtags. +# In "ctags" mode, create a tags file for the source files. +# In "gtags" mode, create a (GLOBAL) gtags file for the +# source files. If HTML is defined, htags(1) is also run +# after gtags(1). .if !target(____) .error bsd.dep.mk cannot be included directly. .endif +CTAGS?= gtags +CTAGSFLAGS?= +GTAGSFLAGS?= -o +HTAGSFLAGS?= + .if ${CC} != "cc" MKDEPCMD?= CC='${CC}' mkdep .else @@ -38,6 +53,20 @@ MKDEPCMD?= mkdep .endif DEPENDFILE?= .depend +# Keep `tags' here, before SRCS are mangled below for `depend'. +.if !target(tags) && defined(SRCS) && !defined(NOTAGS) +tags: ${SRCS} +.if ${CTAGS:T} == "ctags" + @${CTAGS} ${CTAGSFLAGS} -f /dev/stdout \ + ${.ALLSRC:N*.h} | sed "s;${.CURDIR}/;;" > ${.TARGET} +.elif ${CTAGS:T} == "gtags" + @cd ${.CURDIR} && ${CTAGS} ${GTAGSFLAGS} ${.OBJDIR} +.if defined(HTML) + @cd ${.CURDIR} && htags ${HTAGSFLAGS} -d ${.OBJDIR} ${.OBJDIR} +.endif +.endif +.endif + .if defined(SRCS) CLEANFILES?= @@ -128,25 +157,16 @@ afterdepend: .endif .endif -.if defined(NOTAGS) -tags: -.endif - -.if !target(tags) -tags: ${SRCS} - @cd ${.CURDIR} && gtags ${GTAGSFLAGS} ${.OBJDIR} -.if defined(HTML) - @cd ${.CURDIR} && htags ${HTAGSFLAGS} -d ${.OBJDIR} ${.OBJDIR} -.endif -.endif - .if !target(cleandepend) cleandepend: .if defined(SRCS) - rm -f ${DEPENDFILE} ${.OBJDIR}/GPATH ${.OBJDIR}/GRTAGS \ - ${.OBJDIR}/GSYMS ${.OBJDIR}/GTAGS +.if ${CTAGS:T} == "ctags" + rm -f ${DEPENDFILE} tags +.elif ${CTAGS:T} == "gtags" + rm -f ${DEPENDFILE} GPATH GRTAGS GSYMS GTAGS .if defined(HTML) - rm -rf ${.OBJDIR}/HTML + rm -rf HTML +.endif .endif .endif .endif -- cgit v1.1