0f209fcce27c55ed81b32585d4db3310e84b25eb
[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
12 CCXPG2= /usr/xpg2bin/cc
13
14 # Note - be careful with this line, ubik.h is very picky about getting the right lock.h
15 CFLAGS=${OPTMZ} -I${TOP_INCDIR} -I. -I${srcdir} -I${TOP_OBJDIR}/src/config ${XCFLAGS}
16
17 INCLS=${TOP_INCDIR}/afs/afsint.h \
18         ${TOP_INCDIR}/afs/cmd.h \
19         ${TOP_INCDIR}/afs/afsutil.h
20
21 FSLIBS=${TOP_LIBDIR}/libsys.a \
22          ${TOP_LIBDIR}/libvldb.a \
23          ${TOP_LIBDIR}/libubik.a \
24          ${TOP_LIBDIR}/vlib.a \
25          ${TOP_LIBDIR}/libauth.a \
26          ${TOP_LIBDIR}/librxkad.a \
27          ${TOP_LIBDIR}/libcom_err.a \
28          ${TOP_LIBDIR}/libcmd.a \
29          ${TOP_LIBDIR}/libkauth.a \
30          ${TOP_LIBDIR}/libdes.a \
31          ${TOP_LIBDIR}/librx.a \
32          ${TOP_LIBDIR}/libsys.a \
33          $(TOP_LIBDIR)/util.a \
34          ${TOP_LIBDIR}/liblwp.a \
35          ${TOP_LIBDIR}/libaudit.a
36
37 CMLIBS=${TOP_LIBDIR}/libsys.a \
38          ${TOP_LIBDIR}/libafsint.a \
39          ${TOP_LIBDIR}/librxkad.a \
40          ${TOP_LIBDIR}/libauth.a \
41          ${TOP_LIBDIR}/libcom_err.a \
42          ${TOP_LIBDIR}/libcmd.a \
43          ${TOP_LIBDIR}/librx.a \
44          ${TOP_LIBDIR}/libsys.a \
45          $(TOP_LIBDIR)/util.a \
46          ${TOP_LIBDIR}/liblwp.a
47
48 LIBS = ${FSLIBS} 
49
50 all: fs up fstrace cmdebug livesys kdump kdump64
51
52 #
53 # Build targets
54 #
55 cacheout: cacheout.o
56         $(CC) ${CFLAGS} -o cacheout cacheout.o ${LIBS} ${XLIBS} ${CMLIBS}
57
58 cacheout.o: cacheout.c
59
60 ${DEST}/bin/fs ${DEST}/root.server/usr/afs/bin/fs: fs
61         ${INSTALL} -s $? $@
62
63 ${DEST}/bin/livesys: livesys
64         ${INSTALL} -s $? $@
65
66 ${DEST}/bin/up: up
67         ${INSTALL} -s $? $@
68
69 ${DEST}/etc/fstrace: fstrace
70         ${INSTALL} -s $? $@
71
72 ${DEST}/bin/cmdebug: cmdebug
73         ${INSTALL} -s $? $@
74
75 ${DEST}/etc/kdump: kdump
76         -set -x; \
77         case ${SYS_NAME} in \
78         sgi_6? ) \
79                 ${INSTALLex} -f ${srcdir}/kdump.sh.sgi_ipnos $@; \
80                 ln -fs kdump ${DEST}/etc/kdump32; \
81                 ln -fs kdump.IP20 ${DEST}/etc/kdump.IP22; \
82                 ln -fs kdump.IP20 ${DEST}/etc/kdump.IP32; \
83                 for f in kdump.IP??; \
84                         do ${INSTALL} -s $$f ${DEST}/etc/$$f || exit $$? ; \
85                 done ;; \
86         sun*_5[789] ) \
87                 ${INSTALLex} -f ${srcdir}/kdump.sh.solaris7 $@; \
88                 ${INSTALL} -s -f $? ${DEST}/etc/kdump32;; \
89         *linux* ) \
90                 ${INSTALLex} -f ${srcdir}/kdump.sh.linux $@; \
91                 ${INSTALL} -s kdump-${LINUX_VERSION} ${DEST}/etc/kdump-${LINUX_VERSION} ;; \
92         hp_ux11* ) \
93                 ${INSTALLex} -f ${srcdir}/kdump.sh.hp_ux11 $@; \
94                 ${INSTALL} -s -f $? ${DEST}/etc/kdump32;; \
95         *nbsd*) \
96                 ;; \
97         *) \
98                 ${INSTALL} -s $? $@ ;; \
99         esac
100
101 ${DEST}/etc/kdump64: kdump64
102         -set -x; \
103         case ${SYS_NAME} in \
104         sun4x_5[789] | hp_ux11* |sunx86_5[789] ) \
105                 ${INSTALL} -s $? $@ ;;\
106         * ) \
107                 echo skipping kdump64 for ${SYS_NAME} ;; \
108         esac
109
110
111 up.o: up.c AFS_component_version_number.c
112
113 up: up.o
114         ${CC} ${CFLAGS} $(DBG) -o up up.o ${LIBS} ${XLIBS}
115
116 fs.o: fs.c ${INCLS} AFS_component_version_number.c
117
118 fs: fs.o $(LIBS)
119         ${CC} ${CFLAGS} $(DBG) -o fs fs.o ${TOP_LIBDIR}/libprot.a $(LIBS) ${XLIBS}
120
121 livesys.o: livesys.c ${INCLS} AFS_component_version_number.c
122
123 livesys: livesys.c $(LIBS)
124         ${CC} $(DBG) -o livesys $(CFLAGS) ${srcdir}/livesys.c $(LIBS) ${XLIBS}
125
126 twiddle: twiddle.c $(LIBS)
127         ${CC} $(DBG) -o twiddle $(CFLAGS) twiddle.c $(LIBS) ${XLIBS}
128
129 gcpags: gcpags.c $(LIBS)
130         ${CC} $(DBG) -o gcpags $(CFLAGS) gcpags.c $(LIBS) ${XLIBS}
131
132 whatfid.o: whatfid.c ${INCLS} AFS_component_version_number.c
133
134 whatfid: whatfid.o ${LIBS}
135         ${CC} ${CFLAGS} $(DBG) -o whatfid whatfid.o ${LIBS} ${XLIBS}
136
137 fstrace.o: fstrace.c AFS_component_version_number.c
138         case ${SYS_NAME} in \
139                 sun4_411 | sun4c_411 | sun4m_412 ) \
140                         ${CCXPG2} $(DBG) -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR} -I${TOP_INCDIR} -c ${srcdir}/fstrace.c ;; \
141                 sun*_4* ) \
142                         ${CC} -I/usr/xpg2include -I/usr/5include -g -I${TOP_SRCDIR}/config -I${TOP_INCDIR} -I${TOP_INCDIR} -c fstrace.c ;; \
143                 * ) \
144                         ${CC} ${CFLAGS} $(DBG) -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR} -I${TOP_INCDIR} -c ${srcdir}/fstrace.c ;; \
145         esac
146
147 fstrace: fstrace.o
148         case ${SYS_NAME} in \
149                 pmax_ul43 | pmax_ul43a ) \
150                         ${CC} ${CFLAGS} -o fstrace fstrace.o ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a /usr/lib/libi.a ;; \
151                 sun4_411 | sun4c_411 | sun4m_412 ) \
152                         ${CCXPG2} ${CFLAGS} $(DBG) -o fstrace fstrace.o ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a ;; \
153                 sun*_4* ) \
154                         ${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 ;; \
155                 hp700_ux100 | hp800_ux100 | hp?00_ux10? | hp_ux10? | hp_ux11?) \
156                         ${CC} -I${TOP_OBJDIR}/src/config  -o fstrace fstrace.o ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a ;; \
157                 * ) \
158                         ${CC} ${CFLAGS} -o fstrace fstrace.o ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a ;; \
159         esac
160
161 cmdebug.o: cmdebug.c ${INCLS} AFS_component_version_number.c
162
163 cmdebug: cmdebug.o ${CMLIBS}
164         $(CC) -o cmdebug cmdebug.o ${CFLAGS} ${CMLIBS} ${XLIBS}
165
166 kdump.o: kdump.c ${INCLS} AFS_component_version_number.c
167         -set -x; \
168         case ${SYS_NAME} in \
169                 alpha_linux* ) \
170                         ${CC} $(DBG) -I${LINUX_KERNEL_PATH}/include -I${TOP_INCDIR}/afs -I${TOP_OBJDIR}/src/config -I${TOP_OBJDIR}/src/libafs/afs -I${TOP_INCDIR} ${XCFLAGS} -mno-fp-regs -ffixed-8 -o kdump-${LINUX_VERSION}.o -c ${srcdir}/kdump.c ;; \
171                 *linux* ) \
172                         ${CC} $(DBG) -I${LINUX_KERNEL_PATH}/include -I${TOP_INCDIR}/afs -I${TOP_OBJDIR}/src/config -I${TOP_OBJDIR}/src/libafs/afs -I${TOP_INCDIR} ${XCFLAGS} -o kdump-${LINUX_VERSION}.o -c ${srcdir}/kdump.c ;; \
173                 alpha_osf1 | alpha_osf20 |  alpha_osf30 | alpha_osf32 | alpha_osf32c| alpha_dux?? ) \
174                         ${CC} $(DBG) ${CFLAGS} -I/usr/sys/include -I/usr/sys/BINARY -I/usr/sys/AFS -DDEBUGGER -c ${srcdir}/kdump.c ;;\
175                 sgi_6? ) \
176                         for f in ../libafs/STATIC.IP*/CPU_KDEFS; \
177                         do      IP=`expr "$$f" : '../libafs/STATIC.\(IP..\)'`; \
178                                 CPU_KDEFS=`sed 's/-mips.//' $$f`; \
179                                 echo IP = $$IP; \
180                                 echo CPU_KDEFS = $$CPU_KDEFS; \
181                                 case $$CPU_KDEFS in \
182                                 *-64*)  ${CC} -D_KMEMUSER -woff 1178 \
183                                                 $(DBG) -I${TOP_INCDIR} \
184                                                 -I${TOP_OBJDIR}/src/config \
185                                                 $$CPU_KDEFS \
186                                                 ${XCFLAGS64} \
187                                                 -c ${srcdir}/kdump.c -o kdump.$$IP.o \
188                                         ;; \
189                                 *)      ${CC} -D_KMEMUSER -woff 1178 \
190                                                 $(DBG) -I${TOP_INCDIR} \
191                                                 -I${TOP_OBJDIR}/src/config \
192                                                 $$CPU_KDEFS \
193                                                 ${XCFLAGS} -DAFS_32BIT_KERNEL_ENV \
194                                                 -c ${srcdir}/kdump.c -o kdump.$$IP.o \
195                                         ;; \
196                                 esac || exit $$?; \
197                         done \
198                         ;; \
199                 *nbsd*) \
200                         touch kdump.o ;; \
201                 *) \
202                         ${CC} $(DBG) -I${TOP_INCDIR}/afs -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR} ${XCFLAGS} -c ${srcdir}/kdump.c ;; \
203         esac ;
204
205 kdump64.o : kdump.c ${INCLS} AFS_component_version_number.c
206         -set -x; \
207         case ${SYS_NAME} in \
208         sun4x_5[789] | hp_ux11* |sunx86_5[789] ) \
209                 ${CC} $(DBG) -I${TOP_INCDIR}/afs -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR} ${XCFLAGS64} -o kdump64.o -c ${srcdir}/kdump.c ;; \
210         esac
211
212 kdump:  kdump.o
213         -set -x; \
214         case ${SYS_NAME} in \
215         sun4c_51 | sun4c_52 | sun4m_51 | sun4m_52 | sun4c_53 | sun4m_53 | sun4_53 | sun4_54 | sun4c_54 | sun4m_54 | sunx86_5? ) \
216                 ${CC} -g -o kdump kdump.o ${TOP_LIBDIR}/libcmd.a  ${TOP_LIBDIR}/util.a /usr/lib/libkvm.a -lelf ${XLIBS} ;; \
217         sun*_5? ) \
218                 ${CC} -g -o kdump kdump.o ${TOP_LIBDIR}/libcmd.a  ${TOP_LIBDIR}/util.a  ${XLIBELFA} ${XLIBKVM} ${XLIBS} ;; \
219         sgi_6? ) \
220                 for f in ../libafs/STATIC.IP*/CPU_KDEFS; \
221                 do      IP=`expr "$$f" : '../libafs/STATIC.\(IP..\)'`; \
222                         CPU_KDEFS=`sed 's/-mips.//' $$f`; \
223                         echo IP = $$IP; \
224                         echo CPU_KDEFS = $$CPU_KDEFS; \
225                         case $$CPU_KDEFS in \
226                         *-64*)  ${CC} ${XCFLAGS64} $(DBG) \
227                                         $$CPU_KDEFS \
228                                         -o kdump.$$IP kdump.$$IP.o \
229                                         ${TOP_LIBDIR}/libcmd64.a -lelf \
230                                 ;; \
231                         *)      ${CC} ${XCFLAGS} $(DBG) \
232                                         $$CPU_KDEFS \
233                                         -o kdump.$$IP kdump.$$IP.o \
234                                         ${TOP_LIBDIR}/libcmd.a -lelf \
235                                 ;; \
236                         esac || exit $$? ; \
237                 done ;; \
238         *linux* ) \
239                 ${CC} $(DBG) -o kdump-${LINUX_VERSION} kdump-${LINUX_VERSION}.o ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a ${XLIBS} ;; \
240         alpha_osf1 | alpha_osf20 |  alpha_osf30 | alpha_osf32 | alpha_osf32c | alpha_dux??) \
241                 ${CC} $(DBG) -o kdump kdump.o ${TOP_LIBDIR}/libcmd.a  ${TOP_LIBDIR}/util.a ${XLIBS} -ll -lmld;; \
242         ncrx86_* ) ${CC} $(DBG) -o kdump kdump.o ${TOP_LIBDIR}/libcmd.a  ${TOP_LIBDIR}/util.a -lelf ${XLIBS} ;; \
243         *nbsd*) touch kdump ;; \
244         * )     ${CC} $(DBG) -o kdump kdump.o ${TOP_LIBDIR}/libcmd.a  ${TOP_LIBDIR}/util.a ${XLIBS} ;; \
245         esac
246
247 ## kdump to read from 64 bit kernel dumps
248
249 kdump64 : kdump64.o
250         -set -x; \
251         case ${SYS_NAME} in \
252         sun4x_5[789] | hp_ux11* |sunx86_5[789] )  \
253                 ${CC} $(DBG) ${XCFLAGS64} -o kdump64 kdump64.o ${TOP_LIBDIR}/libcmd64.a ${XLIBELFA} ${XLIBKVM} ${XLIBS} ;; \
254         esac
255
256 #
257 # Install targets
258 #
259 install: \
260         ${DESTDIR}${bindir}/fs \
261         ${DESTDIR}${bindir}/livesys \
262         ${DESTDIR}${afssrvbindir}/fs \
263         ${DESTDIR}${bindir}/up \
264         ${DESTDIR}${sbindir}/fstrace \
265         ${DESTDIR}${bindir}/cmdebug \
266         ${DESTDIR}${sbindir}/kdump \
267         ${DESTDIR}${sbindir}/kdump64
268
269 #
270 # Misc targets
271 #
272
273 clean:
274         $(RM) -f *.o *.a up fs kdump-* kdump kdump64 core cmdebug AFS_component_version_number.c fstrace gcpags
275
276 test:
277         cd test; $(MAKE)
278
279 include ../config/Makefile.version
280
281 ${DESTDIR}${bindir}/fs: fs
282         ${INSTALL} -s $? $@
283
284 ${DESTDIR}${bindir}/livesys: livesys
285         ${INSTALL} -s $? $@
286
287 ${DESTDIR}${afssrvbindir}/fs: fs
288         ${INSTALL} -s $? $@
289
290 ${DESTDIR}${bindir}/up: up
291         ${INSTALL} -s $? $@
292
293 ${DESTDIR}${sbindir}/fstrace: fstrace
294         ${INSTALL} -s $? $@
295
296 ${DESTDIR}${bindir}/cmdebug: cmdebug
297         ${INSTALL} -s $? $@
298
299 ${DESTDIR}${sbindir}/kdump: kdump
300         -set -x; \
301         case ${SYS_NAME} in \
302         sgi_6? ) \
303                 ${INSTALLex} -f kdump.sh.sgi_ipnos $@; \
304                 ln -fs kdump ${DESTDIR}${sbindir}/kdump32; \
305                 ln -fs kdump.IP20 ${DESTDIR}${sbindir}/kdump.IP22; \
306                 ln -fs kdump.IP20 ${DESTDIR}${sbindir}/kdump.IP32; \
307                 for f in kdump.IP??; \
308                         do ${INSTALL} -s $$f ${DESTDIR}${sbindir}/$$f || exit $$? ; \
309                 done ;; \
310         sun*_5[789] ) \
311                 ${INSTALLex} -f kdump.sh.solaris7 $@; \
312                 ${INSTALL} -s -f $? ${DESTDIR}${sbindir}/kdump32;; \
313         *linux* ) \
314                 ${INSTALL} -s kdump-${LINUX_VERSION} ${DESTDIR}${sbindir}/kdump-${LINUX_VERSION} ;; \
315         hp_ux11* ) \
316                 ${INSTALLex} -f kdump.sh.hp_ux11 $@; \
317                 ${INSTALL} -s -f $? ${DESTDIR}${sbindir}/kdump32;; \
318         *) \
319                 ${INSTALL} -s $? $@ ;; \
320         esac
321
322 ${DESTDIR}${sbindir}/kdump64: kdump64
323         -set -x; \
324         case ${SYS_NAME} in \
325         sun4x_5[789] | hp_ux11* ) \
326                 ${INSTALL} -s $? $@ ;;\
327         * ) \
328                 echo skipping kdump64 for ${SYS_NAME} ;; \
329         esac
330
331 dest: \
332         ${DEST}/bin/fs \
333         ${DEST}/bin/livesys \
334         ${DEST}/root.server/usr/afs/bin/fs \
335         ${DEST}/bin/up \
336         ${DEST}/etc/fstrace \
337         ${DEST}/bin/cmdebug \
338         ${DEST}/etc/kdump \
339         ${DEST}/etc/kdump64
340