Makefile.sun3 revision 1.47
11.47Smycroft#	$NetBSD: Makefile.sun3,v 1.47 1996/08/10 05:29:53 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.42SmycroftCC?=	cc
251.42SmycroftLD?=	ld
261.45SgwrMKDEP?=	mkdep
271.42SmycroftSTRIP?=	strip -d
281.42SmycroftTOUCH?=	touch -f -c
291.1Sglass
301.1Sglass# source tree is located via $S relative to the compilation directory
311.47SmycroftS!=	cd ../../../..; pwd
321.47SmycroftSUN3=	$S/arch/sun3
331.1Sglass
341.45Sgwr# Override CPP defaults entirely, so cross-compilation works.
351.47SmycroftINCLUDES=	-I. -I$S/arch -I$S
361.47SmycroftXDEFS=		-undef -D__NetBSD__ -Dm68k -Dmc68000
371.47SmycroftCPPFLAGS=	${INCLUDES} ${IDENT} -D_KERNEL -Dmc68020 -Dsun3 ${XDEFS}
381.47SmycroftCWARNFLAGS= 	-Werror # -Wall -Wstrict-prototypes -Wmissing-prototypes
391.47SmycroftCFLAGS= 	${DEBUG} ${CWARNFLAGS} -O2 -msoft-float
401.47SmycroftAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
411.38SmycroftLINKFLAGS=	-N -Ttext 0E004000 -e start
421.31Sgwr
431.47Smycroft### find out what to use for libkern
441.47Smycroft.include "$S/lib/libkern/Makefile.inc"
451.31Sgwr.ifndef PROF
461.47SmycroftLIBKERN=	${KERNLIB}
471.31Sgwr.else
481.47SmycroftLIBKERN=	${KERNLIB_PROF}
491.31Sgwr.endif
501.1Sglass
511.47Smycroft### find out what to use for libcompat
521.47Smycroft.include "$S/compat/common/Makefile.inc"
531.47Smycroft.ifndef PROF
541.47SmycroftLIBCOMPAT=	${COMPATLIB}
551.47Smycroft.else
561.47SmycroftLIBCOMPAT=	${COMPATLIB_PROF}
571.47Smycroft.endif
581.32Schristos
591.1Sglass# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
601.1Sglass# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
611.1Sglass# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
621.1Sglass# is marked as config-dependent.
631.1Sglass
641.38SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
651.38SmycroftNORMAL_C_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
661.1Sglass
671.38SmycroftDRIVER_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
681.38SmycroftDRIVER_C_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
691.1Sglass
701.47SmycroftNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
711.47SmycroftNORMAL_S_C=	${CC} ${AFLAGS} ${CPPFLAGS} ${PARAM} -c $<
721.1Sglass
731.1Sglass%OBJS
741.1Sglass
751.1Sglass%CFILES
761.1Sglass
771.38Smycroft%SFILES
781.38Smycroft
791.1Sglass# load lines for config "xxx" will be emitted as:
801.1Sglass# xxx: ${SYSTEM_DEP} swapxxx.o
811.1Sglass#	${SYSTEM_LD_HEAD}
821.1Sglass#	${SYSTEM_LD} swapxxx.o
831.1Sglass#	${SYSTEM_LD_TAIL}
841.38SmycroftSYSTEM_OBJ=	locore.o \
851.43Scgd		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
861.38SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
871.38SmycroftSYSTEM_LD_HEAD=	@rm -f $@
881.38SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
891.38Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
901.38SmycroftSYSTEM_LD_TAIL=	@size $@; chmod 755 $@
911.38Smycroft
921.38SmycroftDEBUG?=
931.11Sderaadt.if ${DEBUG} == "-g"
941.38SmycroftLINKFLAGS+=	-X
951.38SmycroftSYSTEM_LD_TAIL+=; \
961.38Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
971.38Smycroft		echo ${STRIP} $@; ${STRIP} $@
981.11Sderaadt.else
991.41SgwrLINKFLAGS+=	-S
1001.11Sderaadt.endif
1011.1Sglass
1021.1Sglass%LOAD
1031.1Sglass
1041.38Smycroftassym.h: genassym
1051.38Smycroft	./genassym >assym.h
1061.1Sglass
1071.38Smycroftgenassym: genassym.o
1081.38Smycroft	${CC} -o $@ genassym.o
1091.1Sglass
1101.38Smycroftgenassym.o: ${SUN3}/sun3/genassym.c
1111.38Smycroft	${NORMAL_C_C}
1121.1Sglass
1131.38Smycroftparam.c: $S/conf/param.c
1141.38Smycroft	rm -f param.c
1151.38Smycroft	cp $S/conf/param.c .
1161.17Sgwr
1171.38Smycroftparam.o: param.c Makefile
1181.38Smycroft	${NORMAL_C_C}
1191.21Sgwr
1201.38Smycroftioconf.o: ioconf.c
1211.38Smycroft	${NORMAL_C}
1221.1Sglass
1231.38Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1241.38Smycroft	sh $S/conf/newvers.sh
1251.38Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1261.38Smycroft
1271.38Smycroft
1281.38Smycroftclean::
1291.43Scgd	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1301.38Smycroft	    [Ee]rrs linterrs makelinks genassym genassym.o assym.h
1311.1Sglass
1321.38Smycroftlint:
1331.38Smycroft	@lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \
1341.38Smycroft	    ${SUN3}/sun3/Locore.c ${CFILES} ${SUN3}/sun3/swapgeneric.c \
1351.38Smycroft	    ioconf.c param.c | \
1361.38Smycroft	    grep -v 'static function .* unused'
1371.1Sglass
1381.38Smycrofttags:
1391.38Smycroft	@echo "see $S/kern/Makefile for tags"
1401.1Sglass
1411.1Sglasslinks:
1421.1Sglass	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1431.1Sglass	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1441.1Sglass	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1451.1Sglass	  sort -u | comm -23 - dontlink | \
1461.38Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1471.1Sglass	sh makelinks && rm -f dontlink
1481.1Sglass
1491.38SmycroftSRCS=	${SUN3}/sun3/locore.s \
1501.43Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1511.44Smycroftdepend:: .depend
1521.47Smycroft.depend: ${SRCS} assym.h param.c
1531.47Smycroft	${MKDEP} ${AFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1541.47Smycroft	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} ${PARAM} ${SUN3}/sun3/genassym.c
1551.38Smycroft
1561.45Sgwr# XXX - see below
1571.45Sgwr#	${MKDEP} -a ${APPFLAGS} ${SUN3}/sun3/locore.s
1581.45Sgwr#	${MKDEP} -a ${APPFLAGS} ${SFILES}
1591.45Sgwr#
1601.45Sgwr# For cross-compilation, the "gcc -M" mkdep script is convenient,
1611.45Sgwr# but that does not correctly make rules from *.s files.  The
1621.45Sgwr# easiest compromise is to just list those dependencies here.
1631.45Sgwrlocore.o: assym.h machine/trap.h m68k/trap.h
1641.45Sgwrcopy.o:   assym.h $S/sys/errno.h
1651.1Sglass
1661.47Smycroft
1671.38Smycroft# depend on root or device configuration
1681.38Smycroftautoconf.o conf.o: Makefile
1691.38Smycroft 
1701.38Smycroft# depend on network or filesystem configuration 
1711.38Smycroftuipc_proto.o vfs_conf.o: Makefile 
1721.1Sglass
1731.38Smycroft# depend on maxusers
1741.38Smycroftgenassym.o machdep.o: Makefile
1751.1Sglass
1761.38Smycroft# depend on CPU configuration 
1771.38Smycroftdb_machdep.o dvma.o machdep.o pmap.o sun3_startup.o vm_machdep.o: Makefile
1781.1Sglass
1791.47Smycroft
1801.47Smycroftlocore.o: ${SUN3}/sun3/locore.s assym.h
1811.45Sgwr	${NORMAL_S}
1821.1Sglass
1831.1Sglass%RULES
184