Makefile.mvme68k revision 1.49
11.49Sscw#	$NetBSD: Makefile.mvme68k,v 1.49 2000/11/20 19:35:28 scw 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.45StsutsuiSTRIP?=	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.47SthorpejHAVE_EGCS!=	${CC} --version | egrep "^(2\.[89]|egcs)" ; echo 
481.23SgwrINCLUDES=	-nostdinc -I. -I$S/arch -I$S
491.39SthorpejCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -Dmvme68k
501.49Sscw.if empty(IDENT:M-DMVME172) && empty(IDENT:M-DMVME177)
511.49Sscw.if empty(IDENT:M-DMVME147)
521.49SscwCMACHFLAGS=	-m68040
531.49Sscw.else
541.49SscwCMACHFLAGS=	-m68030
551.49Sscw.endif
561.49Sscw.else
571.49Sscw.if empty(IDENT:M-DMVME147) && empty(IDENT:M-DMVME162) && empty(IDENT:M-DMVME167)
581.49SscwCMACHFLAGS=	-m68060 -Wa,-m68030 -Wa,-m68851
591.49Sscw.else
601.49SscwCMACHFLAGS=	-m68020-60 -Wa,-m68030 -Wa,-m68851
611.49Sscw.endif
621.49Sscw.endif
631.46SscwCWARNFLAGS?=	-Werror -Wall -Wmissing-prototypes -Wstrict-prototypes \
641.46Sscw		-Wpointer-arith
651.47Sthorpej# XXX Delete -Wuninitialized for now, since the compiler doesn't
661.47Sthorpej# XXX always get it right.  --thorpej 
671.47SthorpejCWARNFLAGS+=	-Wno-uninitialized
681.47Sthorpej.if (${HAVE_EGCS} != "")
691.33StvCWARNFLAGS+=	-Wno-main
701.33Stv.endif
711.49SscwCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} ${CMACHFLAGS} -msoft-float
721.25SthorpejAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
731.6SmycroftLINKFLAGS=	-n -Ttext 8000 -e start
741.42StsutsuiSTRIPFLAGS=	-g
751.40Smrg
761.40Smrg%INCLUDES
771.16Smycroft
781.25SthorpejHOSTED_CC=	${CC}
791.25SthorpejHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
801.25SthorpejHOSTED_CFLAGS=	${CFLAGS}
811.25Sthorpej
821.1Schuck### find out what to use for libkern
831.36SdrochnerKERN_AS=	obj
841.1Schuck.include "$S/lib/libkern/Makefile.inc"
851.1Schuck.ifndef PROF
861.1SchuckLIBKERN=	${KERNLIB}
871.1Schuck.else
881.1SchuckLIBKERN=	${KERNLIB_PROF}
891.1Schuck.endif
901.1Schuck
911.1Schuck### find out what to use for libcompat
921.1Schuck.include "$S/compat/common/Makefile.inc"
931.1Schuck.ifndef PROF
941.23SgwrLIBCOMPAT=	${COMPATLIB}
951.1Schuck.else
961.23SgwrLIBCOMPAT=	${COMPATLIB_PROF}
971.1Schuck.endif
981.1Schuck
991.1Schuck### for the Motorola 68040 Floating Point Software Product
1001.1Schuck.include "$S/arch/m68k/fpsp/Makefile.inc"
1011.49Sscw
1021.49Sscw### for the Motorola 68060 Software Support Package
1031.49Sscw.include "$S/arch/m68k/060sp/Makefile.inc"
1041.1Schuck
1051.25Sthorpej# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
1061.25Sthorpej# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
1071.1Schuck
1081.6SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
1091.34SthorpejNOPROF_C=	${CC} ${CFLAGS} ${CPPFLAGS} -c $<
1101.25SthorpejNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
1111.1Schuck
1121.25SthorpejHOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
1131.13Smycroft
1141.1Schuck%OBJS
1151.1Schuck
1161.1Schuck%CFILES
1171.1Schuck
1181.6Smycroft%SFILES
1191.6Smycroft
1201.1Schuck# load lines for config "xxx" will be emitted as:
1211.1Schuck# xxx: ${SYSTEM_DEP} swapxxx.o
1221.1Schuck#	${SYSTEM_LD_HEAD}
1231.1Schuck#	${SYSTEM_LD} swapxxx.o
1241.1Schuck#	${SYSTEM_LD_TAIL}
1251.6SmycroftSYSTEM_OBJ=	locore.o ${FPSP} \
1261.36Sdrochner		param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
1271.6SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
1281.6SmycroftSYSTEM_LD_HEAD=	@rm -f $@
1291.6SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
1301.6Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
1311.30SlukemSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
1321.6Smycroft
1331.1SchuckDEBUG?=
1341.1Schuck.if ${DEBUG} == "-g"
1351.6SmycroftLINKFLAGS+=	-X
1361.6SmycroftSYSTEM_LD_TAIL+=; \
1371.41Scgd		echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
1381.45Stsutsui		echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
1391.45Stsutsui		${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
1401.1Schuck.else
1411.12SmycroftLINKFLAGS+=	-S
1421.1Schuck.endif
1431.1Schuck
1441.1Schuck%LOAD
1451.1Schuck
1461.22Smycroftassym.h: $S/kern/genassym.sh ${MVME68K}/mvme68k/genassym.cf
1471.22Smycroft	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1481.22Smycroft	    < ${MVME68K}/mvme68k/genassym.cf > assym.h.tmp && \
1491.22Smycroft	mv -f assym.h.tmp assym.h
1501.6Smycroft
1511.6Smycroftparam.c: $S/conf/param.c
1521.6Smycroft	rm -f param.c
1531.6Smycroft	cp $S/conf/param.c .
1541.6Smycroft
1551.6Smycroftparam.o: param.c Makefile
1561.14Smycroft	${NORMAL_C}
1571.6Smycroft
1581.6Smycroftioconf.o: ioconf.c
1591.6Smycroft	${NORMAL_C}
1601.1Schuck
1611.6Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1621.1Schuck	sh $S/conf/newvers.sh
1631.6Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1641.6Smycroft
1651.29Schristos__CLEANKERNEL: .USE
1661.29Schristos	@echo "${.TARGET}ing the kernel objects"
1671.10Scgd	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1681.22Smycroft	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1691.29Schristos
1701.29Schristos__CLEANDEPEND: .USE
1711.29Schristos	rm -f .depend
1721.29Schristos
1731.29Schristosclean: __CLEANKERNEL
1741.29Schristos
1751.35Slukemcleandir distclean: __CLEANKERNEL __CLEANDEPEND
1761.1Schuck
1771.6Smycroftlint:
1781.18Sperry	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1791.27Smycroft	    ${CFILES} ioconf.c param.c | \
1801.6Smycroft	    grep -v 'static function .* unused'
1811.1Schuck
1821.6Smycrofttags:
1831.6Smycroft	@echo "see $S/kern/Makefile for tags"
1841.1Schuck
1851.1Schucklinks:
1861.1Schuck	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1871.1Schuck	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1881.1Schuck	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1891.1Schuck	  sort -u | comm -23 - dontlink | \
1901.6Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1911.1Schuck	sh makelinks && rm -f dontlink
1921.1Schuck
1931.6SmycroftSRCS=	${MVME68K}/mvme68k/locore.s \
1941.10Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1951.20Schuckdepend: .depend
1961.10Scgd.depend: ${SRCS} assym.h param.c
1971.25Sthorpej	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${MVME68K}/mvme68k/locore.s
1981.25Sthorpej	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1991.25Sthorpej	-if test -n "${SFILES}"; then \
2001.25Sthorpej		${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}; \
2011.25Sthorpej	fi
2021.26Sleo	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
2031.26Sleo	  ${CPPFLAGS} < ${MVME68K}/mvme68k/genassym.cf
2041.26Sleo	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
2051.26Sleo	@rm -f assym.dep
2061.44Stron
2071.44Strondependall: depend all
2081.6Smycroft
2091.6Smycroft
2101.6Smycroft# depend on root or device configuration
2111.6Smycroftautoconf.o conf.o: Makefile
2121.6Smycroft 
2131.6Smycroft# depend on network or filesystem configuration 
2141.6Smycroftuipc_proto.o vfs_conf.o: Makefile 
2151.1Schuck
2161.6Smycroft# depend on maxusers
2171.22Smycroftmachdep.o: Makefile
2181.1Schuck
2191.6Smycroft# depend on CPU configuration 
2201.6Smycroftlocore.o pmap.o sys_machdep.o trap.o: Makefile
2211.1Schuck
2221.1Schuck
2231.6Smycroftlocore.o: ${MVME68K}/mvme68k/locore.s assym.h
2241.6Smycroft	${NORMAL_S}
2251.48Shubertf
2261.48Shubertf# The install target can be redefined by putting a
2271.48Shubertf# install-kernel-${MACHINE_NAME} target into /etc/mk.conf
2281.48ShubertfMACHINE_NAME!=  uname -n
2291.48Shubertfinstall: install-kernel-${MACHINE_NAME}
2301.48Shubertf.if !target(install-kernel-${MACHINE_NAME}})
2311.48Shubertfinstall-kernel-${MACHINE_NAME}:
2321.48Shubertf	rm -f /onetbsd
2331.48Shubertf	ln /netbsd /onetbsd
2341.48Shubertf	cp netbsd /nnetbsd
2351.48Shubertf	mv /nnetbsd /netbsd
2361.48Shubertf.endif
2371.1Schuck
2381.1Schuck%RULES
239