DEVEL15-cpp-fixes-20080630
[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
23 SHLIBOBJS = picobj/setpag.o picobj/glue.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} syscall.o afsl.exp AFS_component_version_number.o
50         -$(RM) -f $@
51         @set -x; case "${SYS_NAME}" in                          \
52                 hp_ux11*) \
53                         $(AR) crv $@ ${OBJECTS} ${RMTOBJS} \
54                                 AFS_component_version_number.o ${LIBSYS_AIX_EXP} ;; \
55                 *) \
56                         $(AR) crv $@ ${OBJECTS} ${RMTOBJS} syscall.o \
57                                 AFS_component_version_number.o ${LIBSYS_AIX_EXP} ;; \
58         esac
59         $(RANLIB) $@
60         @set -x; case "${SYS_NAME}" in                          \
61                 rs_aix*)                                \
62                         $(AR) crv $@ afsl.exp;;         \
63         esac
64
65 ${LIBAFSSETPAG}: ${SHLIBOBJS} syscall.o
66         @set -x; case ${SYS_NAME} in \
67         *_linux*) \
68             ${SHLIB_LINKER} -Wl,-h,libafssetpag.so.${LIBAFSSETPAGMAJOR} \
69                 -o ${LIBAFSSETPAG} -Wl,--version-script=${srcdir}/mapfile \
70                 ${SHLIBOBJS} syscall.o ;; \
71         rs_aix4*) \
72             ${SHLIB_LINKER} -o ${LIBAFSSETPAG} ${SHLIBOBJS} syscall.o \
73                 -bE:afssetpag.exp;; \
74         sun*_5*) \
75             ${SHLIB_LINKER} -h libafssetpag.so.${LIBAFSSETPAGMAJOR} \
76                 -o ${LIBAFSSETPAG} ${SHLIBOBJS} syscall.o;; \
77         hp_ux11*) \
78             ${SHLIB_LINKER} -o ${LIBAFSSETPAG} ${SHLIBOBJS};; \
79         *) \
80             ${SHLIB_LINKER} -o ${LIBAFSSETPAG} ${SHLIBOBJS} syscall.o ;; \
81         esac
82
83 ${LIBAFSSETPAG_DARWIN}: ${SHLIBOBJS}
84         ${SHLIB_LINKER} -o ${LIBAFSSETPAG_DARWIN} ${ARCHFLAGS} -install_name ${libdir}/${LIBAFSSETPAG_DARWIN} -compatibility_version ${LIBAFSSETPAGMAJOR} -current_version ${LIBAFSSETPAGMAJOR}.${LIBAFSSETPAGMINOR} ${SHLIBOBJS}
85
86 tests:  pagsh pagsh.krb fixit iinc idec icreate iopen istat rmtsysd
87
88 syscall.o: syscall.s
89         @set -x; case "$(SYS_NAME)" in \
90          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?? ) \
91                 $(PATH_CPP) -P ${SFLAGS} ${srcdir}/syscall.s > syscall.ss; \
92                 as -o syscall.o syscall.ss;             \
93                 $(RM) syscall.ss;;                              \
94          sgi_* |*_darwin* ) \
95                 ${CC} ${CFLAGS} -c ${srcdir}/syscall.s;;          \
96          alpha_osf1 | alpha_osf20 |  alpha_osf30 | alpha_osf32 | alpha_osf32c | alpha_dux?? ) \
97                 ${AS} -P ${CFLAGS} -D_NO_PROTO -DMACH -DOSF -nostdinc -traditional -DASSEMBLER ${srcdir}/syscall.s; \
98                 ${AS} -o syscall.o syscall.i; \
99                 $(RM) -f syscall.ss syscall.i;; \
100          hp_ux11? ) \
101                 touch syscall.o;; \
102          amd64_fbsd*|i386_*bsd*|*nbsd*) \
103                 ${CCOBJ} -E ${SFLAGS} syscall.s > syscall.S ; \
104                 ${AS} syscall.S -o syscall.o ;  \
105                 $(RM) -f syscall.S ;;\
106          *) \
107                 $(PATH_CPP) -P ${SFLAGS} ${srcdir}/syscall.s > syscall.ss; \
108                 as -o syscall.o syscall.ss;             \
109                 $(RM) syscall.ss;;                              \
110         esac
111
112 afssyscalls.o: afssyscalls.c afssyscalls.h
113         ${CCOBJ} ${CFLAGS} -c ${srcdir}/afssyscalls.c
114
115 glue.o: glue.c afssyscalls.h
116         ${CCOBJ} ${CFLAGS} -c ${srcdir}/glue.c
117
118 setpag.o: setpag.c afssyscalls.h
119         ${CCOBJ} ${CFLAGS} -c ${srcdir}/setpag.c
120
121 picobj: afssyscalls.h
122         mkdir -p picobj
123         cp ${srcdir}/afssyscalls.h picobj/afssyscalls.h
124
125 picobj/glue.o: picobj glue.c afssyscalls.h
126         rm -f picobj/glue.c
127         cp ${srcdir}/glue.c picobj/glue.c
128         cd picobj && ${CCOBJ} ${CFLAGS} ${SHLIB_CFLAGS} -c glue.c
129
130 picobj/setpag.o: picobj setpag.c afssyscalls.h
131         rm -f picobj/setpag.c
132         cp ${srcdir}/setpag.c picobj/setpag.c
133         cd picobj && ${CCOBJ} ${CFLAGS} ${SHLIB_CFLAGS} -c setpag.c
134
135 rmtsysnet.o rmtsysc.o rmtsyss.o rmtsysd.o: rmtsys.h
136 rmtsysd: AFS_component_version_number.o afs.exp afsl.exp
137
138 rmtsys.cs.c: rmtsys.xg
139         ${RXGEN} -A -C -o $@ ${srcdir}/rmtsys.xg
140
141 rmtsys.ss.c: rmtsys.xg
142         ${RXGEN} -A -S -o $@ ${srcdir}/rmtsys.xg
143
144 rmtsys.xdr.c: rmtsys.xg
145         ${RXGEN} -A -c -o $@ ${srcdir}/rmtsys.xg
146
147 rmtsys.h: rmtsys.xg
148         ${RXGEN} -A -h -o $@ ${srcdir}/rmtsys.xg
149
150 Krmtsys.cs.c: rmtsys.xg Krmtsys.h
151         ${RXGEN} -A -k -C -o Krmtsys.cs.c ${srcdir}/rmtsys.xg
152
153 Krmtsys.xdr.c: rmtsys.xg
154         ${RXGEN} -A -k -c -o Krmtsys.xdr.c ${srcdir}/rmtsys.xg
155
156 Krmtsys.h: rmtsys.xg
157         ${RXGEN} -A -k -h -o Krmtsys.h ${srcdir}/rmtsys.xg
158
159 rmtsysd: rmtsysd.o libsys.a
160         ${CC} ${CFLAGS} -o rmtsysd rmtsysd.o ${LIBS}
161
162 pagsh:  libsys.a AFS_component_version_number.o
163         ${CC} ${CFLAGS} -c ${srcdir}/pagsh.c
164         ${CC} ${CFLAGS} -o pagsh pagsh.o ${LIBS}
165
166 pagsh.krb: libsys.a
167         ${CC} ${CFLAGS} -c ${srcdir}/pagsh.c -DAFS_KERBEROS_ENV 
168         ${CC} ${CFLAGS} -o pagsh.krb pagsh.o ${LIBS}
169
170 #
171 # Test programs.
172 #
173
174 iinc:   iinc.c 
175         $(CC) -o iinc ${CFLAGS} ${srcdir}/iinc.c ${LIBS}
176
177 idec:   idec.c  AFS_component_version_number.c
178         $(CC) -o idec ${CFLAGS} ${srcdir}/idec.c ${LIBS}
179
180 icreate:icreate.c  AFS_component_version_number.c
181         $(CC) -o icreate ${CFLAGS} ${srcdir}/icreate.c ${LIBS}
182
183 iopen:  iopen.c  AFS_component_version_number.c
184         $(CC) -o iopen ${CFLAGS} ${srcdir}/iopen.c ${LIBS}
185
186 iread:  iread.c  AFS_component_version_number.c
187         ${CC} -o iread ${CFLAGS} ${srcdir}/iread.c ${LIBS}
188
189 iwrite: iwrite.c  AFS_component_version_number.c
190         ${CC} -o iwrite ${CFLAGS} ${srcdir}/iwrite.c ${LIBS}
191
192 istat:  istat.c  AFS_component_version_number.c
193         $(CC) -o istat ${CFLAGS} ${srcdir}/istat.c ${LIBS}
194
195 fixit:  fixit.c AFS_component_version_number.c
196         $(CC) -o fixit ${CFLAGS} ${srcdir}/fixit.c ${LIBS}
197
198
199 xfsinode: xfsinode.c  AFS_component_version_number.c
200         @set -x; case "${SYS_NAME}" in \
201                 sgi_62 | sgi_64 ) \
202                 $(CC) -o xfsinode ${CFLAGS} ${srcdir}/xfsinode.c ${LIBS}
203         esac
204
205 ${TOP_LIBDIR}/${LIBAFSSETPAG}: ${LIBAFSSETPAG}
206         ${INSTALL} ${LIBAFSSETPAG} ${TOP_LIBDIR}/${LIBAFSSETPAG}
207         -ln -f -s ${LIBAFSSETPAG} ${TOP_LIBDIR}/libafssetpag.${SHLIB_SUFFIX}
208         -ln -f -s ${LIBAFSSETPAG} ${TOP_LIBDIR}/libafssetpag.${SHLIB_SUFFIX}.${LIBAFSSETPAGMAJOR}
209
210 ${TOP_LIBDIR}/${LIBAFSSETPAG_DARWIN}: ${LIBAFSSETPAG_DARWIN}
211         ${INSTALL} ${LIBAFSSETPAG_DARWIN} ${TOP_LIBDIR}/${LIBAFSSETPAG_DARWIN}
212         -ln -f -s ${LIBAFSSETPAG_DARWIN} ${TOP_LIBDIR}/libafssetpag.${SHLIB_SUFFIX}
213         -ln -f -s ${LIBAFSSETPAG_DARWIN} ${TOP_LIBDIR}/libafssetpag.${LIBAFSSETPAGMAJOR}.${LIBAFSSETPAGMINOR}.${SHLIB_SUFFIX}
214  
215
216 afs.exp: ${srcdir}/afs4.exp ${srcdir}/afs5.exp
217         @set -x; case ${SYS_NAME} in \
218                 rs_aix5* ) \
219                         cp -p ${srcdir}/afs5.exp afs.exp ;; \
220                 rs_aix* ) \
221                         cp -p ${srcdir}/afs4.exp afs.exp ;; \
222                 * ) \
223                         touch afs.exp ;; \
224         esac
225
226 afsl.exp: ${srcdir}/afsl4.exp ${srcdir}/afsl5.exp
227         @set -x; case ${SYS_NAME} in \
228                 rs_aix5* ) \
229                         cp -p ${srcdir}/afsl5.exp afsl.exp ;; \
230                 rs_aix* ) \
231                         cp -p ${srcdir}/afsl4.exp afsl.exp ;; \
232                 * ) \
233                         touch afsl.exp ;; \
234         esac
235
236 #
237 # Installation targets
238 #
239
240 ${TOP_INCDIR}/afs/afssyscalls.h: afssyscalls.h
241         ${INSTALL} $? $@
242
243 ${TOP_INCDIR}/afs/rmtsys.h: rmtsys.h
244         ${INSTALL} $? $@
245
246 ${TOP_INCDIR}/afs/afs.exp: afs.exp
247         @set -x; case ${SYS_NAME} in \
248                 rs_aix* ) \
249                         ${INSTALL} $? $@ ;; \
250         esac
251
252 ${TOP_LIBDIR}/afs.exp: afs.exp
253         @set -x; case ${SYS_NAME} in \
254                 rs_aix* ) \
255                         ${INSTALL} $? $@ ;; \
256         esac
257
258 ${TOP_INCDIR}/afs/xfsattrs.h: xfsattrs.h
259         ${INSTALL} $? $@
260
261 ${TOP_LIBDIR}/libsys.a: libsys.a
262         ${INSTALL} $? $@
263
264 ${UKERNELDIR}/afs:
265         mkdir -p $@
266
267 ${UKERNELDIR}/afs/afsl.exp: afsl.exp
268         @set -x; case ${SYS_NAME} in \
269                 rs_aix* ) \
270                         ${INSTALL} $? $@ ;; \
271         esac
272
273 ${KERNELDIR}/afs:
274         mkdir -p $@
275
276 ${KERNELDIR}/afs/xfsattrs.h: xfsattrs.h
277         ${INSTALL} $? $@
278
279 depinstall: \
280         ${TOP_INCDIR}/afs/afssyscalls.h \
281         ${TOP_INCDIR}/afs/rmtsys.h \
282         ${TOP_INCDIR}/afs/afs.exp \
283         ${TOP_INCDIR}/afs/xfsattrs.h \
284         ${KERNELDIR}/afs/xfsattrs.h \
285         ${UKERNELDIR}/afs/afsl.exp \
286         Krmtsys.cs.c Krmtsys.h Krmtsys.xdr.c rmtsys.h 
287
288 install: \
289     ${DESTDIR}${libdir}/afs/libsys.a \
290     ${DESTDIR}${sbindir}/rmtsysd \
291     ${DESTDIR}${includedir}/afs/afssyscalls.h \
292     ${DESTDIR}${bindir}/pagsh \
293     ${DESTDIR}${bindir}/pagsh.krb \
294     ${DESTDIR}${includedir}/afs/afs.exp \
295     ${DESTDIR}${includedir}/afs/xfsattrs.h
296         @set -x; case ${SYS_NAME} in \
297         *_darwin_*) \
298             ${MAKE} '${DESTDIR}${libdir}/${LIBAFSSETPAG_DARWIN}';; \
299         *) \
300             ${MAKE} '${DESTDIR}${libdir}/${LIBAFSSETPAG}';; \
301         esac
302
303 ${DESTDIR}${libdir}/afs/libsys.a: libsys.a
304         ${INSTALL} $? $@
305
306 ${DESTDIR}${libdir}/${LIBAFSSETPAG}: ${LIBAFSSETPAG}
307         ${INSTALL} ${LIBAFSSETPAG} ${DESTDIR}${libdir}/${LIBAFSSETPAG}
308         -ln -f -s ${LIBAFSSETPAG} \
309             ${DESTDIR}${libdir}/libafssetpag.${SHLIB_SUFFIX}
310         -ln -f -s ${LIBAFSSETPAG} \
311             ${DESTDIR}${libdir}/libafssetpag.${SHLIB_SUFFIX}.${LIBAFSSETPAGMAJOR}
312
313 ${DESTDIR}${libdir}/${LIBAFSSETPAG_DARWIN}: ${LIBAFSSETPAG_DARWIN}
314         ${INSTALL} ${LIBAFSSETPAG_DARWIN} ${DESTDIR}${libdir}/${LIBAFSSETPAG_DARWIN}
315         -ln -f -s ${LIBAFSSETPAG_DARWIN} \
316                 ${DESTDIR}${libdir}/libafssetpag.${SHLIB_SUFFIX} ; \
317         -ln -f -s ${LIBAFSSETPAG_DARWIN} \
318                 ${DESTDIR}${libdir}/libafssetpag.${LIBAFSSETPAGMAJOR}.${LIBAFSSETPAGMINOR}.${SHLIB_SUFFIX} ;; \
319
320 ${DESTDIR}${sbindir}/rmtsysd: rmtsysd
321         ${INSTALL} $? $@
322
323 ${DESTDIR}${includedir}/afs/afssyscalls.h: afssyscalls.h
324         ${INSTALL} $? $@
325
326 ${DESTDIR}${bindir}/pagsh: pagsh
327         ${INSTALL} $? $@
328
329 ${DESTDIR}${bindir}/pagsh.krb: pagsh.krb
330         ${INSTALL} ${NO_STRIP_KRB} $? $@
331
332 ${DESTDIR}${includedir}/afs/afs.exp: afs.exp
333         @set -x; case ${SYS_NAME} in \
334                 rs_aix* ) \
335                         ${INSTALL} $? $@ ;; \
336         esac
337
338 ${DESTDIR}${includedir}/afs/xfsattrs.h: xfsattrs.h
339         ${INSTALL} $? $@
340
341 dest: \
342     ${DEST}/lib/afs/libsys.a \
343     ${DEST}/etc/rmtsysd \
344     ${DEST}/bin/pagsh \
345     ${DEST}/bin/pagsh.krb \
346     ${DEST}/include/afs/afssyscalls.h \
347     ${DEST}/include/afs/afs.exp \
348     ${DEST}/include/afs/xfsattrs.h
349         @set -x; case ${SYS_NAME} in \
350         *_darwin_*) \
351             ${MAKE} '${TOP_LIBDIR}/${LIBAFSSETPAG_DARWIN}';; \
352         *) \
353             ${MAKE} '${TOP_LIBDIR}/${LIBAFSSETPAG}';; \
354         esac
355
356 ${DEST}/lib/afs/libsys.a: libsys.a
357         ${INSTALL} $? $@
358
359 ${DEST}/include/afs/afs.exp: afs.exp
360         @set -x; case ${SYS_NAME} in \
361                 rs_aix* ) \
362                         ${INSTALL} $? $@ ;; \
363         esac
364
365 ${DEST}/include/afs/xfsattrs.h: xfsattrs.h
366         ${INSTALL} $? $@
367
368 ${DEST}/include/afs/afssyscalls.h: afssyscalls.h
369         ${INSTALL} $? $@
370
371 ${DEST}/etc/rmtsysd: rmtsysd
372         ${INSTALL} $? $@
373
374 ${DEST}/bin/pagsh: pagsh
375         ${INSTALL} $? $@
376
377 ${DEST}/bin/pagsh.krb: pagsh.krb
378         ${INSTALL} ${NO_STRIP_KRB} $? $@
379
380 #
381 # Misc targets
382 #
383 include ../config/Makefile.version
384
385 clean:
386         $(RM) -f *.o libsys.a xfsinode iinc idec icreate iopen istat core \
387         rmtsysc rmtsyss *.o rmtsys.ss.c rmtsys.cs.c rmtsys.xdr.c rmtsys.h \
388         rmtsysd AFS_component_version_number.c pagsh pagsh.krb \
389         afs.exp afsl.exp libafssetpag.* Krmtsys.cs.c Krmtsys.h Krmtsys.xdr.c
390         $(RM) -rf picobj