Makefile.vax revision 1.37
11.37Sthorpej#	$NetBSD: Makefile.vax,v 1.37 1997/11/12 22:26:42 thorpej Exp $
21.4Scgd
31.16Smycroft# Makefile for NetBSD
41.1Sragge#
51.1Sragge# This makefile is constructed from a machine description:
61.1Sragge#	config machineid
71.1Sragge# Most changes should be made in the machine description
81.16Smycroft#	/sys/arch/vax/conf/``machineid''
91.1Sragge# after which you should do
101.16Smycroft#	config machineid
111.1Sragge# Machine generic makefile changes should be made in
121.16Smycroft#	/sys/arch/vax/conf/Makefile.vax
131.1Sragge# after which config should be rerun for all machines of that type.
141.1Sragge#
151.1Sragge# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
161.1Sragge#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
171.1Sragge#
181.1Sragge# -DTRACE	compile in kernel tracing hooks
191.1Sragge# -DQUOTA	compile in file system quotas
201.16Smycroft
211.16Smycroft# DEBUG is set to -g if debugging.
221.16Smycroft# PROF is set to -pg if profiling.
231.16Smycroft
241.19SmycroftCC?=	cc
251.19SmycroftLD?=	ld
261.37SthorpejLORDER?=lorder
271.23SmycroftMKDEP?=	mkdep
281.37SthorpejNM?=	nm
291.34SlukemSIZE?=	size
301.27SmycroftSTRIP?=	strip
311.37SthorpejTSORT?=	tsort -q
321.34SlukemCOPTS?= -O2
331.1Sragge
341.16Smycroft# source tree is located via $S relative to the compilation directory
351.26Smycroft.ifndef S
361.23SmycroftS!=	cd ../../../..; pwd
371.26Smycroft.endif
381.23SmycroftVAX=	$S/arch/vax
391.1Sragge
401.24SmycroftINCLUDES=	-I. -I$S/arch -I$S -nostdinc
411.25SmycroftCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
421.25Smycroft		-D_VAX_INLINE_
431.23SmycroftCWARNFLAGS=	-Werror
441.28SjonathanCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS}
451.18SmycroftAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
461.16SmycroftLINKFLAGS=	-Z -Ttext 80000000 -e _start
471.27SmycroftSTRIPFLAGS=	-d
481.27Smycroft
491.27SmycroftHOSTED_CC=	${CC}
501.27SmycroftHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
511.27SmycroftHOSTED_CFLAGS=	${CFLAGS}
521.1Sragge
531.1Sragge### find out what to use for libkern
541.1Sragge.include "$S/lib/libkern/Makefile.inc"
551.1Sragge.ifndef PROF
561.9SchristosLIBKERN=	${KERNLIB}
571.1Sragge.else
581.1SraggeLIBKERN=        ${KERNLIB_PROF}
591.1Sragge.endif
601.1Sragge
611.11Sragge### find out what to use for libcompat
621.11Sragge.include "$S/compat/common/Makefile.inc"
631.11Sragge.ifndef PROF
641.11SraggeLIBCOMPAT=      ${COMPATLIB}
651.11Sragge.else
661.11SraggeLIBCOMPAT=      ${COMPATLIB_PROF}
671.11Sragge.endif
681.11Sragge
691.25Smycroft# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
701.25Smycroft# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
711.16Smycroft
721.16SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
731.18SmycroftNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
741.24Smycroft
751.27SmycroftHOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
761.1Sragge
771.1Sragge%OBJS
781.1Sragge
791.1Sragge%CFILES
801.1Sragge
811.16Smycroft%SFILES
821.16Smycroft
831.16Smycroft# load lines for config "xxx" will be emitted as:
841.16Smycroft# xxx: ${SYSTEM_DEP} swapxxx.o
851.16Smycroft#	${SYSTEM_LD_HEAD}
861.16Smycroft#	${SYSTEM_LD} swapxxx.o
871.16Smycroft#	${SYSTEM_LD_TAIL}
881.22SraggeSYSTEM_OBJ=	intvec.o subr.o \
891.20Scgd		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
901.16SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
911.16SmycroftSYSTEM_LD_HEAD=	@rm -f $@
921.16SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
931.16Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
941.34SlukemSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
951.16Smycroft
961.16SmycroftDEBUG?=
971.16Smycroft.if ${DEBUG} == "-g"
981.16SmycroftLINKFLAGS+=	-X
991.16SmycroftSYSTEM_LD_TAIL+=; \
1001.16Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
1011.27Smycroft		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
1021.16Smycroft.else
1031.23SmycroftLINKFLAGS+=	-S
1041.16Smycroft.endif
1051.16Smycroft
1061.1Sragge%LOAD
1071.1Sragge
1081.35Sraggeassym.h: $S/kern/genassym.sh ${VAX}/vax/genassym.cf
1091.35Sragge	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1101.35Sragge	    < ${VAX}/vax/genassym.cf > assym.h.tmp && \
1111.35Sragge	    mv -f assym.h.tmp assym.h
1121.35Sragge
1131.16Smycroftparam.c: $S/conf/param.c
1141.16Smycroft	rm -f param.c
1151.16Smycroft	cp $S/conf/param.c .
1161.1Sragge
1171.16Smycroftparam.o: param.c Makefile
1181.25Smycroft	${NORMAL_C}
1191.1Sragge
1201.16Smycroftioconf.o: ioconf.c
1211.16Smycroft	${NORMAL_C}
1221.1Sragge
1231.16Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1241.16Smycroft	sh $S/conf/newvers.sh
1251.16Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1261.1Sragge
1271.33Schristos__CLEANKERNEL: .USE
1281.33Schristos	@echo "${.TARGET}ing the kernel objects"
1291.33Schristos	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1301.33Schristos	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1311.33Schristos
1321.33Schristos__CLEANDEPEND: .USE
1331.33Schristos	rm -f .depend
1341.1Sragge
1351.33Schristosclean: __CLEANKERNEL
1361.33Schristos
1371.33Schristoscleandir: __CLEANKERNEL __CLEANDEPEND
1381.1Sragge
1391.16Smycroftlint:
1401.29Sperry	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1411.30Sperry	    ${VAX}/vax/Locore.c ${CFILES} \
1421.16Smycroft	    ioconf.c param.c | \
1431.16Smycroft	    grep -v 'static function .* unused'
1441.16Smycroft
1451.16Smycrofttags:
1461.16Smycroft	@echo "see $S/kern/Makefile for tags"
1471.16Smycroft
1481.16Smycroftlinks:
1491.16Smycroft	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1501.16Smycroft	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1511.16Smycroft	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1521.16Smycroft	  sort -u | comm -23 - dontlink | \
1531.16Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1541.16Smycroft	sh makelinks && rm -f dontlink
1551.16Smycroft
1561.22SraggeSRCS=	${VAX}/vax/intvec.s ${VAX}/vax/subr.s \
1571.20Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1581.31Sraggedepend: .depend
1591.35Sragge.depend: ${SRCS} assym.h param.c
1601.23Smycroft	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${VAX}/vax/intvec.s ${VAX}/vax/subr.s
1611.23Smycroft	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1621.23Smycroft	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
1631.16Smycroft
1641.16Smycroft
1651.16Smycroft# depend on root or device configuration
1661.16Smycroftautoconf.o conf.o: Makefile
1671.16Smycroft 
1681.16Smycroft# depend on network or filesystem configuration 
1691.16Smycroftuipc_proto.o vfs_conf.o: Makefile 
1701.16Smycroft
1711.16Smycroft# depend on maxusers
1721.16Smycroftmachdep.o: Makefile
1731.16Smycroft
1741.16Smycroft# depend on CPU configuration 
1751.16Smycrofttmscp.o ts.o uba.o uda.o autoconf.o clock.o conf.o emulate.o intvec.o: Makefile
1761.16Smycroftmachdep.o sbi.o subr.o uvaxII.o: Makefile
1771.5Sragge
1781.1Sragge
1791.36Sraggeintvec.o: ${VAX}/vax/intvec.s assym.h
1801.16Smycroft	${NORMAL_S}
1811.1Sragge
1821.35Sraggesubr.o: ${VAX}/vax/subr.s assym.h
1831.16Smycroft	${NORMAL_S}
1841.1Sragge
1851.1Sragge%RULES
186