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