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