Makefile.mvme68k revision 1.47
11.47Sthorpej#	$NetBSD: Makefile.mvme68k,v 1.47 2000/05/09 00:32:24 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.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.46SscwCWARNFLAGS?=	-Werror -Wall -Wmissing-prototypes -Wstrict-prototypes \
511.46Sscw		-Wpointer-arith
521.47Sthorpej# XXX Delete -Wuninitialized for now, since the compiler doesn't
531.47Sthorpej# XXX always get it right.  --thorpej 
541.47SthorpejCWARNFLAGS+=	-Wno-uninitialized
551.47Sthorpej.if (${HAVE_EGCS} != "")
561.33StvCWARNFLAGS+=	-Wno-main
571.33Stv.endif
581.25SthorpejCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float
591.25SthorpejAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
601.6SmycroftLINKFLAGS=	-n -Ttext 8000 -e start
611.42StsutsuiSTRIPFLAGS=	-g
621.40Smrg
631.40Smrg%INCLUDES
641.16Smycroft
651.25SthorpejHOSTED_CC=	${CC}
661.25SthorpejHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
671.25SthorpejHOSTED_CFLAGS=	${CFLAGS}
681.25Sthorpej
691.1Schuck### find out what to use for libkern
701.36SdrochnerKERN_AS=	obj
711.1Schuck.include "$S/lib/libkern/Makefile.inc"
721.1Schuck.ifndef PROF
731.1SchuckLIBKERN=	${KERNLIB}
741.1Schuck.else
751.1SchuckLIBKERN=	${KERNLIB_PROF}
761.1Schuck.endif
771.1Schuck
781.1Schuck### find out what to use for libcompat
791.1Schuck.include "$S/compat/common/Makefile.inc"
801.1Schuck.ifndef PROF
811.23SgwrLIBCOMPAT=	${COMPATLIB}
821.1Schuck.else
831.23SgwrLIBCOMPAT=	${COMPATLIB_PROF}
841.1Schuck.endif
851.1Schuck
861.1Schuck### for the Motorola 68040 Floating Point Software Product
871.1Schuck.include "$S/arch/m68k/fpsp/Makefile.inc"
881.1Schuck
891.25Sthorpej# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
901.25Sthorpej# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
911.1Schuck
921.6SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
931.34SthorpejNOPROF_C=	${CC} ${CFLAGS} ${CPPFLAGS} -c $<
941.25SthorpejNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
951.1Schuck
961.25SthorpejHOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
971.13Smycroft
981.1Schuck%OBJS
991.1Schuck
1001.1Schuck%CFILES
1011.1Schuck
1021.6Smycroft%SFILES
1031.6Smycroft
1041.1Schuck# load lines for config "xxx" will be emitted as:
1051.1Schuck# xxx: ${SYSTEM_DEP} swapxxx.o
1061.1Schuck#	${SYSTEM_LD_HEAD}
1071.1Schuck#	${SYSTEM_LD} swapxxx.o
1081.1Schuck#	${SYSTEM_LD_TAIL}
1091.6SmycroftSYSTEM_OBJ=	locore.o ${FPSP} \
1101.36Sdrochner		param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
1111.6SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
1121.6SmycroftSYSTEM_LD_HEAD=	@rm -f $@
1131.6SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
1141.6Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
1151.30SlukemSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
1161.6Smycroft
1171.1SchuckDEBUG?=
1181.1Schuck.if ${DEBUG} == "-g"
1191.6SmycroftLINKFLAGS+=	-X
1201.6SmycroftSYSTEM_LD_TAIL+=; \
1211.41Scgd		echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
1221.45Stsutsui		echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
1231.45Stsutsui		${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
1241.1Schuck.else
1251.12SmycroftLINKFLAGS+=	-S
1261.1Schuck.endif
1271.1Schuck
1281.1Schuck%LOAD
1291.1Schuck
1301.22Smycroftassym.h: $S/kern/genassym.sh ${MVME68K}/mvme68k/genassym.cf
1311.22Smycroft	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1321.22Smycroft	    < ${MVME68K}/mvme68k/genassym.cf > assym.h.tmp && \
1331.22Smycroft	mv -f assym.h.tmp assym.h
1341.6Smycroft
1351.6Smycroftparam.c: $S/conf/param.c
1361.6Smycroft	rm -f param.c
1371.6Smycroft	cp $S/conf/param.c .
1381.6Smycroft
1391.6Smycroftparam.o: param.c Makefile
1401.14Smycroft	${NORMAL_C}
1411.6Smycroft
1421.6Smycroftioconf.o: ioconf.c
1431.6Smycroft	${NORMAL_C}
1441.1Schuck
1451.6Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1461.1Schuck	sh $S/conf/newvers.sh
1471.6Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1481.6Smycroft
1491.29Schristos__CLEANKERNEL: .USE
1501.29Schristos	@echo "${.TARGET}ing the kernel objects"
1511.10Scgd	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1521.22Smycroft	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1531.29Schristos
1541.29Schristos__CLEANDEPEND: .USE
1551.29Schristos	rm -f .depend
1561.29Schristos
1571.29Schristosclean: __CLEANKERNEL
1581.29Schristos
1591.35Slukemcleandir distclean: __CLEANKERNEL __CLEANDEPEND
1601.1Schuck
1611.6Smycroftlint:
1621.18Sperry	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1631.27Smycroft	    ${CFILES} ioconf.c param.c | \
1641.6Smycroft	    grep -v 'static function .* unused'
1651.1Schuck
1661.6Smycrofttags:
1671.6Smycroft	@echo "see $S/kern/Makefile for tags"
1681.1Schuck
1691.1Schucklinks:
1701.1Schuck	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1711.1Schuck	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1721.1Schuck	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1731.1Schuck	  sort -u | comm -23 - dontlink | \
1741.6Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1751.1Schuck	sh makelinks && rm -f dontlink
1761.1Schuck
1771.6SmycroftSRCS=	${MVME68K}/mvme68k/locore.s \
1781.10Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1791.20Schuckdepend: .depend
1801.10Scgd.depend: ${SRCS} assym.h param.c
1811.25Sthorpej	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${MVME68K}/mvme68k/locore.s
1821.25Sthorpej	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1831.25Sthorpej	-if test -n "${SFILES}"; then \
1841.25Sthorpej		${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}; \
1851.25Sthorpej	fi
1861.26Sleo	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
1871.26Sleo	  ${CPPFLAGS} < ${MVME68K}/mvme68k/genassym.cf
1881.26Sleo	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
1891.26Sleo	@rm -f assym.dep
1901.44Stron
1911.44Strondependall: depend all
1921.6Smycroft
1931.6Smycroft
1941.6Smycroft# depend on root or device configuration
1951.6Smycroftautoconf.o conf.o: Makefile
1961.6Smycroft 
1971.6Smycroft# depend on network or filesystem configuration 
1981.6Smycroftuipc_proto.o vfs_conf.o: Makefile 
1991.1Schuck
2001.6Smycroft# depend on maxusers
2011.22Smycroftmachdep.o: Makefile
2021.1Schuck
2031.6Smycroft# depend on CPU configuration 
2041.6Smycroftlocore.o pmap.o sys_machdep.o trap.o: Makefile
2051.1Schuck
2061.1Schuck
2071.6Smycroftlocore.o: ${MVME68K}/mvme68k/locore.s assym.h
2081.6Smycroft	${NORMAL_S}
2091.1Schuck
2101.1Schuck%RULES
211