Makefile.arm revision 1.49
1#	$NetBSD: Makefile.arm,v 1.49 2018/09/22 12:24:01 rin 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##
59OPT_MODULAR=	%MODULAR%
60
61##
62## (4) local objects, compile rules, and dependencies
63##
64MD_OBJS+=	${SYSTEM_FIRST_OBJ} locore.o
65MD_CFILES+=
66MD_SFILES+=	${SYSTEM_FIRST_SFILE} ${ARM}/arm32/locore.S
67
68.if defined(SYSTEM_FIRST_OBJ)
69${SYSTEM_FIRST_OBJ}: ${SYSTEM_FIRST_SFILE} assym.h
70	${NORMAL_S}
71.endif
72
73locore.o: ${ARM}/arm32/locore.S assym.h
74	${NORMAL_S}
75
76##
77## (5) link settings
78##
79LOADADDRESS?=	0xF0000000
80LINKFLAGS_NORMAL=	-X
81# Strip ARM mapping symbols from the kernel image, as they interfere
82# with ddb. Do it differently if 'makeoptions DEBUG="-g"' was specified.
83.if !defined(DEBUG) || empty(DEBUG:M-g*)
84SYSTEM_LD_TAIL?=	${OBJCOPY} --wildcard --strip-symbol='[$$][atd]' \
85				    --strip-symbol='[$$][atd]\.*' $@;   \
86			${SIZE} $@; chmod 755 $@
87.else
88STRIPFLAGS=-g --wildcard --strip-symbol='[$$][atd]' \
89	   --strip-symbol='[$$][atd]\.*'
90.endif
91
92##
93## (6) port specific target dependencies
94##
95
96# depend on CPU configuration
97cpufunc.o cpufunc_asm.o: Makefile
98
99# depend on DIAGNOSTIC etc.
100cpuswitch.o fault.o machdep.o: Makefile
101
102# various assembly files that depend on assym.h
103atomic.o bcopy_page.o bcopyinout.o copystr.o cpuswitch.o cpu_in_cksum.o: assym.h
104exception.o fiq_subr.o fusu.o irq_dispatch.o isa_irq.o sigcode.o: assym.h
105spl.o vectors.o: assym.h
106
107##
108## (7) misc settings
109##
110
111##
112## (8) config(8) generated machinery
113##
114%INCLUDES
115
116%OBJS
117
118%CFILES
119
120%SFILES
121
122%LOAD
123
124%RULES
125
126##
127## (9) after the config file is inserted
128##
129
130.for f in ${SFILES:T:Mcpufunc_asm*}
131AFLAGS.${f}+=-marm
132.endfor
133
134##
135## (10) port independent kernel machinery
136##
137
138.include "$S/conf/Makefile.kern.inc"
139
140##
141## (11) Appending make options.
142##
143%MAKEOPTIONSAPPEND
144