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