solaris-kdump-build-rationalization-20031204
[openafs.git] / src / venus / Makefile.in
1 # Copyright 2000, International Business Machines Corporation and others.
2 # All Rights Reserved.
3
4 # This software has been released under the terms of the IBM Public
5 # License.  For details, see the LICENSE file in the top-level source
6 # directory or online at http://www.openafs.org/dl/license10.html
7
8 srcdir=@srcdir@
9 include @TOP_OBJDIR@/src/config/Makefile.config
10
11 INCLS=${TOP_INCDIR}/afs/afsint.h \
12         ${TOP_INCDIR}/afs/cmd.h \
13         ${TOP_INCDIR}/afs/afsutil.h
14
15 FSLIBS=${TOP_LIBDIR}/libsys.a \
16          ${TOP_LIBDIR}/libvldb.a \
17          ${TOP_LIBDIR}/libubik.a \
18          ${TOP_LIBDIR}/vlib.a \
19          ${TOP_LIBDIR}/libauth.a \
20          ${TOP_LIBDIR}/librxkad.a \
21          ${TOP_LIBDIR}/libcom_err.a \
22          ${TOP_LIBDIR}/libcmd.a \
23          ${TOP_LIBDIR}/libkauth.a \
24          ${TOP_LIBDIR}/libdes.a \
25          ${TOP_LIBDIR}/librx.a \
26          ${TOP_LIBDIR}/libsys.a \
27          ${TOP_LIBDIR}/liblwp.a \
28          ${TOP_LIBDIR}/libaudit.a \
29          $(TOP_LIBDIR)/libafsutil.a
30
31 CMLIBS=${TOP_LIBDIR}/libsys.a \
32          ${TOP_LIBDIR}/libafsint.a \
33          ${TOP_LIBDIR}/librxkad.a \
34          ${TOP_LIBDIR}/libauth.a \
35          ${TOP_LIBDIR}/libcom_err.a \
36          ${TOP_LIBDIR}/libcmd.a \
37          ${TOP_LIBDIR}/librx.a \
38          ${TOP_LIBDIR}/libsys.a \
39          ${TOP_LIBDIR}/liblwp.a \
40          $(TOP_LIBDIR)/libafsutil.a
41
42 LIBS = ${FSLIBS} 
43
44 #
45 # In order not to rebuild kdump* again and again we use
46 # AFS_SYSNAME dependent targets (generated by configure)
47 #
48 KDUMP=@KDUMP@
49 KDUMP64=@KDUMP64@
50
51 all: fs up fstrace cmdebug livesys ${KDUMP} ${KDUMP64}
52
53 #
54 # Build targets
55 #
56 cacheout: cacheout.o
57         $(CC) ${CFLAGS} -o cacheout cacheout.o ${LIBS} ${XLIBS} ${CMLIBS}
58
59 cacheout.o: cacheout.c
60
61 ${DEST}/bin/fs ${DEST}/root.server/usr/afs/bin/fs: fs
62         ${INSTALL} -s $? $@
63
64 ${DEST}/bin/livesys: livesys
65         ${INSTALL} -s $? $@
66
67 ${DEST}/bin/up: up
68         ${INSTALL} -s $? $@
69
70 ${DEST}/etc/fstrace: fstrace
71         ${INSTALL} -s $? $@
72
73 ${DEST}/bin/cmdebug: cmdebug
74         ${INSTALL} -s $? $@
75
76 ${DEST}/etc/${KDUMP}: ${KDUMP}
77         -set -x; \
78         case ${SYS_NAME} in \
79         sgi_6? ) \
80                 ${INSTALLex} -f ${srcdir}/kdump.sh.sgi_ipnos ${DEST}/etc/kdump; \
81                 ln -fs kdump ${DEST}/etc/kdump32; \
82                 ln -fs kdump.IP20 ${DEST}/etc/kdump.IP22; \
83                 ln -fs kdump.IP20 ${DEST}/etc/kdump.IP32; \
84                 for f in kdump.IP??; \
85                         do ${INSTALL} -s $$f ${DEST}/etc/$$f || exit $$? ; \
86                 done ;; \
87         sun*_5[789] ) \
88                 ${INSTALLex} -f ${srcdir}/kdump.sh.solaris7 ${DEST}/etc/kdump; \
89                 ${INSTALL} -s -f $? $@;; \
90         *alpha_linux* ) \
91                 ${INSTALLex} -f ${srcdir}/kdump.sh.linux ${DEST}/etc/kdump; \
92                 ${INSTALL} -s kdump-alpha_linux-${LINUX_VERSION} $@ ;; \
93         *linux* ) \
94                 ${INSTALLex} -f ${srcdir}/kdump.sh.linux ${DEST}/etc/kdump; \
95                 ${INSTALL} -s kdump-linux-${LINUX_VERSION} $@ ;; \
96         hp_ux11* ) \
97                 ${INSTALLex} -f ${srcdir}/kdump.sh.hp_ux11 ${DEST}/etc/kdump; \
98                 ${INSTALL} -s -f $? $@;; \
99         *nbsd*) \
100                 ;; \
101         *) \
102                 ${INSTALL} -s $? $@ ;; \
103         esac
104
105 ${DEST}/etc/${KDUMP64}: ${KDUMP64}
106         -set -x; \
107         case ${SYS_NAME} in \
108         sun4x_5[789] | hp_ux11* |sunx86_5[789] ) \
109                 ${INSTALL} -s $? $@ ;;\
110         * ) \
111                 echo skipping kdump64 for ${SYS_NAME} ;; \
112         esac
113
114
115 up.o: up.c AFS_component_version_number.c
116
117 up: up.o
118         ${CC} ${CFLAGS} -o up up.o ${LIBS} ${XLIBS}
119
120 fs.o: fs.c ${INCLS} AFS_component_version_number.c
121
122 fs: fs.o $(LIBS)
123         ${CC} ${CFLAGS} -o fs fs.o ${TOP_LIBDIR}/libprot.a $(LIBS) ${XLIBS}
124
125 livesys.o: livesys.c ${INCLS} AFS_component_version_number.c
126
127 livesys: livesys.c $(LIBS)
128         ${CC} ${CFLAGS} -o livesys ${srcdir}/livesys.c $(LIBS) ${XLIBS}
129
130 twiddle: twiddle.c $(LIBS)
131         ${CC} ${CFLAGS} -o twiddle ${srcdir}/twiddle.c $(LIBS) ${XLIBS}
132
133 gcpags: gcpags.c $(LIBS)
134         ${CC} ${CFLAGS} -o gcpags ${srcdir}/gcpags.c $(LIBS) ${XLIBS}
135
136 whatfid.o: whatfid.c ${INCLS} AFS_component_version_number.c
137
138 whatfid: whatfid.o ${LIBS}
139         ${CC} ${CFLAGS} -o whatfid whatfid.o ${LIBS} ${XLIBS}
140
141 fstrace.o: fstrace.c AFS_component_version_number.c
142         case ${SYS_NAME} in \
143                 sun4_411 | sun4c_411 | sun4m_412 ) \
144                         ${CCXPG2} ${DBG} ${OPTMZ} -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR} -I${TOP_INCDIR} -c ${srcdir}/fstrace.c ;; \
145                 sun*_4* ) \
146                         ${CC} ${DBG} ${OPTMZ} -I/usr/xpg2include -I/usr/5include -g -I${TOP_SRCDIR}/config -I${TOP_INCDIR} -I${TOP_INCDIR} -c fstrace.c ;; \
147                 * ) \
148                         ${CC} ${CFLAGS} -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR} -I${TOP_INCDIR} -c ${srcdir}/fstrace.c ;; \
149         esac
150
151 fstrace: fstrace.o
152         case ${SYS_NAME} in \
153                 pmax_ul43 | pmax_ul43a ) \
154                         ${CC} ${CFLAGS} -o fstrace fstrace.o ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a /usr/lib/libi.a ;; \
155                 sun4_411 | sun4c_411 | sun4m_412 ) \
156                         ${CCXPG2} ${CFLAGS} -o fstrace fstrace.o ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a ;; \
157                 sun*_4* ) \
158                         ${CC} -L/usr/xpg2lib -L/usr/5lib ${CFLAGS} -g -o fstrace fstrace.o ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a -lxpg ;; \
159                 hp700_ux100 | hp800_ux100 | hp?00_ux10? | hp_ux10? | hp_ux11?) \
160                         ${CC} -I${TOP_OBJDIR}/src/config  -o fstrace fstrace.o ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a ;; \
161                 * ) \
162                         ${CC} ${CFLAGS} -o fstrace fstrace.o ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a ;; \
163         esac
164
165 cmdebug.o: cmdebug.c ${INCLS} AFS_component_version_number.c
166
167 cmdebug: cmdebug.o ${CMLIBS}
168         $(CC) -o cmdebug cmdebug.o ${CFLAGS} ${CMLIBS} ${XLIBS}
169
170 #
171 # Kernel info dumper - these are done with submakes so that
172 # the build process does not attempt to rebuild them every time it runs.
173 #
174
175 # *linux* - Builds kdump-X.Y.Z according to kernel version
176 kdump-linux-@LINUX_VERSION@.o: kdump.c ${INCLS} AFS_component_version_number.c
177         ${CC} ${KERN_DBG} ${KERN_OPTMZ} -I${LINUX_KERNEL_PATH}/include -I${TOP_INCDIR}/afs \
178                 -I${TOP_OBJDIR}/src \
179                 -I${TOP_OBJDIR}/src/afs/${MKAFS_OSTYPE} \
180                 -I${TOP_OBJDIR}/src/config -I${TOP_OBJDIR}/src/libafs/afs \
181                 -I${TOP_SRCDIR} -I${TOP_SRCDIR}/afs/${MKAFS_OSTYPE} \
182                 -I${TOP_INCDIR} ${XCFLAGS} -o kdump-linux-${LINUX_VERSION}.o \
183                 -c ${srcdir}/kdump.c
184
185 kdump-linux-@LINUX_VERSION@: kdump-linux-@LINUX_VERSION@.o
186         ${CC} ${KERN_DBG} ${KERN_OPTMZ} -o kdump-linux-${LINUX_VERSION} kdump-linux-${LINUX_VERSION}.o \
187                 ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a ${XLIBS}
188
189 # *alpha_linux* - Builds kdump-X.Y.Z according to kernel version
190 kdump-alpha_linux-@LINUX_VERSION@.o: kdump.c ${INCLS} AFS_component_version_number.c
191         ${CC} ${KERN_DBG} ${KERN_OPTMZ} -I${LINUX_KERNEL_PATH}/include -I${TOP_INCDIR}/afs \
192                 -I${TOP_OBJDIR}/src \
193                 -I${TOP_OBJDIR}/src/afs/${MKAFS_OSTYPE} \
194                 -I${TOP_OBJDIR}/src/config -I${TOP_OBJDIR}/src/libafs/afs \
195                 -I${TOP_SRCDIR} -I${TOP_SRCDIR}/afs/${MKAFS_OSTYPE} \
196                 -I${TOP_INCDIR} ${XCFLAGS} -mno-fp-regs -ffixed-8 \
197                 -o kdump-alpha_linux-${LINUX_VERSION}.o -c ${srcdir}/kdump.c ;; \
198
199 kdump-alpha_linux-@LINUX_VERSION@: kdump-alpha_linux-@LINUX_VERSION@.o
200         ${CC} ${KERN_DBG} ${KERN_OPTMZ} -o kdump-alpha_linux-${LINUX_VERSION} kdump-alpha_linux-${LINUX_VERSION}.o \
201                 ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a ${XLIBS}
202
203 #
204 # Default target
205 #
206 ${KDUMP}.o: kdump.c ${INCLS} AFS_component_version_number.c
207         -set -x; \
208         case ${SYS_NAME} in \
209                 alpha_linux* ) \
210                         $(MAKE) kdump-alpha_linux-${LINUX_VERSION}.o ;; \
211                 *linux* ) \
212                         $(MAKE) kdump-linux-${LINUX_VERSION}.o ;; \
213                 alpha_osf1 | alpha_osf20 |  alpha_osf30 | alpha_osf32 | alpha_osf32c| alpha_dux?? ) \
214                         ${CC} ${CFLAGS} -I/usr/sys/include -I/usr/sys/BINARY -I/usr/sys/AFS -DDEBUGGER -c ${srcdir}/kdump.c ;;\
215                 sgi_6? ) \
216                         for f in ../libafs/STATIC.IP*/CPU_KDEFS; \
217                         do      IP=`expr "$$f" : '../libafs/STATIC.\(IP..\)'`; \
218                                 CPU_KDEFS=`sed 's/-mips.//' $$f`; \
219                                 echo IP = $$IP; \
220                                 echo CPU_KDEFS = $$CPU_KDEFS; \
221                                 case $$CPU_KDEFS in \
222                                 *-64*)  ${CC} -D_KMEMUSER -woff 1178 \
223                                                 ${KERN_DBG} ${KERN_OPTMZ} -I${TOP_INCDIR} \
224                                                 -I${TOP_OBJDIR}/src/config \
225                                                 $$CPU_KDEFS \
226                                                 ${XCFLAGS64} \
227                                                 -c ${srcdir}/kdump.c -o kdump.$$IP.o \
228                                         ;; \
229                                 *)      ${CC} -D_KMEMUSER -woff 1178 \
230                                                 ${KERN_DBG} ${KERN_OPTMZ} -I${TOP_INCDIR} \
231                                                 -I${TOP_OBJDIR}/src/config \
232                                                 $$CPU_KDEFS \
233                                                 ${XCFLAGS} -DAFS_32BIT_KERNEL_ENV \
234                                                 -c ${srcdir}/kdump.c -o kdump.$$IP.o \
235                                         ;; \
236                                 esac || exit $$?; \
237                         done \
238                         ;; \
239                 *nbsd*) \
240                         touch kdump.o ;; \
241                 *) \
242                         ${CC} ${KERN_DBG} ${KERN_OPTMZ} -I${TOP_SRCDIR} -I${TOP_INCDIR}/afs -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR} ${XCFLAGS} -o ${KDUMP}.o -c ${srcdir}/kdump.c ;; \
243         esac ;
244
245 ${KDUMP64}.o : kdump.c ${INCLS} AFS_component_version_number.c
246         -set -x; \
247         case ${SYS_NAME} in \
248         sun4x_5[789] | hp_ux11* |sunx86_5[789] ) \
249                 ${CC} ${KERN_DBG} ${KERN_OPTMZ} -I${TOP_SRCDIR} -I${TOP_INCDIR}/afs -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR} ${XCFLAGS64} -o ${KDUMP64}.o -c ${srcdir}/kdump.c ;; \
250         esac
251
252 ${KDUMP}:  ${KDUMP}.o
253         -set -x; \
254         case ${SYS_NAME} in \
255         sun4c_51 | sun4c_52 | sun4m_51 | sun4m_52 | sun4c_53 | sun4m_53 | sun4_53 | sun4_54 | sun4c_54 | sun4m_54 | sunx86_5? ) \
256                 ${CC} -o ${KDUMP} ${KDUMP}.o ${TOP_LIBDIR}/libcmd.a  ${TOP_LIBDIR}/util.a /usr/lib/libkvm.a -lelf ${XLIBS} ;; \
257         sun*_5? ) \
258                 ${CC} -o ${KDUMP} ${KDUMP}.o ${TOP_LIBDIR}/libcmd.a  ${TOP_LIBDIR}/util.a  ${XLIBELFA} ${XLIBKVM} ${XLIBS} ;; \
259         sgi_6? ) \
260                 for f in ../libafs/STATIC.IP*/CPU_KDEFS; \
261                 do      IP=`expr "$$f" : '../libafs/STATIC.\(IP..\)'`; \
262                         CPU_KDEFS=`sed 's/-mips.//' $$f`; \
263                         echo IP = $$IP; \
264                         echo CPU_KDEFS = $$CPU_KDEFS; \
265                         case $$CPU_KDEFS in \
266                         *-64*)  ${CC} ${XCFLAGS64} \
267                                         $$CPU_KDEFS \
268                                         -o kdump.$$IP kdump.$$IP.o \
269                                         ${TOP_LIBDIR}/libcmd64.a -lelf \
270                                 ;; \
271                         *)      ${CC} ${XCFLAGS} \
272                                         $$CPU_KDEFS \
273                                         -o kdump.$$IP kdump.$$IP.o \
274                                         ${TOP_LIBDIR}/libcmd.a -lelf \
275                                 ;; \
276                         esac || exit $$? ; \
277                 done ;; \
278         *alpha_linux* ) \
279                 $(MAKE) kdump-alpha_linux-@LINUX_VERSION@ ;; \
280         *linux* ) \
281                 $(MAKE) kdump-linux-@LINUX_VERSION@ ;; \
282         alpha_osf1 | alpha_osf20 |  alpha_osf30 | alpha_osf32 | alpha_osf32c | alpha_dux??) \
283                 ${CC} -o kdump kdump.o ${TOP_LIBDIR}/libcmd.a  ${TOP_LIBDIR}/util.a ${XLIBS} -ll -lmld;; \
284         ncrx86_* ) ${CC} -o kdump kdump.o ${TOP_LIBDIR}/libcmd.a  ${TOP_LIBDIR}/util.a -lelf ${XLIBS} ;; \
285         *nbsd*) touch kdump ;; \
286         * )     ${CC} -o kdump kdump.o ${TOP_LIBDIR}/libcmd.a  ${TOP_LIBDIR}/util.a ${XLIBS} ;; \
287         esac
288
289 ## kdump to read from 64 bit kernel dumps
290
291 ${KDUMP64}: ${KDUMP64}.o
292         -set -x; \
293         case ${SYS_NAME} in \
294         sun4x_5[789] | hp_ux11* |sunx86_5[789] )  \
295                 ${CC} ${XCFLAGS64} -o ${KDUMP64} ${KDUMP64}.o ${TOP_LIBDIR}/libcmd64.a ${XLIBELFA} ${XLIBKVM} ${XLIBS} ;; \
296         esac
297
298 #
299 # Install targets
300 #
301 install: \
302         ${DESTDIR}${bindir}/fs \
303         ${DESTDIR}${bindir}/livesys \
304         ${DESTDIR}${afssrvbindir}/fs \
305         ${DESTDIR}${bindir}/up \
306         ${DESTDIR}${sbindir}/fstrace \
307         ${DESTDIR}${bindir}/cmdebug \
308         ${DESTDIR}${sbindir}/${KDUMP} \
309         ${DESTDIR}${sbindir}/${KDUMP64}
310
311 #
312 # Misc targets
313 #
314
315 clean:
316         $(RM) -f *.o *.a up fs kdump-* kdump kdump64 core cmdebug AFS_component_version_number.c fstrace gcpags
317
318 test:
319         cd test; $(MAKE)
320
321 include ../config/Makefile.version
322
323 ${DESTDIR}${bindir}/fs: fs
324         ${INSTALL} -s $? $@
325
326 ${DESTDIR}${bindir}/livesys: livesys
327         ${INSTALL} -s $? $@
328
329 ${DESTDIR}${afssrvbindir}/fs: fs
330         ${INSTALL} -s $? $@
331
332 ${DESTDIR}${bindir}/up: up
333         ${INSTALL} -s $? $@
334
335 ${DESTDIR}${sbindir}/fstrace: fstrace
336         ${INSTALL} -s $? $@
337
338 ${DESTDIR}${bindir}/cmdebug: cmdebug
339         ${INSTALL} -s $? $@
340
341 ${DESTDIR}${sbindir}/${KDUMP}: ${KDUMP}
342         -set -x; \
343         case ${SYS_NAME} in \
344         sgi_6? ) \
345                 ${INSTALLex} -f kdump.sh.sgi_ipnos ${DESTDIR}${sbindir}/kdump; \
346                 ln -fs kdump ${DESTDIR}${sbindir}/kdump32; \
347                 ln -fs kdump.IP20 ${DESTDIR}${sbindir}/kdump.IP22; \
348                 ln -fs kdump.IP20 ${DESTDIR}${sbindir}/kdump.IP32; \
349                 for f in kdump.IP??; \
350                         do ${INSTALL} -s $$f ${DESTDIR}${sbindir}/$$f || exit $$? ; \
351                 done ;; \
352         sun*_5[789] ) \
353                 ${INSTALLex} -f kdump.sh.solaris7 ${DESTDIR}${sbindir}/kdump32; \
354                 ${INSTALL} -s -f $? $@;; \
355         *linux* ) \
356                 ${INSTALLex} -f kdump.sh.linux ${DESTDIR}${sbindir}/kdump; \
357                 ${INSTALL} -s @? $@ ;; \
358         hp_ux11* ) \
359                 ${INSTALLex} -f kdump.sh.hp_ux11 ${DESTDIR}${sbindir}/kdump; \
360                 ${INSTALL} -s -f $? $@;; \
361         *) \
362                 ${INSTALL} -s $? $@ ;; \
363         esac
364
365 ${DESTDIR}${sbindir}/kdump64: kdump64
366         -set -x; \
367         case ${SYS_NAME} in \
368         sun4x_5[789] | hp_ux11* ) \
369                 ${INSTALL} -s $? $@ ;;\
370         * ) \
371                 echo skipping kdump64 for ${SYS_NAME} ;; \
372         esac
373
374 dest: \
375         ${DEST}/bin/fs \
376         ${DEST}/bin/livesys \
377         ${DEST}/root.server/usr/afs/bin/fs \
378         ${DEST}/bin/up \
379         ${DEST}/etc/fstrace \
380         ${DEST}/bin/cmdebug \
381         ${DEST}/etc/${KDUMP} \
382         ${DEST}/etc/${KDUMP64}
383