11541Srgrimes#! /bin/sh
21541Srgrimes#
31541Srgrimes# Copyright (c) 1992, 1993
41541Srgrimes#	The Regents of the University of California.  All rights reserved.
51541Srgrimes#
61541Srgrimes# Redistribution and use in source and binary forms, with or without
71541Srgrimes# modification, are permitted provided that the following conditions
81541Srgrimes# are met:
91541Srgrimes# 1. Redistributions of source code must retain the above copyright
101541Srgrimes#    notice, this list of conditions and the following disclaimer.
111541Srgrimes# 2. Redistributions in binary form must reproduce the above copyright
121541Srgrimes#    notice, this list of conditions and the following disclaimer in the
131541Srgrimes#    documentation and/or other materials provided with the distribution.
141541Srgrimes# 4. Neither the name of the University nor the names of its contributors
151541Srgrimes#    may be used to endorse or promote products derived from this software
161541Srgrimes#    without specific prior written permission.
171541Srgrimes#
181541Srgrimes# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
191541Srgrimes# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
201541Srgrimes# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
211541Srgrimes# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
221541Srgrimes# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
231541Srgrimes# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
241541Srgrimes# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
251541Srgrimes# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
261541Srgrimes# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
271541Srgrimes# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
281541Srgrimes# SUCH DAMAGE.
291541Srgrimes#
301541Srgrimes#	@(#)systags.sh	8.1 (Berkeley) 6/10/93
3150477Speter# $FreeBSD: stable/11/sys/conf/systags.sh 357332 2020-01-31 12:39:51Z nyan $
321541Srgrimes#
331541Srgrimes# systags.sh - construct a system tags file using dependence relations
341541Srgrimes#	in a .depend file
351541Srgrimes#
361541Srgrimes# First written May 16, 1992 by Van Jacobson, Lawrence Berkeley Laboratory.
371541Srgrimes
381541Srgrimesrm -f tags tags.tmp tags.cfiles tags.sfiles tags.hfiles
39153067Srused -e "s, machine/, ../../include/,g" \
40357332Snyan	-e 's,[a-z][^/    ]*/\.\./,,g' .depend.* | awk '{
411541Srgrimes		for (i = 1; i <= NF; ++i) {
421541Srgrimes			t = substr($i, length($i) - 1)
431541Srgrimes			if (t == ".c")
441541Srgrimes				cfiles[$i] = 1;
451541Srgrimes			else if (t == ".h")
461541Srgrimes				hfiles[$i] = 1;
47357332Snyan			else if (t == ".s" || t == ".S")
481541Srgrimes				sfiles[$i] = 1;
491541Srgrimes		}
501541Srgrimes	};
511541Srgrimes	END {
521541Srgrimes		for (i in cfiles)
531541Srgrimes			print i > "tags.cfiles";
541541Srgrimes		for (i in sfiles)
551541Srgrimes			print i > "tags.sfiles";
561541Srgrimes		for (i in hfiles)
571541Srgrimes			print i > "tags.hfiles";
581541Srgrimes	}'
591541Srgrimes
601541Srgrimesctags -t -d -w `cat tags.cfiles tags.hfiles tags.sfiles`
6148440Sjkhegrep "^ENTRY\(.*\)|^ALTENTRY\(.*\)" `cat tags.sfiles` | \
621541Srgrimes    sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3	\1	/^\2(\3\4$/;" >> tags
631541Srgrimes
641541Srgrimesmv tags tags.tmp
651541Srgrimessort -u tags.tmp > tags
661541Srgrimesrm tags.tmp tags.cfiles tags.sfiles tags.hfiles
67