Makefile.sun3 revision 1.44
11.44Smycroft#	$NetBSD: Makefile.sun3,v 1.44 1996/05/11 16:13:07 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.42SmycroftAS?=	as
251.42SmycroftCC?=	cc
261.42SmycroftCPP?=	cpp
271.42SmycroftLD?=	ld
281.42SmycroftSTRIP?=	strip -d
291.42SmycroftTOUCH?=	touch -f -c
301.1Sglass
311.1Sglass# source tree is located via $S relative to the compilation directory
321.1SglassS=	../../../..
331.1SglassSUN3=	../..
341.1Sglass
351.38SmycroftINCLUDES=	-I. -I$S/arch -I$S
361.38SmycroftCPPFLAGS=	${INCLUDES} ${IDENT} -D_KERNEL -Dmc68020 -Dsun3
371.38SmycroftCFLAGS=		${DEBUG} -O2 -Werror -msoft-float
381.40SmycroftAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
391.38SmycroftLINKFLAGS=	-N -Ttext 0E004000 -e start
401.31Sgwr
411.31Sgwr# What to use for libkern:
421.31Sgwr.include "$S/lib/libkern/Makefile.inc"
431.31Sgwr.ifndef PROF
441.31SgwrLIBKERN=	${KERNLIB}
451.31Sgwr.else
461.31SgwrLIBKERN=	${KERNLIB_PROF}
471.31Sgwr.endif
481.1Sglass
491.32Schristos### find out what to use for libcompat
501.32Schristos.include "$S/compat/common/Makefile.inc"
511.32Schristos.ifndef PROF
521.32SchristosLIBCOMPAT=	${COMPATLIB}
531.32Schristos.else
541.32SchristosLIBCOMPAT=	${COMPATLIB_PROF}
551.32Schristos.endif
561.32Schristos
571.1Sglass# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
581.1Sglass# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
591.1Sglass# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
601.1Sglass# is marked as config-dependent.
611.1Sglass
621.38SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
631.38SmycroftNORMAL_C_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
641.1Sglass
651.38SmycroftDRIVER_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
661.38SmycroftDRIVER_C_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
671.1Sglass
681.40SmycroftNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
691.40SmycroftNORMAL_S_C=	${CC} ${AFLAGS} ${CPPFLAGS} ${PARAM} -c $<
701.1Sglass
711.1Sglass%OBJS
721.1Sglass
731.1Sglass%CFILES
741.1Sglass
751.38Smycroft%SFILES
761.38Smycroft
771.1Sglass# load lines for config "xxx" will be emitted as:
781.1Sglass# xxx: ${SYSTEM_DEP} swapxxx.o
791.1Sglass#	${SYSTEM_LD_HEAD}
801.1Sglass#	${SYSTEM_LD} swapxxx.o
811.1Sglass#	${SYSTEM_LD_TAIL}
821.38SmycroftSYSTEM_OBJ=	locore.o \
831.43Scgd		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
841.38SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
851.38SmycroftSYSTEM_LD_HEAD=	@rm -f $@
861.38SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
871.38Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
881.38SmycroftSYSTEM_LD_TAIL=	@size $@; chmod 755 $@
891.38Smycroft
901.38SmycroftDEBUG?=
911.11Sderaadt.if ${DEBUG} == "-g"
921.38SmycroftLINKFLAGS+=	-X
931.38SmycroftSYSTEM_LD_TAIL+=; \
941.38Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
951.38Smycroft		echo ${STRIP} $@; ${STRIP} $@
961.11Sderaadt.else
971.41SgwrLINKFLAGS+=	-S
981.11Sderaadt.endif
991.1Sglass
1001.1Sglass%LOAD
1011.1Sglass
1021.38Smycroftassym.h: genassym
1031.38Smycroft	./genassym >assym.h
1041.1Sglass
1051.38Smycroftgenassym: genassym.o
1061.38Smycroft	${CC} -o $@ genassym.o
1071.1Sglass
1081.38Smycroftgenassym.o: ${SUN3}/sun3/genassym.c
1091.38Smycroft	${NORMAL_C_C}
1101.1Sglass
1111.38Smycroftparam.c: $S/conf/param.c
1121.38Smycroft	rm -f param.c
1131.38Smycroft	cp $S/conf/param.c .
1141.17Sgwr
1151.38Smycroftparam.o: param.c Makefile
1161.38Smycroft	${NORMAL_C_C}
1171.21Sgwr
1181.38Smycroftioconf.o: ioconf.c
1191.38Smycroft	${NORMAL_C}
1201.1Sglass
1211.38Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1221.38Smycroft	sh $S/conf/newvers.sh
1231.38Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1241.38Smycroft
1251.38Smycroft
1261.38Smycroftclean::
1271.43Scgd	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1281.38Smycroft	    [Ee]rrs linterrs makelinks genassym genassym.o assym.h
1291.1Sglass
1301.38Smycroftlint:
1311.38Smycroft	@lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \
1321.38Smycroft	    ${SUN3}/sun3/Locore.c ${CFILES} ${SUN3}/sun3/swapgeneric.c \
1331.38Smycroft	    ioconf.c param.c | \
1341.38Smycroft	    grep -v 'static function .* unused'
1351.1Sglass
1361.38Smycrofttags:
1371.38Smycroft	@echo "see $S/kern/Makefile for tags"
1381.1Sglass
1391.1Sglasslinks:
1401.1Sglass	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1411.1Sglass	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1421.1Sglass	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1431.1Sglass	  sort -u | comm -23 - dontlink | \
1441.38Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1451.1Sglass	sh makelinks && rm -f dontlink
1461.1Sglass
1471.38SmycroftSRCS=	${SUN3}/sun3/locore.s \
1481.43Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1491.44Smycroftdepend:: .depend
1501.43Scgd.depend: ${SRCS} assym.h param.c
1511.40Smycroft	mkdep ${AFLAGS} ${CPPFLAGS} ${SUN3}/sun3/locore.s
1521.43Scgd	mkdep -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1531.40Smycroft	mkdep -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
1541.38Smycroft	mkdep -a ${CFLAGS} ${CPPFLAGS} ${PARAM} ${SUN3}/sun3/genassym.c
1551.38Smycroft
1561.1Sglass
1571.38Smycroft# depend on root or device configuration
1581.38Smycroftautoconf.o conf.o: Makefile
1591.38Smycroft 
1601.38Smycroft# depend on network or filesystem configuration 
1611.38Smycroftuipc_proto.o vfs_conf.o: Makefile 
1621.1Sglass
1631.38Smycroft# depend on maxusers
1641.38Smycroftgenassym.o machdep.o: Makefile
1651.1Sglass
1661.38Smycroft# depend on CPU configuration 
1671.38Smycroftdb_machdep.o dvma.o machdep.o pmap.o sun3_startup.o vm_machdep.o: Makefile
1681.1Sglass
1691.19Sgwr
1701.38Smycroftlocore.o: ${SUN3}/sun3/locore.s assym.h
1711.38Smycroft	${NORMAL_S}
1721.1Sglass
1731.1Sglass%RULES
174