Makefile.vax revision 1.57
11.57Schs#	$NetBSD: Makefile.vax,v 1.57 2001/02/08 15:19:14 chs 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.16Smycroft
151.16Smycroft# DEBUG is set to -g if debugging.
161.16Smycroft# PROF is set to -pg if profiling.
171.16Smycroft
181.38SthorpejAR?=	ar
191.38SthorpejAS?=	as
201.19SmycroftCC?=	cc
211.38SthorpejCPP?=	cpp
221.19SmycroftLD?=	ld
231.37SthorpejLORDER?=lorder
241.23SmycroftMKDEP?=	mkdep
251.37SthorpejNM?=	nm
261.38SthorpejRANLIB?=ranlib
271.34SlukemSIZE?=	size
281.53StsutsuiSTRIP?=	strip
291.37SthorpejTSORT?=	tsort -q
301.38Sthorpej
311.34SlukemCOPTS?= -O2
321.1Sragge
331.16Smycroft# source tree is located via $S relative to the compilation directory
341.26Smycroft.ifndef S
351.23SmycroftS!=	cd ../../../..; pwd
361.26Smycroft.endif
371.23SmycroftVAX=	$S/arch/vax
381.1Sragge
391.54SthorpejHAVE_EGCS!=	${CC} --version | egrep "^(2\.[89]|egcs)" ; echo 
401.24SmycroftINCLUDES=	-I. -I$S/arch -I$S -nostdinc
411.25SmycroftCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
421.25Smycroft		-D_VAX_INLINE_
431.46SaugustssCWARNFLAGS?=	-Werror -Wall -Wmissing-prototypes -Wstrict-prototypes \
441.46Saugustss		-Wpointer-arith
451.54Sthorpej# XXX Delete -Wuninitialized for now, since the compiler doesn't
461.54Sthorpej# XXX always get it right.  --thorpej 
471.54SthorpejCWARNFLAGS+=	-Wno-uninitialized
481.54Sthorpej.if (${HAVE_EGCS} != "")
491.39StvCWARNFLAGS+=	-Wno-main
501.39Stv.endif
511.28SjonathanCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS}
521.54Sthorpej.if (${HAVE_EGCS} != "")
531.47SmattCFLAGS+=	-mno-pic
541.47Smatt.endif
551.18SmycroftAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
561.43SraggeLINKFLAGS=	-N -Ttext 80000000 -e start
571.50StsutsuiSTRIPFLAGS=	-g
581.48Smrg
591.48Smrg%INCLUDES
601.27Smycroft
611.27SmycroftHOSTED_CC=	${CC}
621.27SmycroftHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
631.27SmycroftHOSTED_CFLAGS=	${CFLAGS}
641.1Sragge
651.1Sragge### find out what to use for libkern
661.45SdrochnerKERN_AS=	obj
671.1Sragge.include "$S/lib/libkern/Makefile.inc"
681.1Sragge.ifndef PROF
691.9SchristosLIBKERN=	${KERNLIB}
701.1Sragge.else
711.1SraggeLIBKERN=        ${KERNLIB_PROF}
721.1Sragge.endif
731.1Sragge
741.11Sragge### find out what to use for libcompat
751.11Sragge.include "$S/compat/common/Makefile.inc"
761.11Sragge.ifndef PROF
771.11SraggeLIBCOMPAT=      ${COMPATLIB}
781.11Sragge.else
791.11SraggeLIBCOMPAT=      ${COMPATLIB_PROF}
801.11Sragge.endif
811.11Sragge
821.25Smycroft# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
831.25Smycroft# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
841.16Smycroft
851.16SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
861.42SthorpejNOPROF_C=	${CC} ${CFLAGS} ${CPPFLAGS} -c $<
871.18SmycroftNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
881.24Smycroft
891.27SmycroftHOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
901.1Sragge
911.1Sragge%OBJS
921.1Sragge
931.1Sragge%CFILES
941.1Sragge
951.16Smycroft%SFILES
961.16Smycroft
971.16Smycroft# load lines for config "xxx" will be emitted as:
981.16Smycroft# xxx: ${SYSTEM_DEP} swapxxx.o
991.16Smycroft#	${SYSTEM_LD_HEAD}
1001.16Smycroft#	${SYSTEM_LD} swapxxx.o
1011.16Smycroft#	${SYSTEM_LD_TAIL}
1021.22SraggeSYSTEM_OBJ=	intvec.o subr.o \
1031.45Sdrochner		param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
1041.16SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
1051.16SmycroftSYSTEM_LD_HEAD=	@rm -f $@
1061.16SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
1071.16Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
1081.34SlukemSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
1091.16Smycroft
1101.16SmycroftDEBUG?=
1111.16Smycroft.if ${DEBUG} == "-g"
1121.16SmycroftLINKFLAGS+=	-X
1131.16SmycroftSYSTEM_LD_TAIL+=; \
1141.49Scgd		echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
1151.53Stsutsui		echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
1161.53Stsutsui		${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
1171.16Smycroft.else
1181.23SmycroftLINKFLAGS+=	-S
1191.16Smycroft.endif
1201.16Smycroft
1211.1Sragge%LOAD
1221.1Sragge
1231.35Sraggeassym.h: $S/kern/genassym.sh ${VAX}/vax/genassym.cf
1241.35Sragge	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1251.35Sragge	    < ${VAX}/vax/genassym.cf > assym.h.tmp && \
1261.35Sragge	    mv -f assym.h.tmp assym.h
1271.35Sragge
1281.16Smycroftparam.c: $S/conf/param.c
1291.16Smycroft	rm -f param.c
1301.16Smycroft	cp $S/conf/param.c .
1311.1Sragge
1321.16Smycroftparam.o: param.c Makefile
1331.25Smycroft	${NORMAL_C}
1341.1Sragge
1351.16Smycroftioconf.o: ioconf.c
1361.16Smycroft	${NORMAL_C}
1371.1Sragge
1381.16Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1391.16Smycroft	sh $S/conf/newvers.sh
1401.16Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1411.1Sragge
1421.33Schristos__CLEANKERNEL: .USE
1431.33Schristos	@echo "${.TARGET}ing the kernel objects"
1441.33Schristos	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1451.33Schristos	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1461.33Schristos
1471.33Schristos__CLEANDEPEND: .USE
1481.33Schristos	rm -f .depend
1491.1Sragge
1501.33Schristosclean: __CLEANKERNEL
1511.33Schristos
1521.44Slukemcleandir distclean: __CLEANKERNEL __CLEANDEPEND
1531.1Sragge
1541.16Smycroftlint:
1551.29Sperry	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1561.30Sperry	    ${VAX}/vax/Locore.c ${CFILES} \
1571.16Smycroft	    ioconf.c param.c | \
1581.16Smycroft	    grep -v 'static function .* unused'
1591.16Smycroft
1601.16Smycrofttags:
1611.16Smycroft	@echo "see $S/kern/Makefile for tags"
1621.16Smycroft
1631.16Smycroftlinks:
1641.16Smycroft	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1651.16Smycroft	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1661.16Smycroft	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1671.16Smycroft	  sort -u | comm -23 - dontlink | \
1681.16Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1691.16Smycroft	sh makelinks && rm -f dontlink
1701.16Smycroft
1711.22SraggeSRCS=	${VAX}/vax/intvec.s ${VAX}/vax/subr.s \
1721.20Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1731.31Sraggedepend: .depend
1741.35Sragge.depend: ${SRCS} assym.h param.c
1751.23Smycroft	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${VAX}/vax/intvec.s ${VAX}/vax/subr.s
1761.23Smycroft	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1771.23Smycroft	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
1781.57Schs	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
1791.57Schs	  ${CPPFLAGS} < ${VAX}/vax/genassym.cf
1801.57Schs	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
1811.57Schs	@rm -f assym.dep
1821.52Stron
1831.52Strondependall: depend all
1841.16Smycroft
1851.16Smycroft
1861.16Smycroft# depend on root or device configuration
1871.16Smycroftautoconf.o conf.o: Makefile
1881.16Smycroft 
1891.16Smycroft# depend on network or filesystem configuration 
1901.16Smycroftuipc_proto.o vfs_conf.o: Makefile 
1911.16Smycroft
1921.16Smycroft# depend on maxusers
1931.16Smycroftmachdep.o: Makefile
1941.16Smycroft
1951.16Smycroft# depend on CPU configuration 
1961.16Smycrofttmscp.o ts.o uba.o uda.o autoconf.o clock.o conf.o emulate.o intvec.o: Makefile
1971.41Sraggemachdep.o sbi.o subr.o: Makefile
1981.5Sragge
1991.1Sragge
2001.36Sraggeintvec.o: ${VAX}/vax/intvec.s assym.h
2011.16Smycroft	${NORMAL_S}
2021.1Sragge
2031.35Sraggesubr.o: ${VAX}/vax/subr.s assym.h
2041.16Smycroft	${NORMAL_S}
2051.55Shubertf
2061.55Shubertf# The install target can be redefined by putting a
2071.55Shubertf# install-kernel-${MACHINE_NAME} target into /etc/mk.conf
2081.55ShubertfMACHINE_NAME!=  uname -n
2091.55Shubertfinstall: install-kernel-${MACHINE_NAME}
2101.55Shubertf.if !target(install-kernel-${MACHINE_NAME}})
2111.55Shubertfinstall-kernel-${MACHINE_NAME}:
2121.55Shubertf	rm -f /onetbsd
2131.55Shubertf	ln /netbsd /onetbsd
2141.55Shubertf	cp netbsd /nnetbsd
2151.55Shubertf	mv /nnetbsd /netbsd
2161.55Shubertf.endif
2171.1Sragge
2181.1Sragge%RULES
219