Makefile.mvme68k revision 1.51
11.51Smrg#	$NetBSD: Makefile.mvme68k,v 1.51 2001/05/29 02:20:24 mrg 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.6Smycroft# DEBUG is set to -g if debugging.
161.6Smycroft# PROF is set to -pg if profiling.
171.1Schuck
181.32SthorpejAR?=	ar
191.32SthorpejAS?=	as
201.9SmycroftCC?=	cc
211.32SthorpejCPP?=	cpp
221.9SmycroftLD?=	ld
231.31SthorpejLORDER?=lorder
241.12SmycroftMKDEP?=	mkdep
251.31SthorpejNM?=	nm
261.32SthorpejRANLIB?=ranlib
271.30SlukemSIZE?=	size
281.45StsutsuiSTRIP?=	strip
291.31SthorpejTSORT?=	tsort -q
301.32Sthorpej
311.30SlukemCOPTS?=	-O2
321.1Schuck
331.1Schuck# source tree is located via $S relative to the compilation directory
341.15Smycroft.ifndef S
351.12SmycroftS!=	cd ../../../..; pwd
361.15Smycroft.endif
371.12SmycroftMVME68K=$S/arch/mvme68k
381.1Schuck
391.23Sgwr# Override CPP defaults entirely, so cross-compilation works.
401.23Sgwr# Keep -nostdinc before all -I flags, similar for -undef ...
411.47SthorpejHAVE_EGCS!=	${CC} --version | egrep "^(2\.[89]|egcs)" ; echo 
421.23SgwrINCLUDES=	-nostdinc -I. -I$S/arch -I$S
431.51SmrgCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT -Dmvme68k
441.49Sscw.if empty(IDENT:M-DMVME172) && empty(IDENT:M-DMVME177)
451.49Sscw.if empty(IDENT:M-DMVME147)
461.49SscwCMACHFLAGS=	-m68040
471.49Sscw.else
481.49SscwCMACHFLAGS=	-m68030
491.49Sscw.endif
501.49Sscw.else
511.49Sscw.if empty(IDENT:M-DMVME147) && empty(IDENT:M-DMVME162) && empty(IDENT:M-DMVME167)
521.49SscwCMACHFLAGS=	-m68060 -Wa,-m68030 -Wa,-m68851
531.49Sscw.else
541.49SscwCMACHFLAGS=	-m68020-60 -Wa,-m68030 -Wa,-m68851
551.49Sscw.endif
561.49Sscw.endif
571.46SscwCWARNFLAGS?=	-Werror -Wall -Wmissing-prototypes -Wstrict-prototypes \
581.46Sscw		-Wpointer-arith
591.47Sthorpej# XXX Delete -Wuninitialized for now, since the compiler doesn't
601.47Sthorpej# XXX always get it right.  --thorpej 
611.47SthorpejCWARNFLAGS+=	-Wno-uninitialized
621.47Sthorpej.if (${HAVE_EGCS} != "")
631.33StvCWARNFLAGS+=	-Wno-main
641.33Stv.endif
651.49SscwCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} ${CMACHFLAGS} -msoft-float
661.25SthorpejAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
671.6SmycroftLINKFLAGS=	-n -Ttext 8000 -e start
681.42StsutsuiSTRIPFLAGS=	-g
691.40Smrg
701.40Smrg%INCLUDES
711.16Smycroft
721.25SthorpejHOSTED_CC=	${CC}
731.25SthorpejHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
741.25SthorpejHOSTED_CFLAGS=	${CFLAGS}
751.25Sthorpej
761.1Schuck### find out what to use for libkern
771.36SdrochnerKERN_AS=	obj
781.1Schuck.include "$S/lib/libkern/Makefile.inc"
791.1Schuck.ifndef PROF
801.1SchuckLIBKERN=	${KERNLIB}
811.1Schuck.else
821.1SchuckLIBKERN=	${KERNLIB_PROF}
831.1Schuck.endif
841.1Schuck
851.1Schuck### find out what to use for libcompat
861.1Schuck.include "$S/compat/common/Makefile.inc"
871.1Schuck.ifndef PROF
881.23SgwrLIBCOMPAT=	${COMPATLIB}
891.1Schuck.else
901.23SgwrLIBCOMPAT=	${COMPATLIB_PROF}
911.1Schuck.endif
921.1Schuck
931.1Schuck### for the Motorola 68040 Floating Point Software Product
941.1Schuck.include "$S/arch/m68k/fpsp/Makefile.inc"
951.49Sscw
961.49Sscw### for the Motorola 68060 Software Support Package
971.49Sscw.include "$S/arch/m68k/060sp/Makefile.inc"
981.1Schuck
991.25Sthorpej# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
1001.25Sthorpej# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
1011.1Schuck
1021.6SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
1031.34SthorpejNOPROF_C=	${CC} ${CFLAGS} ${CPPFLAGS} -c $<
1041.25SthorpejNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
1051.1Schuck
1061.25SthorpejHOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
1071.13Smycroft
1081.1Schuck%OBJS
1091.1Schuck
1101.1Schuck%CFILES
1111.1Schuck
1121.6Smycroft%SFILES
1131.6Smycroft
1141.1Schuck# load lines for config "xxx" will be emitted as:
1151.1Schuck# xxx: ${SYSTEM_DEP} swapxxx.o
1161.1Schuck#	${SYSTEM_LD_HEAD}
1171.1Schuck#	${SYSTEM_LD} swapxxx.o
1181.1Schuck#	${SYSTEM_LD_TAIL}
1191.6SmycroftSYSTEM_OBJ=	locore.o ${FPSP} \
1201.36Sdrochner		param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
1211.6SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
1221.6SmycroftSYSTEM_LD_HEAD=	@rm -f $@
1231.6SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
1241.6Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
1251.30SlukemSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
1261.6Smycroft
1271.1SchuckDEBUG?=
1281.1Schuck.if ${DEBUG} == "-g"
1291.6SmycroftLINKFLAGS+=	-X
1301.6SmycroftSYSTEM_LD_TAIL+=; \
1311.41Scgd		echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
1321.45Stsutsui		echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
1331.45Stsutsui		${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
1341.1Schuck.else
1351.12SmycroftLINKFLAGS+=	-S
1361.1Schuck.endif
1371.1Schuck
1381.1Schuck%LOAD
1391.1Schuck
1401.22Smycroftassym.h: $S/kern/genassym.sh ${MVME68K}/mvme68k/genassym.cf
1411.22Smycroft	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1421.22Smycroft	    < ${MVME68K}/mvme68k/genassym.cf > assym.h.tmp && \
1431.22Smycroft	mv -f assym.h.tmp assym.h
1441.6Smycroft
1451.6Smycroftparam.c: $S/conf/param.c
1461.6Smycroft	rm -f param.c
1471.6Smycroft	cp $S/conf/param.c .
1481.6Smycroft
1491.6Smycroftparam.o: param.c Makefile
1501.14Smycroft	${NORMAL_C}
1511.6Smycroft
1521.6Smycroftioconf.o: ioconf.c
1531.6Smycroft	${NORMAL_C}
1541.1Schuck
1551.6Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1561.1Schuck	sh $S/conf/newvers.sh
1571.6Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1581.6Smycroft
1591.29Schristos__CLEANKERNEL: .USE
1601.29Schristos	@echo "${.TARGET}ing the kernel objects"
1611.10Scgd	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1621.22Smycroft	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1631.29Schristos
1641.29Schristos__CLEANDEPEND: .USE
1651.29Schristos	rm -f .depend
1661.29Schristos
1671.29Schristosclean: __CLEANKERNEL
1681.29Schristos
1691.35Slukemcleandir distclean: __CLEANKERNEL __CLEANDEPEND
1701.1Schuck
1711.6Smycroftlint:
1721.18Sperry	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1731.27Smycroft	    ${CFILES} ioconf.c param.c | \
1741.6Smycroft	    grep -v 'static function .* unused'
1751.1Schuck
1761.6Smycrofttags:
1771.6Smycroft	@echo "see $S/kern/Makefile for tags"
1781.1Schuck
1791.1Schucklinks:
1801.1Schuck	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1811.1Schuck	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1821.1Schuck	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1831.1Schuck	  sort -u | comm -23 - dontlink | \
1841.6Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1851.1Schuck	sh makelinks && rm -f dontlink
1861.1Schuck
1871.6SmycroftSRCS=	${MVME68K}/mvme68k/locore.s \
1881.10Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1891.20Schuckdepend: .depend
1901.10Scgd.depend: ${SRCS} assym.h param.c
1911.25Sthorpej	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${MVME68K}/mvme68k/locore.s
1921.25Sthorpej	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1931.25Sthorpej	-if test -n "${SFILES}"; then \
1941.25Sthorpej		${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}; \
1951.25Sthorpej	fi
1961.26Sleo	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
1971.26Sleo	  ${CPPFLAGS} < ${MVME68K}/mvme68k/genassym.cf
1981.26Sleo	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
1991.26Sleo	@rm -f assym.dep
2001.44Stron
2011.44Strondependall: depend all
2021.6Smycroft
2031.6Smycroft
2041.6Smycroft# depend on root or device configuration
2051.6Smycroftautoconf.o conf.o: Makefile
2061.6Smycroft 
2071.6Smycroft# depend on network or filesystem configuration 
2081.6Smycroftuipc_proto.o vfs_conf.o: Makefile 
2091.1Schuck
2101.6Smycroft# depend on maxusers
2111.22Smycroftmachdep.o: Makefile
2121.1Schuck
2131.6Smycroft# depend on CPU configuration 
2141.6Smycroftlocore.o pmap.o sys_machdep.o trap.o: Makefile
2151.1Schuck
2161.1Schuck
2171.6Smycroftlocore.o: ${MVME68K}/mvme68k/locore.s assym.h
2181.6Smycroft	${NORMAL_S}
2191.48Shubertf
2201.48Shubertf# The install target can be redefined by putting a
2211.48Shubertf# install-kernel-${MACHINE_NAME} target into /etc/mk.conf
2221.48ShubertfMACHINE_NAME!=  uname -n
2231.48Shubertfinstall: install-kernel-${MACHINE_NAME}
2241.48Shubertf.if !target(install-kernel-${MACHINE_NAME}})
2251.48Shubertfinstall-kernel-${MACHINE_NAME}:
2261.48Shubertf	rm -f /onetbsd
2271.48Shubertf	ln /netbsd /onetbsd
2281.48Shubertf	cp netbsd /nnetbsd
2291.48Shubertf	mv /nnetbsd /netbsd
2301.48Shubertf.endif
2311.1Schuck
2321.1Schuck%RULES
233