Makefile.vax revision 1.43
11.43Sragge#	$NetBSD: Makefile.vax,v 1.43 1998/08/22 09:16:45 ragge 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.38SthorpejAR?=	ar
251.38SthorpejAS?=	as
261.19SmycroftCC?=	cc
271.38SthorpejCPP?=	cpp
281.19SmycroftLD?=	ld
291.37SthorpejLORDER?=lorder
301.23SmycroftMKDEP?=	mkdep
311.37SthorpejNM?=	nm
321.38SthorpejRANLIB?=ranlib
331.34SlukemSIZE?=	size
341.27SmycroftSTRIP?=	strip
351.37SthorpejTSORT?=	tsort -q
361.38Sthorpej
371.34SlukemCOPTS?= -O2
381.1Sragge
391.16Smycroft# source tree is located via $S relative to the compilation directory
401.26Smycroft.ifndef S
411.23SmycroftS!=	cd ../../../..; pwd
421.26Smycroft.endif
431.23SmycroftVAX=	$S/arch/vax
441.1Sragge
451.39StvHAVE_GCC28!=	${CC} --version | egrep "^(2\.8|egcs)" ; echo 
461.24SmycroftINCLUDES=	-I. -I$S/arch -I$S -nostdinc
471.25SmycroftCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
481.25Smycroft		-D_VAX_INLINE_
491.40SraggeCWARNFLAGS?=	-Werror -Wall -Wmissing-prototypes -Wstrict-prototypes
501.39Stv.if (${HAVE_GCC28} != "")
511.39StvCWARNFLAGS+=	-Wno-main
521.39Stv.endif
531.28SjonathanCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS}
541.18SmycroftAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
551.43SraggeLINKFLAGS=	-N -Ttext 80000000 -e start
561.27SmycroftSTRIPFLAGS=	-d
571.27Smycroft
581.27SmycroftHOSTED_CC=	${CC}
591.27SmycroftHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
601.27SmycroftHOSTED_CFLAGS=	${CFLAGS}
611.1Sragge
621.1Sragge### find out what to use for libkern
631.1Sragge.include "$S/lib/libkern/Makefile.inc"
641.1Sragge.ifndef PROF
651.9SchristosLIBKERN=	${KERNLIB}
661.1Sragge.else
671.1SraggeLIBKERN=        ${KERNLIB_PROF}
681.1Sragge.endif
691.1Sragge
701.11Sragge### find out what to use for libcompat
711.11Sragge.include "$S/compat/common/Makefile.inc"
721.11Sragge.ifndef PROF
731.11SraggeLIBCOMPAT=      ${COMPATLIB}
741.11Sragge.else
751.11SraggeLIBCOMPAT=      ${COMPATLIB_PROF}
761.11Sragge.endif
771.11Sragge
781.25Smycroft# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
791.25Smycroft# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
801.16Smycroft
811.16SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
821.42SthorpejNOPROF_C=	${CC} ${CFLAGS} ${CPPFLAGS} -c $<
831.18SmycroftNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
841.24Smycroft
851.27SmycroftHOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
861.1Sragge
871.1Sragge%OBJS
881.1Sragge
891.1Sragge%CFILES
901.1Sragge
911.16Smycroft%SFILES
921.16Smycroft
931.16Smycroft# load lines for config "xxx" will be emitted as:
941.16Smycroft# xxx: ${SYSTEM_DEP} swapxxx.o
951.16Smycroft#	${SYSTEM_LD_HEAD}
961.16Smycroft#	${SYSTEM_LD} swapxxx.o
971.16Smycroft#	${SYSTEM_LD_TAIL}
981.22SraggeSYSTEM_OBJ=	intvec.o subr.o \
991.20Scgd		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
1001.16SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
1011.16SmycroftSYSTEM_LD_HEAD=	@rm -f $@
1021.16SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
1031.16Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
1041.34SlukemSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
1051.16Smycroft
1061.16SmycroftDEBUG?=
1071.16Smycroft.if ${DEBUG} == "-g"
1081.16SmycroftLINKFLAGS+=	-X
1091.16SmycroftSYSTEM_LD_TAIL+=; \
1101.16Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
1111.27Smycroft		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
1121.16Smycroft.else
1131.23SmycroftLINKFLAGS+=	-S
1141.16Smycroft.endif
1151.16Smycroft
1161.1Sragge%LOAD
1171.1Sragge
1181.35Sraggeassym.h: $S/kern/genassym.sh ${VAX}/vax/genassym.cf
1191.35Sragge	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1201.35Sragge	    < ${VAX}/vax/genassym.cf > assym.h.tmp && \
1211.35Sragge	    mv -f assym.h.tmp assym.h
1221.35Sragge
1231.16Smycroftparam.c: $S/conf/param.c
1241.16Smycroft	rm -f param.c
1251.16Smycroft	cp $S/conf/param.c .
1261.1Sragge
1271.16Smycroftparam.o: param.c Makefile
1281.25Smycroft	${NORMAL_C}
1291.1Sragge
1301.16Smycroftioconf.o: ioconf.c
1311.16Smycroft	${NORMAL_C}
1321.1Sragge
1331.16Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1341.16Smycroft	sh $S/conf/newvers.sh
1351.16Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1361.1Sragge
1371.33Schristos__CLEANKERNEL: .USE
1381.33Schristos	@echo "${.TARGET}ing the kernel objects"
1391.33Schristos	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1401.33Schristos	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1411.33Schristos
1421.33Schristos__CLEANDEPEND: .USE
1431.33Schristos	rm -f .depend
1441.1Sragge
1451.33Schristosclean: __CLEANKERNEL
1461.33Schristos
1471.33Schristoscleandir: __CLEANKERNEL __CLEANDEPEND
1481.1Sragge
1491.16Smycroftlint:
1501.29Sperry	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1511.30Sperry	    ${VAX}/vax/Locore.c ${CFILES} \
1521.16Smycroft	    ioconf.c param.c | \
1531.16Smycroft	    grep -v 'static function .* unused'
1541.16Smycroft
1551.16Smycrofttags:
1561.16Smycroft	@echo "see $S/kern/Makefile for tags"
1571.16Smycroft
1581.16Smycroftlinks:
1591.16Smycroft	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1601.16Smycroft	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1611.16Smycroft	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1621.16Smycroft	  sort -u | comm -23 - dontlink | \
1631.16Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1641.16Smycroft	sh makelinks && rm -f dontlink
1651.16Smycroft
1661.22SraggeSRCS=	${VAX}/vax/intvec.s ${VAX}/vax/subr.s \
1671.20Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1681.31Sraggedepend: .depend
1691.35Sragge.depend: ${SRCS} assym.h param.c
1701.23Smycroft	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${VAX}/vax/intvec.s ${VAX}/vax/subr.s
1711.23Smycroft	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1721.23Smycroft	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
1731.16Smycroft
1741.16Smycroft
1751.16Smycroft# depend on root or device configuration
1761.16Smycroftautoconf.o conf.o: Makefile
1771.16Smycroft 
1781.16Smycroft# depend on network or filesystem configuration 
1791.16Smycroftuipc_proto.o vfs_conf.o: Makefile 
1801.16Smycroft
1811.16Smycroft# depend on maxusers
1821.16Smycroftmachdep.o: Makefile
1831.16Smycroft
1841.16Smycroft# depend on CPU configuration 
1851.16Smycrofttmscp.o ts.o uba.o uda.o autoconf.o clock.o conf.o emulate.o intvec.o: Makefile
1861.41Sraggemachdep.o sbi.o subr.o: Makefile
1871.5Sragge
1881.1Sragge
1891.36Sraggeintvec.o: ${VAX}/vax/intvec.s assym.h
1901.16Smycroft	${NORMAL_S}
1911.1Sragge
1921.35Sraggesubr.o: ${VAX}/vax/subr.s assym.h
1931.16Smycroft	${NORMAL_S}
1941.1Sragge
1951.1Sragge%RULES
196