[comp.unix.wizards] Installing 4.3BSD

roy@phri.UUCP (Roy Smith) (01/20/87)

	We're currently running 4.2, with non-standard disk partitions on
our RA-81 disk.  We just got the 4.3 tapes and I started to get to work
installing it.  Following the instructions for upgrading a 4.2 system, I
copied the 4.3 /usr file system to an empty partition and changed the
partition table in the 4.3 ra driver and ran config.  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 (or seems to work; it booted, but I didn't give it much
of a workout).  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?  I know this will waste a lot of time compiling stuff I don't have
to, but I only have to do it once and it seems faster than dumping and
restoring my whole disk.
-- 
Roy Smith, {allegra,cmcl2,philabs}!phri!roy
System Administrator, Public Health Research Institute
455 First Avenue, New York, NY 10016

"you can't spell deoxyribonucleic without unix!"

chris@mimsy.UUCP (Chris Torek) (01/22/87)

In article <2565@phri.UUCP> roy@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@mimsy.umd.edu