Makefile.mvme68k revision 1.28
11.28Smycroft#	$NetBSD: Makefile.mvme68k,v 1.28 1997/09/12 09:29:13 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.23Sgwr# Override CPP defaults entirely, so cross-compilation works.
371.23Sgwr# Keep -nostdinc before all -I flags, similar for -undef ...
381.23SgwrINCLUDES=	-nostdinc -I. -I$S/arch -I$S
391.25SthorpejCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
401.28Smycroft		-Dmc68020 -Dmvme68k
411.12SmycroftCWARNFLAGS=	-Werror
421.25SthorpejCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float
431.25SthorpejAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
441.6SmycroftLINKFLAGS=	-n -Ttext 8000 -e start
451.16SmycroftSTRIPFLAGS=	-d
461.16Smycroft
471.25SthorpejHOSTED_CC=	${CC}
481.25SthorpejHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
491.25SthorpejHOSTED_CFLAGS=	${CFLAGS}
501.25Sthorpej
511.1Schuck### find out what to use for libkern
521.1Schuck.include "$S/lib/libkern/Makefile.inc"
531.1Schuck.ifndef PROF
541.1SchuckLIBKERN=	${KERNLIB}
551.1Schuck.else
561.1SchuckLIBKERN=	${KERNLIB_PROF}
571.1Schuck.endif
581.1Schuck
591.1Schuck### find out what to use for libcompat
601.1Schuck.include "$S/compat/common/Makefile.inc"
611.1Schuck.ifndef PROF
621.23SgwrLIBCOMPAT=	${COMPATLIB}
631.1Schuck.else
641.23SgwrLIBCOMPAT=	${COMPATLIB_PROF}
651.1Schuck.endif
661.1Schuck
671.1Schuck### for the Motorola 68040 Floating Point Software Product
681.1Schuck.include "$S/arch/m68k/fpsp/Makefile.inc"
691.1Schuck
701.25Sthorpej# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
711.25Sthorpej# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
721.1Schuck
731.6SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
741.25SthorpejNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
751.1Schuck
761.25SthorpejHOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
771.13Smycroft
781.1Schuck%OBJS
791.1Schuck
801.1Schuck%CFILES
811.1Schuck
821.6Smycroft%SFILES
831.6Smycroft
841.1Schuck# load lines for config "xxx" will be emitted as:
851.1Schuck# xxx: ${SYSTEM_DEP} swapxxx.o
861.1Schuck#	${SYSTEM_LD_HEAD}
871.1Schuck#	${SYSTEM_LD} swapxxx.o
881.1Schuck#	${SYSTEM_LD_TAIL}
891.6SmycroftSYSTEM_OBJ=	locore.o ${FPSP} \
901.10Scgd		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
911.6SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
921.6SmycroftSYSTEM_LD_HEAD=	@rm -f $@
931.6SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
941.6Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
951.6SmycroftSYSTEM_LD_TAIL=	@size $@; chmod 755 $@
961.6Smycroft
971.1SchuckDEBUG?=
981.1Schuck.if ${DEBUG} == "-g"
991.6SmycroftLINKFLAGS+=	-X
1001.6SmycroftSYSTEM_LD_TAIL+=; \
1011.6Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
1021.16Smycroft		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
1031.1Schuck.else
1041.12SmycroftLINKFLAGS+=	-S
1051.1Schuck.endif
1061.1Schuck
1071.1Schuck%LOAD
1081.1Schuck
1091.22Smycroftassym.h: $S/kern/genassym.sh ${MVME68K}/mvme68k/genassym.cf
1101.22Smycroft	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1111.22Smycroft	    < ${MVME68K}/mvme68k/genassym.cf > assym.h.tmp && \
1121.22Smycroft	mv -f assym.h.tmp assym.h
1131.6Smycroft
1141.6Smycroftparam.c: $S/conf/param.c
1151.6Smycroft	rm -f param.c
1161.6Smycroft	cp $S/conf/param.c .
1171.6Smycroft
1181.6Smycroftparam.o: param.c Makefile
1191.14Smycroft	${NORMAL_C}
1201.6Smycroft
1211.6Smycroftioconf.o: ioconf.c
1221.6Smycroft	${NORMAL_C}
1231.1Schuck
1241.6Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1251.1Schuck	sh $S/conf/newvers.sh
1261.6Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1271.6Smycroft
1281.1Schuck
1291.20Schuckclean: cleankernel
1301.20Schuckcleankernel:
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.1Schuck
1341.6Smycroftlint:
1351.18Sperry	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1361.27Smycroft	    ${CFILES} ioconf.c param.c | \
1371.6Smycroft	    grep -v 'static function .* unused'
1381.1Schuck
1391.6Smycrofttags:
1401.6Smycroft	@echo "see $S/kern/Makefile for tags"
1411.1Schuck
1421.1Schucklinks:
1431.1Schuck	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1441.1Schuck	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1451.1Schuck	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1461.1Schuck	  sort -u | comm -23 - dontlink | \
1471.6Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1481.1Schuck	sh makelinks && rm -f dontlink
1491.1Schuck
1501.6SmycroftSRCS=	${MVME68K}/mvme68k/locore.s \
1511.10Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1521.20Schuckdepend: .depend
1531.10Scgd.depend: ${SRCS} assym.h param.c
1541.25Sthorpej	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${MVME68K}/mvme68k/locore.s
1551.25Sthorpej	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1561.25Sthorpej	-if test -n "${SFILES}"; then \
1571.25Sthorpej		${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}; \
1581.25Sthorpej	fi
1591.26Sleo	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
1601.26Sleo	  ${CPPFLAGS} < ${MVME68K}/mvme68k/genassym.cf
1611.26Sleo	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
1621.26Sleo	@rm -f assym.dep
1631.6Smycroft
1641.6Smycroft
1651.6Smycroft# depend on root or device configuration
1661.6Smycroftautoconf.o conf.o: Makefile
1671.6Smycroft 
1681.6Smycroft# depend on network or filesystem configuration 
1691.6Smycroftuipc_proto.o vfs_conf.o: Makefile 
1701.1Schuck
1711.6Smycroft# depend on maxusers
1721.22Smycroftmachdep.o: Makefile
1731.1Schuck
1741.6Smycroft# depend on CPU configuration 
1751.6Smycroftlocore.o pmap.o sys_machdep.o trap.o: Makefile
1761.1Schuck
1771.1Schuck
1781.6Smycroftlocore.o: ${MVME68K}/mvme68k/locore.s assym.h
1791.6Smycroft	${NORMAL_S}
1801.1Schuck
1811.1Schuck%RULES
182