Makefile.mvme68k revision 1.30
11.30Slukem#	$NetBSD: Makefile.mvme68k,v 1.30 1997/10/03 07:17:41 lukem 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.30SlukemSIZE?=	size
281.16SmycroftSTRIP?=	strip
291.30SlukemCOPTS?=	-O2
301.1Schuck
311.1Schuck# source tree is located via $S relative to the compilation directory
321.15Smycroft.ifndef S
331.12SmycroftS!=	cd ../../../..; pwd
341.15Smycroft.endif
351.12SmycroftMVME68K=$S/arch/mvme68k
361.1Schuck
371.23Sgwr# Override CPP defaults entirely, so cross-compilation works.
381.23Sgwr# Keep -nostdinc before all -I flags, similar for -undef ...
391.23SgwrINCLUDES=	-nostdinc -I. -I$S/arch -I$S
401.25SthorpejCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
411.28Smycroft		-Dmc68020 -Dmvme68k
421.12SmycroftCWARNFLAGS=	-Werror
431.25SthorpejCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float
441.25SthorpejAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
451.6SmycroftLINKFLAGS=	-n -Ttext 8000 -e start
461.16SmycroftSTRIPFLAGS=	-d
471.16Smycroft
481.25SthorpejHOSTED_CC=	${CC}
491.25SthorpejHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
501.25SthorpejHOSTED_CFLAGS=	${CFLAGS}
511.25Sthorpej
521.1Schuck### find out what to use for libkern
531.1Schuck.include "$S/lib/libkern/Makefile.inc"
541.1Schuck.ifndef PROF
551.1SchuckLIBKERN=	${KERNLIB}
561.1Schuck.else
571.1SchuckLIBKERN=	${KERNLIB_PROF}
581.1Schuck.endif
591.1Schuck
601.1Schuck### find out what to use for libcompat
611.1Schuck.include "$S/compat/common/Makefile.inc"
621.1Schuck.ifndef PROF
631.23SgwrLIBCOMPAT=	${COMPATLIB}
641.1Schuck.else
651.23SgwrLIBCOMPAT=	${COMPATLIB_PROF}
661.1Schuck.endif
671.1Schuck
681.1Schuck### for the Motorola 68040 Floating Point Software Product
691.1Schuck.include "$S/arch/m68k/fpsp/Makefile.inc"
701.1Schuck
711.25Sthorpej# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
721.25Sthorpej# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
731.1Schuck
741.6SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
751.25SthorpejNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
761.1Schuck
771.25SthorpejHOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
781.13Smycroft
791.1Schuck%OBJS
801.1Schuck
811.1Schuck%CFILES
821.1Schuck
831.6Smycroft%SFILES
841.6Smycroft
851.1Schuck# load lines for config "xxx" will be emitted as:
861.1Schuck# xxx: ${SYSTEM_DEP} swapxxx.o
871.1Schuck#	${SYSTEM_LD_HEAD}
881.1Schuck#	${SYSTEM_LD} swapxxx.o
891.1Schuck#	${SYSTEM_LD_TAIL}
901.6SmycroftSYSTEM_OBJ=	locore.o ${FPSP} \
911.10Scgd		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
921.6SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
931.6SmycroftSYSTEM_LD_HEAD=	@rm -f $@
941.6SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
951.6Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
961.30SlukemSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
971.6Smycroft
981.1SchuckDEBUG?=
991.1Schuck.if ${DEBUG} == "-g"
1001.6SmycroftLINKFLAGS+=	-X
1011.6SmycroftSYSTEM_LD_TAIL+=; \
1021.6Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
1031.16Smycroft		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
1041.1Schuck.else
1051.12SmycroftLINKFLAGS+=	-S
1061.1Schuck.endif
1071.1Schuck
1081.1Schuck%LOAD
1091.1Schuck
1101.22Smycroftassym.h: $S/kern/genassym.sh ${MVME68K}/mvme68k/genassym.cf
1111.22Smycroft	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1121.22Smycroft	    < ${MVME68K}/mvme68k/genassym.cf > assym.h.tmp && \
1131.22Smycroft	mv -f assym.h.tmp assym.h
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.29Schristos__CLEANKERNEL: .USE
1301.29Schristos	@echo "${.TARGET}ing the kernel objects"
1311.10Scgd	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1321.22Smycroft	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1331.29Schristos
1341.29Schristos__CLEANDEPEND: .USE
1351.29Schristos	rm -f .depend
1361.29Schristos
1371.29Schristosclean: __CLEANKERNEL
1381.29Schristos
1391.29Schristoscleandir: __CLEANKERNEL __CLEANDEPEND
1401.1Schuck
1411.6Smycroftlint:
1421.18Sperry	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1431.27Smycroft	    ${CFILES} ioconf.c param.c | \
1441.6Smycroft	    grep -v 'static function .* unused'
1451.1Schuck
1461.6Smycrofttags:
1471.6Smycroft	@echo "see $S/kern/Makefile for tags"
1481.1Schuck
1491.1Schucklinks:
1501.1Schuck	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1511.1Schuck	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1521.1Schuck	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1531.1Schuck	  sort -u | comm -23 - dontlink | \
1541.6Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1551.1Schuck	sh makelinks && rm -f dontlink
1561.1Schuck
1571.6SmycroftSRCS=	${MVME68K}/mvme68k/locore.s \
1581.10Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1591.20Schuckdepend: .depend
1601.10Scgd.depend: ${SRCS} assym.h param.c
1611.25Sthorpej	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${MVME68K}/mvme68k/locore.s
1621.25Sthorpej	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1631.25Sthorpej	-if test -n "${SFILES}"; then \
1641.25Sthorpej		${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}; \
1651.25Sthorpej	fi
1661.26Sleo	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
1671.26Sleo	  ${CPPFLAGS} < ${MVME68K}/mvme68k/genassym.cf
1681.26Sleo	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
1691.26Sleo	@rm -f assym.dep
1701.6Smycroft
1711.6Smycroft
1721.6Smycroft# depend on root or device configuration
1731.6Smycroftautoconf.o conf.o: Makefile
1741.6Smycroft 
1751.6Smycroft# depend on network or filesystem configuration 
1761.6Smycroftuipc_proto.o vfs_conf.o: Makefile 
1771.1Schuck
1781.6Smycroft# depend on maxusers
1791.22Smycroftmachdep.o: Makefile
1801.1Schuck
1811.6Smycroft# depend on CPU configuration 
1821.6Smycroftlocore.o pmap.o sys_machdep.o trap.o: Makefile
1831.1Schuck
1841.1Schuck
1851.6Smycroftlocore.o: ${MVME68K}/mvme68k/locore.s assym.h
1861.6Smycroft	${NORMAL_S}
1871.1Schuck
1881.1Schuck%RULES
189