Makefile.sparc64 revision 1.31 1 # $NetBSD: Makefile.sparc64,v 1.31 2000/09/28 19:56:15 eeh 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/sparc64/conf/``machineid''
9 # after which you should do
10 # config machineid
11 # Machine generic makefile changes should be made in
12 # /sys/arch/sparc64/conf/Makefile.sparc64
13 # after which config should be rerun for all machines of that type.
14 #
15 # N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
16 # IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
17 #
18 # -DTRACE compile in kernel tracing hooks
19 # -DQUOTA compile in file system quotas
20
21 # DEBUG is set to -g if debugging.
22 # PROF is set to -pg if profiling.
23
24 .if defined(MAKECONF) && exists(${MAKECONF})
25 .include "${MAKECONF}"
26 .elif exists(/etc/mk.conf)
27 .include "/etc/mk.conf"
28 .endif
29
30 CC?= cc
31 .if exists(/usr/ccs/bin/ld)
32 LD?= /usr/ccs/bin/ld #Need to use Solaris ld to use the solaris loader
33 .endif
34 MKDEP?= mkdep
35 STRIP?=strip
36 SIZE?= size
37 COPTS?= -O2
38 #### Stuff for cross compiling
39 NM?=nm
40 LORDER?=lorder
41 TSORT?=tsort
42
43
44 # deal with Solaris vs. NetBSD build environments for now ..
45 OS!=uname -s
46 .if (${OS} == "NetBSD")
47 USE_GENASSYM?= no
48 .else
49 USE_GENASSYM?= no
50 AWK=nawk
51 .endif
52
53 .if exists(/usr/ccs/bin/ld)
54 SVR4=-U__SVR4 -U__svr4__ -D__NetBSD__
55 .else
56 SVR4=
57 .endif
58
59 # source tree is located via $S relative to the compilation directory
60 .ifndef S
61 S!= cd ../../../..; pwd
62 .endif
63 SPARC64= $S/arch/sparc64
64
65 INCLUDES= -I. -I$S/arch -I$S -nostdinc
66 CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL ${SVR4}
67 CWARNFLAGS= -Wimplicit -Wunused -Wswitch -Wcomment -Wtrigraphs -Wchar-subscripts -Wparentheses -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
68 #CWARNFLAGS= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes
69 CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} -Wa,-Av9a -mno-fpu
70 .if defined(PROF)
71 # We need to run the compiler in medlow memory model.
72 CFLAGS += -mcmodel=medlow
73 .endif
74 AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE -Wa,-Av9a
75
76 #
77 # Gotta find a way to make kernel base tuneable.
78 #
79
80 LINKFLAGS= -Ttext 01000000 -Tdata 01400000 -e start
81
82 #LINKFLAGS= -Ttext f1000000 -Tdata f1400000 -e start
83 STRIPFLAGS= -g
84
85 %INCLUDES
86
87 ### find out what to use for libkern
88 # KERN_AS= obj # bcopy, bzero, memcpy, memset, etc. are in locore.s
89 .include "$S/lib/libkern/Makefile.inc"
90 .ifndef PROF
91 LIBKERN= ${KERNLIB}
92 .else
93 LIBKERN= ${KERNLIB_PROF}
94 .endif
95
96 ### find out what to use for libcompat
97 .include "$S/compat/common/Makefile.inc"
98 .ifndef PROF
99 LIBCOMPAT= ${COMPATLIB}
100 .else
101 LIBCOMPAT= ${COMPATLIB_PROF}
102 .endif
103
104 # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
105 # HOSTED, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
106
107 NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
108 NOOPT_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -O0 -c $<
109 NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $<
110
111 %OBJS
112
113 %CFILES
114
115 %SFILES
116
117 # load lines for config "xxx" will be emitted as:
118 # xxx: ${SYSTEM_DEP} swapxxx.o
119 # ${SYSTEM_LD_HEAD}
120 # ${SYSTEM_LD} swapxxx.o
121 # ${SYSTEM_LD_TAIL}
122 SYSTEM_OBJ= locore.o \
123 param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
124 SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
125 SYSTEM_LD_HEAD= rm -f $@
126 SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
127 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
128 SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@
129
130 DEBUG?=
131 .if ${DEBUG} == "-g"
132 LINKFLAGS+= -X
133 SYSTEM_LD_TAIL+=; \
134 echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
135 echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
136 ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
137 .else
138 LINKFLAGS+= -S
139 .endif
140
141 %LOAD
142
143 .if ${USE_GENASSYM} == "no"
144 assym.h: $S/kern/genassym.sh ${SPARC64}/sparc64/genassym.cf
145 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
146 < ${SPARC64}/sparc64/genassym.cf > assym.h.tmp && \
147 mv -f assym.h.tmp assym.h
148 .else
149 HOSTED_CC= ${CC}
150 HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
151 HOSTED_CFLAGS= ${CFLAGS}
152
153 HOSTED_C= ${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
154
155 assym.h: genassym
156 ./genassym >assym.h
157
158 genassym: genassym.o
159 ${CC} -o $@ genassym.o
160
161 genassym.o: ${SPARC64}/sparc64/genassym.c
162 ${HOSTED_C}
163 .endif
164
165 param.c: $S/conf/param.c
166 rm -f param.c
167 cp $S/conf/param.c .
168
169 param.o: param.c Makefile
170 ${NORMAL_C}
171
172 ioconf.o: ioconf.c
173 ${NORMAL_C}
174
175 newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
176 sh $S/conf/newvers.sh
177 ${CC} ${COPTS} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
178
179
180 __CLEANKERNEL: .USE
181 @echo "${.TARGET}ing the kernel objects"
182 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
183 [Ee]rrs linterrs makelinks assym.h.tmp assym.h
184
185 __CLEANDEPEND: .USE
186 rm -f .depend
187
188 clean: __CLEANKERNEL
189
190 cleandir distclean: __CLEANKERNEL __CLEANDEPEND
191
192 lint:
193 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
194 ${SPARC64}/sparc64/Locore.c ${CFILES} \
195 ioconf.c param.c | \
196 grep -v 'static function .* unused'
197
198 tags:
199 @echo "see $S/kern/Makefile for tags"
200
201 links:
202 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
203 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
204 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
205 sort -u | comm -23 - dontlink | \
206 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
207 sh makelinks && rm -f dontlink
208
209 SRCS= ${SPARC64}/sparc64/locore.s \
210 param.c ioconf.c ${CFILES} ${SFILES}
211 depend: .depend
212 .depend: ${SRCS} assym.h param.c
213 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SPARC64}/sparc64/locore.s
214 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
215 .if (${SFILES} != "")
216 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
217 .endif
218 sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${COPTS} ${CFLAGS} \
219 ${CPPFLAGS} < ${SPARC64}/sparc64/genassym.cf
220 @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
221 @rm -f assym.dep
222
223 dependall: depend all
224
225
226 # depend on root or device configuration
227 autoconf.o conf.o: Makefile
228
229 # depend on network or filesystem configuration
230 uipc_proto.o vfs_conf.o: Makefile
231
232 # depend on maxusers
233 machdep.o: Makefile
234
235 # depend on CPU configuration
236 bwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile
237 ms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile
238 machdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile
239
240
241 locore.o: ${SPARC64}/sparc64/locore.s assym.h
242 ${NORMAL_S}
243
244 # The install target can be redefined by putting a
245 # install-kernel-${MACHINE_NAME} target into /etc/mk.conf
246 MACHINE_NAME!= uname -n
247 install: install-kernel-${MACHINE_NAME}
248 .if !target(install-kernel-${MACHINE_NAME}})
249 install-kernel-${MACHINE_NAME}:
250 rm -f /onetbsd
251 ln /netbsd /onetbsd
252 cp netbsd /nnetbsd
253 mv /nnetbsd /netbsd
254 .endif
255
256 %RULES
257