makedepend for C++?
Marco S Hyman
marc at dumbcat.sf.ca.us
Fri Nov 30 16:43:49 AEST 1990
In article <TIM.90Nov26000013 at liberty.cs.columbia.edu> tim at cs.columbia.edu writes:
Does anyone know if there's a version of makedepend(1) for UNIX that
knows how to deal with C++?
Don't know if this is close to makedepend(1) (it's not on any machine that I
use) but this script works fine for me.
#! /bin/sh
# @(#) $Id: mkdep,v 1.4 90/05/09 20:19:19 marc Exp $
#
# Make C++ dependencies. This script depends upon the -H option built
# into cpp in System V unix. Note: some CC shell scripts do not process
# -H properly, i.e. they do not pass it to cpp. If this happens you will
# see an error message from patch or munch. If this happens edit your CC
# script to pass -H to cpp.
#
# BSD users can try the -M option to cpp and then modify the script to parse
# -M output. The Sun cpp will process the -H option and the script might
# work as is.
CC=${CC-CC} # use CC unless ${CC} set in environment
# process all files on the command line. Abort if no files passed
if [ "$1" = "" ]; then
exit 1
fi
for file do
${CC} -E -H $file 2>&1 >/dev/null |
grep '^\./' |
sed "s;^\./;$file: ;"
done |
sort |
uniq |
sed 's/\(.*\)\.cc: \(.*\)/\1.o: \2/' |
awk ' { if ($1 != prev) {
print rec;
rec = $0;
prev = $1
} else {
if (length(rec $2) > 72) {
print rec;
rec = $0
} else {
rec = rec " " $2
}
}
}
END { print rec } '
// marc
--
// marc at dumbcat.sf.ca.us
// {ames,decwrl,sun}!pacbell!dumbcat!marc
More information about the Comp.unix.programmer
mailing list