xref: /netbsd-src/sys/arch/arm/conf/Makefile.arm (revision b7b7574d3bf8eeb51a1fa3977b59142ec6434a55)
1#	$NetBSD: Makefile.arm,v 1.42 2014/03/02 13:21:59 joerg Exp $
2
3# Makefile for NetBSD
4#
5# This makefile is constructed from a machine description:
6#	config machineid
7# Most changes should be made in the machine description
8#	/sys/arch/<arch>/conf/``machineid''
9# after which you should do
10#	config machineid
11# Machine generic makefile changes should be made in
12#	/sys/arch/arm/conf/Makefile.arm
13# after which config should be rerun for all machines of that type.
14#
15# To specify debugging, add the config line: makeoptions DEBUG="-g"
16# A better way is to specify -g only for a few files.
17#
18#	makeoptions DEBUGLIST="uvm* trap if_*"
19
20USETOOLS?=	no
21NEED_OWN_INSTALL_TARGET?=no
22.include <bsd.own.mk>
23
24##
25## (1) port identification
26##
27THISARM=	$S/arch/${MACHINE}
28ARM=		$S/arch/arm
29GENASSYM_CONF=	${ARM}/arm32/genassym.cf
30.-include "$S/arch/${MACHINE}/conf/Makefile.${MACHINE}.inc"
31
32##
33## (2) compile settings
34##
35# CPPFLAGS set by platform-specific Makefile fragment.
36AFLAGS+=	-x assembler-with-cpp
37COPTS.arm32_kvminit.c+=		-fno-stack-protector
38COPTS.vfp_init.c=		-mfpu=vfp
39AFLAGS.bcopyinout.S+=-marm
40AFLAGS.cpuswitch.S+=-marm -mfpu=vfp
41AFLAGS.locore.S+=-marm
42AFLAGS.fusu.S+=-marm
43AFLAGS.exception.S+=-marm
44AFLAGS.irq_dispatch.S+=-marm
45AFLAGS.blockio.S+=-marm
46AFLAGS.copystr.S+=-marm
47CFLAGS+=	 -mfloat-abi=soft
48
49# This files use instructions deprecated for ARMv7+, but still
50# included in kernel that build with higher -mcpu=... settings.
51CPPFLAGS.cpufunc_asm_armv4.S+=	-mcpu=arm8
52CPPFLAGS.cpufunc_asm_armv6.S+=	-mcpu=arm1136j-s
53CPPFLAGS.cpufunc_asm_arm11.S+=	-mcpu=arm1136j-s
54CPPFLAGS.cpufunc_asm_xscale.S+=	-mcpu=xscale
55
56##
57## (3) libkern and compat
58##
59KERN_AS=	obj
60
61
62##
63## (4) local objects, compile rules, and dependencies
64##
65MD_OBJS+=	${SYSTEM_FIRST_OBJ} locore.o
66MD_CFILES+=
67MD_SFILES+=	${SYSTEM_FIRST_SFILE} ${ARM}/arm32/locore.S
68
69.if defined(SYSTEM_FIRST_OBJ)
70${SYSTEM_FIRST_OBJ}: ${SYSTEM_FIRST_SFILE} assym.h
71	${NORMAL_S}
72.endif
73
74locore.o: ${ARM}/arm32/locore.S assym.h
75	${NORMAL_S}
76
77##
78## (5) link settings
79##
80LOADADDRESS?=	0xF0000000
81LINKFLAGS_NORMAL=	-X
82# Strip ARM mapping symbols from the kernel image, as they interfere
83# with ddb. Do it differently if 'makeoptions DEBUG="-g"' was specified.
84.if !defined(DEBUG) || empty(DEBUG:M-g*)
85SYSTEM_LD_TAIL?=	${SYSTEM_LD_TAIL_DBSYM} ; \
86			${OBJCOPY} --strip-symbol='$$a'	 \
87				    --strip-symbol='$$t'	 \
88				    --strip-symbol='$$d' $@	;\
89			${SIZE} $@; chmod 755 $@
90.else
91STRIPFLAGS=-g --strip-symbol='$$a' --strip-symbol='$$t' --strip-symbol='$$d'
92.endif
93
94##
95## (6) port specific target dependencies
96##
97
98# depend on CPU configuration
99cpufunc.o cpufunc_asm.o: Makefile
100
101# depend on DIAGNOSTIC etc.
102cpuswitch.o fault.o machdep.o: Makefile
103
104# various assembly files that depend on assym.h
105atomic.o bcopy_page.o bcopyinout.o copystr.o cpuswitch.o cpu_in_cksum.o: assym.h
106exception.o fiq_subr.o fusu.o irq_dispatch.o isa_irq.o sigcode.o: assym.h
107spl.o vectors.o: assym.h
108
109##
110## (7) misc settings
111##
112
113##
114## (8) config(8) generated machinery
115##
116%INCLUDES
117
118%OBJS
119
120%CFILES
121
122%SFILES
123
124%LOAD
125
126%RULES
127
128##
129## (9) after the config file is inserted
130##
131
132.for f in ${SFILES:T:Mcpufunc_asm*}
133AFLAGS.${f}+=-marm
134.endfor
135
136##
137## (10) port independent kernel machinery
138##
139
140.include "$S/conf/Makefile.kern.inc"
141
142##
143## (11) Appending make options.
144##
145%MAKEOPTIONSAPPEND
146