Makefile.sun3 revision 1.48
11.48Smycroft#	$NetBSD: Makefile.sun3,v 1.48 1996/08/10 06:10: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.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.48SmycroftINCLUDES=	-I. -I$S/arch -I$S -nostdinc
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.48SmycroftHOSTED_C_C=	${NORMAL_C_C:S/^-pg$//:S/^-p$//:S/^-nostdinc$//}
741.48Smycroft
751.1Sglass%OBJS
761.1Sglass
771.1Sglass%CFILES
781.1Sglass
791.38Smycroft%SFILES
801.38Smycroft
811.1Sglass# load lines for config "xxx" will be emitted as:
821.1Sglass# xxx: ${SYSTEM_DEP} swapxxx.o
831.1Sglass#	${SYSTEM_LD_HEAD}
841.1Sglass#	${SYSTEM_LD} swapxxx.o
851.1Sglass#	${SYSTEM_LD_TAIL}
861.38SmycroftSYSTEM_OBJ=	locore.o \
871.43Scgd		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
881.38SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
891.38SmycroftSYSTEM_LD_HEAD=	@rm -f $@
901.38SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
911.38Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
921.38SmycroftSYSTEM_LD_TAIL=	@size $@; chmod 755 $@
931.38Smycroft
941.38SmycroftDEBUG?=
951.11Sderaadt.if ${DEBUG} == "-g"
961.38SmycroftLINKFLAGS+=	-X
971.38SmycroftSYSTEM_LD_TAIL+=; \
981.38Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
991.38Smycroft		echo ${STRIP} $@; ${STRIP} $@
1001.11Sderaadt.else
1011.41SgwrLINKFLAGS+=	-S
1021.11Sderaadt.endif
1031.1Sglass
1041.1Sglass%LOAD
1051.1Sglass
1061.38Smycroftassym.h: genassym
1071.38Smycroft	./genassym >assym.h
1081.1Sglass
1091.38Smycroftgenassym: genassym.o
1101.38Smycroft	${CC} -o $@ genassym.o
1111.1Sglass
1121.38Smycroftgenassym.o: ${SUN3}/sun3/genassym.c
1131.48Smycroft	${HOSTED_C_C}
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.43Scgd	rm -f eddep *netbsd netbsd.gdb tags *.[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.43Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1531.44Smycroftdepend:: .depend
1541.47Smycroft.depend: ${SRCS} assym.h param.c
1551.47Smycroft	${MKDEP} ${AFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1561.47Smycroft	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} ${PARAM} ${SUN3}/sun3/genassym.c
1571.38Smycroft
1581.45Sgwr# XXX - see below
1591.45Sgwr#	${MKDEP} -a ${APPFLAGS} ${SUN3}/sun3/locore.s
1601.45Sgwr#	${MKDEP} -a ${APPFLAGS} ${SFILES}
1611.45Sgwr#
1621.45Sgwr# For cross-compilation, the "gcc -M" mkdep script is convenient,
1631.45Sgwr# but that does not correctly make rules from *.s files.  The
1641.45Sgwr# easiest compromise is to just list those dependencies here.
1651.45Sgwrlocore.o: assym.h machine/trap.h m68k/trap.h
1661.45Sgwrcopy.o:   assym.h $S/sys/errno.h
1671.1Sglass
1681.47Smycroft
1691.38Smycroft# depend on root or device configuration
1701.38Smycroftautoconf.o conf.o: Makefile
1711.38Smycroft 
1721.38Smycroft# depend on network or filesystem configuration 
1731.38Smycroftuipc_proto.o vfs_conf.o: Makefile 
1741.1Sglass
1751.38Smycroft# depend on maxusers
1761.38Smycroftgenassym.o machdep.o: Makefile
1771.1Sglass
1781.38Smycroft# depend on CPU configuration 
1791.38Smycroftdb_machdep.o dvma.o machdep.o pmap.o sun3_startup.o vm_machdep.o: Makefile
1801.1Sglass
1811.47Smycroft
1821.47Smycroftlocore.o: ${SUN3}/sun3/locore.s assym.h
1831.45Sgwr	${NORMAL_S}
1841.1Sglass
1851.1Sglass%RULES
186