Makefile.mvme68k revision 1.22
11.22Smycroft#	$NetBSD: Makefile.mvme68k,v 1.22 1997/03/14 23:19:03 mycroft Exp $
21.1Schuck
31.1Schuck# Makefile for NetBSD
41.1Schuck#
51.1Schuck# This makefile is constructed from a machine description:
61.1Schuck#	config machineid
71.1Schuck# Most changes should be made in the machine description
81.1Schuck#	/sys/arch/mvme68k/conf/``machineid''
91.1Schuck# after which you should do
101.6Smycroft#	config machineid
111.1Schuck# Machine generic makefile changes should be made in
121.1Schuck#	/sys/arch/mvme68k/conf/Makefile.mvme68k
131.1Schuck# after which config should be rerun for all machines of that type.
141.1Schuck#
151.1Schuck# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
161.1Schuck#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
171.1Schuck#
181.1Schuck# -DTRACE	compile in kernel tracing hooks
191.1Schuck# -DQUOTA	compile in file system quotas
201.1Schuck
211.6Smycroft# DEBUG is set to -g if debugging.
221.6Smycroft# PROF is set to -pg if profiling.
231.1Schuck
241.9SmycroftCC?=	cc
251.9SmycroftLD?=	ld
261.12SmycroftMKDEP?=	mkdep
271.16SmycroftSTRIP?=	strip
281.17SjonathanCOPTS?= 	-O2
291.1Schuck
301.1Schuck# source tree is located via $S relative to the compilation directory
311.15Smycroft.ifndef S
321.12SmycroftS!=	cd ../../../..; pwd
331.15Smycroft.endif
341.12SmycroftMVME68K=$S/arch/mvme68k
351.1Schuck
361.13SmycroftINCLUDES=	-I. -I$S/arch -I$S -nostdinc
371.14SmycroftCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
381.14Smycroft		-Dmc68020 -Dmvme68k -DFPCOPROC
391.12SmycroftCWARNFLAGS=	-Werror
401.17SjonathanCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float
411.8SmycroftAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
421.6SmycroftLINKFLAGS=	-n -Ttext 8000 -e start
431.16SmycroftSTRIPFLAGS=	-d
441.16Smycroft
451.16SmycroftHOSTED_CC=	${CC}
461.16SmycroftHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
471.16SmycroftHOSTED_CFLAGS=	${CFLAGS}
481.1Schuck
491.1Schuck### find out what to use for libkern
501.1Schuck.include "$S/lib/libkern/Makefile.inc"
511.1Schuck.ifndef PROF
521.1SchuckLIBKERN=	${KERNLIB}
531.1Schuck.else
541.1SchuckLIBKERN=	${KERNLIB_PROF}
551.1Schuck.endif
561.1Schuck
571.1Schuck### find out what to use for libcompat
581.1Schuck.include "$S/compat/common/Makefile.inc"
591.1Schuck.ifndef PROF
601.1SchuckLIBCOMPAT=    ${COMPATLIB}
611.1Schuck.else
621.1SchuckLIBCOMPAT=    ${COMPATLIB_PROF}
631.1Schuck.endif
641.1Schuck
651.1Schuck### for the Motorola 68040 Floating Point Software Product
661.1Schuck.include "$S/arch/m68k/fpsp/Makefile.inc"
671.1Schuck
681.14Smycroft# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
691.14Smycroft# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
701.1Schuck
711.6SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
721.8SmycroftNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
731.1Schuck
741.16SmycroftHOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
751.13Smycroft
761.1Schuck%OBJS
771.1Schuck
781.1Schuck%CFILES
791.1Schuck
801.6Smycroft%SFILES
811.6Smycroft
821.1Schuck# load lines for config "xxx" will be emitted as:
831.1Schuck# xxx: ${SYSTEM_DEP} swapxxx.o
841.1Schuck#	${SYSTEM_LD_HEAD}
851.1Schuck#	${SYSTEM_LD} swapxxx.o
861.1Schuck#	${SYSTEM_LD_TAIL}
871.6SmycroftSYSTEM_OBJ=	locore.o ${FPSP} \
881.10Scgd		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
891.6SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
901.6SmycroftSYSTEM_LD_HEAD=	@rm -f $@
911.6SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
921.6Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
931.6SmycroftSYSTEM_LD_TAIL=	@size $@; chmod 755 $@
941.6Smycroft
951.1SchuckDEBUG?=
961.1Schuck.if ${DEBUG} == "-g"
971.6SmycroftLINKFLAGS+=	-X
981.6SmycroftSYSTEM_LD_TAIL+=; \
991.6Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
1001.16Smycroft		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
1011.1Schuck.else
1021.12SmycroftLINKFLAGS+=	-S
1031.1Schuck.endif
1041.1Schuck
1051.1Schuck%LOAD
1061.1Schuck
1071.22Smycroftassym.h: $S/kern/genassym.sh ${MVME68K}/mvme68k/genassym.cf
1081.22Smycroft	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1091.22Smycroft	    < ${MVME68K}/mvme68k/genassym.cf > assym.h.tmp && \
1101.22Smycroft	mv -f assym.h.tmp assym.h
1111.6Smycroft
1121.6Smycroftparam.c: $S/conf/param.c
1131.6Smycroft	rm -f param.c
1141.6Smycroft	cp $S/conf/param.c .
1151.6Smycroft
1161.6Smycroftparam.o: param.c Makefile
1171.14Smycroft	${NORMAL_C}
1181.6Smycroft
1191.6Smycroftioconf.o: ioconf.c
1201.6Smycroft	${NORMAL_C}
1211.1Schuck
1221.6Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1231.1Schuck	sh $S/conf/newvers.sh
1241.6Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1251.6Smycroft
1261.1Schuck
1271.20Schuckclean: cleankernel
1281.20Schuckcleankernel:
1291.10Scgd	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1301.22Smycroft	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1311.1Schuck
1321.6Smycroftlint:
1331.18Sperry	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1341.19Sperry	    ${MVME68K}/mvme68k/Locore.c ${CFILES} \
1351.1Schuck	    ioconf.c param.c | \
1361.6Smycroft	    grep -v 'static function .* unused'
1371.1Schuck
1381.6Smycrofttags:
1391.6Smycroft	@echo "see $S/kern/Makefile for tags"
1401.1Schuck
1411.1Schucklinks:
1421.1Schuck	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1431.1Schuck	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1441.1Schuck	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1451.1Schuck	  sort -u | comm -23 - dontlink | \
1461.6Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1471.1Schuck	sh makelinks && rm -f dontlink
1481.1Schuck
1491.6SmycroftSRCS=	${MVME68K}/mvme68k/locore.s \
1501.10Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1511.20Schuckdepend: .depend
1521.10Scgd.depend: ${SRCS} assym.h param.c
1531.12Smycroft	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${MVME68K}/mvme68k/locore.s
1541.12Smycroft	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1551.12Smycroft	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
1561.6Smycroft
1571.6Smycroft
1581.6Smycroft# depend on root or device configuration
1591.6Smycroftautoconf.o conf.o: Makefile
1601.6Smycroft 
1611.6Smycroft# depend on network or filesystem configuration 
1621.6Smycroftuipc_proto.o vfs_conf.o: Makefile 
1631.1Schuck
1641.6Smycroft# depend on maxusers
1651.22Smycroftmachdep.o: Makefile
1661.1Schuck
1671.6Smycroft# depend on CPU configuration 
1681.6Smycroftlocore.o pmap.o sys_machdep.o trap.o: Makefile
1691.1Schuck
1701.1Schuck
1711.6Smycroftlocore.o: ${MVME68K}/mvme68k/locore.s assym.h
1721.6Smycroft	${NORMAL_S}
1731.1Schuck
1741.1Schuck%RULES
175