Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.unix.wizards Subject: Re: RCS vs. SCCS and make Message-ID: <7129@mimsy.UUCP> Date: Thu, 18-Jun-87 18:05:26 EDT Article-I.D.: mimsy.7129 Posted: Thu Jun 18 18:05:26 1987 Date-Received: Sun, 21-Jun-87 15:06:12 EDT References: <41@esosun.UUCP> <20393@sun.uucp> <42@loki.esosun.UUCP> <392@rocksanne.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 66 In article <392@rocksanne.UUCP> mayer@rocksanne.UUCP (Jim Mayer) writes: > -I|-o) > options="$options $1 ${2?No second argument for -I}" > shift; shift The -I flag takes the include path without a space, i.e., cc -I. -I../h foo.c so this should be modified a bit. > object=`expr "$file" : "\(.*\)\..*"`.o > if test ".o" = "$object" > then > object="$file.o" > fi > cc $options -E $file | sed -n -e "s/^# 1 \"\(.*\)\"\$/$object: \1/p" This last fails if "$file" contains slashes: ... -I. -I../h ../gorp/foo.c Here is the script I provide with the current ctex. I avoided `cc -E', assuming that the -E option may not exist in some `cc's. It should be obvious how to change this as appropriate for your system. The dependency extraction scheme here is rather more complex, so as to depend less upon whatever features are peculiar to the Reiser cpp. Whether it will be successful is another matter. : getdep - get dependency lists. : change ":" comments to "#" comments if your shell supports those; : the result will run faster. : find cpp cpp=unknown for where in /lib /usr/lib /bin /usr/bin; do if test -f $where/cpp; then cpp=$where/cpp; break; fi done if test $cpp = unknown; then echo "I cannot find cpp, sorry" 1>&2; exit 1 fi : handle arguments incl= for i do case "$i" in -I*) incl="$incl $i";; *) : assume source file : put '$dep' in front of dependencies dep=`echo "$i" | sed -e 's,/,\\\\/,g' -e 's/\.c$/.o/'` : Find includes, remove leading numerics, remove ./, : remove double quotes, and remove trailing numerics. : Sort that, discarding duplicates, and add '$dep'. $cpp $incl "$i" | grep "^#" | sed -e 's/# [0-9]* //' -e 's,"./,",' -e 's/"\(.*\)"/\1/' \ -e 's/ [ 0-9]*$//' | sort -u | sed -e "s/^/$dep: /";; esac done -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690) Domain: chris@mimsy.umd.edu Path: seismo!mimsy!chris