Makefile.mvme68k revision 1.16
11.16Smycroft#	$NetBSD: Makefile.mvme68k,v 1.16 1996/09/09 21:07: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.1Schuck
291.1Schuck# source tree is located via $S relative to the compilation directory
301.15Smycroft.ifndef S
311.12SmycroftS!=	cd ../../../..; pwd
321.15Smycroft.endif
331.12SmycroftMVME68K=$S/arch/mvme68k
341.1Schuck
351.13SmycroftINCLUDES=	-I. -I$S/arch -I$S -nostdinc
361.14SmycroftCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
371.14Smycroft		-Dmc68020 -Dmvme68k -DFPCOPROC
381.12SmycroftCWARNFLAGS=	-Werror
391.12SmycroftCFLAGS=		${DEBUG} ${CWARNFLAGS} -O2 -msoft-float
401.8SmycroftAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
411.6SmycroftLINKFLAGS=	-n -Ttext 8000 -e start
421.16SmycroftSTRIPFLAGS=	-d
431.16Smycroft
441.16SmycroftHOSTED_CC=	${CC}
451.16SmycroftHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
461.16SmycroftHOSTED_CFLAGS=	${CFLAGS}
471.1Schuck
481.1Schuck### find out what to use for libkern
491.1Schuck.include "$S/lib/libkern/Makefile.inc"
501.1Schuck.ifndef PROF
511.1SchuckLIBKERN=	${KERNLIB}
521.1Schuck.else
531.1SchuckLIBKERN=	${KERNLIB_PROF}
541.1Schuck.endif
551.1Schuck
561.1Schuck### find out what to use for libcompat
571.1Schuck.include "$S/compat/common/Makefile.inc"
581.1Schuck.ifndef PROF
591.1SchuckLIBCOMPAT=    ${COMPATLIB}
601.1Schuck.else
611.1SchuckLIBCOMPAT=    ${COMPATLIB_PROF}
621.1Schuck.endif
631.1Schuck
641.1Schuck### for the Motorola 68040 Floating Point Software Product
651.1Schuck.include "$S/arch/m68k/fpsp/Makefile.inc"
661.1Schuck
671.14Smycroft# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
681.14Smycroft# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
691.1Schuck
701.6SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
711.8SmycroftNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
721.1Schuck
731.16SmycroftHOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
741.13Smycroft
751.1Schuck%OBJS
761.1Schuck
771.1Schuck%CFILES
781.1Schuck
791.6Smycroft%SFILES
801.6Smycroft
811.1Schuck# load lines for config "xxx" will be emitted as:
821.1Schuck# xxx: ${SYSTEM_DEP} swapxxx.o
831.1Schuck#	${SYSTEM_LD_HEAD}
841.1Schuck#	${SYSTEM_LD} swapxxx.o
851.1Schuck#	${SYSTEM_LD_TAIL}
861.6SmycroftSYSTEM_OBJ=	locore.o ${FPSP} \
871.10Scgd		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
881.6SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
891.6SmycroftSYSTEM_LD_HEAD=	@rm -f $@
901.6SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
911.6Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
921.6SmycroftSYSTEM_LD_TAIL=	@size $@; chmod 755 $@
931.6Smycroft
941.1SchuckDEBUG?=
951.1Schuck.if ${DEBUG} == "-g"
961.6SmycroftLINKFLAGS+=	-X
971.6SmycroftSYSTEM_LD_TAIL+=; \
981.6Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
991.16Smycroft		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
1001.1Schuck.else
1011.12SmycroftLINKFLAGS+=	-S
1021.1Schuck.endif
1031.1Schuck
1041.1Schuck%LOAD
1051.1Schuck
1061.6Smycroftassym.h: genassym
1071.6Smycroft	./genassym >assym.h
1081.6Smycroft
1091.6Smycroftgenassym: genassym.o
1101.6Smycroft	${CC} -o $@ genassym.o
1111.6Smycroft
1121.6Smycroftgenassym.o: ${MVME68K}/mvme68k/genassym.c
1131.14Smycroft	${HOSTED_C}
1141.6Smycroft
1151.6Smycroftparam.c: $S/conf/param.c
1161.6Smycroft	rm -f param.c
1171.6Smycroft	cp $S/conf/param.c .
1181.6Smycroft
1191.6Smycroftparam.o: param.c Makefile
1201.14Smycroft	${NORMAL_C}
1211.6Smycroft
1221.6Smycroftioconf.o: ioconf.c
1231.6Smycroft	${NORMAL_C}
1241.1Schuck
1251.6Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1261.1Schuck	sh $S/conf/newvers.sh
1271.6Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1281.6Smycroft
1291.1Schuck
1301.1Schuckclean::
1311.10Scgd	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1321.6Smycroft	    [Ee]rrs linterrs makelinks genassym genassym.o assym.h
1331.1Schuck
1341.6Smycroftlint:
1351.14Smycroft	@lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} -UKGDB \
1361.1Schuck	    ${MVME68K}/mvme68k/Locore.c ${CFILES} ${MVME68K}/mvme68k/swapgeneric.c \
1371.1Schuck	    ioconf.c param.c | \
1381.6Smycroft	    grep -v 'static function .* unused'
1391.1Schuck
1401.6Smycrofttags:
1411.6Smycroft	@echo "see $S/kern/Makefile for tags"
1421.1Schuck
1431.1Schucklinks:
1441.1Schuck	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1451.1Schuck	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1461.1Schuck	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1471.1Schuck	  sort -u | comm -23 - dontlink | \
1481.6Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1491.1Schuck	sh makelinks && rm -f dontlink
1501.1Schuck
1511.6SmycroftSRCS=	${MVME68K}/mvme68k/locore.s \
1521.10Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1531.11Smycroftdepend:: .depend
1541.10Scgd.depend: ${SRCS} assym.h param.c
1551.12Smycroft	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${MVME68K}/mvme68k/locore.s
1561.12Smycroft	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1571.12Smycroft	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
1581.16Smycroft	${MKDEP} -a ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} \
1591.16Smycroft	    ${MVME68K}/mvme68k/genassym.c
1601.6Smycroft
1611.6Smycroft
1621.6Smycroft# depend on root or device configuration
1631.6Smycroftautoconf.o conf.o: Makefile
1641.6Smycroft 
1651.6Smycroft# depend on network or filesystem configuration 
1661.6Smycroftuipc_proto.o vfs_conf.o: Makefile 
1671.1Schuck
1681.6Smycroft# depend on maxusers
1691.6Smycroftgenassym.o machdep.o: Makefile
1701.1Schuck
1711.6Smycroft# depend on CPU configuration 
1721.6Smycroftlocore.o pmap.o sys_machdep.o trap.o: Makefile
1731.1Schuck
1741.1Schuck
1751.6Smycroftlocore.o: ${MVME68K}/mvme68k/locore.s assym.h
1761.6Smycroft	${NORMAL_S}
1771.1Schuck
1781.1Schuck%RULES
179