Makefile.mvme68k revision 1.52
11.52Sthorpej# $NetBSD: Makefile.mvme68k,v 1.52 2001/10/23 19:26:45 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.52Sthorpej 151.52SthorpejMACHINE_ARCH=m68k 161.1Schuck 171.6Smycroft# DEBUG is set to -g if debugging. 181.6Smycroft# PROF is set to -pg if profiling. 191.1Schuck 201.32SthorpejAR?= ar 211.32SthorpejAS?= as 221.9SmycroftCC?= cc 231.32SthorpejCPP?= cpp 241.9SmycroftLD?= ld 251.31SthorpejLORDER?=lorder 261.12SmycroftMKDEP?= mkdep 271.31SthorpejNM?= nm 281.32SthorpejRANLIB?=ranlib 291.30SlukemSIZE?= size 301.45StsutsuiSTRIP?= strip 311.31SthorpejTSORT?= tsort -q 321.32Sthorpej 331.30SlukemCOPTS?= -O2 341.1Schuck 351.1Schuck# source tree is located via $S relative to the compilation directory 361.15Smycroft.ifndef S 371.12SmycroftS!= cd ../../../..; pwd 381.15Smycroft.endif 391.12SmycroftMVME68K=$S/arch/mvme68k 401.1Schuck 411.23Sgwr# Override CPP defaults entirely, so cross-compilation works. 421.23Sgwr# Keep -nostdinc before all -I flags, similar for -undef ... 431.47SthorpejHAVE_EGCS!= ${CC} --version | egrep "^(2\.[89]|egcs)" ; echo 441.23SgwrINCLUDES= -nostdinc -I. -I$S/arch -I$S 451.51SmrgCPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT -Dmvme68k 461.49Sscw.if empty(IDENT:M-DMVME172) && empty(IDENT:M-DMVME177) 471.49Sscw.if empty(IDENT:M-DMVME147) 481.49SscwCMACHFLAGS= -m68040 491.49Sscw.else 501.49SscwCMACHFLAGS= -m68030 511.49Sscw.endif 521.49Sscw.else 531.49Sscw.if empty(IDENT:M-DMVME147) && empty(IDENT:M-DMVME162) && empty(IDENT:M-DMVME167) 541.49SscwCMACHFLAGS= -m68060 -Wa,-m68030 -Wa,-m68851 551.49Sscw.else 561.49SscwCMACHFLAGS= -m68020-60 -Wa,-m68030 -Wa,-m68851 571.49Sscw.endif 581.49Sscw.endif 591.46SscwCWARNFLAGS?= -Werror -Wall -Wmissing-prototypes -Wstrict-prototypes \ 601.46Sscw -Wpointer-arith 611.47Sthorpej# XXX Delete -Wuninitialized for now, since the compiler doesn't 621.47Sthorpej# XXX always get it right. --thorpej 631.47SthorpejCWARNFLAGS+= -Wno-uninitialized 641.47Sthorpej.if (${HAVE_EGCS} != "") 651.33StvCWARNFLAGS+= -Wno-main 661.33Stv.endif 671.49SscwCFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} ${CMACHFLAGS} -msoft-float 681.25SthorpejAFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE 691.6SmycroftLINKFLAGS= -n -Ttext 8000 -e start 701.42StsutsuiSTRIPFLAGS= -g 711.40Smrg 721.40Smrg%INCLUDES 731.16Smycroft 741.25SthorpejHOSTED_CC= ${CC} 751.25SthorpejHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} 761.25SthorpejHOSTED_CFLAGS= ${CFLAGS} 771.25Sthorpej 781.1Schuck### find out what to use for libkern 791.36SdrochnerKERN_AS= obj 801.1Schuck.include "$S/lib/libkern/Makefile.inc" 811.1Schuck.ifndef PROF 821.1SchuckLIBKERN= ${KERNLIB} 831.1Schuck.else 841.1SchuckLIBKERN= ${KERNLIB_PROF} 851.1Schuck.endif 861.1Schuck 871.1Schuck### find out what to use for libcompat 881.1Schuck.include "$S/compat/common/Makefile.inc" 891.1Schuck.ifndef PROF 901.23SgwrLIBCOMPAT= ${COMPATLIB} 911.1Schuck.else 921.23SgwrLIBCOMPAT= ${COMPATLIB_PROF} 931.1Schuck.endif 941.1Schuck 951.1Schuck### for the Motorola 68040 Floating Point Software Product 961.1Schuck.include "$S/arch/m68k/fpsp/Makefile.inc" 971.49Sscw 981.49Sscw### for the Motorola 68060 Software Support Package 991.49Sscw.include "$S/arch/m68k/060sp/Makefile.inc" 1001.1Schuck 1011.25Sthorpej# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 1021.25Sthorpej# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 1031.1Schuck 1041.6SmycroftNORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 1051.34SthorpejNOPROF_C= ${CC} ${CFLAGS} ${CPPFLAGS} -c $< 1061.25SthorpejNORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 1071.1Schuck 1081.25SthorpejHOSTED_C= ${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $< 1091.13Smycroft 1101.1Schuck%OBJS 1111.1Schuck 1121.1Schuck%CFILES 1131.1Schuck 1141.6Smycroft%SFILES 1151.6Smycroft 1161.1Schuck# load lines for config "xxx" will be emitted as: 1171.1Schuck# xxx: ${SYSTEM_DEP} swapxxx.o 1181.1Schuck# ${SYSTEM_LD_HEAD} 1191.1Schuck# ${SYSTEM_LD} swapxxx.o 1201.1Schuck# ${SYSTEM_LD_TAIL} 1211.6SmycroftSYSTEM_OBJ= locore.o ${FPSP} \ 1221.36Sdrochner param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN} 1231.6SmycroftSYSTEM_DEP= Makefile ${SYSTEM_OBJ} 1241.6SmycroftSYSTEM_LD_HEAD= @rm -f $@ 1251.6SmycroftSYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 1261.6Smycroft ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 1271.30SlukemSYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 1281.6Smycroft 1291.1SchuckDEBUG?= 1301.1Schuck.if ${DEBUG} == "-g" 1311.6SmycroftLINKFLAGS+= -X 1321.6SmycroftSYSTEM_LD_TAIL+=; \ 1331.41Scgd echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \ 1341.45Stsutsui echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ 1351.45Stsutsui ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb 1361.1Schuck.else 1371.12SmycroftLINKFLAGS+= -S 1381.1Schuck.endif 1391.1Schuck 1401.1Schuck%LOAD 1411.1Schuck 1421.22Smycroftassym.h: $S/kern/genassym.sh ${MVME68K}/mvme68k/genassym.cf 1431.22Smycroft sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 1441.22Smycroft < ${MVME68K}/mvme68k/genassym.cf > assym.h.tmp && \ 1451.22Smycroft mv -f assym.h.tmp assym.h 1461.6Smycroft 1471.6Smycroftparam.c: $S/conf/param.c 1481.6Smycroft rm -f param.c 1491.6Smycroft cp $S/conf/param.c . 1501.6Smycroft 1511.6Smycroftparam.o: param.c Makefile 1521.14Smycroft ${NORMAL_C} 1531.6Smycroft 1541.6Smycroftioconf.o: ioconf.c 1551.6Smycroft ${NORMAL_C} 1561.1Schuck 1571.6Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 1581.1Schuck sh $S/conf/newvers.sh 1591.6Smycroft ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 1601.6Smycroft 1611.29Schristos__CLEANKERNEL: .USE 1621.29Schristos @echo "${.TARGET}ing the kernel objects" 1631.10Scgd rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 1641.22Smycroft [Ee]rrs linterrs makelinks assym.h.tmp assym.h 1651.29Schristos 1661.29Schristos__CLEANDEPEND: .USE 1671.29Schristos rm -f .depend 1681.29Schristos 1691.29Schristosclean: __CLEANKERNEL 1701.29Schristos 1711.35Slukemcleandir distclean: __CLEANKERNEL __CLEANDEPEND 1721.1Schuck 1731.6Smycroftlint: 1741.18Sperry @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 1751.27Smycroft ${CFILES} ioconf.c param.c | \ 1761.6Smycroft grep -v 'static function .* unused' 1771.1Schuck 1781.6Smycrofttags: 1791.6Smycroft @echo "see $S/kern/Makefile for tags" 1801.1Schuck 1811.1Schucklinks: 1821.1Schuck egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 1831.1Schuck sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 1841.1Schuck echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 1851.1Schuck sort -u | comm -23 - dontlink | \ 1861.6Smycroft sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 1871.1Schuck sh makelinks && rm -f dontlink 1881.1Schuck 1891.6SmycroftSRCS= ${MVME68K}/mvme68k/locore.s \ 1901.10Scgd param.c ioconf.c ${CFILES} ${SFILES} 1911.20Schuckdepend: .depend 1921.10Scgd.depend: ${SRCS} assym.h param.c 1931.25Sthorpej ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${MVME68K}/mvme68k/locore.s 1941.25Sthorpej ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 1951.25Sthorpej -if test -n "${SFILES}"; then \ 1961.25Sthorpej ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}; \ 1971.25Sthorpej fi 1981.26Sleo sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 1991.26Sleo ${CPPFLAGS} < ${MVME68K}/mvme68k/genassym.cf 2001.26Sleo @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 2011.26Sleo @rm -f assym.dep 2021.44Stron 2031.44Strondependall: depend all 2041.6Smycroft 2051.6Smycroft 2061.6Smycroft# depend on root or device configuration 2071.6Smycroftautoconf.o conf.o: Makefile 2081.6Smycroft 2091.6Smycroft# depend on network or filesystem configuration 2101.6Smycroftuipc_proto.o vfs_conf.o: Makefile 2111.1Schuck 2121.6Smycroft# depend on maxusers 2131.22Smycroftmachdep.o: Makefile 2141.1Schuck 2151.6Smycroft# depend on CPU configuration 2161.6Smycroftlocore.o pmap.o sys_machdep.o trap.o: Makefile 2171.1Schuck 2181.1Schuck 2191.6Smycroftlocore.o: ${MVME68K}/mvme68k/locore.s assym.h 2201.6Smycroft ${NORMAL_S} 2211.48Shubertf 2221.48Shubertf# The install target can be redefined by putting a 2231.48Shubertf# install-kernel-${MACHINE_NAME} target into /etc/mk.conf 2241.48ShubertfMACHINE_NAME!= uname -n 2251.48Shubertfinstall: install-kernel-${MACHINE_NAME} 2261.48Shubertf.if !target(install-kernel-${MACHINE_NAME}}) 2271.48Shubertfinstall-kernel-${MACHINE_NAME}: 2281.48Shubertf rm -f /onetbsd 2291.48Shubertf ln /netbsd /onetbsd 2301.48Shubertf cp netbsd /nnetbsd 2311.48Shubertf mv /nnetbsd /netbsd 2321.48Shubertf.endif 2331.1Schuck 2341.1Schuck%RULES 235