Makefile.mvme68k revision 1.31
11.31Sthorpej#	$NetBSD: Makefile.mvme68k,v 1.31 1997/11/12 22:26:11 thorpej 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.31SthorpejLORDER?=lorder
271.12SmycroftMKDEP?=	mkdep
281.31SthorpejNM?=	nm
291.30SlukemSIZE?=	size
301.16SmycroftSTRIP?=	strip
311.31SthorpejTSORT?=	tsort -q
321.30SlukemCOPTS?=	-O2
331.1Schuck
341.1Schuck# source tree is located via $S relative to the compilation directory
351.15Smycroft.ifndef S
361.12SmycroftS!=	cd ../../../..; pwd
371.15Smycroft.endif
381.12SmycroftMVME68K=$S/arch/mvme68k
391.1Schuck
401.23Sgwr# Override CPP defaults entirely, so cross-compilation works.
411.23Sgwr# Keep -nostdinc before all -I flags, similar for -undef ...
421.23SgwrINCLUDES=	-nostdinc -I. -I$S/arch -I$S
431.25SthorpejCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
441.28Smycroft		-Dmc68020 -Dmvme68k
451.12SmycroftCWARNFLAGS=	-Werror
461.25SthorpejCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float
471.25SthorpejAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
481.6SmycroftLINKFLAGS=	-n -Ttext 8000 -e start
491.16SmycroftSTRIPFLAGS=	-d
501.16Smycroft
511.25SthorpejHOSTED_CC=	${CC}
521.25SthorpejHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
531.25SthorpejHOSTED_CFLAGS=	${CFLAGS}
541.25Sthorpej
551.1Schuck### find out what to use for libkern
561.1Schuck.include "$S/lib/libkern/Makefile.inc"
571.1Schuck.ifndef PROF
581.1SchuckLIBKERN=	${KERNLIB}
591.1Schuck.else
601.1SchuckLIBKERN=	${KERNLIB_PROF}
611.1Schuck.endif
621.1Schuck
631.1Schuck### find out what to use for libcompat
641.1Schuck.include "$S/compat/common/Makefile.inc"
651.1Schuck.ifndef PROF
661.23SgwrLIBCOMPAT=	${COMPATLIB}
671.1Schuck.else
681.23SgwrLIBCOMPAT=	${COMPATLIB_PROF}
691.1Schuck.endif
701.1Schuck
711.1Schuck### for the Motorola 68040 Floating Point Software Product
721.1Schuck.include "$S/arch/m68k/fpsp/Makefile.inc"
731.1Schuck
741.25Sthorpej# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
751.25Sthorpej# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
761.1Schuck
771.6SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
781.25SthorpejNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
791.1Schuck
801.25SthorpejHOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
811.13Smycroft
821.1Schuck%OBJS
831.1Schuck
841.1Schuck%CFILES
851.1Schuck
861.6Smycroft%SFILES
871.6Smycroft
881.1Schuck# load lines for config "xxx" will be emitted as:
891.1Schuck# xxx: ${SYSTEM_DEP} swapxxx.o
901.1Schuck#	${SYSTEM_LD_HEAD}
911.1Schuck#	${SYSTEM_LD} swapxxx.o
921.1Schuck#	${SYSTEM_LD_TAIL}
931.6SmycroftSYSTEM_OBJ=	locore.o ${FPSP} \
941.10Scgd		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
951.6SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
961.6SmycroftSYSTEM_LD_HEAD=	@rm -f $@
971.6SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
981.6Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
991.30SlukemSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
1001.6Smycroft
1011.1SchuckDEBUG?=
1021.1Schuck.if ${DEBUG} == "-g"
1031.6SmycroftLINKFLAGS+=	-X
1041.6SmycroftSYSTEM_LD_TAIL+=; \
1051.6Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
1061.16Smycroft		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
1071.1Schuck.else
1081.12SmycroftLINKFLAGS+=	-S
1091.1Schuck.endif
1101.1Schuck
1111.1Schuck%LOAD
1121.1Schuck
1131.22Smycroftassym.h: $S/kern/genassym.sh ${MVME68K}/mvme68k/genassym.cf
1141.22Smycroft	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1151.22Smycroft	    < ${MVME68K}/mvme68k/genassym.cf > assym.h.tmp && \
1161.22Smycroft	mv -f assym.h.tmp assym.h
1171.6Smycroft
1181.6Smycroftparam.c: $S/conf/param.c
1191.6Smycroft	rm -f param.c
1201.6Smycroft	cp $S/conf/param.c .
1211.6Smycroft
1221.6Smycroftparam.o: param.c Makefile
1231.14Smycroft	${NORMAL_C}
1241.6Smycroft
1251.6Smycroftioconf.o: ioconf.c
1261.6Smycroft	${NORMAL_C}
1271.1Schuck
1281.6Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1291.1Schuck	sh $S/conf/newvers.sh
1301.6Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1311.6Smycroft
1321.29Schristos__CLEANKERNEL: .USE
1331.29Schristos	@echo "${.TARGET}ing the kernel objects"
1341.10Scgd	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1351.22Smycroft	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1361.29Schristos
1371.29Schristos__CLEANDEPEND: .USE
1381.29Schristos	rm -f .depend
1391.29Schristos
1401.29Schristosclean: __CLEANKERNEL
1411.29Schristos
1421.29Schristoscleandir: __CLEANKERNEL __CLEANDEPEND
1431.1Schuck
1441.6Smycroftlint:
1451.18Sperry	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1461.27Smycroft	    ${CFILES} ioconf.c param.c | \
1471.6Smycroft	    grep -v 'static function .* unused'
1481.1Schuck
1491.6Smycrofttags:
1501.6Smycroft	@echo "see $S/kern/Makefile for tags"
1511.1Schuck
1521.1Schucklinks:
1531.1Schuck	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1541.1Schuck	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1551.1Schuck	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1561.1Schuck	  sort -u | comm -23 - dontlink | \
1571.6Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1581.1Schuck	sh makelinks && rm -f dontlink
1591.1Schuck
1601.6SmycroftSRCS=	${MVME68K}/mvme68k/locore.s \
1611.10Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1621.20Schuckdepend: .depend
1631.10Scgd.depend: ${SRCS} assym.h param.c
1641.25Sthorpej	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${MVME68K}/mvme68k/locore.s
1651.25Sthorpej	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1661.25Sthorpej	-if test -n "${SFILES}"; then \
1671.25Sthorpej		${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}; \
1681.25Sthorpej	fi
1691.26Sleo	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
1701.26Sleo	  ${CPPFLAGS} < ${MVME68K}/mvme68k/genassym.cf
1711.26Sleo	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
1721.26Sleo	@rm -f assym.dep
1731.6Smycroft
1741.6Smycroft
1751.6Smycroft# depend on root or device configuration
1761.6Smycroftautoconf.o conf.o: Makefile
1771.6Smycroft 
1781.6Smycroft# depend on network or filesystem configuration 
1791.6Smycroftuipc_proto.o vfs_conf.o: Makefile 
1801.1Schuck
1811.6Smycroft# depend on maxusers
1821.22Smycroftmachdep.o: Makefile
1831.1Schuck
1841.6Smycroft# depend on CPU configuration 
1851.6Smycroftlocore.o pmap.o sys_machdep.o trap.o: Makefile
1861.1Schuck
1871.1Schuck
1881.6Smycroftlocore.o: ${MVME68K}/mvme68k/locore.s assym.h
1891.6Smycroft	${NORMAL_S}
1901.1Schuck
1911.1Schuck%RULES
192