Makefile.mvme68k revision 1.12
11.12Smycroft#	$NetBSD: Makefile.mvme68k,v 1.12 1996/08/10 05:29:43 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.9SmycroftSTRIP?=	strip -d
281.9SmycroftTOUCH?=	touch -f -c
291.1Schuck
301.1Schuck# source tree is located via $S relative to the compilation directory
311.12SmycroftS!=	cd ../../../..; pwd
321.12SmycroftMVME68K=$S/arch/mvme68k
331.1Schuck
341.6SmycroftINCLUDES=	-I. -I$S/arch -I$S
351.6SmycroftCPPFLAGS=	${INCLUDES} ${IDENT} -D_KERNEL -Dmc68020 -Dmvme68k -DFPCOPROC
361.12SmycroftCWARNFLAGS=	-Werror
371.12SmycroftCFLAGS=		${DEBUG} ${CWARNFLAGS} -O2 -msoft-float
381.8SmycroftAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
391.6SmycroftLINKFLAGS=	-n -Ttext 8000 -e start
401.1Schuck
411.1Schuck### find out what to use for libkern
421.1Schuck.include "$S/lib/libkern/Makefile.inc"
431.1Schuck.ifndef PROF
441.1SchuckLIBKERN=	${KERNLIB}
451.1Schuck.else
461.1SchuckLIBKERN=	${KERNLIB_PROF}
471.1Schuck.endif
481.1Schuck
491.1Schuck### find out what to use for libcompat
501.1Schuck.include "$S/compat/common/Makefile.inc"
511.1Schuck.ifndef PROF
521.1SchuckLIBCOMPAT=    ${COMPATLIB}
531.1Schuck.else
541.1SchuckLIBCOMPAT=    ${COMPATLIB_PROF}
551.1Schuck.endif
561.1Schuck
571.1Schuck### for the Motorola 68040 Floating Point Software Product
581.1Schuck.include "$S/arch/m68k/fpsp/Makefile.inc"
591.1Schuck
601.1Schuck# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
611.1Schuck# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
621.1Schuck# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
631.1Schuck# is marked as config-dependent.
641.1Schuck
651.6SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
661.6SmycroftNORMAL_C_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
671.1Schuck
681.6SmycroftDRIVER_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
691.6SmycroftDRIVER_C_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
701.1Schuck
711.8SmycroftNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
721.8SmycroftNORMAL_S_C=	${CC} ${AFLAGS} ${CPPFLAGS} ${PARAM} -c $<
731.1Schuck
741.1Schuck%OBJS
751.1Schuck
761.1Schuck%CFILES
771.1Schuck
781.6Smycroft%SFILES
791.6Smycroft
801.1Schuck# load lines for config "xxx" will be emitted as:
811.1Schuck# xxx: ${SYSTEM_DEP} swapxxx.o
821.1Schuck#	${SYSTEM_LD_HEAD}
831.1Schuck#	${SYSTEM_LD} swapxxx.o
841.1Schuck#	${SYSTEM_LD_TAIL}
851.6SmycroftSYSTEM_OBJ=	locore.o ${FPSP} \
861.10Scgd		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
871.6SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
881.6SmycroftSYSTEM_LD_HEAD=	@rm -f $@
891.6SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
901.6Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
911.6SmycroftSYSTEM_LD_TAIL=	@size $@; chmod 755 $@
921.6Smycroft
931.1SchuckDEBUG?=
941.1Schuck.if ${DEBUG} == "-g"
951.6SmycroftLINKFLAGS+=	-X
961.6SmycroftSYSTEM_LD_TAIL+=; \
971.6Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
981.6Smycroft		echo ${STRIP} $@; ${STRIP} $@
991.1Schuck.else
1001.12SmycroftLINKFLAGS+=	-S
1011.1Schuck.endif
1021.1Schuck
1031.1Schuck%LOAD
1041.1Schuck
1051.6Smycroftassym.h: genassym
1061.6Smycroft	./genassym >assym.h
1071.6Smycroft
1081.6Smycroftgenassym: genassym.o
1091.6Smycroft	${CC} -o $@ genassym.o
1101.6Smycroft
1111.6Smycroftgenassym.o: ${MVME68K}/mvme68k/genassym.c
1121.6Smycroft	${NORMAL_C_C}
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.6Smycroft	${NORMAL_C_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.1Schuckclean::
1301.10Scgd	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1311.6Smycroft	    [Ee]rrs linterrs makelinks genassym genassym.o assym.h
1321.1Schuck
1331.6Smycroftlint:
1341.6Smycroft	@lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \
1351.1Schuck	    ${MVME68K}/mvme68k/Locore.c ${CFILES} ${MVME68K}/mvme68k/swapgeneric.c \
1361.1Schuck	    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.11Smycroftdepend:: .depend
1531.10Scgd.depend: ${SRCS} assym.h param.c
1541.12Smycroft	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${MVME68K}/mvme68k/locore.s
1551.12Smycroft	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1561.12Smycroft	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
1571.12Smycroft	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} ${PARAM} ${MVME68K}/mvme68k/genassym.c
1581.6Smycroft
1591.6Smycroft
1601.6Smycroft# depend on root or device configuration
1611.6Smycroftautoconf.o conf.o: Makefile
1621.6Smycroft 
1631.6Smycroft# depend on network or filesystem configuration 
1641.6Smycroftuipc_proto.o vfs_conf.o: Makefile 
1651.1Schuck
1661.6Smycroft# depend on maxusers
1671.6Smycroftgenassym.o machdep.o: Makefile
1681.1Schuck
1691.6Smycroft# depend on CPU configuration 
1701.6Smycroftlocore.o pmap.o sys_machdep.o trap.o: Makefile
1711.1Schuck
1721.1Schuck
1731.6Smycroftlocore.o: ${MVME68K}/mvme68k/locore.s assym.h
1741.6Smycroft	${NORMAL_S}
1751.1Schuck
1761.1Schuck%RULES
177