diff options
author | ru <ru@FreeBSD.org> | 2002-10-17 13:48:13 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2002-10-17 13:48:13 +0000 |
commit | 64dd2ee656bb0005524d781c28e4c227d6bc5a22 (patch) | |
tree | 9d155f4e09a9ac61c84d0128e618472317b061de | |
parent | d91054229567b7e8d98914d2335b054dac2635fe (diff) | |
download | FreeBSD-src-64dd2ee656bb0005524d781c28e4c227d6bc5a22.zip FreeBSD-src-64dd2ee656bb0005524d781c28e4c227d6bc5a22.tar.gz |
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
-rw-r--r-- | share/mk/bsd.dep.mk | 54 | ||||
-rw-r--r-- | share/mk/bsd.prog.mk | 14 | ||||
-rw-r--r-- | share/mk/sys.mk | 4 |
3 files changed, 37 insertions, 35 deletions
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(__<bsd.init.mk>__) .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 diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index ff1a708..19e5fd4 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -163,20 +163,6 @@ lint: ${SRCS:M*.c} .endif .endif -.if defined(NOTAGS) -tags: -.endif - -.if !target(tags) -tags: ${SRCS} -.if defined(PROG) - @cd ${.CURDIR} && gtags ${GTAGSFLAGS} ${.OBJDIR} -.if defined(HTML) - @cd ${.CURDIR} && htags ${HTAGSFLAGS} -d ${.OBJDIR} ${.OBJDIR} -.endif -.endif -.endif - .if !defined(NOMAN) .include <bsd.man.mk> .endif diff --git a/share/mk/sys.mk b/share/mk/sys.mk index ae84263..6a31090 100644 --- a/share/mk/sys.mk +++ b/share/mk/sys.mk @@ -108,10 +108,6 @@ YFLAGS ?= -d # as an i386 architecture. MACHINE_ARCH ?= i386 -# For tags rule. -GTAGSFLAGS= -o -HTAGSFLAGS= - .if defined(%POSIX) # Posix 1003.2 mandated rules # |