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