From: Chris Hanson Date: Sat, 27 Feb 2016 22:11:45 +0000 (-0800) Subject: Refactor TAGS generation. X-Git-Tag: mit-scheme-pucked-9.2.12~261^2~121 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=3fbf4c5223cf1b0e056da14e43a88972b6ac6970;p=mit-scheme.git Refactor TAGS generation. * Now works in unconfigured src directory. * Generates top-level TAGS file. * Includes .pkg files. --- diff --git a/src/TAGS b/src/TAGS deleted file mode 100644 index e0668593b..000000000 --- a/src/TAGS +++ /dev/null @@ -1,18 +0,0 @@ - -runtime/TAGS,include - -microcode/TAGS,include - -edwin/TAGS,include - -compiler/TAGS,include - -6001/TAGS,include - -sf/TAGS,include - -cref/TAGS,include - -rcs/TAGS,include - -ffi/TAGS,include diff --git a/src/Tags.sh b/src/Tags.sh index db7bb11e1..b241bcea8 100755 --- a/src/Tags.sh +++ b/src/Tags.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -25,7 +25,51 @@ # Utility to make TAGS files for MIT/GNU Scheme build directories. # The working directory must be the top-level source directory. -for SUBDIR; do +set -e + +DEFAULT_SUBDIRS=( \ + 6001 \ + blowfish \ + compiler \ + cref \ + edwin \ + ffi \ + gdbm \ + imail \ + mcrypt \ + md5 \ + mhash \ + microcode \ + rcs \ + sf \ + sos \ + ssp \ + star-parser \ + win32 \ + xdoc \ + xml \ +) + +SUBDIRS=("${@}") +if (( ${#SUBDIRS[@]} == 0 )); then + SUBDIRS=("${DEFAULT_SUBDIRS[@]}") +fi + +for SUBDIR in "${SUBDIRS[@]}"; do echo "making TAGS in ${SUBDIR}" - ( cd ${SUBDIR} && ./Tags.sh ) || exit 1 + if [[ -x ${SUBDIR}/Tags.sh ]]; then + SCRIPT_LOC=. + else + SCRIPT_LOC=../etc + fi + ( cd ${SUBDIR} && ${SCRIPT_LOC}/Tags.sh ) || exit 1 done + +function write_entries () +{ + for SUBDIR in "${SUBDIRS[@]}"; do + echo -e "\f" + echo "${SUBDIR}"/TAGS,include + done +} +write_entries > TAGS diff --git a/src/compiler/Tags.sh b/src/compiler/Tags.sh index ef425e7ea..ad107c3e4 100755 --- a/src/compiler/Tags.sh +++ b/src/compiler/Tags.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -25,5 +25,13 @@ # Utility to make TAGS file for the MIT/GNU Scheme compiler directory. # The working directory must be the compiler directory. -etags back/*.scm base/*.scm fggen/*.scm fgopt/*.scm machine/*.scm \ - rtlbase/*.scm rtlgen/*.scm rtlopt/*.scm +set -e + +if [[ -d machine ]]; then + MACHINES=(machine/*.scm machine/*.pkg) +else + MACHINES=(machines/*/*.scm machines/*/*.pkg) +fi + +etags back/*.scm base/*.scm fggen/*.scm fgopt/*.scm \ + rtlbase/*.scm rtlgen/*.scm rtlopt/*.scm "${MACHINES[@]}" diff --git a/src/etc/Tags.sh b/src/etc/Tags.sh index dd089de78..cc381fdb4 100755 --- a/src/etc/Tags.sh +++ b/src/etc/Tags.sh @@ -25,4 +25,4 @@ # Utility to make TAGS file for an MIT/GNU Scheme build directory. # The working directory must be the build directory. -etags *.scm +etags *.scm *.pkg diff --git a/src/microcode/Tags.sh b/src/microcode/Tags.sh index 600128709..bde448079 100755 --- a/src/microcode/Tags.sh +++ b/src/microcode/Tags.sh @@ -3,4 +3,8 @@ # Utility to make TAGS file for the MIT/GNU Scheme MICROCODE build # directory. The working directory must be the build directory. -make tags +REGEX1='/^DEF[A-Z0-9_]*[ \t]*(\("[^"]+"\|[a-zA-Z_][a-zA-Z0-9_]*\)/' +REGEX2='/^DEF[A-Z0-9_]*[ \t]*\(("[^"]+"|[a-zA-Z_][a-zA-Z0-9_]+)/\1/' + +etags -r "${REGEX1}" *.[ch] */*.[ch] \ + || etags --regex-C="${REGEX2}" *.[ch] */*.[ch] diff --git a/src/microcode/makegen/Makefile.in.in b/src/microcode/makegen/Makefile.in.in index 20bbbce0f..20b979072 100644 --- a/src/microcode/makegen/Makefile.in.in +++ b/src/microcode/makegen/Makefile.in.in @@ -221,11 +221,7 @@ prx11.so: prx11.o x11base.o x11color.o x11graph.o x11term.o @MODULE_LOADER@ tags: TAGS TAGS: - etags -r '/^DEF[A-Z0-9_]*[ \t]*(\("[^"]+"\|[a-zA-Z_][a-zA-Z0-9_]*\)/' \ - *.[ch] */*.[ch] \ - || etags \ - --regex-C='/^DEF[A-Z0-9_]*[ \t]*\(("[^"]+"|[a-zA-Z_][a-zA-Z0-9_]+)/\1/'\ - *.[ch] */*.[ch] + ./Tags.sh mostlyclean: -rm -f $(MOSTLYCLEAN_FILES)