e7c2efd8cff5566fd389be3dbfa8dcd9378bee91
[openafs.git] / src / sys / Makefile.in
1 # API version. When something changes, increment as appropriate. 
2 # Ignore at your own risk.
3 LIBAFSSETPAGMAJOR=1
4 LIBAFSSETPAGMINOR=0
5
6 # Copyright 2000, International Business Machines Corporation and others.
7 # All Rights Reserved.
8
9 # This software has been released under the terms of the IBM Public
10 # License.  For details, see the LICENSE file in the top-level source
11 # directory or online at http://www.openafs.org/dl/license10.html
12 #
13 # Portions Copyright (c) 2003 Apple Computer, Inc.
14
15 srcdir=@srcdir@
16 include @TOP_OBJDIR@/src/config/Makefile.config
17
18 CFLAGS=-I. -I${srcdir} ${DBUG} -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR}  ${XCFLAGS} ${ARCHFLAGS}
19 SFLAGS=-I${TOP_INCDIR}
20 LIBS=libsys.a ${TOP_LIBDIR}/librx.a libsys.a ${TOP_LIBDIR}/liblwp.a ${TOP_LIBDIR}/util.a ${XLIBS}
21
22 OBJECTS= afssyscalls.o setpag.o glue.o syscall.o
23 SHLIBOBJS = picobj/setpag.o picobj/glue.o syscall.o
24 RMTOBJS=rmtsysnet.o rmtsysc.o rmtsys.cs.o rmtsys.xdr.o rmtsys.ss.o rmtsyss.o 
25
26 LIBAFSSETPAG = libafssetpag.${SHLIB_SUFFIX}.${LIBAFSSETPAGMAJOR}.${LIBAFSSETPAGMINOR}
27 LIBAFSSETPAG_DARWIN = libafssetpag.${LIBAFSSETPAGMAJOR}.${SHLIB_SUFFIX}
28
29 all: \
30     rmtsysd \
31     pagsh \
32     pagsh.krb \
33     ${TOP_INCDIR}/afs/afssyscalls.h \
34     ${TOP_INCDIR}/afs/afs.exp \
35     ${TOP_INCDIR}/afs/xfsattrs.h \
36     ${TOP_LIBDIR}/afs.exp \
37     ${TOP_LIBDIR}/libsys.a \
38     ${KERNELDIR}/afs \
39     ${KERNELDIR}/afs/xfsattrs.h \
40     ${UKERNELDIR}/afs \
41     ${UKERNELDIR}/afs/afsl.exp
42         @set -x; case ${SYS_NAME} in \
43         *_darwin_*) \
44             ${MAKE} '${TOP_LIBDIR}/${LIBAFSSETPAG_DARWIN}';; \
45         *) \
46             ${MAKE} '${TOP_LIBDIR}/${LIBAFSSETPAG}';; \
47         esac
48
49 libsys.a: ${OBJECTS} ${RMTOBJS} afsl.exp AFS_component_version_number.o
50         -$(RM) -f $@
51         $(AR) crv $@ ${OBJECTS} ${RMTOBJS} \
52                 AFS_component_version_number.o ${LIBSYS_AIX_EXP}
53         $(RANLIB) $@
54         @set -x; case "${SYS_NAME}" in                          \
55                 rs_aix*)                                \
56                         $(AR) crv $@ afsl.exp;;         \
57         esac
58
59 ${LIBAFSSETPAG}: ${SHLIBOBJS}
60         @set -x; case ${SYS_NAME} in \
61         *_linux*) \
62             ${SHLIB_LINKER} -Wl,-h,libafssetpag.so.${LIBAFSSETPAGMAJOR} \
63                 -o ${LIBAFSSETPAG} -Wl,--version-script=${srcdir}/mapfile \
64                 ${SHLIBOBJS};; \
65         rs_aix4*) \
66             ${SHLIB_LINKER} -o ${LIBAFSSETPAG} ${SHLIBOBJS} \
67                 -bE:afssetpag.exp;; \
68         sun*_5*) \
69             ${SHLIB_LINKER} -h libafssetpag.so.${LIBAFSSETPAGMAJOR} \
70                 -o ${LIBAFSSETPAG} ${SHLIBOBJS};; \
71         *) \
72             ${SHLIB_LINKER} -o ${LIBAFSSETPAG} ${SHLIBOBJS};; \
73         esac
74
75 ${LIBAFSSETPAG_DARWIN}: ${SHLIBOBJS}
76         ${SHLIB_LINKER} -o ${LIBAFSSETPAG_DARWIN} ${ARCHFLAGS} -install_name ${libdir}/${LIBAFSSETPAG_DARWIN} -compatibility_version ${LIBAFSSETPAGMAJOR} -current_version ${LIBAFSSETPAGMAJOR}.${LIBAFSSETPAGMINOR} ${SHLIBOBJS}
77
78 tests:  pagsh pagsh.krb fixit iinc idec icreate iopen istat rmtsysd
79
80 syscall.o: syscall.s
81         @set -x; case "$(SYS_NAME)" in \
82          sun4c_51 | sun4c_52 | sun4m_51 | sun4m_52 | sun4c_53 | sun4m_53  | sun4_53 | sun4_52 | sun4_54 | sun4c_54 | sun4m_54 | sun4x_5? | sun4x_5?? | sunx86_5? | sunx86_5?? ) \
83                 $(CPP) -P ${SFLAGS} ${srcdir}/syscall.s syscall.ss; \
84                 as -o syscall.o syscall.ss;             \
85                 $(RM) syscall.ss;;                              \
86          sgi_* |*_darwin* ) \
87                 ${CC} ${CFLAGS} -c ${srcdir}/syscall.s;;          \
88          alpha_osf1 | alpha_osf20 |  alpha_osf30 | alpha_osf32 | alpha_osf32c | alpha_dux?? ) \
89                 ${AS} -P ${CFLAGS} -D_NO_PROTO -DMACH -DOSF -nostdinc -traditional -DASSEMBLER ${srcdir}/syscall.s; \
90                 ${AS} -o syscall.o syscall.i; \
91                 $(RM) -f syscall.ss syscall.i;; \
92          hp_ux11? ) \
93                 touch syscall.o;; \
94          amd64_fbsd*|i386_*bsd*|*nbsd*) \
95                 ${CCOBJ} -E ${SFLAGS} syscall.s > syscall.S ; \
96                 ${AS} syscall.S -o syscall.o ;  \
97                 $(RM) -f syscall.S ;;\
98          *) \
99                 $(CPP) -P ${SFLAGS} ${srcdir}/syscall.s syscall.ss; \
100                 as -o syscall.o syscall.ss;             \
101                 $(RM) syscall.ss;;                              \
102         esac
103
104 afssyscalls.o: afssyscalls.c afssyscalls.h
105         ${CCOBJ} ${CFLAGS} -c ${srcdir}/afssyscalls.c
106
107 glue.o: glue.c afssyscalls.h
108         ${CCOBJ} ${CFLAGS} -c ${srcdir}/glue.c
109
110 setpag.o: setpag.c afssyscalls.h
111         ${CCOBJ} ${CFLAGS} -c ${srcdir}/setpag.c
112
113 picobj: afssyscalls.h
114         mkdir -p picobj
115         cp ${srcdir}/afssyscalls.h picobj/afssyscalls.h
116
117 picobj/glue.o: picobj glue.c afssyscalls.h
118         rm -f picobj/glue.c
119         cp ${srcdir}/glue.c picobj/glue.c
120         cd picobj && ${CCOBJ} ${CFLAGS} ${SHLIB_CFLAGS} -c glue.c
121
122 picobj/setpag.o: picobj setpag.c afssyscalls.h
123         rm -f picobj/setpag.c
124         cp ${srcdir}/setpag.c picobj/setpag.c
125         cd picobj && ${CCOBJ} ${CFLAGS} ${SHLIB_CFLAGS} -c setpag.c
126
127 rmtsysnet.o rmtsysc.o rmtsyss.o rmtsysd.o: rmtsys.h
128 rmtsysd: AFS_component_version_number.o afs.exp afsl.exp
129
130 rmtsys.cs.c: rmtsys.xg
131         ${RXGEN} -A -C -o $@ ${srcdir}/rmtsys.xg
132
133 rmtsys.ss.c: rmtsys.xg
134         ${RXGEN} -A -S -o $@ ${srcdir}/rmtsys.xg
135
136 rmtsys.xdr.c: rmtsys.xg
137         ${RXGEN} -A -c -o $@ ${srcdir}/rmtsys.xg
138
139 rmtsys.h: rmtsys.xg
140         ${RXGEN} -A -h -o $@ ${srcdir}/rmtsys.xg
141
142 Krmtsys.cs.c: rmtsys.xg Krmtsys.h
143         ${RXGEN} -A -k -C -o Krmtsys.cs.c ${srcdir}/rmtsys.xg
144
145 Krmtsys.xdr.c: rmtsys.xg
146         ${RXGEN} -A -k -c -o Krmtsys.xdr.c ${srcdir}/rmtsys.xg
147
148 Krmtsys.h: rmtsys.xg
149         ${RXGEN} -A -k -h -o Krmtsys.h ${srcdir}/rmtsys.xg
150
151 rmtsysd: rmtsysd.o libsys.a
152         ${CC} ${CFLAGS} -o rmtsysd rmtsysd.o ${LIBS}
153
154 pagsh:  libsys.a AFS_component_version_number.o
155         ${CC} ${CFLAGS} -c ${srcdir}/pagsh.c
156         ${CC} ${CFLAGS} -o pagsh pagsh.o ${LIBS}
157
158 pagsh.krb: libsys.a
159         ${CC} ${CFLAGS} -c ${srcdir}/pagsh.c -DAFS_KERBEROS_ENV 
160         ${CC} ${CFLAGS} -o pagsh.krb pagsh.o ${LIBS}
161
162 #
163 # Test programs.
164 #
165
166 iinc:   iinc.c 
167         $(CC) -o iinc ${CFLAGS} ${srcdir}/iinc.c ${LIBS}
168
169 idec:   idec.c  AFS_component_version_number.c
170         $(CC) -o idec ${CFLAGS} ${srcdir}/idec.c ${LIBS}
171
172 icreate:icreate.c  AFS_component_version_number.c
173         $(CC) -o icreate ${CFLAGS} ${srcdir}/icreate.c ${LIBS}
174
175 iopen:  iopen.c  AFS_component_version_number.c
176         $(CC) -o iopen ${CFLAGS} ${srcdir}/iopen.c ${LIBS}
177
178 iread:  iread.c  AFS_component_version_number.c
179         ${CC} -o iread ${CFLAGS} ${srcdir}/iread.c ${LIBS}
180
181 iwrite: iwrite.c  AFS_component_version_number.c
182         ${CC} -o iwrite ${CFLAGS} ${srcdir}/iwrite.c ${LIBS}
183
184 istat:  istat.c  AFS_component_version_number.c
185         $(CC) -o istat ${CFLAGS} ${srcdir}/istat.c ${LIBS}
186
187 fixit:  fixit.c AFS_component_version_number.c
188         $(CC) -o fixit ${CFLAGS} ${srcdir}/fixit.c ${LIBS}
189
190
191 xfsinode: xfsinode.c  AFS_component_version_number.c
192         @set -x; case "${SYS_NAME}" in \
193                 sgi_62 | sgi_64 ) \
194                 $(CC) -o xfsinode ${CFLAGS} ${srcdir}/xfsinode.c ${LIBS}
195         esac
196
197 ${TOP_LIBDIR}/${LIBAFSSETPAG}: ${LIBAFSSETPAG}
198         ${INSTALL} ${LIBAFSSETPAG} ${TOP_LIBDIR}/${LIBAFSSETPAG}
199         -ln -f -s ${LIBAFSSETPAG} ${TOP_LIBDIR}/libafssetpag.${SHLIB_SUFFIX}
200         -ln -f -s ${LIBAFSSETPAG} ${TOP_LIBDIR}/libafssetpag.${SHLIB_SUFFIX}.${LIBAFSSETPAGMAJOR}
201
202 ${TOP_LIBDIR}/${LIBAFSSETPAG_DARWIN}: ${LIBAFSSETPAG_DARWIN}
203         ${INSTALL} ${LIBAFSSETPAG_DARWIN} ${TOP_LIBDIR}/${LIBAFSSETPAG_DARWIN}
204         -ln -f -s ${LIBAFSSETPAG_DARWIN} ${TOP_LIBDIR}/libafssetpag.${SHLIB_SUFFIX}
205         -ln -f -s ${LIBAFSSETPAG_DARWIN} ${TOP_LIBDIR}/libafssetpag.${LIBAFSSETPAGMAJOR}.${LIBAFSSETPAGMINOR}.${SHLIB_SUFFIX}
206  
207
208 afs.exp: ${srcdir}/afs4.exp ${srcdir}/afs5.exp
209         @set -x; case ${SYS_NAME} in \
210                 rs_aix5* ) \
211                         cp -p ${srcdir}/afs5.exp afs.exp ;; \
212                 rs_aix* ) \
213                         cp -p ${srcdir}/afs4.exp afs.exp ;; \
214                 * ) \
215                         touch afs.exp ;; \
216         esac
217
218 afsl.exp: ${srcdir}/afsl4.exp ${srcdir}/afsl5.exp
219         @set -x; case ${SYS_NAME} in \
220                 rs_aix5* ) \
221                         cp -p ${srcdir}/afsl5.exp afsl.exp ;; \
222                 rs_aix* ) \
223                         cp -p ${srcdir}/afsl4.exp afsl.exp ;; \
224                 * ) \
225                         touch afsl.exp ;; \
226         esac
227
228 #
229 # Installation targets
230 #
231
232 ${TOP_INCDIR}/afs/afssyscalls.h: afssyscalls.h
233         ${INSTALL} $? $@
234
235 ${TOP_INCDIR}/afs/rmtsys.h: rmtsys.h
236         ${INSTALL} $? $@
237
238 ${TOP_INCDIR}/afs/afs.exp: afs.exp
239         @set -x; case ${SYS_NAME} in \
240                 rs_aix* ) \
241                         ${INSTALL} $? $@ ;; \
242         esac
243
244 ${TOP_LIBDIR}/afs.exp: afs.exp
245         @set -x; case ${SYS_NAME} in \
246                 rs_aix* ) \
247                         ${INSTALL} $? $@ ;; \
248         esac
249
250 ${TOP_INCDIR}/afs/xfsattrs.h: xfsattrs.h
251         ${INSTALL} $? $@
252
253 ${TOP_LIBDIR}/libsys.a: libsys.a
254         ${INSTALL} $? $@
255
256 ${UKERNELDIR}/afs:
257         mkdir -p $@
258
259 ${UKERNELDIR}/afs/afsl.exp: afsl.exp
260         @set -x; case ${SYS_NAME} in \
261                 rs_aix* ) \
262                         ${INSTALL} $? $@ ;; \
263         esac
264
265 ${KERNELDIR}/afs:
266         mkdir -p $@
267
268 ${KERNELDIR}/afs/xfsattrs.h: xfsattrs.h
269         ${INSTALL} $? $@
270
271 depinstall: \
272         ${TOP_INCDIR}/afs/afssyscalls.h \
273         ${TOP_INCDIR}/afs/rmtsys.h \
274         ${TOP_INCDIR}/afs/afs.exp \
275         ${TOP_INCDIR}/afs/xfsattrs.h \
276         ${KERNELDIR}/afs/xfsattrs.h \
277         ${UKERNELDIR}/afs/afsl.exp \
278         Krmtsys.cs.c Krmtsys.h Krmtsys.xdr.c rmtsys.h 
279
280 install: \
281     ${DESTDIR}${libdir}/afs/libsys.a \
282     ${DESTDIR}${sbindir}/rmtsysd \
283     ${DESTDIR}${includedir}/afs/afssyscalls.h \
284     ${DESTDIR}${bindir}/pagsh \
285     ${DESTDIR}${bindir}/pagsh.krb \
286     ${DESTDIR}${includedir}/afs/afs.exp \
287     ${DESTDIR}${includedir}/afs/xfsattrs.h
288         @set -x; case ${SYS_NAME} in \
289         *_darwin_*) \
290             ${MAKE} '${DESTDIR}${libdir}/${LIBAFSSETPAG_DARWIN}';; \
291         *) \
292             ${MAKE} '${DESTDIR}${libdir}/${LIBAFSSETPAG}';; \
293         esac
294
295 ${DESTDIR}${libdir}/afs/libsys.a: libsys.a
296         ${INSTALL} $? $@
297
298 ${DESTDIR}${libdir}/${LIBAFSSETPAG}: ${LIBAFSSETPAG}
299         ${INSTALL} ${LIBAFSSETPAG} ${DESTDIR}${libdir}/${LIBAFSSETPAG}
300         -ln -f -s ${LIBAFSSETPAG} \
301             ${DESTDIR}${libdir}/libafssetpag.${SHLIB_SUFFIX}
302         -ln -f -s ${LIBAFSSETPAG} \
303             ${DESTDIR}${libdir}/libafssetpag.${SHLIB_SUFFIX}.${LIBAFSSETPAGMAJOR}
304
305 ${DESTDIR}${libdir}/${LIBAFSSETPAG_DARWIN}: ${LIBAFSSETPAG_DARWIN}
306         ${INSTALL} ${LIBAFSSETPAG_DARWIN} ${DESTDIR}${libdir}/${LIBAFSSETPAG_DARWIN}
307         -ln -f -s ${LIBAFSSETPAG_DARWIN} \
308                 ${DESTDIR}${libdir}/libafssetpag.${SHLIB_SUFFIX} ; \
309         -ln -f -s ${LIBAFSSETPAG_DARWIN} \
310                 ${DESTDIR}${libdir}/libafssetpag.${LIBAFSSETPAGMAJOR}.${LIBAFSSETPAGMINOR}.${SHLIB_SUFFIX} ;; \
311
312 ${DESTDIR}${sbindir}/rmtsysd: rmtsysd
313         ${INSTALL} -s $? $@
314
315 ${DESTDIR}${includedir}/afs/afssyscalls.h: afssyscalls.h
316         ${INSTALL} $? $@
317
318 ${DESTDIR}${bindir}/pagsh: pagsh
319         ${INSTALL} -s $? $@
320
321 ${DESTDIR}${bindir}/pagsh.krb: pagsh.krb
322         ${INSTALL} -s $? $@
323
324 ${DESTDIR}${includedir}/afs/afs.exp: afs.exp
325         @set -x; case ${SYS_NAME} in \
326                 rs_aix* ) \
327                         ${INSTALL} $? $@ ;; \
328         esac
329
330 ${DESTDIR}${includedir}/afs/xfsattrs.h: xfsattrs.h
331         ${INSTALL} $? $@
332
333 dest: \
334     ${DEST}/lib/afs/libsys.a \
335     ${DEST}/etc/rmtsysd \
336     ${DEST}/bin/pagsh \
337     ${DEST}/bin/pagsh.krb \
338     ${DEST}/include/afs/afssyscalls.h \
339     ${DEST}/include/afs/afs.exp \
340     ${DEST}/include/afs/xfsattrs.h
341         @set -x; case ${SYS_NAME} in \
342         *_darwin_*) \
343             ${MAKE} '${TOP_LIBDIR}/${LIBAFSSETPAG_DARWIN}';; \
344         *) \
345             ${MAKE} '${TOP_LIBDIR}/${LIBAFSSETPAG}';; \
346         esac
347
348 ${DEST}/lib/afs/libsys.a: libsys.a
349         ${INSTALL} $? $@
350
351 ${DEST}/include/afs/afs.exp: afs.exp
352         @set -x; case ${SYS_NAME} in \
353                 rs_aix* ) \
354                         ${INSTALL} $? $@ ;; \
355         esac
356
357 ${DEST}/include/afs/xfsattrs.h: xfsattrs.h
358         ${INSTALL} $? $@
359
360 ${DEST}/include/afs/afssyscalls.h: afssyscalls.h
361         ${INSTALL} $? $@
362
363 ${DEST}/etc/rmtsysd: rmtsysd
364         ${INSTALL} -s $? $@
365
366 ${DEST}/bin/pagsh: pagsh
367         ${INSTALL} -s $? $@
368
369 ${DEST}/bin/pagsh.krb: pagsh.krb
370         ${INSTALL} -s $? $@
371
372 #
373 # Misc targets
374 #
375 include ../config/Makefile.version
376
377 clean:
378         $(RM) -f *.o libsys.a xfsinode iinc idec icreate iopen istat core \
379         rmtsysc rmtsyss *.o rmtsys.ss.c rmtsys.cs.c rmtsys.xdr.c rmtsys.h \
380         rmtsysd AFS_component_version_number.c pagsh pagsh.krb \
381         afs.exp afsl.exp libafssetpag.* Krmtsys.cs.c Krmtsys.h Krmtsys.xdr.c
382         $(RM) -rf picobj