tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

rfc: bsd.tags.mk: recursive tags target



I've been using an include file (bsd.tags.mk, attached) to add a
recursive tags target to most of my C projects for the last several
years.  That is, I can type 'make tags' at the top directory of a
project, and that way create 'tags' for every descendant directory,
and create top-level 'tags'.  Each directory's tags file contains that
directory's tags and tags for all of the descendant directories.

I thought that it would be helpful for NetBSD to distribute it in
/usr/share/mk/.  Comments?

bsd.tags.mk derives from other include files in /usr/share/mk/, and
I'm sure that other developers have helped me to refine it over the
years.  All bugs are mine.  Maybe some make(1) wizard can point out
where bsd.tags.mk is fragile.

Dave

-- 
David Young             OJC Technologies
dyoung%ojctech.com@localhost      Urbana, IL * (217) 278-3933
# $Id: tags.mk 5302 2010-09-02 18:33:07Z dyoung-ojc $

###
### Create tags files throughout the source tree.
###
.if defined(SRCS) || defined(INCS)
do-tags: $(SRCS) $(INCS)
        @$(TOOL_CTAGS) -twd -f $(.CURDIR)/tags $(.ALLSRC)

.else
do-tags:
        @touch $(.CURDIR)/tags
.endif

CLEANFILES+= $(.CURDIR)/tags

.if defined(__REALSUBDIR)
.for dir in $(__REALSUBDIR)
__TARGDIR := $(dir)
.if $(__TARGDIR) != ".WAIT"
tags-$(dir): do-tags
tags: tags-$(dir)
.endif
.endfor
.for dir in $(__REALSUBDIR)
__TARGDIR := $(dir)
.if $(__TARGDIR) != ".WAIT"
SUBDIR_TAGS:=$(SUBDIR_TAGS) $(.CURDIR)/$(__TARGDIR)/tags
.endif
.endfor
tags:
        @sort -m -o $(.CURDIR)/tags $(SUBDIR_TAGS)
.else
tags: do-tags
.endif


Home | Main Index | Thread Index | Old Index