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