Makefile.arm revision 1.42
11.42Sjoerg#	$NetBSD: Makefile.arm,v 1.42 2014/03/02 13:21:59 joerg 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.15Satatat#
151.15Satatat# To specify debugging, add the config line: makeoptions DEBUG="-g"
161.15Satatat# A better way is to specify -g only for a few files.
171.15Satatat#
181.15Satatat#	makeoptions DEBUGLIST="uvm* trap if_*"
191.10Sjmc
201.10SjmcUSETOOLS?=	no
211.15SatatatNEED_OWN_INSTALL_TARGET?=no
221.8Sthorpej.include <bsd.own.mk>
231.1Smatt
241.15Satatat##
251.15Satatat## (1) port identification
261.15Satatat##
271.15SatatatTHISARM=	$S/arch/${MACHINE}
281.15SatatatARM=		$S/arch/arm
291.24SchristosGENASSYM_CONF=	${ARM}/arm32/genassym.cf
301.15Satatat.-include "$S/arch/${MACHINE}/conf/Makefile.${MACHINE}.inc"
311.1Smatt
321.15Satatat##
331.15Satatat## (2) compile settings
341.15Satatat##
351.18Sthorpej# CPPFLAGS set by platform-specific Makefile fragment.
361.15SatatatAFLAGS+=	-x assembler-with-cpp
371.35SmattCOPTS.arm32_kvminit.c+=		-fno-stack-protector
381.42SjoergCOPTS.vfp_init.c=		-mfpu=vfp
391.38SmattAFLAGS.bcopyinout.S+=-marm
401.39SmattAFLAGS.cpuswitch.S+=-marm -mfpu=vfp
411.38SmattAFLAGS.locore.S+=-marm
421.38SmattAFLAGS.fusu.S+=-marm
431.38SmattAFLAGS.exception.S+=-marm
441.38SmattAFLAGS.irq_dispatch.S+=-marm
451.38SmattAFLAGS.blockio.S+=-marm
461.38SmattAFLAGS.copystr.S+=-marm
471.37SskrllCFLAGS+=	 -mfloat-abi=soft
481.15Satatat
491.40Sjoerg# This files use instructions deprecated for ARMv7+, but still
501.40Sjoerg# included in kernel that build with higher -mcpu=... settings.
511.41SmartinCPPFLAGS.cpufunc_asm_armv4.S+=	-mcpu=arm8
521.40SjoergCPPFLAGS.cpufunc_asm_armv6.S+=	-mcpu=arm1136j-s
531.40SjoergCPPFLAGS.cpufunc_asm_arm11.S+=	-mcpu=arm1136j-s
541.40SjoergCPPFLAGS.cpufunc_asm_xscale.S+=	-mcpu=xscale
551.40Sjoerg
561.15Satatat##
571.15Satatat## (3) libkern and compat
581.15Satatat##
591.15SatatatKERN_AS=	obj
601.1Smatt
611.38Smatt
621.15Satatat##
631.15Satatat## (4) local objects, compile rules, and dependencies
641.15Satatat##
651.28SscwMD_OBJS+=	${SYSTEM_FIRST_OBJ} locore.o
661.28SscwMD_CFILES+=
671.28SscwMD_SFILES+=	${SYSTEM_FIRST_SFILE} ${ARM}/arm32/locore.S
681.7Smatt
691.15Satatat.if defined(SYSTEM_FIRST_OBJ)
701.15Satatat${SYSTEM_FIRST_OBJ}: ${SYSTEM_FIRST_SFILE} assym.h
711.15Satatat	${NORMAL_S}
721.7Smatt.endif
731.1Smatt
741.15Satatatlocore.o: ${ARM}/arm32/locore.S assym.h
751.15Satatat	${NORMAL_S}
761.1Smatt
771.15Satatat##
781.15Satatat## (5) link settings
791.15Satatat##
801.3SmattLOADADDRESS?=	0xF0000000
811.15SatatatLINKFLAGS_NORMAL=	-X
821.25Sscw# Strip ARM mapping symbols from the kernel image, as they interfere
831.27Sdbj# with ddb. Do it differently if 'makeoptions DEBUG="-g"' was specified.
841.27Sdbj.if !defined(DEBUG) || empty(DEBUG:M-g*)
851.34SskrllSYSTEM_LD_TAIL?=	${SYSTEM_LD_TAIL_DBSYM} ; \
861.33Sbsh			${OBJCOPY} --strip-symbol='$$a'	 \
871.27Sdbj				    --strip-symbol='$$t'	 \
881.27Sdbj				    --strip-symbol='$$d' $@	;\
891.27Sdbj			${SIZE} $@; chmod 755 $@
901.27Sdbj.else
911.26SdbjSTRIPFLAGS=-g --strip-symbol='$$a' --strip-symbol='$$t' --strip-symbol='$$d'
921.27Sdbj.endif
931.1Smatt
941.15Satatat##
951.15Satatat## (6) port specific target dependencies
961.15Satatat##
971.1Smatt
981.15Satatat# depend on CPU configuration
991.15Satatatcpufunc.o cpufunc_asm.o: Makefile
1001.1Smatt
1011.15Satatat# depend on DIAGNOSTIC etc.
1021.15Satatatcpuswitch.o fault.o machdep.o: Makefile
1031.1Smatt
1041.22Ssimonb# various assembly files that depend on assym.h
1051.31Schrisatomic.o bcopy_page.o bcopyinout.o copystr.o cpuswitch.o cpu_in_cksum.o: assym.h
1061.31Schrisexception.o fiq_subr.o fusu.o irq_dispatch.o isa_irq.o sigcode.o: assym.h
1071.23Ssimonbspl.o vectors.o: assym.h
1081.22Ssimonb
1091.15Satatat##
1101.15Satatat## (7) misc settings
1111.15Satatat##
1121.19Sskrll
1131.15Satatat##
1141.15Satatat## (8) config(8) generated machinery
1151.15Satatat##
1161.15Satatat%INCLUDES
1171.1Smatt
1181.1Smatt%OBJS
1191.1Smatt
1201.1Smatt%CFILES
1211.1Smatt
1221.1Smatt%SFILES
1231.1Smatt
1241.1Smatt%LOAD
1251.1Smatt
1261.15Satatat%RULES
1271.1Smatt
1281.15Satatat##
1291.38Smatt## (9) after the config file is inserted
1301.38Smatt##
1311.38Smatt
1321.38Smatt.for f in ${SFILES:T:Mcpufunc_asm*}
1331.38SmattAFLAGS.${f}+=-marm
1341.38Smatt.endfor
1351.38Smatt
1361.38Smatt##
1371.38Smatt## (10) port independent kernel machinery
1381.15Satatat##
1391.38Smatt
1401.15Satatat.include "$S/conf/Makefile.kern.inc"
1411.21Sthorpej
1421.21Sthorpej##
1431.38Smatt## (11) Appending make options.
1441.21Sthorpej##
1451.21Sthorpej%MAKEOPTIONSAPPEND
146