Makefile.arm revision 1.4
11.4Smatt# $NetBSD: Makefile.arm,v 1.4 2001/07/12 07:02:00 matt 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.1Smatt 151.1Smatt# DEBUG is set to -g if debugging. 161.1Smatt# PROF is set to -pg if profiling. 171.1Smatt 181.1SmattAR?= ar 191.1SmattAS?= as 201.1SmattCC?= cc 211.1SmattCPP?= cpp 221.1SmattLD?= ld 231.1SmattLORDER?=lorder 241.1SmattMKDEP?= mkdep 251.1SmattNM?= nm 261.1SmattRANLIB?=ranlib 271.1SmattSIZE?= size 281.1SmattSTRIP?= strip 291.1SmattTSORT?= tsort -q 301.1Smatt 311.1SmattCOPTS?= -O2 321.1Smatt 331.1SmattARM32= $S/arch/arm32 341.1SmattTHISARM= $S/arch/${TARGET_MACHINE} 351.1Smatt 361.1SmattHAVE_EGCS!= ${CC} --version | egrep "^(2\.[89]|egcs)" ; echo 371.1SmattINCLUDES= -I. -I./include -I$S/arch -I$S -nostdinc 381.1SmattCPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} \ 391.1Smatt -D_KERNEL -D_KERNEL_OPT -D${TARGET_MACHINE} 401.1SmattCWARNFLAGS?= -Werror -Wall -Wcomment -Wpointer-arith 411.1Smatt# XXX Delete -Wuninitialized for now, since the compiler doesn't 421.1Smatt# XXX always get it right. --thorpej 431.1SmattCWARNFLAGS+= -Wno-uninitialized 441.1Smatt.if (${HAVE_EGCS} != "") 451.1SmattCWARNFLAGS+= -Wno-main 461.1Smatt.endif 471.1SmattCFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} 481.1SmattAFLAGS= -x assembler-with-cpp -D_LOCORE 491.1Smatt 501.3SmattLOADADDRESS?= 0xF0000000 511.3SmattLINKENTRY?= -e start 521.4SmattLINKFLAGS= -Ttext ${LOADADDRESS} ${LINKENTRY} ${EXTRA_LINKFLAGS} 531.1SmattSTRIPFLAGS= -g 541.1Smatt 551.3Smatt.if exists($S/arch/${TARGET_MACHINE}/conf/Makefile.${TARGET_MACHINE}.inc) 561.3Smatt.include "$S/arch/${TARGET_MACHINE}/conf/Makefile.${TARGET_MACHINE}.inc" 571.1Smatt.endif 581.1Smatt 591.1Smatt%INCLUDES 601.1Smatt 611.1SmattHOSTED_CC= ${CC} 621.1SmattHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} 631.1SmattHOSTED_CFLAGS= ${CFLAGS} 641.1Smatt 651.1Smatt### find out what to use for libkern 661.1SmattKERN_AS= obj 671.1Smatt.include "$S/lib/libkern/Makefile.inc" 681.1Smatt.ifndef PROF 691.1SmattLIBKERN= ${KERNLIB} 701.1Smatt.else 711.1SmattLIBKERN= ${KERNLIB_PROF} 721.1Smatt.endif 731.1Smatt 741.1Smatt### find out what to use for libcompat 751.1Smatt.include "$S/compat/common/Makefile.inc" 761.1Smatt.ifndef PROF 771.1SmattLIBCOMPAT= ${COMPATLIB} 781.1Smatt.else 791.1SmattLIBCOMPAT= ${COMPATLIB_PROF} 801.1Smatt.endif 811.1Smatt 821.1Smatt# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 831.1Smatt# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 841.1Smatt 851.1SmattNORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 861.1SmattNOPROF_C= ${CC} ${CFLAGS} ${CPPFLAGS} -c $< 871.1SmattNORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 881.1Smatt 891.1SmattHOSTED_C= ${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $< 901.1Smatt 911.1Smatt%OBJS 921.1Smatt 931.1Smatt%CFILES 941.1Smatt 951.1Smatt%SFILES 961.1Smatt 971.1Smatt# load lines for config "xxx" will be emitted as: 981.1Smatt# xxx: ${SYSTEM_DEP} swapxxx.o 991.1Smatt# ${SYSTEM_LD_HEAD} 1001.1Smatt# ${SYSTEM_LD} swapxxx.o 1011.1Smatt# ${SYSTEM_LD_TAIL} 1021.1SmattSYSTEM_OBJ= ${SYSTEM_FIRST_OBJ} locore.o \ 1031.1Smatt param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN} 1041.1SmattSYSTEM_DEP= Makefile ${SYSTEM_OBJ} 1051.1SmattSYSTEM_LD_HEAD= rm -f $@ 1061.1SmattSYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 1071.1Smatt ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 1081.1SmattSYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 1091.1Smatt 1101.1SmattDEBUG?= 1111.1Smatt.if ${DEBUG} == "-g" 1121.1SmattLINKFLAGS+= -X 1131.1SmattSYSTEM_LD_TAIL+=; \ 1141.1Smatt echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \ 1151.1Smatt echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ 1161.1Smatt ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb 1171.1Smatt.else 1181.1Smatt#LINKFLAGS+= -S 1191.1SmattLINKFLAGS+= -x 1201.1Smatt.endif 1211.1Smatt 1221.1Smatt%LOAD 1231.1Smatt 1241.1Smattassym.h: $S/kern/genassym.sh ${ARM32}/arm32/genassym.cf 1251.1Smatt sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 1261.1Smatt < ${ARM32}/arm32/genassym.cf > assym.h.tmp && \ 1271.1Smatt mv -f assym.h.tmp assym.h 1281.1Smatt 1291.1Smattparam.c: $S/conf/param.c 1301.1Smatt rm -f param.c 1311.1Smatt cp $S/conf/param.c . 1321.1Smatt 1331.1Smattparam.o: param.c Makefile 1341.1Smatt ${NORMAL_C} 1351.1Smatt 1361.1Smattioconf.o: ioconf.c 1371.1Smatt ${NORMAL_C} 1381.1Smatt 1391.1Smattnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 1401.1Smatt sh $S/conf/newvers.sh 1411.1Smatt ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 1421.1Smatt 1431.1Smatt__CLEANKERNEL: .USE 1441.1Smatt @echo "${.TARGET}ing the kernel objects" 1451.1Smatt rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 1461.1Smatt [Ee]rrs linterrs makelinks assym.h.tmp assym.h ${EXTRA_CLEAN} 1471.1Smatt 1481.1Smatt__CLEANDEPEND: .USE 1491.1Smatt rm -f .depend 1501.1Smatt 1511.1Smattclean: __CLEANKERNEL 1521.1Smatt 1531.1Smattcleandir distclean: __CLEANKERNEL __CLEANDEPEND 1541.1Smatt 1551.1Smattlint: 1561.1Smatt @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 1571.1Smatt ${ARM32}/arm32/Locore.c ${CFILES} \ 1581.1Smatt ioconf.c param.c | \ 1591.1Smatt grep -v 'static function .* unused' 1601.1Smatt 1611.1Smatttags: 1621.1Smatt @echo "see $S/kern/Makefile for tags" 1631.1Smatt 1641.1Smattlinks: 1651.1Smatt egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 1661.1Smatt sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 1671.1Smatt echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 1681.1Smatt sort -u | comm -23 - dontlink | \ 1691.1Smatt sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 1701.1Smatt sh makelinks && rm -f dontlink 1711.1Smatt 1721.1SmattSRCS= ${ARM32}/arm32/locore.S param.c ioconf.c ${CFILES} ${SFILES} \ 1731.1Smatt ${EXTRA_CFILES} ${EXTRA_SFILES} ${SYSTEM_FIRST_SFILE} 1741.1Smatt 1751.1Smattdepend: .depend 1761.1Smatt.depend: ${SRCS} assym.h param.c 1771.1Smatt ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SYSTEM_FIRST_SFILE} \ 1781.1Smatt ${ARM32}/arm32/locore.S ${EXTRA_SFILES} 1791.1Smatt ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} \ 1801.1Smatt ${EXTRA_CFILES} 1811.1Smatt test -z "${SFILES}" || ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 1821.1Smatt sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 1831.1Smatt ${CPPFLAGS} < ${ARM32}/arm32/genassym.cf 1841.1Smatt @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 1851.1Smatt @rm -f assym.dep 1861.1Smatt 1871.1Smattdependall: depend all 1881.1Smatt 1891.2Smatt.if !exists(include) 1901.1Smatt${OBJS} assym.h .depend: include-dir 1911.1Smattinclude-dir: 1921.1Smatt @rm -rf include 1931.1Smatt @mkdir -p include/arm 1941.1Smatt.if (${S} == "../../../..") 1951.1Smatt @(cd include/arm; ln -s ../../$S/arch/${TARGET_MACHINE}/include ${TARGET_MACHINE}) 1961.1Smatt @(cd include; ln -s ../$S/arch/arm/include machine) 1971.1Smatt.else 1981.1Smatt @ln -s $S/arch/${TARGET_MACHINE}/include include/arm/${TARGET_MACHINE} 1991.1Smatt @ln -s $S/arch/arm/include include/machine 2001.2Smatt.endif 2011.1Smatt.endif 2021.1Smatt 2031.1Smatt# depend on root or device configuration 2041.1Smattautoconf.o conf.o: Makefile 2051.1Smatt 2061.1Smatt# depend on network 2071.1Smattuipc_proto.o: Makefile 2081.1Smatt 2091.1Smatt# depend on maxusers 2101.1Smattassym.h: Makefile 2111.1Smatt 2121.1Smatt# depend on CPU configuration 2131.1Smattcpufunc.o cpufunc_asm.o: Makefile 2141.1Smatt 2151.1Smatt# depend on DIAGNOSTIC etc. 2161.1Smattcpuswitch.o fault.o machdep.o: Makefile 2171.1Smatt 2181.1Smatt.if defined(SYSTEM_FIRST_OBJ) 2191.1Smatt${SYSTEM_FIRST_OBJ}: ${SYSTEM_FIRST_SFILE} assym.h 2201.1Smatt ${NORMAL_S} 2211.1Smatt.endif 2221.1Smatt 2231.1Smattlocore.o: ${ARM32}/arm32/locore.S assym.h 2241.1Smatt ${NORMAL_S} 2251.1Smatt 2261.1Smatt# The install target can be redefined by putting a 2271.1Smatt# install-kernel-${MACHINE_NAME} target into /etc/mk.conf 2281.1SmattMACHINE_NAME!= uname -n 2291.1Smattinstall: install-kernel-${MACHINE_NAME} 2301.1Smatt.if !target(install-kernel-${MACHINE_NAME}}) 2311.1Smattinstall-kernel-${MACHINE_NAME}: 2321.1Smatt rm -f /onetbsd 2331.1Smatt ln /netbsd /onetbsd 2341.1Smatt cp netbsd /nnetbsd 2351.1Smatt mv /nnetbsd /netbsd 2361.1Smatt.endif 2371.1Smatt 2381.1Smatt%RULES 239