Installing 4.3BSD (Make depend)

Chris Torek chris at mimsy.UUCP
Fri Jan 23 04:24:30 AEST 1987


In article <2565 at phri.UUCP> roy at phri.UUCP (Roy Smith) writes:
>... Following the instructions for upgrading a 4.2 system [to 4.3BSD] ...
>The problem is when I do a "make depend" (we're still running 4.2),
>our c compiler ignores the "-M" flag (to generate the dependancy lists)
>and just starts compiling all the code.  Arghhh!

>The funny thing is that when I let make finish, I get a bootable
>vmunix that works....  Is it safe to assume that if I do a "make
>clean" and then a "make vmunix", everything will get done right
>even if "make depend" didn't get run?

In short:  Yes.

In longer words, here is a shell script that should work under 4BSD
that does what `cc -M' does.  It would be nice if we had used
`makedep' or `getdep' or something other than `cc -M' in all the
makefiles in 4.3, but none of us thought of it.  Ah well.  You could
always make `/bin/cc' a shell script similar to the one below,
and trap the -M option there.

: 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)
UUCP:	seismo!mimsy!chris	ARPA/CSNet:	chris at mimsy.umd.edu



More information about the Comp.unix.wizards mailing list