Makefile.vax revision 1.34
11.34Slukem#	$NetBSD: Makefile.vax,v 1.34 1997/10/03 07:17:49 lukem 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.23SmycroftMKDEP?=	mkdep
271.34SlukemSIZE?=	size
281.27SmycroftSTRIP?=	strip
291.34SlukemCOPTS?= -O2
301.1Sragge
311.16Smycroft# source tree is located via $S relative to the compilation directory
321.26Smycroft.ifndef S
331.23SmycroftS!=	cd ../../../..; pwd
341.26Smycroft.endif
351.23SmycroftVAX=	$S/arch/vax
361.1Sragge
371.24SmycroftINCLUDES=	-I. -I$S/arch -I$S -nostdinc
381.25SmycroftCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
391.25Smycroft		-D_VAX_INLINE_
401.23SmycroftCWARNFLAGS=	-Werror
411.28SjonathanCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS}
421.18SmycroftAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
431.16SmycroftLINKFLAGS=	-Z -Ttext 80000000 -e _start
441.27SmycroftSTRIPFLAGS=	-d
451.27Smycroft
461.27SmycroftHOSTED_CC=	${CC}
471.27SmycroftHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
481.27SmycroftHOSTED_CFLAGS=	${CFLAGS}
491.1Sragge
501.1Sragge### find out what to use for libkern
511.1Sragge.include "$S/lib/libkern/Makefile.inc"
521.1Sragge.ifndef PROF
531.9SchristosLIBKERN=	${KERNLIB}
541.1Sragge.else
551.1SraggeLIBKERN=        ${KERNLIB_PROF}
561.1Sragge.endif
571.1Sragge
581.11Sragge### find out what to use for libcompat
591.11Sragge.include "$S/compat/common/Makefile.inc"
601.11Sragge.ifndef PROF
611.11SraggeLIBCOMPAT=      ${COMPATLIB}
621.11Sragge.else
631.11SraggeLIBCOMPAT=      ${COMPATLIB_PROF}
641.11Sragge.endif
651.11Sragge
661.25Smycroft# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
671.25Smycroft# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
681.16Smycroft
691.16SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
701.18SmycroftNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
711.24Smycroft
721.27SmycroftHOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
731.1Sragge
741.1Sragge%OBJS
751.1Sragge
761.1Sragge%CFILES
771.1Sragge
781.16Smycroft%SFILES
791.16Smycroft
801.16Smycroft# load lines for config "xxx" will be emitted as:
811.16Smycroft# xxx: ${SYSTEM_DEP} swapxxx.o
821.16Smycroft#	${SYSTEM_LD_HEAD}
831.16Smycroft#	${SYSTEM_LD} swapxxx.o
841.16Smycroft#	${SYSTEM_LD_TAIL}
851.22SraggeSYSTEM_OBJ=	intvec.o subr.o \
861.20Scgd		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
871.16SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
881.16SmycroftSYSTEM_LD_HEAD=	@rm -f $@
891.16SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
901.16Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
911.34SlukemSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
921.16Smycroft
931.16SmycroftDEBUG?=
941.16Smycroft.if ${DEBUG} == "-g"
951.16SmycroftLINKFLAGS+=	-X
961.16SmycroftSYSTEM_LD_TAIL+=; \
971.16Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
981.27Smycroft		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
991.16Smycroft.else
1001.23SmycroftLINKFLAGS+=	-S
1011.16Smycroft.endif
1021.16Smycroft
1031.1Sragge%LOAD
1041.1Sragge
1051.16Smycroftparam.c: $S/conf/param.c
1061.16Smycroft	rm -f param.c
1071.16Smycroft	cp $S/conf/param.c .
1081.1Sragge
1091.16Smycroftparam.o: param.c Makefile
1101.25Smycroft	${NORMAL_C}
1111.1Sragge
1121.16Smycroftioconf.o: ioconf.c
1131.16Smycroft	${NORMAL_C}
1141.1Sragge
1151.16Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1161.16Smycroft	sh $S/conf/newvers.sh
1171.16Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1181.1Sragge
1191.33Schristos__CLEANKERNEL: .USE
1201.33Schristos	@echo "${.TARGET}ing the kernel objects"
1211.33Schristos	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1221.33Schristos	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1231.33Schristos
1241.33Schristos__CLEANDEPEND: .USE
1251.33Schristos	rm -f .depend
1261.1Sragge
1271.33Schristosclean: __CLEANKERNEL
1281.33Schristos
1291.33Schristoscleandir: __CLEANKERNEL __CLEANDEPEND
1301.1Sragge
1311.16Smycroftlint:
1321.29Sperry	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1331.30Sperry	    ${VAX}/vax/Locore.c ${CFILES} \
1341.16Smycroft	    ioconf.c param.c | \
1351.16Smycroft	    grep -v 'static function .* unused'
1361.16Smycroft
1371.16Smycrofttags:
1381.16Smycroft	@echo "see $S/kern/Makefile for tags"
1391.16Smycroft
1401.16Smycroftlinks:
1411.16Smycroft	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1421.16Smycroft	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1431.16Smycroft	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1441.16Smycroft	  sort -u | comm -23 - dontlink | \
1451.16Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1461.16Smycroft	sh makelinks && rm -f dontlink
1471.16Smycroft
1481.22SraggeSRCS=	${VAX}/vax/intvec.s ${VAX}/vax/subr.s \
1491.20Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1501.31Sraggedepend: .depend
1511.20Scgd.depend: ${SRCS} param.c
1521.23Smycroft	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${VAX}/vax/intvec.s ${VAX}/vax/subr.s
1531.23Smycroft	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1541.23Smycroft	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
1551.16Smycroft
1561.16Smycroft
1571.16Smycroft# depend on root or device configuration
1581.16Smycroftautoconf.o conf.o: Makefile
1591.16Smycroft 
1601.16Smycroft# depend on network or filesystem configuration 
1611.16Smycroftuipc_proto.o vfs_conf.o: Makefile 
1621.16Smycroft
1631.16Smycroft# depend on maxusers
1641.16Smycroftmachdep.o: Makefile
1651.16Smycroft
1661.16Smycroft# depend on CPU configuration 
1671.16Smycrofttmscp.o ts.o uba.o uda.o autoconf.o clock.o conf.o emulate.o intvec.o: Makefile
1681.16Smycroftmachdep.o sbi.o subr.o uvaxII.o: Makefile
1691.5Sragge
1701.1Sragge
1711.16Smycroftintvec.o: ${VAX}/vax/intvec.s
1721.16Smycroft	${NORMAL_S}
1731.1Sragge
1741.16Smycroftsubr.o: ${VAX}/vax/subr.s
1751.16Smycroft	${NORMAL_S}
1761.1Sragge
1771.1Sragge%RULES
178