2a6ea4ebf4f95907828c48be0f925798635bbee3
[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 all: fs up fstrace cmdebug livesys kdump-build
45
46 #
47 # Build targets
48 #
49 cacheout: cacheout.o
50         $(CC) ${CFLAGS} -o cacheout cacheout.o ${LIBS} ${XLIBS} ${CMLIBS}
51
52 cacheout.o: cacheout.c
53
54 ${DEST}/bin/fs ${DEST}/root.server/usr/afs/bin/fs: fs
55         ${INSTALL} -s $? $@
56
57 ${DEST}/bin/livesys: livesys
58         ${INSTALL} -s $? $@
59
60 ${DEST}/bin/up: up
61         ${INSTALL} -s $? $@
62
63 ${DEST}/etc/fstrace: fstrace
64         ${INSTALL} -s $? $@
65
66 ${DEST}/bin/cmdebug: cmdebug
67         ${INSTALL} -s $? $@
68
69
70
71 up.o: up.c AFS_component_version_number.c
72
73 up: up.o
74         ${CC} ${CFLAGS} -o up up.o ${LIBS} ${XLIBS}
75
76 fs.o: fs.c ${INCLS} AFS_component_version_number.c
77
78 fs: fs.o $(LIBS)
79         ${CC} ${CFLAGS} -o fs fs.o ${TOP_LIBDIR}/libprot.a $(LIBS) ${XLIBS}
80
81 livesys.o: livesys.c ${INCLS} AFS_component_version_number.c
82
83 livesys: livesys.c $(LIBS)
84         ${CC} ${CFLAGS} -o livesys ${srcdir}/livesys.c $(LIBS) ${XLIBS}
85
86 twiddle: twiddle.c $(LIBS)
87         ${CC} ${CFLAGS} -o twiddle ${srcdir}/twiddle.c $(LIBS) ${XLIBS}
88
89 gcpags: gcpags.c $(LIBS)
90         ${CC} ${CFLAGS} -o gcpags ${srcdir}/gcpags.c $(LIBS) ${XLIBS}
91
92 whatfid.o: whatfid.c ${INCLS} AFS_component_version_number.c
93
94 whatfid: whatfid.o ${LIBS}
95         ${CC} ${CFLAGS} -o whatfid whatfid.o ${LIBS} ${XLIBS}
96
97 fstrace.o: fstrace.c AFS_component_version_number.c
98         case ${SYS_NAME} in \
99                 sun4_411 | sun4c_411 | sun4m_412 ) \
100                         ${CCXPG2} ${DBG} ${OPTMZ} -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR} -I${TOP_INCDIR} -c ${srcdir}/fstrace.c ;; \
101                 sun*_4* ) \
102                         ${CC} ${DBG} ${OPTMZ} -I/usr/xpg2include -I/usr/5include -g -I${TOP_SRCDIR}/config -I${TOP_INCDIR} -I${TOP_INCDIR} -c fstrace.c ;; \
103                 * ) \
104                         ${CC} ${CFLAGS} -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR} -I${TOP_INCDIR} -c ${srcdir}/fstrace.c ;; \
105         esac
106
107 fstrace: fstrace.o
108         case ${SYS_NAME} in \
109                 pmax_ul43 | pmax_ul43a ) \
110                         ${CC} ${CFLAGS} -o fstrace fstrace.o ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a /usr/lib/libi.a ;; \
111                 sun4_411 | sun4c_411 | sun4m_412 ) \
112                         ${CCXPG2} ${CFLAGS} -o fstrace fstrace.o ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a ;; \
113                 sun*_4* ) \
114                         ${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 ;; \
115                 hp700_ux100 | hp800_ux100 | hp?00_ux10? | hp_ux10? | hp_ux11?) \
116                         ${CC} -I${TOP_OBJDIR}/src/config  -o fstrace fstrace.o ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a ;; \
117                 * ) \
118                         ${CC} ${CFLAGS} -o fstrace fstrace.o ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a ;; \
119         esac
120
121 cmdebug.o: cmdebug.c ${INCLS} AFS_component_version_number.c
122
123 cmdebug: cmdebug.o ${CMLIBS}
124         $(CC) -o cmdebug cmdebug.o ${CFLAGS} ${CMLIBS} ${XLIBS}
125
126
127
128 #
129 # Kernel info dumper - these are done with submakes so that
130 # the build process does not attempt to rebuild them every time it runs.
131 #
132
133 #
134 # Branching target, run the actual build depending on sysname
135 #
136 kdump-build: kdump.c ${INCLS} AFS_component_version_number.c
137         $(MAKE) kdump kdump64
138         touch kdump-build
139
140 #
141 # Build targets - one for each type of kdump build process we have
142 #
143 kdump: kdump.o
144         -set -x; \
145         case ${SYS_NAME} in \
146         sun4c_51 | sun4c_52 | sun4m_51 | sun4m_52 | sun4c_53 | sun4m_53 | sun4_53 | sun4_54 | sun4c_54 | sun4m_54 | sunx86_5? ) \
147                 ${CC} -o kdump kdump.o ${TOP_LIBDIR}/libcmd.a  ${TOP_LIBDIR}/util.a /usr/lib/libkvm.a -lelf ${XLIBS} ;; \
148         sun*_5? ) \
149                 ${CC} -o kdump kdump.o ${TOP_LIBDIR}/libcmd.a  ${TOP_LIBDIR}/util.a  ${XLIBELFA} ${XLIBKVM} ${XLIBS} ;; \
150         sgi_6? ) \
151                 for f in ../libafs/STATIC.IP*/CPU_KDEFS; \
152                 do      IP=`expr "$$f" : '../libafs/STATIC.\(IP..\)'`; \
153                         CPU_KDEFS=`sed 's/-mips.//' $$f`; \
154                         echo IP = $$IP; \
155                         echo CPU_KDEFS = $$CPU_KDEFS; \
156                         case $$CPU_KDEFS in \
157                         *-64*)  ${CC} ${XCFLAGS64} \
158                                         $$CPU_KDEFS \
159                                         -o kdump.$$IP kdump.$$IP.o \
160                                         ${TOP_LIBDIR}/libcmd64.a -lelf \
161                                 ;; \
162                         *)      ${CC} ${XCFLAGS} \
163                                         $$CPU_KDEFS \
164                                         -o kdump.$$IP kdump.$$IP.o \
165                                         ${TOP_LIBDIR}/libcmd.a -lelf \
166                                 ;; \
167                         esac || exit $$? ; \
168                 done ;; \
169         *alpha_linux* ) \
170                 $(MAKE) kdump-alpha_linux-@LINUX_VERSION@ ;; \
171         *linux* ) \
172                 $(MAKE) kdump-linux-@LINUX_VERSION@ ;; \
173         alpha_osf1 | alpha_osf20 |  alpha_osf30 | alpha_osf32 | alpha_osf32c | alpha_dux??) \
174                 ${CC} -o kdump kdump.o ${TOP_LIBDIR}/libcmd.a  ${TOP_LIBDIR}/util.a ${XLIBS} -ll -lmld;; \
175         ncrx86_* ) ${CC} -o kdump kdump.o ${TOP_LIBDIR}/libcmd.a  ${TOP_LIBDIR}/util.a -lelf ${XLIBS} ;; \
176         *nbsd*) touch kdump ;; \
177         * )     ${CC} -o kdump kdump.o ${TOP_LIBDIR}/libcmd.a  ${TOP_LIBDIR}/util.a ${XLIBS} ;; \
178         esac
179
180 kdump64: 
181         -set -x; \
182         case ${SYS_NAME} in \
183         sun4x_5[789] | hp_ux11* |sunx86_5[789] )  \
184                 $(MAKE) kdump64.o ; \
185                 ${CC} ${XCFLAGS64} -o kdump64 kdump64.o ${TOP_LIBDIR}/libcmd64.a ${XLIBELFA} ${XLIBKVM} ${XLIBS} ;; \
186         esac
187
188
189 kdump.o: kdump.c ${INCLS} AFS_component_version_number.c
190         -set -x; \
191         case ${SYS_NAME} in \
192                 alpha_linux* ) \
193                         $(MAKE) kdump-alpha_linux-${LINUX_VERSION}.o ;; \
194                 *linux* ) \
195                         $(MAKE) kdump-linux-${LINUX_VERSION}.o ;; \
196                 alpha_osf1 | alpha_osf20 |  alpha_osf30 | alpha_osf32 | alpha_osf32c| alpha_dux?? ) \
197                         ${CC} ${CFLAGS} -I/usr/sys/include -I/usr/sys/BINARY -I/usr/sys/AFS -DDEBUGGER -c ${srcdir}/kdump.c ;;\
198                 sgi_6? ) \
199                         for f in ../libafs/STATIC.IP*/CPU_KDEFS; \
200                         do      IP=`expr "$$f" : '../libafs/STATIC.\(IP..\)'`; \
201                                 CPU_KDEFS=`sed 's/-mips.//' $$f`; \
202                                 echo IP = $$IP; \
203                                 echo CPU_KDEFS = $$CPU_KDEFS; \
204                                 case $$CPU_KDEFS in \
205                                 *-64*)  ${CC} -D_KMEMUSER -woff 1178 \
206                                                 ${KERN_DBG} ${KERN_OPTMZ} -I${TOP_INCDIR} \
207                                                 -I${TOP_OBJDIR}/src/config \
208                                                 $$CPU_KDEFS \
209                                                 ${XCFLAGS64} \
210                                                 -c ${srcdir}/kdump.c -o kdump.$$IP.o \
211                                         ;; \
212                                 *)      ${CC} -D_KMEMUSER -woff 1178 \
213                                                 ${KERN_DBG} ${KERN_OPTMZ} -I${TOP_INCDIR} \
214                                                 -I${TOP_OBJDIR}/src/config \
215                                                 $$CPU_KDEFS \
216                                                 ${XCFLAGS} -DAFS_32BIT_KERNEL_ENV \
217                                                 -c ${srcdir}/kdump.c -o kdump.$$IP.o \
218                                         ;; \
219                                 esac || exit $$?; \
220                         done \
221                         ;; \
222                 *nbsd*) \
223                         touch kdump.o ;; \
224                 *) \
225                         ${CC} ${KERN_DBG} ${KERN_OPTMZ} -I${TOP_SRCDIR} -I${TOP_INCDIR}/afs \
226                         -I${TOP_OBJDIR}/src/config -I${TOP_OBJDIR}/src -I${TOP_INCDIR} ${XCFLAGS} \
227                         -o kdump.o -c ${srcdir}/kdump.c ;; \
228         esac ;
229
230 kdump64.o : kdump.c ${INCLS} AFS_component_version_number.c
231         -set -x; \
232         case ${SYS_NAME} in \
233         sun4x_5[789] | hp_ux11* |sunx86_5[789] ) \
234                 ${CC} ${KERN_DBG} ${KERN_OPTMZ} -I${TOP_SRCDIR} -I${TOP_INCDIR}/afs \
235                 -I${TOP_OBJDIR}/src/config -I${TOP_OBJDIR}/src -I${TOP_INCDIR} ${XCFLAGS64} \
236                 -o kdump64.o -c ${srcdir}/kdump.c ;; \
237         esac
238
239 # *linux* - Builds kdump-X.Y.Z according to kernel version
240 kdump-linux-@LINUX_VERSION@.o: kdump.c ${INCLS} AFS_component_version_number.c
241         ${CC} ${KERN_DBG} ${KERN_OPTMZ} -I${LINUX_KERNEL_PATH}/include -I${TOP_INCDIR}/afs \
242                 -I${TOP_OBJDIR}/src \
243                 -I${TOP_OBJDIR}/src/afs/${MKAFS_OSTYPE} \
244                 -I${TOP_OBJDIR}/src/config -I${TOP_OBJDIR}/src/libafs/afs \
245                 -I${TOP_SRCDIR} -I${TOP_SRCDIR}/afs/${MKAFS_OSTYPE} \
246                 -I${TOP_INCDIR} ${XCFLAGS} -o kdump-linux-${LINUX_VERSION}.o \
247                 -c ${srcdir}/kdump.c
248
249 kdump-linux-@LINUX_VERSION@: kdump-linux-@LINUX_VERSION@.o
250         ${CC} ${KERN_DBG} ${KERN_OPTMZ} -o kdump-linux-${LINUX_VERSION} kdump-linux-${LINUX_VERSION}.o \
251                 ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a ${XLIBS}
252
253 # *alpha_linux* - Builds kdump-X.Y.Z according to kernel version
254 kdump-alpha_linux-@LINUX_VERSION@.o: kdump.c ${INCLS} AFS_component_version_number.c
255         ${CC} ${KERN_DBG} ${KERN_OPTMZ} -I${LINUX_KERNEL_PATH}/include -I${TOP_INCDIR}/afs \
256                 -I${TOP_OBJDIR}/src \
257                 -I${TOP_OBJDIR}/src/afs/${MKAFS_OSTYPE} \
258                 -I${TOP_OBJDIR}/src/config -I${TOP_OBJDIR}/src/libafs/afs \
259                 -I${TOP_SRCDIR} -I${TOP_SRCDIR}/afs/${MKAFS_OSTYPE} \
260                 -I${TOP_INCDIR} ${XCFLAGS} -mno-fp-regs -ffixed-8 \
261                 -o kdump-alpha_linux-${LINUX_VERSION}.o -c ${srcdir}/kdump.c ;; \
262
263 kdump-alpha_linux-@LINUX_VERSION@: kdump-alpha_linux-@LINUX_VERSION@.o
264         ${CC} ${KERN_DBG} ${KERN_OPTMZ} -o kdump-alpha_linux-${LINUX_VERSION} kdump-alpha_linux-${LINUX_VERSION}.o \
265                 ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a ${XLIBS}
266
267 #
268 # kdump install targets
269 #
270 ${DEST}/etc/kdump: kdump-build
271         -set -x; \
272         case ${SYS_NAME} in \
273         sgi_6? ) \
274                 ${INSTALLex} -f ${srcdir}/kdump.sh.sgi_ipnos ${DEST}/etc/kdump; \
275                 ln -fs kdump ${DEST}/etc/kdump32; \
276                 ln -fs kdump.IP20 ${DEST}/etc/kdump.IP22; \
277                 ln -fs kdump.IP20 ${DEST}/etc/kdump.IP32; \
278                 for f in kdump.IP??; \
279                         do ${INSTALL} -s $$f ${DEST}/etc/$$f || exit $$? ; \
280                 done ;; \
281         sun*_5[789] ) \
282                 ${INSTALLex} -f ${srcdir}/kdump.sh.solaris7 ${DEST}/etc/kdump; \
283                 ${INSTALL} -s -f $? $@;; \
284         *alpha_linux* ) \
285                 ${INSTALLex} -f ${srcdir}/kdump.sh.linux ${DEST}/etc/kdump; \
286                 ${INSTALL} -s kdump-alpha_linux-${LINUX_VERSION} $@ ;; \
287         *linux* ) \
288                 ${INSTALLex} -f ${srcdir}/kdump.sh.linux ${DEST}/etc/kdump; \
289                 ${INSTALL} -s kdump-linux-${LINUX_VERSION} $@ ;; \
290         hp_ux11* ) \
291                 ${INSTALLex} -f ${srcdir}/kdump.sh.hp_ux11 ${DEST}/etc/kdump; \
292                 ${INSTALL} -s -f $? $@;; \
293         *nbsd*) \
294                 ;; \
295         *) \
296                 ${INSTALL} -s $? $@ ;; \
297         esac
298
299 ${DEST}/etc/kdump64: kdump-build
300         if [ -f kdump64 ]; then \
301                 ${INSTALL} -s kdump64 $@; \
302         fi
303
304
305 #
306 # Install targets
307 #
308 install: \
309         ${DESTDIR}${bindir}/fs \
310         ${DESTDIR}${bindir}/livesys \
311         ${DESTDIR}${afssrvbindir}/fs \
312         ${DESTDIR}${bindir}/up \
313         ${DESTDIR}${sbindir}/fstrace \
314         ${DESTDIR}${bindir}/cmdebug \
315         ${DESTDIR}${sbindir}/kdump \
316         ${DESTDIR}${sbindir}/kdump64
317
318 #
319 # Misc targets
320 #
321
322 clean:
323         $(RM) -f *.o *.a up fs kdump-* kdump kdump64 core cmdebug AFS_component_version_number.c fstrace gcpags livesys
324
325 test:
326         cd test; $(MAKE)
327
328 include ../config/Makefile.version
329
330 ${DESTDIR}${bindir}/fs: fs
331         ${INSTALL} -s $? $@
332
333 ${DESTDIR}${bindir}/livesys: livesys
334         ${INSTALL} -s $? $@
335
336 ${DESTDIR}${afssrvbindir}/fs: fs
337         ${INSTALL} -s $? $@
338
339 ${DESTDIR}${bindir}/up: up
340         ${INSTALL} -s $? $@
341
342 ${DESTDIR}${sbindir}/fstrace: fstrace
343         ${INSTALL} -s $? $@
344
345 ${DESTDIR}${bindir}/cmdebug: cmdebug
346         ${INSTALL} -s $? $@
347
348 ${DESTDIR}${sbindir}/kdump: kdump-build
349         -set -x; \
350         case ${SYS_NAME} in \
351         sgi_6? ) \
352                 ${INSTALLex} -f kdump.sh.sgi_ipnos ${DESTDIR}${sbindir}/kdump; \
353                 ln -fs kdump ${DESTDIR}${sbindir}/kdump32; \
354                 ln -fs kdump.IP20 ${DESTDIR}${sbindir}/kdump.IP22; \
355                 ln -fs kdump.IP20 ${DESTDIR}${sbindir}/kdump.IP32; \
356                 for f in kdump.IP??; \
357                         do ${INSTALL} -s $$f ${DESTDIR}${sbindir}/$$f || exit $$? ; \
358                 done ;; \
359         sun*_5[789] ) \
360                 ${INSTALLex} -f kdump.sh.solaris7 ${DESTDIR}${sbindir}/kdump32; \
361                 ${INSTALL} -s -f $? $@;; \
362         *linux* ) \
363                 ${INSTALLex} -f kdump.sh.linux ${DESTDIR}${sbindir}/kdump; \
364                 ${INSTALL} -s $? $@ ;; \
365         hp_ux11* ) \
366                 ${INSTALLex} -f kdump.sh.hp_ux11 ${DESTDIR}${sbindir}/kdump; \
367                 ${INSTALL} -s -f $? $@;; \
368         *) \
369                 ${INSTALL} -s $? $@ ;; \
370         esac
371
372 ${DESTDIR}${sbindir}/kdump64: kdump-build
373         if [ -f kdump64 ]; then \
374                 ${INSTALL} -s kdump64 $@; \
375         fi
376
377 dest: \
378         ${DEST}/bin/fs \
379         ${DEST}/bin/livesys \
380         ${DEST}/root.server/usr/afs/bin/fs \
381         ${DEST}/bin/up \
382         ${DEST}/etc/fstrace \
383         ${DEST}/bin/cmdebug \
384         ${DEST}/etc/kdump \
385         ${DEST}/etc/kdump64
386