Makefile.mvme68k revision 1.23
11.23Sgwr#	$NetBSD: Makefile.mvme68k,v 1.23 1997/03/17 22:16:03 gwr 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.23Sgwr# Simplify cross-build...
251.23SgwrMACHINE_ARCH=m68k
261.23SgwrMACHINE=mvme68k
271.23Sgwr
281.9SmycroftCC?=	cc
291.9SmycroftLD?=	ld
301.12SmycroftMKDEP?=	mkdep
311.16SmycroftSTRIP?=	strip
321.17SjonathanCOPTS?= 	-O2
331.1Schuck
341.1Schuck# source tree is located via $S relative to the compilation directory
351.15Smycroft.ifndef S
361.12SmycroftS!=	cd ../../../..; pwd
371.15Smycroft.endif
381.12SmycroftMVME68K=$S/arch/mvme68k
391.1Schuck
401.23Sgwr# Override CPP defaults entirely, so cross-compilation works.
411.23Sgwr# Keep -nostdinc before all -I flags, similar for -undef ...
421.23SgwrINCLUDES=	-nostdinc -I. -I$S/arch -I$S
431.23SgwrXDEFS=		-undef -D__NetBSD__ -Dm68k -Dmc68000
441.23SgwrDEFINES=	-D_KERNEL -Dmc68020 -Dmvme68k
451.23SgwrCPPFLAGS=	${INCLUDES} ${XDEFS} ${DEFINES} ${IDENT} ${PARAM}
461.12SmycroftCWARNFLAGS=	-Werror
471.23SgwrCFLAGS= 	${DEBUG} ${COPTS} -msoft-float ${CWARNFLAGS}
481.23SgwrAPPFLAGS=	-P -traditional ${CPPFLAGS} -D_LOCORE
491.23SgwrAFLAGS= 	-m68030
501.6SmycroftLINKFLAGS=	-n -Ttext 8000 -e start
511.16SmycroftSTRIPFLAGS=	-d
521.16Smycroft
531.1Schuck### find out what to use for libkern
541.1Schuck.include "$S/lib/libkern/Makefile.inc"
551.1Schuck.ifndef PROF
561.1SchuckLIBKERN=	${KERNLIB}
571.1Schuck.else
581.1SchuckLIBKERN=	${KERNLIB_PROF}
591.1Schuck.endif
601.1Schuck
611.1Schuck### find out what to use for libcompat
621.1Schuck.include "$S/compat/common/Makefile.inc"
631.1Schuck.ifndef PROF
641.23SgwrLIBCOMPAT=	${COMPATLIB}
651.1Schuck.else
661.23SgwrLIBCOMPAT=	${COMPATLIB_PROF}
671.1Schuck.endif
681.1Schuck
691.1Schuck### for the Motorola 68040 Floating Point Software Product
701.1Schuck.include "$S/arch/m68k/fpsp/Makefile.inc"
711.1Schuck
721.23Sgwr# compile rules: rules are named NORMAL_${SUFFIX} where SUFFIX is
731.23Sgwr# the file suffix, capitalized (e.g. C for a .c file).
741.1Schuck
751.6SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
761.1Schuck
771.23Sgwr# Please do not assume the compiler does "-x ..." (gcc-only).
781.23Sgwr# This needs an intermediate file.  The original file is always
791.23Sgwr# safe in some far away directory, so just use the base name.
801.23SgwrNORMAL_S=	${CPP} ${APPFLAGS} $< > $*.s ;\
811.23Sgwr		${AS} ${AFLAGS} -o $@ $*.s ; rm $*.s
821.13Smycroft
831.1Schuck%OBJS
841.1Schuck
851.1Schuck%CFILES
861.1Schuck
871.6Smycroft%SFILES
881.6Smycroft
891.1Schuck# load lines for config "xxx" will be emitted as:
901.1Schuck# xxx: ${SYSTEM_DEP} swapxxx.o
911.1Schuck#	${SYSTEM_LD_HEAD}
921.1Schuck#	${SYSTEM_LD} swapxxx.o
931.1Schuck#	${SYSTEM_LD_TAIL}
941.6SmycroftSYSTEM_OBJ=	locore.o ${FPSP} \
951.10Scgd		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
961.6SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
971.6SmycroftSYSTEM_LD_HEAD=	@rm -f $@
981.6SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
991.6Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
1001.6SmycroftSYSTEM_LD_TAIL=	@size $@; chmod 755 $@
1011.6Smycroft
1021.1SchuckDEBUG?=
1031.1Schuck.if ${DEBUG} == "-g"
1041.6SmycroftLINKFLAGS+=	-X
1051.6SmycroftSYSTEM_LD_TAIL+=; \
1061.6Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
1071.16Smycroft		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
1081.1Schuck.else
1091.12SmycroftLINKFLAGS+=	-S
1101.1Schuck.endif
1111.1Schuck
1121.1Schuck%LOAD
1131.1Schuck
1141.22Smycroftassym.h: $S/kern/genassym.sh ${MVME68K}/mvme68k/genassym.cf
1151.22Smycroft	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1161.22Smycroft	    < ${MVME68K}/mvme68k/genassym.cf > assym.h.tmp && \
1171.22Smycroft	mv -f assym.h.tmp assym.h
1181.6Smycroft
1191.6Smycroftparam.c: $S/conf/param.c
1201.6Smycroft	rm -f param.c
1211.6Smycroft	cp $S/conf/param.c .
1221.6Smycroft
1231.6Smycroftparam.o: param.c Makefile
1241.14Smycroft	${NORMAL_C}
1251.6Smycroft
1261.6Smycroftioconf.o: ioconf.c
1271.6Smycroft	${NORMAL_C}
1281.1Schuck
1291.6Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1301.1Schuck	sh $S/conf/newvers.sh
1311.6Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1321.6Smycroft
1331.1Schuck
1341.20Schuckclean: cleankernel
1351.20Schuckcleankernel:
1361.10Scgd	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1371.22Smycroft	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1381.1Schuck
1391.6Smycroftlint:
1401.18Sperry	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1411.19Sperry	    ${MVME68K}/mvme68k/Locore.c ${CFILES} \
1421.1Schuck	    ioconf.c param.c | \
1431.6Smycroft	    grep -v 'static function .* unused'
1441.1Schuck
1451.6Smycrofttags:
1461.6Smycroft	@echo "see $S/kern/Makefile for tags"
1471.1Schuck
1481.1Schucklinks:
1491.1Schuck	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1501.1Schuck	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1511.1Schuck	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1521.1Schuck	  sort -u | comm -23 - dontlink | \
1531.6Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1541.1Schuck	sh makelinks && rm -f dontlink
1551.1Schuck
1561.6SmycroftSRCS=	${MVME68K}/mvme68k/locore.s \
1571.10Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1581.20Schuckdepend: .depend
1591.10Scgd.depend: ${SRCS} assym.h param.c
1601.23Sgwr	${MKDEP} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1611.23Sgwr
1621.23Sgwr# XXX - see below
1631.23Sgwr#	${MKDEP} -a ${APPFLAGS} ${MVME68K}/mvme68k/locore.s
1641.23Sgwr#	${MKDEP} -a ${APPFLAGS} ${SFILES}
1651.23Sgwr#
1661.23Sgwr# For cross-compilation, the "gcc -M" mkdep script is convenient,
1671.23Sgwr# but that does not correctly make rules from *.s files.  The
1681.23Sgwr# easiest work-around is to just list those dependencies here.
1691.23Sgwrlocore.o:   assym.h m68k/asm.h m68k/trap.h
1701.23Sgwrcopy.o:     assym.h m68k/asm.h $S/sys/errno.h
1711.23Sgwrbcopy.o:    assym.h m68k/asm.h
1721.23Sgwrcopypage.o: assym.h m68k/asm.h
1731.6Smycroft
1741.6Smycroft
1751.6Smycroft# depend on root or device configuration
1761.6Smycroftautoconf.o conf.o: Makefile
1771.6Smycroft 
1781.6Smycroft# depend on network or filesystem configuration 
1791.6Smycroftuipc_proto.o vfs_conf.o: Makefile 
1801.1Schuck
1811.6Smycroft# depend on maxusers
1821.22Smycroftmachdep.o: Makefile
1831.1Schuck
1841.6Smycroft# depend on CPU configuration 
1851.6Smycroftlocore.o pmap.o sys_machdep.o trap.o: Makefile
1861.1Schuck
1871.1Schuck
1881.6Smycroftlocore.o: ${MVME68K}/mvme68k/locore.s assym.h
1891.6Smycroft	${NORMAL_S}
1901.1Schuck
1911.1Schuck%RULES
192