4.1cBSD/a/sys/conf/makefile.vax

#	makefile.vax	4.4	12/17/82
#
# Makefile for 4.1c bsd
#
# This makefile is constructed from a machine description:
#	config machine
# Most changes should be made in the machine description
#	/usr/sys/conf/``machineid''
# after which you should do
#	 config machineid
# Generic makefile changes should be made in
#	/usr/sys/conf/makefile
# after which config should be rerun for all machines.
#
# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
#
# -DTRACE	compile in kernel tracing hooks
#
C2=	/lib/c2
LD=	/bin/ld
TOUCH=	touch -f -c

COPTS=	${IDENT} -DKERNEL
CFLAGS=	-O ${COPTS}

AHEADS=	../vax/pcb.m

%OBJS

%CFILES

%LOAD

clean:
	rm -f eddep *vmunix* tags *.o locore.i [a-tv-z]*.s \
		errs linterrs makelinks

lint: /tmp
	@lint -hbxn -I. -DGENERIC ${COPTS} ../vax/Locore.c \
	  ${CFILES} ../vax/swapgeneric.c ioconf.c | \
	    grep -v 'struct/union .* never defined' | \
	    grep -v 'possible pointer alignment problem'

../conf/symbols.sort: ../conf/symbols.raw
	grep -v '^#' ../conf/symbols.raw \
	    | sed 's/^	//' | sort -u > ../conf/symbols.sort

locore.o: assym.s ${AHEADS} ../vax/scb.s ../vax/locore.s ubglue.s \
    ../vax/mtpr.h ../vax/trap.h ../machine/psl.h ../machine/pte.h \
    ../vax/cpu.h mba.h
	cat assym.s ../vax/scb.s ../vax/locore.s ubglue.s > locore.c
	cc -E -I. -DLOCORE ${COPTS} locore.c > locore.i
	@echo 'as -o locore.o $${AHEADS} locore.i'
	@as -o locore.o ${AHEADS} locore.i
	@rm locore.i

# the following is necessary because autoconf.o depends on #if GENERIC
autoconf.o tu.o: makefile

# the following are necessary because the files depend on the types of
# vax cpu's included in the system configuration
clock.o machdep.o autoconf.o conf.o cons.o flp.o mba.o uba.o vaxcpu.o : makefile
# depend on network configuration
af.o : makefile

assym.s: ../h/param.h ../machine/pte.h ../h/buf.h ../h/vmparam.h \
    ../h/vmmeter.h ../h/dir.h ../h/cmap.h ../h/map.h ../vaxuba/ubavar.h \
    ../h/proc.h ../h/msgbuf.h
	cc ${IDENT} ../vax/genassym.c; ./a.out >assym.s; rm -f a.out

../h/param.h: /usr/include/signal.h
	${TOUCH} ../h/param.h
../h/tty.h:  ../h/ttychars.h ../h/ttydev.h
	${TOUCH} ../h/tty.h
../h/ioctl.h: /usr/include/sgtty.h ../h/ttychars.h ../h/ttydev.h
	${TOUCH} ../h/ioctl.h
../h/user.h: ../vax/pcb.h ../h/dmap.h ../h/types.h \
    /usr/include/errno.h
	${TOUCH} ../h/user.h
../h/vm.h: ../h/vmmac.h ../h/vmmeter.h ../h/vmparam.h ../h/vmsystm.h
	${TOUCH} ../h/vm.h

depend:
	grep '^#include' ${CFILES} | grep -v '<' | \
	      sed 's/:[^"]*"\([^"]*\)".*/: \1/' | \
	      sed 's/\.c/.o/' | sed 's,../[a-z]*/,,' | \
	awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \
		else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
		       else rec = rec " " $$2 } } \
	      END { print rec } ' > makedep
	echo '$$r makedep' >>eddep
	echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
	echo '$$r makedep' >>eddep
	echo 'w' >>eddep
	cp makefile makefile.bak
	ed - makefile < eddep
	rm eddep makedep


links:
	egrep '#if' ${CFILES} | sed -f ../conf/defines | \
	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
	  sort -u | comm -23 - dontlink | \
	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
	echo 'rm -f udiv.o;ln -s ../GENERIC/udiv.o udiv.o' >> makelinks
	echo 'rm -f urem.o;ln -s ../GENERIC/urem.o urem.o' >> makelinks
	sh makelinks && rm -f dontlink

tags:
	/usr/ucb/ctags ${CFILES}

print:
	@pr -f makefile ../sys/TODO linterrs
	@/usr/ucb/ctags -x ${CFILES} | pr -f -h XREF
	@(size vmunix *.o) | pr -f -h sizes
	@ls -ls | pr -f
	@cd ../h; ls -ls | pr -f ; pr -f *.m *.h
	@echo 'once upon a time ...'
	@cd ../sys; pr -f asm.sed Locore.c scb.s locore.s
	@pr -f ${CFILES}

ioconf.o: ioconf.c ../h/param.h ../machine/pte.h ../h/buf.h ../h/map.h \
    ../vaxmba/mbavar.h ../h/vm.h ../vaxuba/ubavar.h
	${CC} -I. -c -S ${COPTS} ioconf.c
	${C2} ioconf.s | sed -f ../vax/asm.sed | ${AS} -o ioconf.o
	rm -f ioconf.s

param.c: ../conf/param.c
	cp ../conf/param.c .

param.o: param.c makefile
	${CC} -I. -c ${CFLAGS} ${PARAM} param.c

%RULES

# DO NOT DELETE THIS LINE -- make depend uses it