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