#ident	"@(#)genheaders	1.5	99/03/22 SMI"
#
# Copyright (c) 1998-1999 by Sun Microsystems, Inc.
# All rights reserved.
#
# uts/common/io/llc2/genheaders
#
# To generate header files for LLC2 tracing.
#

CTAGS=ctags
AWK=awk
SORT=sort
BASENAME=basename

#
# The following will generate a C structure which contains the ctags
# info on a LLC2 source file.  It is used by llc2_tparser for finding
# the function name given a line number in the source file.
#

echo "/*"
echo " * Copyright (c) 1999 by Sun Microsystems, Inc."
echo " * All rights reserved."
echo " */"
echo
echo "/*"
echo " * This header file is automatically generated by"
echo " * usr/src/cmd/llc2/bin/genheaders.  DO NOT MODIFY!"
echo " */"
echo

echo "static struct func_table `$BASENAME $@ .c`_ftbl[] = {"
$CTAGS -w -x "$@" | \
	$AWK '{printf("\t{\"%s\", %s},\n",$1,$2);}' | \
	$SORT -t \, -n -r +1
echo "};"
