Makefile.sun3 revision 1.45
11.45Sgwr#	$NetBSD: Makefile.sun3,v 1.45 1996/06/18 16:18:34 gwr 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.45SgwrMKDEP?=	mkdep
291.42SmycroftSTRIP?=	strip -d
301.42SmycroftTOUCH?=	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.45Sgwr# Override CPP defaults entirely, so cross-compilation works.
371.45SgwrINCLUDES=	-nostdinc -I. -I$S/arch -I$S
381.45SgwrDEFINES=	-undef -D__NetBSD__ -D_KERNEL -Dmc68020 -Dsun3
391.45SgwrCPPFLAGS=	${INCLUDES} ${DEFINES} ${IDENT}
401.45Sgwr# Make it easy to override this on the command line...
411.45SgwrWFLAGS= 	-Werror # -Wall -Wstrict-prototypes -Wmissing-prototypes
421.45SgwrCFLAGS= 	${DEBUG} -O2 -msoft-float ${WFLAGS}
431.45SgwrAPPFLAGS=	-P -traditional ${CPPFLAGS} -D_LOCORE
441.38SmycroftLINKFLAGS=	-N -Ttext 0E004000 -e start
451.31Sgwr
461.31Sgwr# What to use for libkern:
471.31Sgwr.include "$S/lib/libkern/Makefile.inc"
481.31Sgwr.ifndef PROF
491.31SgwrLIBKERN=	${KERNLIB}
501.31Sgwr.else
511.31SgwrLIBKERN=	${KERNLIB_PROF}
521.31Sgwr.endif
531.1Sglass
541.45Sgwr# What to use for libcompat:
551.32Schristos.include "$S/compat/common/Makefile.inc"
561.32Schristos.ifndef PROF
571.32SchristosLIBCOMPAT=	${COMPATLIB}
581.32Schristos.else
591.32SchristosLIBCOMPAT=	${COMPATLIB_PROF}
601.32Schristos.endif
611.32Schristos
621.1Sglass# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
631.1Sglass# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
641.1Sglass# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
651.1Sglass# is marked as config-dependent.
661.1Sglass
671.38SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
681.38SmycroftNORMAL_C_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
691.1Sglass
701.38SmycroftDRIVER_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
711.38SmycroftDRIVER_C_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
721.1Sglass
731.45SgwrNORMAL_S=	${CPP} ${APPFLAGS} $< > $*.s ;\
741.45Sgwr		${AS} -o $@ $*.s ; rm $*.s
751.45SgwrNORMAL_S_C=	${CPP} ${APPFLAGS} ${PARAM} $< > $*.s ;\
761.45Sgwr		${AS} -o $@ $*.s ; rm $*.s
771.45Sgwr
781.45Sgwr# OBJS, CFILES, SFILES follow:
791.1Sglass
801.1Sglass%OBJS
811.1Sglass
821.1Sglass%CFILES
831.1Sglass
841.38Smycroft%SFILES
851.38Smycroft
861.1Sglass# load lines for config "xxx" will be emitted as:
871.1Sglass# xxx: ${SYSTEM_DEP} swapxxx.o
881.1Sglass#	${SYSTEM_LD_HEAD}
891.1Sglass#	${SYSTEM_LD} swapxxx.o
901.1Sglass#	${SYSTEM_LD_TAIL}
911.38SmycroftSYSTEM_OBJ=	locore.o \
921.43Scgd		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
931.38SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
941.38SmycroftSYSTEM_LD_HEAD=	@rm -f $@
951.38SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
961.38Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
971.38SmycroftSYSTEM_LD_TAIL=	@size $@; chmod 755 $@
981.38Smycroft
991.38SmycroftDEBUG?=
1001.11Sderaadt.if ${DEBUG} == "-g"
1011.38SmycroftLINKFLAGS+=	-X
1021.38SmycroftSYSTEM_LD_TAIL+=; \
1031.38Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
1041.38Smycroft		echo ${STRIP} $@; ${STRIP} $@
1051.11Sderaadt.else
1061.41SgwrLINKFLAGS+=	-S
1071.11Sderaadt.endif
1081.1Sglass
1091.1Sglass%LOAD
1101.1Sglass
1111.38Smycroftassym.h: genassym
1121.38Smycroft	./genassym >assym.h
1131.1Sglass
1141.38Smycroftgenassym: genassym.o
1151.38Smycroft	${CC} -o $@ genassym.o
1161.1Sglass
1171.38Smycroftgenassym.o: ${SUN3}/sun3/genassym.c
1181.38Smycroft	${NORMAL_C_C}
1191.1Sglass
1201.38Smycroftparam.c: $S/conf/param.c
1211.38Smycroft	rm -f param.c
1221.38Smycroft	cp $S/conf/param.c .
1231.17Sgwr
1241.38Smycroftparam.o: param.c Makefile
1251.38Smycroft	${NORMAL_C_C}
1261.21Sgwr
1271.38Smycroftioconf.o: ioconf.c
1281.38Smycroft	${NORMAL_C}
1291.1Sglass
1301.38Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1311.38Smycroft	sh $S/conf/newvers.sh
1321.38Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1331.38Smycroft
1341.38Smycroft
1351.38Smycroftclean::
1361.43Scgd	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1371.38Smycroft	    [Ee]rrs linterrs makelinks genassym genassym.o assym.h
1381.1Sglass
1391.38Smycroftlint:
1401.38Smycroft	@lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \
1411.38Smycroft	    ${SUN3}/sun3/Locore.c ${CFILES} ${SUN3}/sun3/swapgeneric.c \
1421.38Smycroft	    ioconf.c param.c | \
1431.38Smycroft	    grep -v 'static function .* unused'
1441.1Sglass
1451.38Smycrofttags:
1461.38Smycroft	@echo "see $S/kern/Makefile for tags"
1471.1Sglass
1481.1Sglasslinks:
1491.1Sglass	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1501.1Sglass	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1511.1Sglass	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1521.1Sglass	  sort -u | comm -23 - dontlink | \
1531.38Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1541.1Sglass	sh makelinks && rm -f dontlink
1551.1Sglass
1561.38SmycroftSRCS=	${SUN3}/sun3/locore.s \
1571.43Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1581.45Sgwr
1591.44Smycroftdepend:: .depend
1601.43Scgd.depend: ${SRCS} assym.h param.c
1611.45Sgwr	${MKDEP} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1621.45Sgwr	${MKDEP} -a ${CPPFLAGS} ${PARAM} ${SUN3}/sun3/genassym.c
1631.38Smycroft
1641.45Sgwr# XXX - see below
1651.45Sgwr#	${MKDEP} -a ${APPFLAGS} ${SUN3}/sun3/locore.s
1661.45Sgwr#	${MKDEP} -a ${APPFLAGS} ${SFILES}
1671.45Sgwr#
1681.45Sgwr# For cross-compilation, the "gcc -M" mkdep script is convenient,
1691.45Sgwr# but that does not correctly make rules from *.s files.  The
1701.45Sgwr# easiest compromise is to just list those dependencies here.
1711.45Sgwrlocore.o: assym.h machine/trap.h m68k/trap.h
1721.45Sgwrcopy.o:   assym.h $S/sys/errno.h
1731.1Sglass
1741.38Smycroft# depend on root or device configuration
1751.38Smycroftautoconf.o conf.o: Makefile
1761.38Smycroft 
1771.38Smycroft# depend on network or filesystem configuration 
1781.38Smycroftuipc_proto.o vfs_conf.o: Makefile 
1791.1Sglass
1801.38Smycroft# depend on maxusers
1811.38Smycroftgenassym.o machdep.o: Makefile
1821.1Sglass
1831.38Smycroft# depend on CPU configuration 
1841.38Smycroftdb_machdep.o dvma.o machdep.o pmap.o sun3_startup.o vm_machdep.o: Makefile
1851.1Sglass
1861.45Sgwrlocore.o: ${SUN3}/sun3/locore.s
1871.45Sgwr	${NORMAL_S}
1881.19Sgwr
1891.45Sgwr# Rules follow
1901.1Sglass
1911.1Sglass%RULES
192