Makefile.sun3 revision 1.38
11.38Smycroft#	$NetBSD: Makefile.sun3,v 1.38 1996/02/02 20:09:40 mycroft Exp $
21.23Scgd
31.24Sgwr# Makefile for NetBSD
41.1Sglass#
51.1Sglass# This makefile is constructed from a machine description:
61.1Sglass#	config machineid
71.1Sglass# Most changes should be made in the machine description
81.35Sgwr#	/sys/arch/sun3/conf/``machineid''
91.1Sglass# after which you should do
101.38Smycroft#	config machineid
111.1Sglass# Machine generic makefile changes should be made in
121.35Sgwr#	/sys/arch/sun3/conf/Makefile.sun3
131.1Sglass# after which config should be rerun for all machines of that type.
141.1Sglass#
151.1Sglass# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
161.1Sglass#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
171.1Sglass#
181.1Sglass# -DTRACE	compile in kernel tracing hooks
191.1Sglass# -DQUOTA	compile in file system quotas
201.1Sglass
211.38Smycroft# DEBUG is set to -g if debugging.
221.38Smycroft# PROF is set to -pg if profiling.
231.38Smycroft
241.31SgwrAS=	as
251.38SmycroftAWK=	awk
261.33SgwrCC=	cc
271.31SgwrCPP=	cpp
281.1SglassLD=	ld
291.38SmycroftSTRIP=	strip -d
301.1SglassTOUCH=	touch -f -c
311.1Sglass
321.1Sglass# source tree is located via $S relative to the compilation directory
331.1SglassS=	../../../..
341.1SglassSUN3=	../..
351.1Sglass
361.38SmycroftINCLUDES=	-I. -I$S/arch -I$S
371.38SmycroftCPPFLAGS=	${INCLUDES} ${IDENT} -D_KERNEL -Dmc68020 -Dsun3
381.38SmycroftCFLAGS=		${DEBUG} -O2 -Werror -msoft-float
391.38SmycroftAFLAGS=		-D_LOCORE
401.38SmycroftLINKFLAGS=	-N -Ttext 0E004000 -e start
411.31Sgwr
421.31Sgwr# What to use for libkern:
431.31Sgwr.include "$S/lib/libkern/Makefile.inc"
441.31Sgwr.ifndef PROF
451.31SgwrLIBKERN=	${KERNLIB}
461.31Sgwr.else
471.31SgwrLIBKERN=	${KERNLIB_PROF}
481.31Sgwr.endif
491.1Sglass
501.32Schristos### find out what to use for libcompat
511.32Schristos.include "$S/compat/common/Makefile.inc"
521.32Schristos.ifndef PROF
531.32SchristosLIBCOMPAT=	${COMPATLIB}
541.32Schristos.else
551.32SchristosLIBCOMPAT=	${COMPATLIB_PROF}
561.32Schristos.endif
571.32Schristos
581.1Sglass# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
591.1Sglass# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
601.1Sglass# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
611.1Sglass# is marked as config-dependent.
621.1Sglass
631.38SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
641.38SmycroftNORMAL_C_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
651.1Sglass
661.38SmycroftDRIVER_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
671.38SmycroftDRIVER_C_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
681.1Sglass
691.38SmycroftNORMAL_S=	${CC} -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} -c $<
701.38SmycroftNORMAL_S_C=	${CC} -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} ${PARAM} -c $<
711.1Sglass
721.1Sglass%OBJS
731.1Sglass
741.1Sglass%CFILES
751.1Sglass
761.38Smycroft%SFILES
771.38Smycroft
781.1Sglass# load lines for config "xxx" will be emitted as:
791.1Sglass# xxx: ${SYSTEM_DEP} swapxxx.o
801.1Sglass#	${SYSTEM_LD_HEAD}
811.1Sglass#	${SYSTEM_LD} swapxxx.o
821.1Sglass#	${SYSTEM_LD_TAIL}
831.38SmycroftSYSTEM_OBJ=	locore.o \
841.38Smycroft		vnode_if.o param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
851.38SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
861.38SmycroftSYSTEM_LD_HEAD=	@rm -f $@
871.38SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
881.38Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
891.38SmycroftSYSTEM_LD_TAIL=	@size $@; chmod 755 $@
901.38Smycroft
911.38SmycroftDEBUG?=
921.11Sderaadt.if ${DEBUG} == "-g"
931.38SmycroftLINKFLAGS+=	-X
941.38SmycroftSYSTEM_LD_TAIL+=; \
951.38Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
961.38Smycroft		echo ${STRIP} $@; ${STRIP} $@
971.11Sderaadt.else
981.38SmycroftLINKFLAGS+=	-x
991.11Sderaadt.endif
1001.1Sglass
1011.1Sglass%LOAD
1021.1Sglass
1031.38Smycroftassym.h: genassym
1041.38Smycroft	./genassym >assym.h
1051.1Sglass
1061.38Smycroftgenassym: genassym.o
1071.38Smycroft	${CC} -o $@ genassym.o
1081.1Sglass
1091.38Smycroftgenassym.o: ${SUN3}/sun3/genassym.c
1101.38Smycroft	${NORMAL_C_C}
1111.1Sglass
1121.38Smycroftvnode_if.c vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
1131.38Smycroft	AWK="${AWK}" sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
1141.1Sglass
1151.38Smycroftparam.c: $S/conf/param.c
1161.38Smycroft	rm -f param.c
1171.38Smycroft	cp $S/conf/param.c .
1181.17Sgwr
1191.38Smycroftparam.o: param.c Makefile
1201.38Smycroft	${NORMAL_C_C}
1211.21Sgwr
1221.38Smycroftioconf.o: ioconf.c
1231.38Smycroft	${NORMAL_C}
1241.1Sglass
1251.38Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1261.38Smycroft	sh $S/conf/newvers.sh
1271.38Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1281.38Smycroft
1291.38Smycroft
1301.38Smycroftclean::
1311.38Smycroft	rm -f eddep *netbsd netbsd.gdb tags vnode_if.[ch] *.[io] [a-z]*.s \
1321.38Smycroft	    [Ee]rrs linterrs makelinks genassym genassym.o assym.h
1331.1Sglass
1341.38Smycroftlint:
1351.38Smycroft	@lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \
1361.38Smycroft	    ${SUN3}/sun3/Locore.c ${CFILES} ${SUN3}/sun3/swapgeneric.c \
1371.38Smycroft	    ioconf.c param.c | \
1381.38Smycroft	    grep -v 'static function .* unused'
1391.1Sglass
1401.38Smycrofttags:
1411.38Smycroft	@echo "see $S/kern/Makefile for tags"
1421.1Sglass
1431.1Sglasslinks:
1441.1Sglass	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1451.1Sglass	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1461.1Sglass	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1471.1Sglass	  sort -u | comm -23 - dontlink | \
1481.38Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1491.1Sglass	sh makelinks && rm -f dontlink
1501.1Sglass
1511.38SmycroftSRCS=	${SUN3}/sun3/locore.s \
1521.38Smycroft	vnode_if.c param.c ioconf.c ${CFILES} ${SFILES}
1531.38Smycroftdepend: .depend
1541.38Smycroft.depend: ${SRCS} assym.h vnode_if.h param.c
1551.38Smycroft	mkdep -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} ${SUN3}/sun3/locore.s
1561.38Smycroft	mkdep -a ${CFLAGS} ${CPPFLAGS} vnode_if.c param.c ioconf.c ${CFILES}
1571.38Smycroft	mkdep -a -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} ${SFILES}
1581.38Smycroft	mkdep -a ${CFLAGS} ${CPPFLAGS} ${PARAM} ${SUN3}/sun3/genassym.c
1591.38Smycroft
1601.1Sglass
1611.38Smycroft# depend on root or device configuration
1621.38Smycroftautoconf.o conf.o: Makefile
1631.38Smycroft 
1641.38Smycroft# depend on network or filesystem configuration 
1651.38Smycroftuipc_proto.o vfs_conf.o: Makefile 
1661.1Sglass
1671.38Smycroft# depend on maxusers
1681.38Smycroftgenassym.o machdep.o: Makefile
1691.1Sglass
1701.38Smycroft# depend on CPU configuration 
1711.38Smycroftdb_machdep.o dvma.o machdep.o pmap.o sun3_startup.o vm_machdep.o: Makefile
1721.1Sglass
1731.19Sgwr
1741.38Smycroftlocore.o: ${SUN3}/sun3/locore.s assym.h
1751.38Smycroft	${NORMAL_S}
1761.1Sglass
1771.1Sglass%RULES
178