Makefile.mvme68k revision 1.52 1 # $NetBSD: Makefile.mvme68k,v 1.52 2001/10/23 19:26:45 thorpej 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/mvme68k/conf/``machineid''
9 # after which you should do
10 # config machineid
11 # Machine generic makefile changes should be made in
12 # /sys/arch/mvme68k/conf/Makefile.mvme68k
13 # after which config should be rerun for all machines of that type.
14
15 MACHINE_ARCH=m68k
16
17 # DEBUG is set to -g if debugging.
18 # PROF is set to -pg if profiling.
19
20 AR?= ar
21 AS?= as
22 CC?= cc
23 CPP?= cpp
24 LD?= ld
25 LORDER?=lorder
26 MKDEP?= mkdep
27 NM?= nm
28 RANLIB?=ranlib
29 SIZE?= size
30 STRIP?= strip
31 TSORT?= tsort -q
32
33 COPTS?= -O2
34
35 # source tree is located via $S relative to the compilation directory
36 .ifndef S
37 S!= cd ../../../..; pwd
38 .endif
39 MVME68K=$S/arch/mvme68k
40
41 # Override CPP defaults entirely, so cross-compilation works.
42 # Keep -nostdinc before all -I flags, similar for -undef ...
43 HAVE_EGCS!= ${CC} --version | egrep "^(2\.[89]|egcs)" ; echo
44 INCLUDES= -nostdinc -I. -I$S/arch -I$S
45 CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT -Dmvme68k
46 .if empty(IDENT:M-DMVME172) && empty(IDENT:M-DMVME177)
47 .if empty(IDENT:M-DMVME147)
48 CMACHFLAGS= -m68040
49 .else
50 CMACHFLAGS= -m68030
51 .endif
52 .else
53 .if empty(IDENT:M-DMVME147) && empty(IDENT:M-DMVME162) && empty(IDENT:M-DMVME167)
54 CMACHFLAGS= -m68060 -Wa,-m68030 -Wa,-m68851
55 .else
56 CMACHFLAGS= -m68020-60 -Wa,-m68030 -Wa,-m68851
57 .endif
58 .endif
59 CWARNFLAGS?= -Werror -Wall -Wmissing-prototypes -Wstrict-prototypes \
60 -Wpointer-arith
61 # XXX Delete -Wuninitialized for now, since the compiler doesn't
62 # XXX always get it right. --thorpej
63 CWARNFLAGS+= -Wno-uninitialized
64 .if (${HAVE_EGCS} != "")
65 CWARNFLAGS+= -Wno-main
66 .endif
67 CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} ${CMACHFLAGS} -msoft-float
68 AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE
69 LINKFLAGS= -n -Ttext 8000 -e start
70 STRIPFLAGS= -g
71
72 %INCLUDES
73
74 HOSTED_CC= ${CC}
75 HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
76 HOSTED_CFLAGS= ${CFLAGS}
77
78 ### find out what to use for libkern
79 KERN_AS= obj
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 ### for the Motorola 68040 Floating Point Software Product
96 .include "$S/arch/m68k/fpsp/Makefile.inc"
97
98 ### for the Motorola 68060 Software Support Package
99 .include "$S/arch/m68k/060sp/Makefile.inc"
100
101 # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
102 # HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
103
104 NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
105 NOPROF_C= ${CC} ${CFLAGS} ${CPPFLAGS} -c $<
106 NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $<
107
108 HOSTED_C= ${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
109
110 %OBJS
111
112 %CFILES
113
114 %SFILES
115
116 # load lines for config "xxx" will be emitted as:
117 # xxx: ${SYSTEM_DEP} swapxxx.o
118 # ${SYSTEM_LD_HEAD}
119 # ${SYSTEM_LD} swapxxx.o
120 # ${SYSTEM_LD_TAIL}
121 SYSTEM_OBJ= locore.o ${FPSP} \
122 param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
123 SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
124 SYSTEM_LD_HEAD= @rm -f $@
125 SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
126 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
127 SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@
128
129 DEBUG?=
130 .if ${DEBUG} == "-g"
131 LINKFLAGS+= -X
132 SYSTEM_LD_TAIL+=; \
133 echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
134 echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
135 ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
136 .else
137 LINKFLAGS+= -S
138 .endif
139
140 %LOAD
141
142 assym.h: $S/kern/genassym.sh ${MVME68K}/mvme68k/genassym.cf
143 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
144 < ${MVME68K}/mvme68k/genassym.cf > assym.h.tmp && \
145 mv -f assym.h.tmp assym.h
146
147 param.c: $S/conf/param.c
148 rm -f param.c
149 cp $S/conf/param.c .
150
151 param.o: param.c Makefile
152 ${NORMAL_C}
153
154 ioconf.o: ioconf.c
155 ${NORMAL_C}
156
157 newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
158 sh $S/conf/newvers.sh
159 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
160
161 __CLEANKERNEL: .USE
162 @echo "${.TARGET}ing the kernel objects"
163 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
164 [Ee]rrs linterrs makelinks assym.h.tmp assym.h
165
166 __CLEANDEPEND: .USE
167 rm -f .depend
168
169 clean: __CLEANKERNEL
170
171 cleandir distclean: __CLEANKERNEL __CLEANDEPEND
172
173 lint:
174 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
175 ${CFILES} ioconf.c param.c | \
176 grep -v 'static function .* unused'
177
178 tags:
179 @echo "see $S/kern/Makefile for tags"
180
181 links:
182 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
183 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
184 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
185 sort -u | comm -23 - dontlink | \
186 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
187 sh makelinks && rm -f dontlink
188
189 SRCS= ${MVME68K}/mvme68k/locore.s \
190 param.c ioconf.c ${CFILES} ${SFILES}
191 depend: .depend
192 .depend: ${SRCS} assym.h param.c
193 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${MVME68K}/mvme68k/locore.s
194 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
195 -if test -n "${SFILES}"; then \
196 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}; \
197 fi
198 sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
199 ${CPPFLAGS} < ${MVME68K}/mvme68k/genassym.cf
200 @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
201 @rm -f assym.dep
202
203 dependall: depend all
204
205
206 # depend on root or device configuration
207 autoconf.o conf.o: Makefile
208
209 # depend on network or filesystem configuration
210 uipc_proto.o vfs_conf.o: Makefile
211
212 # depend on maxusers
213 machdep.o: Makefile
214
215 # depend on CPU configuration
216 locore.o pmap.o sys_machdep.o trap.o: Makefile
217
218
219 locore.o: ${MVME68K}/mvme68k/locore.s assym.h
220 ${NORMAL_S}
221
222 # The install target can be redefined by putting a
223 # install-kernel-${MACHINE_NAME} target into /etc/mk.conf
224 MACHINE_NAME!= uname -n
225 install: install-kernel-${MACHINE_NAME}
226 .if !target(install-kernel-${MACHINE_NAME}})
227 install-kernel-${MACHINE_NAME}:
228 rm -f /onetbsd
229 ln /netbsd /onetbsd
230 cp netbsd /nnetbsd
231 mv /nnetbsd /netbsd
232 .endif
233
234 %RULES
235