Fix mech of building export on AIX
[openafs.git] / src / export / 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   EXPORTS = -bexport:export.exp
18   IMPORTS = /lib/kernex.exp /lib/syscalls.exp ${srcdir}/extras.exp
19      KOBJ = export.o symtab.o
20
21 EXPORTS32 = export.exp export.ext.nonfs export.ext cfgexport cfgafs
22 TOPEXP32  = ${TOP_LIBDIR}/export.exp
23 EXPORTS64 = export64.exp export64.ext.nonfs export64.ext cfgexport64 cfgafs64
24 TOPEXP64  = ${TOP_LIBDIR}/export64.exp
25
26 all: $(TOPEXP32) $(TOPEXP64) ${TOP_LIBDIR}/extras.exp
27         ${INSTALL} -d ${KERNELDIR}
28         ${INSTALL} -d ${UKERNELDIR}
29         ${INSTALL_DATA} ${srcdir}/export.h ${KERNELDIR}/export.h
30         ${INSTALL_DATA} ${srcdir}/export.h ${UKERNELDIR}/export.h
31         if [ "x$(AIX32)" = "xyes" ]; then  \
32           ${INSTALL_DATA} export.exp ${UKERNELDIR}/export.exp; \
33           ${INSTALL_DATA} export.exp ${KERNELDIR}/export.exp; \
34         fi
35         if [ "x$(AIX64)" = "xyes" ]; then  \
36           ${INSTALL_DATA} export64.exp ${KERNELDIR}/export64.exp; \
37           ${INSTALL_DATA} export64.exp ${UKERNELDIR}/export64.exp; \
38         fi
39
40 ${TOP_LIBDIR}/export.exp: export.exp
41         if [ "x$(AIX32)" = "xyes" ]; then  \
42           ${INSTALL_DATA} $? $@ ; \
43         fi
44
45 ${TOP_LIBDIR}/export64.exp: export64.exp
46         if [ "x$(AIX64)" = "xyes" ]; then  \
47           ${INSTALL_DATA} $? $@ ; \
48         fi
49
50 ${TOP_LIBDIR}/extras.exp: ${srcdir}/extras.exp
51         ${INSTALL_DATA} $? $@
52
53 noversion system: install
54
55 export.exp: ${srcdir}/export4.exp ${srcdir}/export5.exp
56         case ${SYS_NAME} in \
57         rs_aix4* ) \
58                 cp -p ${srcdir}/export4.exp export.exp ;; \
59         rs_aix5* ) \
60                 cp -p ${srcdir}/export5.exp export.exp ;; \
61         esac
62
63 export64.exp: ${srcdir}/export4-64.exp ${srcdir}/export5-64.exp
64         case ${SYS_NAME} in \
65         rs_aix4* ) \
66                 cp -p ${srcdir}/export4-64.exp export64.exp ;; \
67         rs_aix5* ) \
68                 cp -p ${srcdir}/export5-64.exp export64.exp ;; \
69         rs_aix6* ) \
70                 cp -p ${srcdir}/export5-64.exp export64.exp ;; \
71         esac
72
73 export.ext: ${KOBJ}
74         if [ "x$(AIX32)" = "xyes" ]; then  \
75           ${LD} -o export.ext -eexport ${IMPORTS} ${KOBJ} ${EXPORTS} -lcsys ; \
76         fi
77
78 export64.ext: export64.o symtab64.o
79         if [ "x$(AIX64)" = "xyes" ]; then  \
80           ${LD} -b64 -o export64.ext -eexport ${IMPORTS} export64.o symtab64.o \
81                 -bexport:export64.exp -lcsys ; \
82         fi
83
84 export.ext.nonfs: export.nonfs.o symtab.o
85         if [ "x$(AIX32)" = "xyes" ]; then  \
86           ${LD} -o export.ext.nonfs -eexport ${IMPORTS} export.nonfs.o \
87                 symtab.o ${EXPORTS} -lcsys ; \
88         fi
89
90 export64.ext.nonfs: export64.nonfs.o symtab64.o
91         if [ "x$(AIX64)" = "xyes" ]; then  \
92           ${LD} -b64 -o export64.ext.nonfs -eexport ${IMPORTS} export64.nonfs.o \
93                 symtab64.o -bexport:export64.exp -lcsys ; \
94         fi
95
96 symtab.o symtab64.o: ${srcdir}/symtab.c
97         case ${SYS_NAME} in \
98         rs_aix4* ) \
99                 $(CC) $(AFS_CPPFLAGS) $(AFS_CFLAGS) -c ${srcdir}/symtab.c ;; \
100         rs_aix5* ) \
101                 $(CC) $(AFS_CPPFLAGS) ${AFS_CFLAGS} -q64 -D__XCOFF64__ \
102                         -DAFS_64BIT_KERNEL -DAFS_AIX51_ENV \
103                         -c ${srcdir}/symtab.c ; \
104                 mv symtab.o symtab64.o ; \
105                 $(CC) $(AFS_CPPFLAGS) $(AFS_CFLAGS) -DAFS_AIX51_ENV \
106                         -c ${srcdir}/symtab.c ;; \
107         rs_aix6* ) \
108                 $(CC) $(AFS_CPPFLAGS) $(AFS_CFLAGS) -q64 -D__XCOFF64__ \
109                         -DAFS_64BIT_KERNEL -DAFS_AIX51_ENV \
110                         -c ${srcdir}/symtab.c ; \
111                 mv symtab.o symtab64.o ;; \
112         esac
113
114 export.o export64.o: ${srcdir}/export.c
115         case ${SYS_NAME} in \
116         rs_aix4* ) \
117                 $(CC) $(AFS_CPPFLAGS) $(AFS_CFLAGS) -c ${srcdir}/export.c ;; \
118         rs_aix5* ) \
119                 $(CC) $(AFS_CPPFLAGS) $(AFS_CFLAGS) -q64 -D__XCOFF64__ \
120                         -DAFS_64BIT_KERNEL -DAFS_AIX51_ENV \
121                         -c ${srcdir}/export.c ; \
122                 mv export.o export64.o ; \
123                 $(CC) $(AFS_CPPFLAGS) $(AFS_CFLAGS) -DAFS_AIX51_ENV \
124                         -c ${srcdir}/export.c ;; \
125         rs_aix6* ) \
126                 $(CC) $(AFS_CPPFLAGS) $(AFS_CFLAGS) -q64 \
127                         -D__XCOFF64__ -DAFS_64BIT_KERNEL -DAFS_AIX51_ENV \
128                         -c ${srcdir}/export.c ; \
129                 mv export.o export64.o ;; \
130         esac
131
132 export.nonfs.o export64.nonfs.o: ${srcdir}/export.c
133         case ${SYS_NAME} in \
134         rs_aix4* ) \
135                 $(CC) $(CPPFLAGS) $(CFLAGS) ${INCS} -DAFS_NONFSTRANS \
136                         -c ${srcdir}/export.c ; \
137                 mv export.o export.nonfs.o ;; \
138         rs_aix5* ) \
139                 $(CC) $(CPPFLAGS) $(CFLAGS) -q64 ${INCS} -D__XCOFF64__ \
140                         -DAFS_64BIT_KERNEL -DAFS_NONFSTRANS -DAFS_AIX51_ENV \
141                         -c ${srcdir}/export.c ; \
142                 mv export.o export64.nonfs.o ; \
143                 $(CC) $(CPPFLAGS) $(CFLAGS) ${INCS} -DAFS_NONFSTRANS \
144                         -DAFS_AIX51_ENV -c ${srcdir}/export.c ; \
145                 mv export.o export.nonfs.o ;; \
146         rs_aix6* ) \
147                 $(CC) $(CPPFLAGS) $(CFLAGS) -q64 ${INCS} -D__XCOFF64__ \
148                         -DAFS_64BIT_KERNEL -DAFS_NONFSTRANS -DAFS_AIX51_ENV \
149                         -c ${srcdir}/export.c ; \
150                 mv export.o export64.nonfs.o ;; \
151         esac
152
153 cfgexport: cfgexport.o
154         $(CC) $(LDFLAGS) -g ${INCS} -o cfgexport cfgexport.o
155
156 cfgexport64: cfgexport64.o
157         if [ "x$(AIX64)" = "xyes" ]; then  \
158           $(CC) $(LDFLAGS) -g ${INCS} -q64 -o cfgexport64 cfgexport64.o ; \
159         fi
160
161 cfgafs: cfgafs.o
162         $(CC) $(LDFLAGS) ${INCS} -o cfgafs cfgafs.o
163
164 cfgafs64: cfgafs64.o
165         if [ "x$(AIX64)" = "xyes" ]; then  \
166           $(CC) $(LDFLAGS) -g ${INCS} -q64 -o cfgafs64 cfgafs64.o ; \
167         fi
168
169 CFLAGS_cfgexport64.o = -g -q64 -D__XCOFF64__ 
170 cfgexport64.o: ${srcdir}/cfgexport.c AFS_component_version_number.c
171         if [ "x$(AIX64)" = "xyes" ]; then  \
172           $(AFS_CCRULE) $(srcdir)/cfgexport.c ; \
173         fi
174
175 cfgexport.o: ${srcdir}/cfgexport.c AFS_component_version_number.c
176 cfgafs.o: ${srcdir}/cfgafs.c AFS_component_version_number.c
177
178 CFLAGS_cfgafs64.o = -q64
179 cfgafs64.o: ${srcdir}/cfgafs.c AFS_component_version_number.c
180         if [ "x$(AIX64)" = "xyes" ]; then  \
181           $(AFS_CCRULE) $(srcdir)/cfgafs.c ; \
182         fi
183
184 clean:
185         $(RM) -f *.o *.Zlst *.map *.out AFS_component_version_number.c
186         $(RM) -f export.exp export64.exp
187         $(RM) -f cfgexport cfgexport64
188         $(RM) -f cfgafs cfgafs64
189         $(RM) -f *.ext *.ext.nonfs
190
191 install: $(EXPORTS32) $(EXPORTS64)
192         ${INSTALL} -d ${DESTDIR}${afskerneldir}
193         ${INSTALL} -d ${DESTDIR}${libdir}/afs
194         ${INSTALL_DATA} ${srcdir}/extras.exp ${DESTDIR}${libdir}/afs/extras.exp
195         if [ "xyes" = "x$(AIX32)" ]; then \
196           ${INSTALL_DATA} export.exp ${DESTDIR}${libdir}/afs/export.exp ; \
197           ${INSTALL_DATA} export.ext ${DESTDIR}${afskerneldir}/export.ext ; \
198           ${INSTALL_DATA} export.ext.nonfs ${DESTDIR}${afskerneldir}/export.ext.nonfs ; \
199           ${INSTALL_DATA} cfgexport ${DESTDIR}${afskerneldir}/cfgexport ; \
200           ${INSTALL_DATA} cfgafs ${DESTDIR}${afskerneldir}/cfgafs ; \
201         fi
202         if [ "xyes" = "x$(AIX64)" ]; then \
203           ${INSTALL_DATA} export64.exp ${DESTDIR}${libdir}/afs/export64.exp ; \
204           ${INSTALL_DATA} export64.ext ${DESTDIR}${afskerneldir}/export64.ext ; \
205           ${INSTALL_DATA} export64.ext.nonfs ${DESTDIR}${afskerneldir}/export64.ext.nonfs ; \
206           ${INSTALL_DATA} cfgexport64 ${DESTDIR}${afskerneldir}/cfgexport64 ; \
207           ${INSTALL_DATA} cfgafs64 ${DESTDIR}${afskerneldir}/cfgafs64 ; \
208         fi
209
210 dest: $(EXPORTS32) $(EXPORTS64)
211         ${INSTALL} -d ${DEST}/root.client/usr/vice/etc/dkload
212         ${INSTALL} -d ${DEST}/lib/afs
213         ${INSTALL_DATA} ${srcdir}/extras.exp ${DEST}/lib/afs/extras.exp
214         if [ "xyes" = "x$(AIX32)" ];then \
215           ${INSTALL_DATA} export.exp ${DEST}/lib/afs/export.exp ; \
216           ${INSTALL} export.ext ${DEST}/root.client/usr/vice/etc/dkload/export.ext ; \
217           ${INSTALL} export.ext.nonfs ${DEST}/root.client/usr/vice/etc/dkload/export.ext.nonfs ; \
218           ${INSTALL} cfgexport ${DEST}/root.client/usr/vice/etc/dkload/cfgexport ; \
219           ${INSTALL} cfgafs ${DEST}/root.client/usr/vice/etc/dkload/cfgafs ; \
220         fi
221         if [ "xyes" = "x$(AIX64)" ];then \
222           ${INSTALL_DATA} export64.exp ${DEST}/lib/afs/export64.exp ; \
223           ${INSTALL} export64.ext ${DEST}/root.client/usr/vice/etc/dkload/export64.ext ; \
224           ${INSTALL} export64.ext.nonfs ${DEST}/root.client/usr/vice/etc/dkload/export64.ext.nonfs ; \
225           ${INSTALL} cfgexport64 ${DEST}/root.client/usr/vice/etc/dkload/cfgexport64 ; \
226           ${INSTALL} cfgafs64 ${DEST}/root.client/usr/vice/etc/dkload/cfgafs64 ; \
227         fi
228
229 include ../config/Makefile.version