995f79177e5ab9735571a9793185555c2df710a7
[openafs.git] / src / tbutc / 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 # */
9
10 DESTDIR=@DESTDIR@
11 SRCDIR=@SRCDIR@
12 TOP_SRCDIR=@TOP_SRCDIR@
13 SYS_NAME=@AFS_SYSNAME@
14
15 SHELL    =/bin/sh
16
17 include ../config/Makefile.${SYS_NAME}
18
19 CC      =${MT_CC}
20 CFLAGS  = ${DBG} -w -I${TOP_SRCDIR}/config ${MT_CFLAGS}
21
22 LDFLAGS = ${DBG} ${XLDFLAGS}
23
24 VICED   =../viced
25 VLSERVER=../vlserver
26 LWP     =../lwp
27 LIBACL  =../libacl
28 UTIL    =../util
29 DIR     =../dir
30 VOL     =../vol
31 FSINT   =../fsint
32 BUTM    =../butm
33 BUTC    =../butc
34 BUCOORD = ../bucoord
35 VOLSER  = ../volser
36
37 # ----------------------------------------------------------------
38 # The default is to build butc without using the TSM API libraries. 
39 # To build with TSM support, set XBSA_NOBUILD="". Be sure you have
40 #  the TSM API version 3.7.1 installed.
41 # ----------------------------------------------------------------
42 XBSA_NOBUILD="true"
43
44 BUCOORDOBJS=ubik_db_if.o ${BUCOORD}/volstub.o ${BUCOORD}/dlq.o \
45             ${BUCOORD}/status.o ${BUCOORD}/bucoord_errs.o
46
47 VOLSERLIBOBJ=${VOLSER}/volint.cs.o  vsprocs.o              ${VOLSER}/vsutils.o \
48             ${VOLSER}/lockprocs.o  ${VOLSER}/volint.xdr.o ${VOLSER}/volerr.o \
49             ${VOLSER}/volint.ss.o  AFS_component_version_number.o 
50 VOLSERLIBS=libvolser.a
51
52 LWPOBJS    =lock.o
53
54 BUTMOBJS   =file_tm.o
55 BUTMLIBS   =libbutm.a
56 BUTMINCLS  =${SRCDIR}include/afs/com_err.h ${SRCDIR}include/afs/butm.h
57 BUTMINCLUDE=-I${SRCDIR}include
58
59 BUTCOBJS   =dbentries.o tcprocs.o lwps.o tcmain.o list.o recoverDb.o \
60             tcudbprocs.o dump.o tcstatus.o butc_xbsa.o \
61             ${LWPOBJS} ${BUCOORDOBJS}
62 BUTCINCLS  =${SRCDIR}include/afs/partition.h \
63             ${SRCDIR}include/afs/volume.h \
64             ${SRCDIR}include/afs/vlserver.h \
65             ${SRCDIR}include/rx/rx.h \
66             ${SRCDIR}include/rx/xdr.h \
67             ${SRCDIR}include/afs/keys.h \
68             ${SRCDIR}include/afs/cellconfig.h \
69             ${SRCDIR}include/ubik.h \
70             ${SRCDIR}include/afs/cmd.h \
71             ${SRCDIR}include/afs/butc.h \
72             ${SRCDIR}include/afs/tcdata.h \
73             ${SRCDIR}include/afs/bubasics.h \
74             ${SRCDIR}include/afs/butm.h
75 BUTCINCLUDE=-I. -I${SRCDIR}include
76 BUTCLIBS   =${SRCDIR}lib/afs/libbudb.a \
77             ${SRCDIR}lib/afs/libbubasics.a \
78             ${VOLSERLIBS} \
79             ${BUTMLIBS} \
80             ${SRCDIR}lib/afs/libvldb.a \
81             ${SRCDIR}/lib/libafsauthent.a \
82             ${SRCDIR}/lib/libafsrpc.a \
83             ${SRCDIR}lib/afs/libcmd.a \
84             ${SRCDIR}lib/afs/util.a \
85             ${SRCDIR}lib/afs/libusd.a \
86             ${SRCDIR}lib/afs/libprocmgmt.a \
87             ${SRCDIR}lib/librx.a
88
89 include ../config/Makefile.version
90
91 #----------------------------------------------- BUTC
92
93 butc: pre ${BUTCOBJS} ${BUTCLIBS}
94         if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
95         else                                xbsaflags=""; \
96         fi; \
97         if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
98         else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
99         fi; \
100         if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
101         ${CC} ${CFLAGS} $$xbsaflags ${BUTCOBJS} ${BUTCLIBS} $$hdrdir ${MTLIBS} ${XLIBS} -o butc
102
103 dbentries.o: ${BUTC}/dbentries.c ${BUTCINCLS}
104         if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
105         else                                xbsaflags=""; \
106         fi; \
107         if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
108         else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
109         fi; \
110         if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
111         ${CC} ${CFLAGS} $$xbsaflags ${BUTCINCLUDE} $$hdrdir -c ${BUTC}/dbentries.c
112
113 tcprocs.o: ${BUTC}/tcprocs.c ${BUTCINCLS}
114         if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
115         else                                xbsaflags=""; \
116         fi; \
117         if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
118         else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
119         fi; \
120         if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
121         ${CC} ${CFLAGS} $$xbsaflags ${BUTCINCLUDE} $$hdrdir -c ${BUTC}/tcprocs.c
122
123 lwps.o: ${BUTC}/lwps.c ${BUTCINCLS}
124         if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
125         else                                xbsaflags=""; \
126         fi; \
127         if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
128         else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
129         fi; \
130         if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
131         ${CC} ${CFLAGS} $$xbsaflags ${BUTCINCLUDE} $$hdrdir -c ${BUTC}/lwps.c
132
133 tcmain.o: ${BUTC}/tcmain.c ${BUTCINCLS} AFS_component_version_number.c
134         if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
135         else                                xbsaflags=""; \
136         fi; \
137         if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
138         else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
139         fi; \
140         if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
141         ${CC} ${CFLAGS} $$xbsaflags ${BUTCINCLUDE} $$hdrdir -c ${BUTC}/tcmain.c
142
143 list.o: ${BUTC}/list.c ${BUTCINCLS}
144         if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
145         else                                xbsaflags=""; \
146         fi; \
147         if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
148         else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
149         fi; \
150         if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
151         ${CC} ${CFLAGS} $$xbsaflags ${BUTCINCLUDE} $$hdrdir -c ${BUTC}/list.c
152
153 recoverDb.o: ${BUTC}/recoverDb.c ${BUTCINCLS}
154         if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
155         else                                xbsaflags=""; \
156         fi; \
157         if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
158         else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
159         fi; \
160         if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
161         ${CC} ${CFLAGS} $$xbsaflags ${BUTCINCLUDE} $$hdrdir -c ${BUTC}/recoverDb.c
162
163 tcudbprocs.o: ${BUTC}/tcudbprocs.c ${BUTCINCLS}
164         if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
165         else                                xbsaflags=""; \
166         fi; \
167         if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
168         else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
169         fi; \
170         if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
171         ${CC} ${CFLAGS} $$xbsaflags ${BUTCINCLUDE} $$hdrdir -c ${BUTC}/tcudbprocs.c
172
173 dump.o: ${BUTC}/dump.c ${BUTCINCLS}
174         if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
175         else                                xbsaflags=""; \
176         fi; \
177         if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
178         else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
179         fi; \
180         if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
181         ${CC} ${CFLAGS} $$xbsaflags ${BUTCINCLUDE} $$hdrdir -c ${BUTC}/dump.c
182
183 tcstatus.o: ${BUTC}/tcstatus.c ${BUTCINCLS}
184         if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
185         else                                xbsaflags=""; \
186         fi; \
187         if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
188         else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
189         fi; \
190         if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
191         ${CC} ${CFLAGS} $$xbsaflags ${BUTCINCLUDE} $$hdrdir -c ${BUTC}/tcstatus.c
192
193 butc_xbsa.o: ${BUTC}/butc_xbsa.c ${BUTC}/butc_xbsa.h ${BUTCINCLS}
194         if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
195         else                                xbsaflags=""; \
196         fi; \
197         if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
198         else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
199         fi; \
200         if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
201         ${CC} ${CFLAGS} $$xbsaflags ${BUTCINCLUDE} $$hdrdir -c ${BUTC}/butc_xbsa.c
202
203 #----------------------------------------------- BUCOORD
204
205 ubik_db_if.o: ${BUCOORD}/ubik_db_if.c
206         if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
207         else                                xbsaflags=""; \
208         fi; \
209         if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
210         else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
211         fi; \
212         if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
213         ${CC} ${CFLAGS} $$xbsaflags ${BUTCINCLUDE} $$hdrdir -c ${BUCOORD}/ubik_db_if.c
214
215 #----------------------------------------------- VOLSER
216 # Build the libvolser.a library here. The file compiled
217 # for is is vsprocs.c. The rest are from the VOLSER dir.
218
219 libvolser.a: vsprocs.o ${VOLSERLIBOBJ}
220         -rm -f libvolser.a
221         ar rv libvolser.a ${VOLSERLIBOBJ}
222         $(RANLIB) libvolser.a
223
224 vsprocs.o: ${VOLSER}/vsprocs.c
225         if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
226         else                                xbsaflags=""; \
227         fi; \
228         if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
229         else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
230         fi; \
231         if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
232         ${CC} ${CFLAGS} $$xbsaflags ${BUTCINCLUDE} $$hdrdir -c ${VOLSER}/vsprocs.c
233
234 #----------------------------------------------- LWP
235
236 lock.o: ${LWP}/lock.c
237         if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
238         else                                xbsaflags=""; \
239         fi; \
240         if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
241         else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
242         fi; \
243         if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
244         ${CC} ${CFLAGS} $$xbsaflags ${BUTCINCLUDE} $$hdrdir -c ${LWP}/lock.c
245
246 #----------------------------------------------- BUTC
247
248 file_tm.o: ${BUTM}/file_tm.c ${BUTMINCLS}
249         if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
250         else                                xbsaflags=""; \
251         fi; \
252         if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
253         else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
254         fi; \
255         if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
256         ${CC} ${CFLAGS} $$xbsaflags ${BUTMINCLUDE} $$hdrdir -c ${BUTM}/file_tm.c
257
258 libbutm.a: ${BUTMOBJS} AFS_component_version_number.o
259         -rm -f libbutm.a
260         ${AR} rv libbutm.a $(BUTMOBJS) AFS_component_version_number.o
261         ${RANLIB} libbutm.a
262
263 #-----------------------------------------------
264 clean:
265         rm -f *.o *.a core AFS_component_version_number.c butc
266
267 pre:
268         if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
269         else                                xbsaflags=""; \
270         fi; \
271         if [ "$$xbsaflags" = "" ]; then \
272                 echo 'Will not build with XBSA'; \
273         else \
274                 if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir="${XBSADIR}" ; \
275                 else                               hdrdir="${XBSA_HDRDIR}" ; \
276                 fi; \
277                 if test "$$hdrdir" != "" -a ! -f "$$hdrdir/xbsa.h"; then \
278                         echo '*** This build of butc cannot support XBSA because'; \
279                         echo '*** the required header file "'$$hdrdir'/xbsa.h"'; \
280                         echo '*** does not exist. If you know the pathname to the'; \
281                         echo '*** header file, then use XBSA_HDRDIR="<path>" as a make'; \
282                         echo '*** argument.'; \
283                         echo '*** If you do not want to build an XBSA version of butc,'; \
284                         echo '*** then use XBSA_NOBUILD="true" as a make argument.'; \
285                         exit 2; \
286                 else \
287                         echo 'Will use XBSA header files from "'$$hdrdir'" (XBSA_HDRDIR)'; \
288                 fi; \
289         fi;
290
291 all: butc ${BUTMLIBS}
292 install install.noversion: all
293         ${INSTALL} butc ${DESTDIR}etc/butc
294
295 noversion: install
296 system: install