xref: /netbsd/sys/arch/sparc64/conf/Makefile.sparc64 (revision 6550d01e)
1# 	$NetBSD: Makefile.sparc64,v 1.70 2011/01/17 18:11:10 joerg 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
46##
47## (1) port identification
48##
49SPARC64=	$S/arch/sparc64
50GENASSYM_CONF=	${SPARC64}/sparc64/genassym.cf
51
52##
53## (2) compile settings
54##
55CPPFLAGS+=	-Dsparc64 -D__sparc64__
56.if ${LP64} == "yes"
57# 64-bit kernels
58CPPFLAGS+=	-D_LP64 -Wa,-Av9a
59AFLAGS+=	-Wa,-Av9a
60CC_NOOPT=	${NORMAL_C}
61.if defined(PROF)
62# Profiling is only supported in the medium low memory model.
63CFLAGS+=	-mcmodel=medlow
64.else
65# Since the kernel resides in the lower 32 bits, use medium low for now anyway.
66CFLAGS+=	-mcmodel=medlow
67.endif
68.else
69# 32-bit kernels
70CPPFLAGS+=	-m32 -Wa,-Av8plusa -mcpu=ultrasparc
71AFLAGS+=	-Wa,-Av8plusa
72# XXX
73# The sparc gcc version 3.3.3 (NetBSD nb1 20040301) does not compile this
74# file properly with higher optimizations
75CC_NOOPT=	${NORMAL_C:C/-O./-O0/}
76.endif
77CFLAGS+=	-mno-fpu
78AFLAGS+=	-x assembler-with-cpp
79
80##
81## (3) libkern and compat
82##
83# KERN_AS=	obj	# memcpy, memset, etc. are in locore.s
84
85##
86## (4) local objects, compile rules, and dependencies
87##
88MD_OBJS=	locore.o copy.o mp_subr.o
89MD_CFILES=
90MD_SFILES=	${SPARC64}/sparc64/locore.s ${SPARC64}/sparc64/copy.S \
91	 ${SPARC64}/sparc64/mp_subr.S
92
93locore.o: ${SPARC64}/sparc64/locore.s assym.h
94	${NORMAL_S}
95
96copy.o:	${SPARC64}/sparc64/copy.S assym.h
97	${NORMAL_S}
98
99mp_subr.o:	${SPARC64}/sparc64/mp_subr.S assym.h
100	${NORMAL_S}
101
102##
103## (5) link settings
104##
105TEXTADDR?=	01000000
106LINKFORMAT=	-T ${SPARC64}/conf/${KERN_LDSCRIPT}
107.if ${LP64} == "yes"
108KERN_LDSCRIPT?= kern.ldscript
109.else
110KERN_LDSCRIPT?= kern32.ldscript
111.endif
112
113##
114## (6) port specific target dependencies
115##
116
117# depend on CPU configuration
118bwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile
119ms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile
120machdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile
121
122cpu_in_cksum.o lock_stubs.o: assym.h
123
124##
125## (7) misc settings
126##
127
128# define .MAIN _before_ the make() check, so that implicit target
129# would be defined
130.MAIN: all
131
132.if make(depend) || make(all) || make(dependall)
133.BEGIN:
134	@rm -f sparc && \
135		ln -s $S/arch/sparc/include sparc
136.endif
137
138##
139## (8) config(8) generated machinery
140##
141%INCLUDES
142
143%OBJS
144
145%CFILES
146
147%SFILES
148
149%LOAD
150
151%RULES
152
153##
154## (9) port independent kernel machinery
155##
156.include "$S/conf/Makefile.kern.inc"
157
158##
159## (10) Appending make options.
160##
161%MAKEOPTIONSAPPEND
162