Hi all, In the process of hacking on Kaffe, I've been trying to get lots of the tools (well, hacks) I'm used to working with it. Here's another one. Attached is a makefile I took from one of our internal projects that generates an TAGS file (in emacs-friendly format) and/or a glimpse index of a source tree. Its fairly generic, and can be used for other projects, with only minor changes. It creates a TAGS file if given the 'tags' target. If given the 'glimpse' target it will create a script (kglimpse) that uses a glimpse generated index of the source to find all matches (e.g. "kglimpse lookupClass" will return a list of all files that contain the string lookupClass.) Glimpse has lots of options (like looking for spelling variations, or only in certain files, etc.) See http://donkey.cs.arizona.edu/index.html for more info on glimpse. -Pat ## ## usage: ## cd ## make -f ## ## the glimpse target will create a script called kglimpse ## which is like a really fast dir-tree grep. For more info ## on glimpse, see http://donkey.cs.arizona.edu/index.html. ## ## the tags/TAGS target will make an emacs TAGS file. ## ## Hacked by Pat Tullmann from a Makefile originally written ## by Bart Robinson. Send comments and bug fixes to ## Pat Tullmann . ## # Directories to search and include in glimpse and TAGS dirs = . # Name of glimpse script to create out = kglimpse ## Some programs that might be site specific ETAGS= etags -a GLIMPSEINDEX= glimpseindex GINDEXOPTS=-B -M 4 -H . GLIMPSE= glimpse GOPTS=-ynH default: @echo "Make 'tags' or 'glimpse'" ## --- TAGS: tags ## Note that the grep -v drops out all the config files to avoid multiple ## defines. The correct file will be included (probably) via dynamic links (?) tags: rm -f TAGS find $(dirs) \ -name '.*' \ -o -name '*.[ch]' -print | grep -v "^./config" | xargs $(ETAGS) ## --- .PHONY: index $(out) glimpse: index $(out) index: $(GLIMPSEINDEX) $(GINDEXOPTS) $(dirs) chmod 664 .gl* $(out): @echo >$(out) "#!/bin/sh" @echo >>$(out) "dir=`pwd`" @echo >>$(out) 'if [ "x$$1" = x-Z ]; then' @echo >>$(out) ' filter=cat' @echo >>$(out) ' shift' @echo >>$(out) 'else' @echo >>$(out) ' # Quote "+" and "." regexp magic chars.' @echo >>$(out) ' xdir=`echo $$dir | perl -pe "s,([+.]),\"\134$$1\",ge"`' @echo >>$(out) ' filter="sed s,^$$xdir/,,"' @echo >>$(out) 'fi' @echo >>$(out) '$(GLIMPSE) $(GOPTS) $$dir "$$@" | $$filter' @chmod +x $(out) @echo "created \"$(out)\""