xref: /netbsd-src/sys/arch/arm/conf/Makefile.arm (revision 479d8f7d843cc1b22d497efdf1f27a50ee8418d4)
1#	$NetBSD: Makefile.arm,v 1.48 2015/05/01 02:00:41 nat 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?=	${OBJCOPY} --wildcard --strip-symbol='[$$][atd]' \
86				    --strip-symbol='[$$][atd]\.*' $@;   \
87			${SIZE} $@; chmod 755 $@
88.else
89STRIPFLAGS=-g --wildcard --strip-symbol='[$$][atd]' \
90	   --strip-symbol='[$$][atd]\.*'
91.endif
92
93##
94## (6) port specific target dependencies
95##
96
97# depend on CPU configuration
98cpufunc.o cpufunc_asm.o: Makefile
99
100# depend on DIAGNOSTIC etc.
101cpuswitch.o fault.o machdep.o: Makefile
102
103# various assembly files that depend on assym.h
104atomic.o bcopy_page.o bcopyinout.o copystr.o cpuswitch.o cpu_in_cksum.o: assym.h
105exception.o fiq_subr.o fusu.o irq_dispatch.o isa_irq.o sigcode.o: assym.h
106spl.o vectors.o: assym.h
107
108##
109## (7) misc settings
110##
111
112##
113## (8) config(8) generated machinery
114##
115%INCLUDES
116
117%OBJS
118
119%CFILES
120
121%SFILES
122
123%LOAD
124
125%RULES
126
127##
128## (9) after the config file is inserted
129##
130
131.for f in ${SFILES:T:Mcpufunc_asm*}
132AFLAGS.${f}+=-marm
133.endfor
134
135##
136## (10) port independent kernel machinery
137##
138
139.include "$S/conf/Makefile.kern.inc"
140
141##
142## (11) Appending make options.
143##
144%MAKEOPTIONSAPPEND
145