#!/bin/sh ############################################################################### if [ "${#}" != "2" ] then echo "`basename $0`: usage: object-directory output-file" >&2 exit 1 fi OBJECTS="${1}" SHORTFILE="${2}" find "${OBJECTS}" -name '*.o' -print -exec nm '{}' ';' | awk ' BEGIN { printf ("/* Automatically generated by 'build_shortnames'. */\n"); } $1 ~ /\.o$/ { printf ("/* From file '%s': */\n", $1); } $2 ~ /^[TSDCB]$/ { printf ("#define %s I%05d\n", substr ($3, 2), id ++); }' > ${SHORTFILE}