Makefile.arm revision 1.10
11.10Sjmc# $NetBSD: Makefile.arm,v 1.10 2001/10/26 06:45:35 jmc Exp $ 21.1Smatt 31.1Smatt# Makefile for NetBSD 41.1Smatt# 51.1Smatt# This makefile is constructed from a machine description: 61.1Smatt# config machineid 71.1Smatt# Most changes should be made in the machine description 81.1Smatt# /sys/arch/<arch>/conf/``machineid'' 91.1Smatt# after which you should do 101.1Smatt# config machineid 111.1Smatt# Machine generic makefile changes should be made in 121.1Smatt# /sys/arch/arm/conf/Makefile.arm 131.1Smatt# after which config should be rerun for all machines of that type. 141.10Sjmc 151.10SjmcUSETOOLS?= no 161.8Sthorpej 171.8Sthorpej.include <bsd.own.mk> 181.1Smatt 191.1Smatt# DEBUG is set to -g if debugging. 201.1Smatt# PROF is set to -pg if profiling. 211.1Smatt 221.1SmattAR?= ar 231.1SmattAS?= as 241.1SmattCC?= cc 251.1SmattCPP?= cpp 261.1SmattLD?= ld 271.1SmattLORDER?=lorder 281.1SmattMKDEP?= mkdep 291.1SmattNM?= nm 301.1SmattRANLIB?=ranlib 311.1SmattSIZE?= size 321.1SmattSTRIP?= strip 331.1SmattTSORT?= tsort -q 341.1Smatt 351.1SmattCOPTS?= -O2 361.7Smatt 371.7Smatt.if $S == "../../../.." 381.7SmattS!= cd ../../../..; pwd 391.7Smatt.endif 401.1Smatt 411.1SmattARM32= $S/arch/arm32 421.6SchrisARM= $S/arch/arm 431.9SthorpejTHISARM= $S/arch/${MACHINE} 441.1Smatt 451.1SmattHAVE_EGCS!= ${CC} --version | egrep "^(2\.[89]|egcs)" ; echo 461.1SmattINCLUDES= -I. -I./include -I$S/arch -I$S -nostdinc 471.1SmattCPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} \ 481.9Sthorpej -D_KERNEL -D_KERNEL_OPT -D${MACHINE} 491.1SmattCWARNFLAGS?= -Werror -Wall -Wcomment -Wpointer-arith 501.1Smatt# XXX Delete -Wuninitialized for now, since the compiler doesn't 511.1Smatt# XXX always get it right. --thorpej 521.1SmattCWARNFLAGS+= -Wno-uninitialized 531.1Smatt.if (${HAVE_EGCS} != "") 541.1SmattCWARNFLAGS+= -Wno-main 551.1Smatt.endif 561.1SmattCFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} 571.1SmattAFLAGS= -x assembler-with-cpp -D_LOCORE 581.1Smatt 591.3SmattLOADADDRESS?= 0xF0000000 601.3SmattLINKENTRY?= -e start 611.4SmattLINKFLAGS= -Ttext ${LOADADDRESS} ${LINKENTRY} ${EXTRA_LINKFLAGS} 621.1SmattSTRIPFLAGS= -g 631.1Smatt 641.9Sthorpej.if exists($S/arch/${MACHINE}/conf/Makefile.${MACHINE}.inc) 651.9Sthorpej.include "$S/arch/${MACHINE}/conf/Makefile.${MACHINE}.inc" 661.1Smatt.endif 671.1Smatt 681.1Smatt%INCLUDES 691.1Smatt 701.1SmattHOSTED_CC= ${CC} 711.1SmattHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} 721.1SmattHOSTED_CFLAGS= ${CFLAGS} 731.1Smatt 741.1Smatt### find out what to use for libkern 751.1SmattKERN_AS= obj 761.1Smatt.include "$S/lib/libkern/Makefile.inc" 771.1Smatt.ifndef PROF 781.1SmattLIBKERN= ${KERNLIB} 791.1Smatt.else 801.1SmattLIBKERN= ${KERNLIB_PROF} 811.1Smatt.endif 821.1Smatt 831.1Smatt### find out what to use for libcompat 841.1Smatt.include "$S/compat/common/Makefile.inc" 851.1Smatt.ifndef PROF 861.1SmattLIBCOMPAT= ${COMPATLIB} 871.1Smatt.else 881.1SmattLIBCOMPAT= ${COMPATLIB_PROF} 891.1Smatt.endif 901.1Smatt 911.1Smatt# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 921.1Smatt# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 931.1Smatt 941.1SmattNORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 951.1SmattNOPROF_C= ${CC} ${CFLAGS} ${CPPFLAGS} -c $< 961.1SmattNORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 971.1Smatt 981.1SmattHOSTED_C= ${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $< 991.1Smatt 1001.1Smatt%OBJS 1011.1Smatt 1021.1Smatt%CFILES 1031.1Smatt 1041.1Smatt%SFILES 1051.1Smatt 1061.1Smatt# load lines for config "xxx" will be emitted as: 1071.1Smatt# xxx: ${SYSTEM_DEP} swapxxx.o 1081.1Smatt# ${SYSTEM_LD_HEAD} 1091.1Smatt# ${SYSTEM_LD} swapxxx.o 1101.1Smatt# ${SYSTEM_LD_TAIL} 1111.1SmattSYSTEM_OBJ= ${SYSTEM_FIRST_OBJ} locore.o \ 1121.1Smatt param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN} 1131.1SmattSYSTEM_DEP= Makefile ${SYSTEM_OBJ} 1141.1SmattSYSTEM_LD_HEAD= rm -f $@ 1151.1SmattSYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 1161.1Smatt ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 1171.1SmattSYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 1181.1Smatt 1191.1SmattDEBUG?= 1201.1Smatt.if ${DEBUG} == "-g" 1211.1SmattLINKFLAGS+= -X 1221.1SmattSYSTEM_LD_TAIL+=; \ 1231.1Smatt echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \ 1241.1Smatt echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ 1251.1Smatt ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb 1261.1Smatt.else 1271.1Smatt#LINKFLAGS+= -S 1281.5SchrisLINKFLAGS+= -X 1291.1Smatt.endif 1301.1Smatt 1311.1Smatt%LOAD 1321.1Smatt 1331.6Schrisassym.h: $S/kern/genassym.sh ${ARM}/arm32/genassym.cf 1341.1Smatt sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 1351.6Schris < ${ARM}/arm32/genassym.cf > assym.h.tmp && \ 1361.1Smatt mv -f assym.h.tmp assym.h 1371.1Smatt 1381.1Smattparam.c: $S/conf/param.c 1391.1Smatt rm -f param.c 1401.1Smatt cp $S/conf/param.c . 1411.1Smatt 1421.1Smattparam.o: param.c Makefile 1431.1Smatt ${NORMAL_C} 1441.1Smatt 1451.1Smattioconf.o: ioconf.c 1461.1Smatt ${NORMAL_C} 1471.1Smatt 1481.1Smattnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 1491.1Smatt sh $S/conf/newvers.sh 1501.1Smatt ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 1511.1Smatt 1521.1Smatt__CLEANKERNEL: .USE 1531.1Smatt @echo "${.TARGET}ing the kernel objects" 1541.1Smatt rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 1551.1Smatt [Ee]rrs linterrs makelinks assym.h.tmp assym.h ${EXTRA_CLEAN} 1561.1Smatt 1571.1Smatt__CLEANDEPEND: .USE 1581.1Smatt rm -f .depend 1591.1Smatt 1601.1Smattclean: __CLEANKERNEL 1611.1Smatt 1621.1Smattcleandir distclean: __CLEANKERNEL __CLEANDEPEND 1631.1Smatt 1641.1Smattlint: 1651.1Smatt @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 1661.1Smatt ${ARM32}/arm32/Locore.c ${CFILES} \ 1671.1Smatt ioconf.c param.c | \ 1681.1Smatt grep -v 'static function .* unused' 1691.1Smatt 1701.1Smatttags: 1711.1Smatt @echo "see $S/kern/Makefile for tags" 1721.1Smatt 1731.1Smattlinks: 1741.1Smatt egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 1751.1Smatt sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 1761.1Smatt echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 1771.1Smatt sort -u | comm -23 - dontlink | \ 1781.1Smatt sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 1791.1Smatt sh makelinks && rm -f dontlink 1801.1Smatt 1811.6SchrisSRCS= ${ARM}/arm32/locore.S param.c ioconf.c ${CFILES} ${SFILES} \ 1821.1Smatt ${EXTRA_CFILES} ${EXTRA_SFILES} ${SYSTEM_FIRST_SFILE} 1831.1Smatt 1841.1Smattdepend: .depend 1851.1Smatt.depend: ${SRCS} assym.h param.c 1861.1Smatt ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SYSTEM_FIRST_SFILE} \ 1871.6Schris ${ARM}/arm32/locore.S ${EXTRA_SFILES} 1881.1Smatt ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} \ 1891.1Smatt ${EXTRA_CFILES} 1901.1Smatt test -z "${SFILES}" || ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 1911.1Smatt sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 1921.6Schris ${CPPFLAGS} < ${ARM}/arm32/genassym.cf 1931.1Smatt @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 1941.1Smatt @rm -f assym.dep 1951.1Smatt 1961.1Smattdependall: depend all 1971.1Smatt 1981.2Smatt.if !exists(include) 1991.1Smatt${OBJS} assym.h .depend: include-dir 2001.1Smattinclude-dir: 2011.1Smatt @rm -rf include 2021.1Smatt @mkdir -p include/arm 2031.1Smatt.if (${S} == "../../../..") 2041.9Sthorpej @(cd include/arm; ln -s ../../$S/arch/${MACHINE}/include ${MACHINE}) 2051.1Smatt @(cd include; ln -s ../$S/arch/arm/include machine) 2061.1Smatt.else 2071.9Sthorpej @ln -s $S/arch/${MACHINE}/include include/arm/${MACHINE} 2081.1Smatt @ln -s $S/arch/arm/include include/machine 2091.2Smatt.endif 2101.1Smatt.endif 2111.1Smatt 2121.1Smatt# depend on root or device configuration 2131.1Smattautoconf.o conf.o: Makefile 2141.1Smatt 2151.1Smatt# depend on network 2161.1Smattuipc_proto.o: Makefile 2171.1Smatt 2181.1Smatt# depend on maxusers 2191.1Smattassym.h: Makefile 2201.1Smatt 2211.1Smatt# depend on CPU configuration 2221.1Smattcpufunc.o cpufunc_asm.o: Makefile 2231.1Smatt 2241.1Smatt# depend on DIAGNOSTIC etc. 2251.1Smattcpuswitch.o fault.o machdep.o: Makefile 2261.1Smatt 2271.1Smatt.if defined(SYSTEM_FIRST_OBJ) 2281.1Smatt${SYSTEM_FIRST_OBJ}: ${SYSTEM_FIRST_SFILE} assym.h 2291.1Smatt ${NORMAL_S} 2301.1Smatt.endif 2311.1Smatt 2321.6Schrislocore.o: ${ARM}/arm32/locore.S assym.h 2331.1Smatt ${NORMAL_S} 2341.1Smatt 2351.1Smatt# The install target can be redefined by putting a 2361.1Smatt# install-kernel-${MACHINE_NAME} target into /etc/mk.conf 2371.1SmattMACHINE_NAME!= uname -n 2381.1Smattinstall: install-kernel-${MACHINE_NAME} 2391.1Smatt.if !target(install-kernel-${MACHINE_NAME}}) 2401.1Smattinstall-kernel-${MACHINE_NAME}: 2411.1Smatt rm -f /onetbsd 2421.1Smatt ln /netbsd /onetbsd 2431.1Smatt cp netbsd /nnetbsd 2441.1Smatt mv /nnetbsd /netbsd 2451.1Smatt.endif 2461.1Smatt 2471.1Smatt%RULES 248