Makefile.vax revision 1.62
11.62Sjmc#	$NetBSD: Makefile.vax,v 1.62 2001/10/26 06:45:41 jmc 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.61Sthorpej
151.61SthorpejMACHINE_ARCH=vax
161.62SjmcUSETOOLS?=	no
171.62Sjmc
181.62Sjmc.include <bsd.own.mk>
191.16Smycroft
201.16Smycroft# DEBUG is set to -g if debugging.
211.16Smycroft# PROF is set to -pg if profiling.
221.16Smycroft
231.38SthorpejAR?=	ar
241.38SthorpejAS?=	as
251.19SmycroftCC?=	cc
261.38SthorpejCPP?=	cpp
271.19SmycroftLD?=	ld
281.37SthorpejLORDER?=lorder
291.23SmycroftMKDEP?=	mkdep
301.37SthorpejNM?=	nm
311.38SthorpejRANLIB?=ranlib
321.34SlukemSIZE?=	size
331.53StsutsuiSTRIP?=	strip
341.37SthorpejTSORT?=	tsort -q
351.38Sthorpej
361.34SlukemCOPTS?= -O2
371.1Sragge
381.16Smycroft# source tree is located via $S relative to the compilation directory
391.26Smycroft.ifndef S
401.23SmycroftS!=	cd ../../../..; pwd
411.26Smycroft.endif
421.23SmycroftVAX=	$S/arch/vax
431.1Sragge
441.59SmattHAVE_EGCS!=	${CC} --version | egrep "^(2\.8|2\.9[0-4]|egcs)" ; echo 
451.24SmycroftINCLUDES=	-I. -I$S/arch -I$S -nostdinc
461.58SmrgCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT \
471.25Smycroft		-D_VAX_INLINE_
481.46SaugustssCWARNFLAGS?=	-Werror -Wall -Wmissing-prototypes -Wstrict-prototypes \
491.60Smatt		-Wpointer-arith -Wno-main
501.54Sthorpej# XXX Delete -Wuninitialized for now, since the compiler doesn't
511.54Sthorpej# XXX always get it right.  --thorpej 
521.54SthorpejCWARNFLAGS+=	-Wno-uninitialized
531.28SjonathanCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS}
541.54Sthorpej.if (${HAVE_EGCS} != "")
551.47SmattCFLAGS+=	-mno-pic
561.47Smatt.endif
571.18SmycroftAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
581.43SraggeLINKFLAGS=	-N -Ttext 80000000 -e start
591.50StsutsuiSTRIPFLAGS=	-g
601.48Smrg
611.48Smrg%INCLUDES
621.27Smycroft
631.27SmycroftHOSTED_CC=	${CC}
641.27SmycroftHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
651.27SmycroftHOSTED_CFLAGS=	${CFLAGS}
661.1Sragge
671.1Sragge### find out what to use for libkern
681.45SdrochnerKERN_AS=	obj
691.1Sragge.include "$S/lib/libkern/Makefile.inc"
701.1Sragge.ifndef PROF
711.9SchristosLIBKERN=	${KERNLIB}
721.1Sragge.else
731.1SraggeLIBKERN=        ${KERNLIB_PROF}
741.1Sragge.endif
751.1Sragge
761.11Sragge### find out what to use for libcompat
771.11Sragge.include "$S/compat/common/Makefile.inc"
781.11Sragge.ifndef PROF
791.11SraggeLIBCOMPAT=      ${COMPATLIB}
801.11Sragge.else
811.11SraggeLIBCOMPAT=      ${COMPATLIB_PROF}
821.11Sragge.endif
831.11Sragge
841.25Smycroft# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
851.25Smycroft# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
861.16Smycroft
871.16SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
881.42SthorpejNOPROF_C=	${CC} ${CFLAGS} ${CPPFLAGS} -c $<
891.18SmycroftNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
901.24Smycroft
911.27SmycroftHOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
921.1Sragge
931.1Sragge%OBJS
941.1Sragge
951.1Sragge%CFILES
961.1Sragge
971.16Smycroft%SFILES
981.16Smycroft
991.16Smycroft# load lines for config "xxx" will be emitted as:
1001.16Smycroft# xxx: ${SYSTEM_DEP} swapxxx.o
1011.16Smycroft#	${SYSTEM_LD_HEAD}
1021.16Smycroft#	${SYSTEM_LD} swapxxx.o
1031.16Smycroft#	${SYSTEM_LD_TAIL}
1041.22SraggeSYSTEM_OBJ=	intvec.o subr.o \
1051.45Sdrochner		param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
1061.16SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
1071.16SmycroftSYSTEM_LD_HEAD=	@rm -f $@
1081.16SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
1091.16Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
1101.34SlukemSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
1111.16Smycroft
1121.16SmycroftDEBUG?=
1131.16Smycroft.if ${DEBUG} == "-g"
1141.16SmycroftLINKFLAGS+=	-X
1151.16SmycroftSYSTEM_LD_TAIL+=; \
1161.49Scgd		echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
1171.53Stsutsui		echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
1181.53Stsutsui		${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
1191.16Smycroft.else
1201.23SmycroftLINKFLAGS+=	-S
1211.16Smycroft.endif
1221.16Smycroft
1231.1Sragge%LOAD
1241.1Sragge
1251.35Sraggeassym.h: $S/kern/genassym.sh ${VAX}/vax/genassym.cf
1261.35Sragge	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1271.35Sragge	    < ${VAX}/vax/genassym.cf > assym.h.tmp && \
1281.35Sragge	    mv -f assym.h.tmp assym.h
1291.35Sragge
1301.16Smycroftparam.c: $S/conf/param.c
1311.16Smycroft	rm -f param.c
1321.16Smycroft	cp $S/conf/param.c .
1331.1Sragge
1341.16Smycroftparam.o: param.c Makefile
1351.25Smycroft	${NORMAL_C}
1361.1Sragge
1371.16Smycroftioconf.o: ioconf.c
1381.16Smycroft	${NORMAL_C}
1391.1Sragge
1401.16Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1411.16Smycroft	sh $S/conf/newvers.sh
1421.16Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1431.1Sragge
1441.33Schristos__CLEANKERNEL: .USE
1451.33Schristos	@echo "${.TARGET}ing the kernel objects"
1461.33Schristos	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1471.33Schristos	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1481.33Schristos
1491.33Schristos__CLEANDEPEND: .USE
1501.33Schristos	rm -f .depend
1511.1Sragge
1521.33Schristosclean: __CLEANKERNEL
1531.33Schristos
1541.44Slukemcleandir distclean: __CLEANKERNEL __CLEANDEPEND
1551.1Sragge
1561.16Smycroftlint:
1571.29Sperry	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1581.30Sperry	    ${VAX}/vax/Locore.c ${CFILES} \
1591.16Smycroft	    ioconf.c param.c | \
1601.16Smycroft	    grep -v 'static function .* unused'
1611.16Smycroft
1621.16Smycrofttags:
1631.16Smycroft	@echo "see $S/kern/Makefile for tags"
1641.16Smycroft
1651.16Smycroftlinks:
1661.16Smycroft	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1671.16Smycroft	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1681.16Smycroft	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1691.16Smycroft	  sort -u | comm -23 - dontlink | \
1701.16Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1711.16Smycroft	sh makelinks && rm -f dontlink
1721.16Smycroft
1731.22SraggeSRCS=	${VAX}/vax/intvec.s ${VAX}/vax/subr.s \
1741.20Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1751.31Sraggedepend: .depend
1761.35Sragge.depend: ${SRCS} assym.h param.c
1771.23Smycroft	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${VAX}/vax/intvec.s ${VAX}/vax/subr.s
1781.23Smycroft	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1791.23Smycroft	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
1801.57Schs	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
1811.57Schs	  ${CPPFLAGS} < ${VAX}/vax/genassym.cf
1821.57Schs	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
1831.57Schs	@rm -f assym.dep
1841.52Stron
1851.52Strondependall: depend all
1861.16Smycroft
1871.16Smycroft
1881.16Smycroft# depend on root or device configuration
1891.16Smycroftautoconf.o conf.o: Makefile
1901.16Smycroft 
1911.16Smycroft# depend on network or filesystem configuration 
1921.16Smycroftuipc_proto.o vfs_conf.o: Makefile 
1931.16Smycroft
1941.16Smycroft# depend on maxusers
1951.16Smycroftmachdep.o: Makefile
1961.16Smycroft
1971.16Smycroft# depend on CPU configuration 
1981.16Smycrofttmscp.o ts.o uba.o uda.o autoconf.o clock.o conf.o emulate.o intvec.o: Makefile
1991.41Sraggemachdep.o sbi.o subr.o: Makefile
2001.5Sragge
2011.1Sragge
2021.36Sraggeintvec.o: ${VAX}/vax/intvec.s assym.h
2031.16Smycroft	${NORMAL_S}
2041.1Sragge
2051.35Sraggesubr.o: ${VAX}/vax/subr.s assym.h
2061.16Smycroft	${NORMAL_S}
2071.55Shubertf
2081.55Shubertf# The install target can be redefined by putting a
2091.55Shubertf# install-kernel-${MACHINE_NAME} target into /etc/mk.conf
2101.55ShubertfMACHINE_NAME!=  uname -n
2111.55Shubertfinstall: install-kernel-${MACHINE_NAME}
2121.55Shubertf.if !target(install-kernel-${MACHINE_NAME}})
2131.55Shubertfinstall-kernel-${MACHINE_NAME}:
2141.55Shubertf	rm -f /onetbsd
2151.55Shubertf	ln /netbsd /onetbsd
2161.55Shubertf	cp netbsd /nnetbsd
2171.55Shubertf	mv /nnetbsd /netbsd
2181.55Shubertf.endif
2191.1Sragge
2201.1Sragge%RULES
221