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