Makefile.mvme68k revision 1.32
11.32Sthorpej#	$NetBSD: Makefile.mvme68k,v 1.32 1997/11/12 23:12:16 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.32SthorpejAR?=	ar
251.32SthorpejAS?=	as
261.9SmycroftCC?=	cc
271.32SthorpejCPP?=	cpp
281.9SmycroftLD?=	ld
291.31SthorpejLORDER?=lorder
301.12SmycroftMKDEP?=	mkdep
311.31SthorpejNM?=	nm
321.32SthorpejRANLIB?=ranlib
331.30SlukemSIZE?=	size
341.16SmycroftSTRIP?=	strip
351.31SthorpejTSORT?=	tsort -q
361.32Sthorpej
371.30SlukemCOPTS?=	-O2
381.1Schuck
391.1Schuck# source tree is located via $S relative to the compilation directory
401.15Smycroft.ifndef S
411.12SmycroftS!=	cd ../../../..; pwd
421.15Smycroft.endif
431.12SmycroftMVME68K=$S/arch/mvme68k
441.1Schuck
451.23Sgwr# Override CPP defaults entirely, so cross-compilation works.
461.23Sgwr# Keep -nostdinc before all -I flags, similar for -undef ...
471.23SgwrINCLUDES=	-nostdinc -I. -I$S/arch -I$S
481.25SthorpejCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
491.28Smycroft		-Dmc68020 -Dmvme68k
501.12SmycroftCWARNFLAGS=	-Werror
511.25SthorpejCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float
521.25SthorpejAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
531.6SmycroftLINKFLAGS=	-n -Ttext 8000 -e start
541.16SmycroftSTRIPFLAGS=	-d
551.16Smycroft
561.25SthorpejHOSTED_CC=	${CC}
571.25SthorpejHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
581.25SthorpejHOSTED_CFLAGS=	${CFLAGS}
591.25Sthorpej
601.1Schuck### find out what to use for libkern
611.1Schuck.include "$S/lib/libkern/Makefile.inc"
621.1Schuck.ifndef PROF
631.1SchuckLIBKERN=	${KERNLIB}
641.1Schuck.else
651.1SchuckLIBKERN=	${KERNLIB_PROF}
661.1Schuck.endif
671.1Schuck
681.1Schuck### find out what to use for libcompat
691.1Schuck.include "$S/compat/common/Makefile.inc"
701.1Schuck.ifndef PROF
711.23SgwrLIBCOMPAT=	${COMPATLIB}
721.1Schuck.else
731.23SgwrLIBCOMPAT=	${COMPATLIB_PROF}
741.1Schuck.endif
751.1Schuck
761.1Schuck### for the Motorola 68040 Floating Point Software Product
771.1Schuck.include "$S/arch/m68k/fpsp/Makefile.inc"
781.1Schuck
791.25Sthorpej# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
801.25Sthorpej# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
811.1Schuck
821.6SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
831.25SthorpejNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
841.1Schuck
851.25SthorpejHOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
861.13Smycroft
871.1Schuck%OBJS
881.1Schuck
891.1Schuck%CFILES
901.1Schuck
911.6Smycroft%SFILES
921.6Smycroft
931.1Schuck# load lines for config "xxx" will be emitted as:
941.1Schuck# xxx: ${SYSTEM_DEP} swapxxx.o
951.1Schuck#	${SYSTEM_LD_HEAD}
961.1Schuck#	${SYSTEM_LD} swapxxx.o
971.1Schuck#	${SYSTEM_LD_TAIL}
981.6SmycroftSYSTEM_OBJ=	locore.o ${FPSP} \
991.10Scgd		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
1001.6SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
1011.6SmycroftSYSTEM_LD_HEAD=	@rm -f $@
1021.6SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
1031.6Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
1041.30SlukemSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
1051.6Smycroft
1061.1SchuckDEBUG?=
1071.1Schuck.if ${DEBUG} == "-g"
1081.6SmycroftLINKFLAGS+=	-X
1091.6SmycroftSYSTEM_LD_TAIL+=; \
1101.6Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
1111.16Smycroft		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
1121.1Schuck.else
1131.12SmycroftLINKFLAGS+=	-S
1141.1Schuck.endif
1151.1Schuck
1161.1Schuck%LOAD
1171.1Schuck
1181.22Smycroftassym.h: $S/kern/genassym.sh ${MVME68K}/mvme68k/genassym.cf
1191.22Smycroft	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1201.22Smycroft	    < ${MVME68K}/mvme68k/genassym.cf > assym.h.tmp && \
1211.22Smycroft	mv -f assym.h.tmp assym.h
1221.6Smycroft
1231.6Smycroftparam.c: $S/conf/param.c
1241.6Smycroft	rm -f param.c
1251.6Smycroft	cp $S/conf/param.c .
1261.6Smycroft
1271.6Smycroftparam.o: param.c Makefile
1281.14Smycroft	${NORMAL_C}
1291.6Smycroft
1301.6Smycroftioconf.o: ioconf.c
1311.6Smycroft	${NORMAL_C}
1321.1Schuck
1331.6Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1341.1Schuck	sh $S/conf/newvers.sh
1351.6Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1361.6Smycroft
1371.29Schristos__CLEANKERNEL: .USE
1381.29Schristos	@echo "${.TARGET}ing the kernel objects"
1391.10Scgd	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1401.22Smycroft	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1411.29Schristos
1421.29Schristos__CLEANDEPEND: .USE
1431.29Schristos	rm -f .depend
1441.29Schristos
1451.29Schristosclean: __CLEANKERNEL
1461.29Schristos
1471.29Schristoscleandir: __CLEANKERNEL __CLEANDEPEND
1481.1Schuck
1491.6Smycroftlint:
1501.18Sperry	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1511.27Smycroft	    ${CFILES} ioconf.c param.c | \
1521.6Smycroft	    grep -v 'static function .* unused'
1531.1Schuck
1541.6Smycrofttags:
1551.6Smycroft	@echo "see $S/kern/Makefile for tags"
1561.1Schuck
1571.1Schucklinks:
1581.1Schuck	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1591.1Schuck	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1601.1Schuck	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1611.1Schuck	  sort -u | comm -23 - dontlink | \
1621.6Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1631.1Schuck	sh makelinks && rm -f dontlink
1641.1Schuck
1651.6SmycroftSRCS=	${MVME68K}/mvme68k/locore.s \
1661.10Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1671.20Schuckdepend: .depend
1681.10Scgd.depend: ${SRCS} assym.h param.c
1691.25Sthorpej	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${MVME68K}/mvme68k/locore.s
1701.25Sthorpej	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1711.25Sthorpej	-if test -n "${SFILES}"; then \
1721.25Sthorpej		${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}; \
1731.25Sthorpej	fi
1741.26Sleo	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
1751.26Sleo	  ${CPPFLAGS} < ${MVME68K}/mvme68k/genassym.cf
1761.26Sleo	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
1771.26Sleo	@rm -f assym.dep
1781.6Smycroft
1791.6Smycroft
1801.6Smycroft# depend on root or device configuration
1811.6Smycroftautoconf.o conf.o: Makefile
1821.6Smycroft 
1831.6Smycroft# depend on network or filesystem configuration 
1841.6Smycroftuipc_proto.o vfs_conf.o: Makefile 
1851.1Schuck
1861.6Smycroft# depend on maxusers
1871.22Smycroftmachdep.o: Makefile
1881.1Schuck
1891.6Smycroft# depend on CPU configuration 
1901.6Smycroftlocore.o pmap.o sys_machdep.o trap.o: Makefile
1911.1Schuck
1921.1Schuck
1931.6Smycroftlocore.o: ${MVME68K}/mvme68k/locore.s assym.h
1941.6Smycroft	${NORMAL_S}
1951.1Schuck
1961.1Schuck%RULES
197