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