787e1eab29ad385f060b4a61d4af9bf6b23ad772
[openafs.git] / src / venus / Makefile
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 SHELL = /bin/sh
9 COMPONENT=venus
10 include ../config/Makefile.${SYS_NAME}
11
12 INSTALL = ${DESTDIR}bin/install
13 INSTALLex = ${DESTDIR}bin/install -m 755
14 CCXPG2= /usr/xpg2bin/cc
15
16 CFLAGS = ${OPTMZ} -I${DESTDIR}include -I${SRCDIR}include ${XCFLAGS}
17
18 INCLS = ${DESTDIR}include/afs/afsint.h \
19         ${DESTDIR}include/afs/cmd.h \
20         ${DESTDIR}include/afs/afsutil.h
21
22 VLIB = ${DESTDIR}lib/afs/
23
24 LIB = ${DESTDIR}lib/
25
26 FSLIBS = ${VLIB}libsys.a \
27          ${VLIB}libvldb.a \
28          ${LIB}libubik.a \
29          ${VLIB}vlib.a \
30          ${VLIB}libauth.a \
31          ${DESTDIR}lib/librxkad.a \
32          ${VLIB}libcom_err.a \
33          ${VLIB}libcmd.a \
34          ${VLIB}libkauth.a \
35          ${DESTDIR}lib/libdes.a \
36          ${LIB}librx.a \
37          ${VLIB}libsys.a \
38          $(VLIB)util.a \
39          ${LIB}liblwp.a \
40          ${VLIB}libaudit.a
41
42 CMLIBS = ${VLIB}libsys.a \
43          ${VLIB}libafsint.a \
44          ${DESTDIR}lib/librxkad.a \
45          ${VLIB}libauth.a \
46          ${VLIB}libcom_err.a \
47          ${VLIB}libcmd.a \
48          ${LIB}librx.a \
49          ${VLIB}libsys.a \
50          $(VLIB)util.a \
51          ${LIB}liblwp.a 
52
53 LIBS = ${FSLIBS} 
54
55 include ../config/Makefile.version
56
57 cacheout: cacheout.o
58         $(CC) ${CFLAGS} -o cacheout cacheout.o ${LIBS} ${XLIBS} ${CMLIBS}
59
60 cacheout.o: cacheout.c
61
62 all: fs up cmdebug fstrace kdump gcpags kdump64
63
64 ${DESTDIR}bin/fs ${DESTDIR}root.server/usr/afs/bin/fs: fs
65         ${INSTALL} -s $? $@
66
67 ${DESTDIR}bin/up: up
68         ${INSTALL} -s $? $@
69
70 ${DESTDIR}etc/fstrace: fstrace
71         ${INSTALL} -s $? $@
72
73 ${DESTDIR}bin/cmdebug: cmdebug
74         ${INSTALL} -s $? $@
75
76 ${DESTDIR}etc/kdump: kdump
77         set -x; \
78         case ${SYS_NAME} in \
79         sgi_6? ) \
80                 ${INSTALLex} -f kdump.sh.sgi_ipnos $@; \
81                 ln -fs kdump ${DESTDIR}etc/kdump32; \
82                 ln -fs kdump.IP20 ${DESTDIR}etc/kdump.IP22; \
83                 ln -fs kdump.IP20 ${DESTDIR}etc/kdump.IP32; \
84                 for f in kdump.IP??; \
85                 do ${INSTALL} -s $$f ${DESTDIR}etc/$$f || exit $$? ; \
86                 done ;; \
87         sun4x_57 ) \
88                 ${INSTALLex} -f kdump.sh.solaris7 $@; \
89                 ${INSTALL} -s -f $? ${DESTDIR}etc/kdump32;; \
90         *linux* ) \
91                 for lv in ${LINUX_VERS}; do \
92                         ${INSTALL} -s kdump-$$lv ${DESTDIR}etc/kdump-$$lv ; \
93                 done ;; \
94         hp_ux11* ) \
95                 ${INSTALLex} -f kdump.sh.hp_ux11 $@; \
96                 ${INSTALL} -s -f $? ${DESTDIR}etc/kdump32;; \
97         *) \
98                 ${INSTALL} -s $? $@ ;; \
99         esac
100
101 ${DESTDIR}etc/kdump64: kdump64
102         set -x; \
103         case ${SYS_NAME} in \
104         sun4x_57 | hp_ux11* ) \
105                 ${INSTALL} -s $? $@ ;;\
106         * ) \
107                 echo skipping kdump64 for ${SYS_NAME} ;; \
108         esac
109
110
111 install: all ${DESTDIR}bin/fs ${DESTDIR}root.server/usr/afs/bin/fs \
112         ${DESTDIR}bin/up ${DESTDIR}etc/fstrace ${DESTDIR}bin/cmdebug \
113         ${DESTDIR}etc/kdump ${DESTDIR}etc/kdump64
114
115 system: install
116
117 up.o: up.c AFS_component_version_number.c
118
119 up: up.o
120         ${CC} ${CFLAGS} -g -o up up.o ${LIBS} ${XLIBS}
121
122 fs.o: fs.c ${INCLS} AFS_component_version_number.c
123
124 fs: fs.o $(LIBS)
125         ${CC} ${CFLAGS} -g -o fs fs.o ${DESTDIR}lib/afs/libprot.a $(LIBS) ${XLIBS}
126
127 twiddle: twiddle.c $(LIBS)
128         ${CC} -g -o twiddle $(CFLAGS) twiddle.c $(LIBS) ${XLIBS}
129
130 gcpags: gcpags.c $(LIBS)
131         ${CC} -g -o gcpags $(CFLAGS) gcpags.c $(LIBS) ${XLIBS}
132
133 whatfid.o: whatfid.c ${INCLS} AFS_component_version_number.c
134
135 whatfid: whatfid.o ${LIBS}
136         ${CC} ${CFLAGS} -g -o whatfid whatfid.o ${LIBS} ${XLIBS}
137
138 fstrace.o: fstrace.c AFS_component_version_number.c
139         case ${SYS_NAME} in \
140                 sun4_411 | sun4c_411 | sun4m_412 ) \
141                         ${CCXPG2} -g -I${DESTDIR}include -I${SRCDIR}include -c fstrace.c ;; \
142                 * ) \
143                         ${CC} ${CFLAGS} -g -I${DESTDIR}include -I${SRCDIR}include -c fstrace.c ;; \
144         esac
145
146 fstrace: fstrace.o
147         case ${SYS_NAME} in \
148                 pmax_ul43 | pmax_ul43a ) \
149                         ${CC} ${CFLAGS} -o fstrace fstrace.o ${VLIB}/libsys.a ${VLIB}libcmd.a ${VLIB}util.a /usr/lib/libi.a ;; \
150                 sun4_411 | sun4c_411 | sun4m_412 ) \
151                         ${CCXPG2} ${CFLAGS} -g -o fstrace fstrace.o ${VLIB}/libsys.a ${VLIB}libcmd.a ${VLIB}util.a ;; \
152                 hp700_ux100 | hp800_ux100 | hp?00_ux10? | hp_ux10? | hp_ux11?) \
153                         ${CC}  -o fstrace fstrace.o ${VLIB}/libsys.a ${VLIB}libcmd.a ${VLIB}util.a ;; \
154                 * ) \
155                         ${CC} ${CFLAGS} -o fstrace fstrace.o ${VLIB}/libsys.a ${VLIB}libcmd.a ${VLIB}util.a ;; \
156         esac
157
158 cmdebug.o: cmdebug.c ${INCLS} AFS_component_version_number.c
159
160 cmdebug: cmdebug.o ${CMLIBS}
161         $(CC) -o cmdebug cmdebug.o ${CFLAGS} ${CMLIBS} ${XLIBS}
162
163 kdump.o: kdump.c ${INCLS} AFS_component_version_number.c
164         set -x; \
165         case ${SYS_NAME} in \
166                 *linux* ) \
167                         for lv in ${LINUX_VERS}; do \
168                                 ${CC} -g -I${LINUX_SRCDIR}$$lv/include -I${DESTDIR}include -I${SRCDIR}include ${XCFLAGS} -o kdump-$$lv.o -c kdump.c ; \
169                         done ;; \
170                 alpha_osf1 | alpha_osf20 |  alpha_osf30 | alpha_osf32 | alpha_osf32c| alpha_dux?? ) \
171                         ${CC} -g ${CFLAGS} -I/usr/sys/include -I/usr/sys/BINARY -I/usr/sys/AFS -DDEBUGGER -c kdump.c ;;\
172                 sgi_6? ) \
173                         for f in ../libafs/STATIC.IP*/CPU_KDEFS; \
174                         do      IP=`expr "$$f" : '../libafs/STATIC.\(IP..\)'`; \
175                                 CPU_KDEFS=`sed 's/-mips.//' $$f`; \
176                                 echo IP = $$IP; \
177                                 echo CPU_KDEFS = $$CPU_KDEFS; \
178                                 case $$CPU_KDEFS in \
179                                 *-64*)  ${CC} -D_KMEMUSER -woff 1178 \
180                                                 -g -I${DESTDIR}include \
181                                                 $$CPU_KDEFS \
182                                                 ${XCFLAGS64} \
183                                                 -c kdump.c -o kdump.$$IP.o \
184                                         ;; \
185                                 *)      ${CC} -D_KMEMUSER -woff 1178 \
186                                                 -g -I${DESTDIR}include \
187                                                 $$CPU_KDEFS \
188                                                 ${XCFLAGS} -DAFS_32BIT_KERNEL_ENV \
189                                                 -c kdump.c -o kdump.$$IP.o \
190                                         ;; \
191                                 esac || exit $$?; \
192                         done \
193                         ;; \
194                 *) \
195                         ${CC} -g -I${DESTDIR}include -I${SRCDIR}include ${XCFLAGS} -c kdump.c ;; \
196         esac ;
197
198 kdump64.o : kdump.c ${INCLS} AFS_component_version_number.c
199         set -x; \
200         case ${SYS_NAME} in \
201         sun4x_57 | hp_ux11* ) \
202                 ${CC} -g -I${DESTDIR}include -I${SRCDIR}include ${XCFLAGS64} -o kdump64.o -c kdump.c ;; \
203         esac
204
205 kdump:  kdump.o
206         set -x; \
207         case ${SYS_NAME} in \
208         sun4c_51 | sun4c_52 | sun4m_51 | sun4m_52 | sun4c_53 | sun4m_53 | sun4_53 | sun4_54 | sun4c_54 | sun4m_54 | sunx86_54) \
209                 ${CC} -g -o kdump kdump.o ${DESTDIR}lib/afs/libcmd.a  ${DESTDIR}lib/afs/util.a /usr/lib/libkvm.a -lelf ${XLIBS} ;; \
210         sun4x_5? ) \
211                 ${CC} -g -o kdump kdump.o ${DESTDIR}lib/afs/libcmd.a  ${DESTDIR}lib/afs/util.a  ${XLIBELFA}  ${XLIBKVM} ${XLIBS} ;; \
212         sgi_6? ) \
213                 for f in ../libafs/STATIC.IP*/CPU_KDEFS; \
214                 do      IP=`expr "$$f" : '../libafs/STATIC.\(IP..\)'`; \
215                         CPU_KDEFS=`sed 's/-mips.//' $$f`; \
216                         echo IP = $$IP; \
217                         echo CPU_KDEFS = $$CPU_KDEFS; \
218                         case $$CPU_KDEFS in \
219                         *-64*)  ${CC} ${XCFLAGS64} -g \
220                                         $$CPU_KDEFS \
221                                         -o kdump.$$IP kdump.$$IP.o \
222                                         ${DESTDIR}lib/afs/libcmd64.a -lelf \
223                                 ;; \
224                         *)      ${CC} ${XCFLAGS} -g \
225                                         $$CPU_KDEFS \
226                                         -o kdump.$$IP kdump.$$IP.o \
227                                         ${DESTDIR}lib/afs/libcmd.a -lelf \
228                                 ;; \
229                         esac || exit $$? ; \
230                 done ;; \
231         *linux* ) \
232                 for lv in ${LINUX_VERS}; do \
233                         ${CC} -g -o kdump-$$lv kdump-$$lv.o ${DESTDIR}lib/afs/libcmd.a  ${DESTDIR}lib/afs/util.a ${XLIBS} ; \
234                 done ;; \
235         alpha_osf1 | alpha_osf20 |  alpha_osf30 | alpha_osf32 | alpha_osf32c | alpha_dux??) \
236                 ${CC} -g -o kdump kdump.o ${DESTDIR}lib/afs/libcmd.a  ${DESTDIR}lib/afs/util.a ${XLIBS} -ll -lmld;; \
237         ncrx86_* ) ${CC} -g -o kdump kdump.o ${DESTDIR}lib/afs/libcmd.a  ${DESTDIR}lib/afs/util.a -lelf ${XLIBS} ;; \
238         * )     ${CC} -g -o kdump kdump.o ${DESTDIR}lib/afs/libcmd.a  ${DESTDIR}lib/afs/util.a ${XLIBS} ;; \
239         esac
240
241 ## kdump to read from 64 bit kernel dumps
242
243 kdump64 : kdump64.o
244         set -x; \
245         case ${SYS_NAME} in \
246         sun4x_57 | hp_ux11* )  \
247                 ${CC} -g ${XCFLAGS64} -o kdump64 kdump64.o ${DESTDIR}lib/afs/libcmd64.a ${XLIBELFA}  ${XLIBKVM} ${XLIBS} ;; \
248         esac
249
250 clean:
251         rm -f *.o *.a up fs core cmdebug AFS_component_version_number.c
252
253 beancount:
254         wc -l *.c *.h
255
256 test:
257         cd test; $(MAKE)
258