Makefile.sparc64 revision 1.42 1 1.42 jmc # $NetBSD: Makefile.sparc64,v 1.42 2001/10/26 06:45:40 jmc Exp $
2 1.1 eeh
3 1.1 eeh # Makefile for NetBSD
4 1.1 eeh #
5 1.1 eeh # This makefile is constructed from a machine description:
6 1.1 eeh # config machineid
7 1.1 eeh # Most changes should be made in the machine description
8 1.1 eeh # /sys/arch/sparc64/conf/``machineid''
9 1.1 eeh # after which you should do
10 1.1 eeh # config machineid
11 1.1 eeh # Machine generic makefile changes should be made in
12 1.1 eeh # /sys/arch/sparc64/conf/Makefile.sparc64
13 1.1 eeh # after which config should be rerun for all machines of that type.
14 1.1 eeh
15 1.41 thorpej # Default to 32-bit. Set the MACHINE_ARCH accordingly, using either
16 1.41 thorpej # the 32-bit or 64-bit toolchain.
17 1.41 thorpej LP64?= no
18 1.41 thorpej .if ${LP64} == "yes"
19 1.40 thorpej MACHINE_ARCH=sparc64
20 1.41 thorpej .else
21 1.41 thorpej MACHINE_ARCH=sparc
22 1.41 thorpej .endif
23 1.42 jmc
24 1.42 jmc USETOOLS?= no
25 1.40 thorpej
26 1.39 thorpej .include <bsd.own.mk>
27 1.39 thorpej
28 1.1 eeh # DEBUG is set to -g if debugging.
29 1.1 eeh # PROF is set to -pg if profiling.
30 1.1 eeh
31 1.39 thorpej AR?= ar
32 1.39 thorpej AS?= as
33 1.1 eeh CC?= cc
34 1.39 thorpej CPP?= cpp
35 1.39 thorpej LD?= ld
36 1.39 thorpej LORDER?=lorder
37 1.1 eeh MKDEP?= mkdep
38 1.39 thorpej NM?= nm
39 1.39 thorpej RANLIB?=ranlib
40 1.2 mrg SIZE?= size
41 1.39 thorpej STRIP?= strip
42 1.39 thorpej TSORT?= tsort -q
43 1.39 thorpej
44 1.1 eeh COPTS?= -O2
45 1.4 mrg
46 1.1 eeh # source tree is located via $S relative to the compilation directory
47 1.1 eeh .ifndef S
48 1.1 eeh S!= cd ../../../..; pwd
49 1.1 eeh .endif
50 1.1 eeh SPARC64= $S/arch/sparc64
51 1.1 eeh
52 1.1 eeh INCLUDES= -I. -I$S/arch -I$S -nostdinc
53 1.39 thorpej CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT -Dsparc64
54 1.39 thorpej CWARNFLAGS= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
55 1.39 thorpej -Wpointer-arith
56 1.39 thorpej # XXX Delete -Wuninitialized for now, since the compiler doesn't
57 1.39 thorpej # XXX always get it right. --thorpej
58 1.32 fvdl CWARNFLAGS+= -Wno-uninitialized
59 1.39 thorpej CWARNFLAGS+= -Wno-main
60 1.40 thorpej .if ${LP64} == "yes"
61 1.40 thorpej CPPFLAGS+= -D_LP64
62 1.40 thorpej .endif
63 1.40 thorpej
64 1.27 mycroft CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} -Wa,-Av9a -mno-fpu
65 1.30 eeh .if defined(PROF)
66 1.30 eeh # We need to run the compiler in medlow memory model.
67 1.40 thorpej CFLAGS+= -mcmodel=medlow
68 1.30 eeh .endif
69 1.27 mycroft AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE -Wa,-Av9a
70 1.31 eeh
71 1.31 eeh #
72 1.31 eeh # Gotta find a way to make kernel base tuneable.
73 1.31 eeh #
74 1.31 eeh
75 1.38 eeh LINKFLAGS= -Ttext 01000000 -Tdata 01800000 -e start
76 1.34 mrg #LINKFLAGS= -Ttext f1000000 -Tdata f1400000 -e start
77 1.34 mrg
78 1.34 mrg LINKFLAGS+= -n -T ${SPARC64}/conf/${KERN_LDSCRIPT}
79 1.40 thorpej .if ${LP64} == "yes"
80 1.34 mrg KERN_LDSCRIPT?= kern.ldscript
81 1.35 mrg .else
82 1.35 mrg KERN_LDSCRIPT?= kern32.ldscript
83 1.35 mrg .endif
84 1.31 eeh
85 1.15 tsutsui STRIPFLAGS= -g
86 1.10 mrg
87 1.10 mrg %INCLUDES
88 1.1 eeh
89 1.1 eeh ### find out what to use for libkern
90 1.14 eeh # KERN_AS= obj # bcopy, bzero, memcpy, memset, etc. are in locore.s
91 1.1 eeh .include "$S/lib/libkern/Makefile.inc"
92 1.1 eeh .ifndef PROF
93 1.1 eeh LIBKERN= ${KERNLIB}
94 1.1 eeh .else
95 1.1 eeh LIBKERN= ${KERNLIB_PROF}
96 1.1 eeh .endif
97 1.1 eeh
98 1.1 eeh ### find out what to use for libcompat
99 1.1 eeh .include "$S/compat/common/Makefile.inc"
100 1.1 eeh .ifndef PROF
101 1.1 eeh LIBCOMPAT= ${COMPATLIB}
102 1.1 eeh .else
103 1.1 eeh LIBCOMPAT= ${COMPATLIB_PROF}
104 1.1 eeh .endif
105 1.1 eeh
106 1.1 eeh # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
107 1.1 eeh # HOSTED, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
108 1.1 eeh
109 1.27 mycroft NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
110 1.27 mycroft NOOPT_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -O0 -c $<
111 1.1 eeh NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $<
112 1.1 eeh
113 1.1 eeh %OBJS
114 1.1 eeh
115 1.1 eeh %CFILES
116 1.1 eeh
117 1.1 eeh %SFILES
118 1.1 eeh
119 1.1 eeh # load lines for config "xxx" will be emitted as:
120 1.1 eeh # xxx: ${SYSTEM_DEP} swapxxx.o
121 1.1 eeh # ${SYSTEM_LD_HEAD}
122 1.1 eeh # ${SYSTEM_LD} swapxxx.o
123 1.1 eeh # ${SYSTEM_LD_TAIL}
124 1.1 eeh SYSTEM_OBJ= locore.o \
125 1.6 drochner param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
126 1.1 eeh SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
127 1.27 mycroft SYSTEM_LD_HEAD= rm -f $@
128 1.1 eeh SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
129 1.1 eeh ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
130 1.2 mrg SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@
131 1.1 eeh
132 1.1 eeh DEBUG?=
133 1.1 eeh .if ${DEBUG} == "-g"
134 1.1 eeh LINKFLAGS+= -X
135 1.1 eeh SYSTEM_LD_TAIL+=; \
136 1.12 cgd echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
137 1.19 eeh echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
138 1.19 eeh ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
139 1.1 eeh .else
140 1.1 eeh LINKFLAGS+= -S
141 1.1 eeh .endif
142 1.1 eeh
143 1.1 eeh %LOAD
144 1.2 mrg
145 1.1 eeh assym.h: $S/kern/genassym.sh ${SPARC64}/sparc64/genassym.cf
146 1.27 mycroft sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
147 1.1 eeh < ${SPARC64}/sparc64/genassym.cf > assym.h.tmp && \
148 1.1 eeh mv -f assym.h.tmp assym.h
149 1.1 eeh
150 1.1 eeh param.c: $S/conf/param.c
151 1.1 eeh rm -f param.c
152 1.1 eeh cp $S/conf/param.c .
153 1.1 eeh
154 1.1 eeh param.o: param.c Makefile
155 1.1 eeh ${NORMAL_C}
156 1.1 eeh
157 1.1 eeh ioconf.o: ioconf.c
158 1.1 eeh ${NORMAL_C}
159 1.1 eeh
160 1.1 eeh newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
161 1.1 eeh sh $S/conf/newvers.sh
162 1.25 eeh ${CC} ${COPTS} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
163 1.22 eeh
164 1.1 eeh
165 1.21 mrg __CLEANKERNEL: .USE
166 1.21 mrg @echo "${.TARGET}ing the kernel objects"
167 1.1 eeh rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
168 1.28 mycroft [Ee]rrs linterrs makelinks assym.h.tmp assym.h
169 1.21 mrg
170 1.21 mrg __CLEANDEPEND: .USE
171 1.21 mrg rm -f .depend
172 1.21 mrg
173 1.21 mrg clean: __CLEANKERNEL
174 1.21 mrg
175 1.21 mrg cleandir distclean: __CLEANKERNEL __CLEANDEPEND
176 1.1 eeh
177 1.1 eeh lint:
178 1.1 eeh @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
179 1.1 eeh ${SPARC64}/sparc64/Locore.c ${CFILES} \
180 1.1 eeh ioconf.c param.c | \
181 1.1 eeh grep -v 'static function .* unused'
182 1.1 eeh
183 1.1 eeh tags:
184 1.1 eeh @echo "see $S/kern/Makefile for tags"
185 1.1 eeh
186 1.1 eeh links:
187 1.1 eeh egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
188 1.1 eeh sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
189 1.1 eeh echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
190 1.1 eeh sort -u | comm -23 - dontlink | \
191 1.1 eeh sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
192 1.1 eeh sh makelinks && rm -f dontlink
193 1.1 eeh
194 1.1 eeh SRCS= ${SPARC64}/sparc64/locore.s \
195 1.1 eeh param.c ioconf.c ${CFILES} ${SFILES}
196 1.1 eeh depend: .depend
197 1.1 eeh .depend: ${SRCS} assym.h param.c
198 1.1 eeh ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SPARC64}/sparc64/locore.s
199 1.1 eeh ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
200 1.9 mrg .if (${SFILES} != "")
201 1.1 eeh ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
202 1.9 mrg .endif
203 1.25 eeh sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${COPTS} ${CFLAGS} \
204 1.1 eeh ${CPPFLAGS} < ${SPARC64}/sparc64/genassym.cf
205 1.1 eeh @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
206 1.1 eeh @rm -f assym.dep
207 1.17 tron
208 1.17 tron dependall: depend all
209 1.17 tron
210 1.1 eeh
211 1.1 eeh # depend on root or device configuration
212 1.1 eeh autoconf.o conf.o: Makefile
213 1.2 mrg
214 1.1 eeh # depend on network or filesystem configuration
215 1.1 eeh uipc_proto.o vfs_conf.o: Makefile
216 1.1 eeh
217 1.1 eeh # depend on maxusers
218 1.1 eeh machdep.o: Makefile
219 1.1 eeh
220 1.1 eeh # depend on CPU configuration
221 1.1 eeh bwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile
222 1.1 eeh ms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile
223 1.1 eeh machdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile
224 1.1 eeh
225 1.1 eeh
226 1.1 eeh locore.o: ${SPARC64}/sparc64/locore.s assym.h
227 1.1 eeh ${NORMAL_S}
228 1.23 hubertf
229 1.23 hubertf # The install target can be redefined by putting a
230 1.23 hubertf # install-kernel-${MACHINE_NAME} target into /etc/mk.conf
231 1.23 hubertf MACHINE_NAME!= uname -n
232 1.23 hubertf install: install-kernel-${MACHINE_NAME}
233 1.23 hubertf .if !target(install-kernel-${MACHINE_NAME}})
234 1.23 hubertf install-kernel-${MACHINE_NAME}:
235 1.23 hubertf rm -f /onetbsd
236 1.23 hubertf ln /netbsd /onetbsd
237 1.23 hubertf cp netbsd /nnetbsd
238 1.23 hubertf mv /nnetbsd /netbsd
239 1.23 hubertf .endif
240 1.1 eeh
241 1.1 eeh %RULES
242