xref: /netbsd-src/sys/arch/sparc64/conf/Makefile.sparc64 (revision b83ebeba7f767758d2778bb0f9d7a76534253621)
1# 	$NetBSD: Makefile.sparc64,v 1.82 2016/03/19 18:50:25 martin Exp $
2
3#=========================================================================
4#
5#			***** WARNING ******
6#
7# ANYONE WHO CHANGES THIS MAKEFILE AND DOES NOT TEST BOTH A 32-BIT
8# AND 64-BIT KERNEL WILL BE SHOT.
9#
10#=========================================================================
11
12
13# Makefile for NetBSD
14#
15# This makefile is constructed from a machine description:
16#	config machineid
17# Most changes should be made in the machine description
18#	/sys/arch/sparc64/conf/``machineid''
19# after which you should do
20#	config machineid
21# Machine generic makefile changes should be made in
22#	/sys/arch/sparc64/conf/Makefile.sparc64
23# after which config should be rerun for all machines of that type.
24#
25# To specify debugging, add the config line: makeoptions DEBUG="-g"
26# A better way is to specify -g only for a few files.
27#
28#	makeoptions DEBUGLIST="uvm* trap if_*"
29
30# Default to 32-bit.  Set the MACHINE_ARCH accordingly.
31#
32# You must also be using the correct toolchain or the kernel build
33# will fail.
34#
35LP64?=	no
36.if ${LP64} == "yes"
37MACHINE_ARCH=sparc64
38.else
39MACHINE_ARCH=sparc
40.endif
41
42USETOOLS?=	no
43NEED_OWN_INSTALL_TARGET?=no
44.include <bsd.own.mk>
45
46USE_SSP?=	yes
47
48##
49## (1) port identification
50##
51SPARC64=	$S/arch/sparc64
52GENASSYM_CONF=	${SPARC64}/sparc64/genassym.cf
53
54##
55## (2) compile settings
56##
57CPPFLAGS+=	-Dsparc64 -D__sparc64__
58.if ${LP64} == "yes"
59# 64-bit kernels
60CPPFLAGS+=	-D_LP64 -Wa,-Av9a
61CPPFLAGS+=	${${ACTIVE_CC} == "clang":? -Qunused-arguments :}
62AFLAGS+=	-Wa,-Av9a
63.if defined(PROF)
64# Profiling is only supported in the medium low memory model.
65CFLAGS+=	${${ACTIVE_CC} == "gcc":? -mcmodel=medlow :}
66CFLAGS+=	${${ACTIVE_CC} == "clang":? -mcmodel=small :}
67.else
68# Since the kernel resides in the lower 32 bits, use medium low for now anyway.
69CFLAGS+=	${${ACTIVE_CC} == "gcc":? -mcmodel=medlow :}
70CFLAGS+=	${${ACTIVE_CC} == "clang":? -mcmodel=small :}
71.endif
72.else
73# 32-bit kernels
74CPPFLAGS+=	-m32 -Wa,-Av8plusa -mcpu=ultrasparc
75CPPFLAGS+=	${${ACTIVE_CC} == "clang":? -Qunused-arguments :}
76AFLAGS+=	-Wa,-Av8plusa
77AFLAGS+=	${${ACTIVE_CC} == "clang":? -Qunused-arguments :}
78.endif
79CFLAGS+=	${${ACTIVE_CC} == "gcc":? -mno-fpu :}
80AFLAGS+=	-x assembler-with-cpp
81
82##
83## (3) libkern and compat
84##
85OPT_MODULAR=	%MODULAR%
86.if !empty(OPT_MODULAR)
87KERN_AS=	obj
88.else
89KERN_AS=	library
90.endif
91
92##
93## (4) local objects, compile rules, and dependencies
94##
95MD_OBJS=	locore.o copy.o mp_subr.o
96MD_CFILES=
97MD_SFILES=	${SPARC64}/sparc64/locore.s ${SPARC64}/sparc64/copy.S \
98	 ${SPARC64}/sparc64/mp_subr.S
99
100locore.o: ${SPARC64}/sparc64/locore.s assym.h
101	${NORMAL_S}
102
103copy.o:	${SPARC64}/sparc64/copy.S assym.h
104	${NORMAL_S}
105
106mp_subr.o:	${SPARC64}/sparc64/mp_subr.S assym.h
107	${NORMAL_S}
108
109# Our libkern needs stuff from assym.h for memcpy and memset.
110dependkernlib:	assym.h
111
112##
113## (5) link settings
114##
115TEXTADDR?=	01000000
116.if ${LP64} == "yes"
117KERNLDSCRIPT?= ${SPARC64}/conf/kern.ldscript
118.else
119KERNLDSCRIPT?= ${SPARC64}/conf/kern32.ldscript
120.endif
121
122##
123## (6) port specific target dependencies
124##
125
126# depend on CPU configuration
127bwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile
128ms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile
129machdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile
130
131cpu_in_cksum.o lock_stubs.o: assym.h
132
133##
134## (7) misc settings
135##
136
137# define .MAIN _before_ the make() check, so that implicit target
138# would be defined
139.MAIN: all
140
141.if make(depend) || make(all) || make(dependall)
142.BEGIN:
143	@rm -f sparc && \
144		ln -s $S/arch/sparc/include sparc
145.endif
146
147##
148## (8) config(8) generated machinery
149##
150%INCLUDES
151
152%OBJS
153
154%CFILES
155
156%SFILES
157
158%LOAD
159
160%RULES
161
162##
163## (9) port independent kernel machinery
164##
165.include "$S/conf/Makefile.kern.inc"
166
167##
168## (10) Appending make options.
169##
170%MAKEOPTIONSAPPEND
171