Unix: Rework build system
[openafs.git] / src / crypto / hcrypto / Makefile.in
1 # Copyright 2010, Your File System Inc
2 # All rights reserved
3 #
4 # This software has been released under the terms of the BSD License
5 # For details, see the LICENSE file in the top level source directory
6
7 # API version. Must be incremented whenever something changes.
8 LIBMAJOR=1
9 LIBMINOR=1
10
11 srcdir=@srcdir@
12 include @TOP_OBJDIR@/src/config/Makefile.config
13 include @TOP_OBJDIR@/src/config/Makefile.shared
14
15 INSTALL = @INSTALL@
16 INSTALL_DATA = @INSTALL_DATA@
17
18 HEADERS= ${TOP_INCDIR}/hcrypto/aes.h \
19          ${TOP_INCDIR}/hcrypto/des.h \
20          ${TOP_INCDIR}/hcrypto/engine.h \
21          ${TOP_INCDIR}/hcrypto/evp.h \
22          ${TOP_INCDIR}/hcrypto/evp-hcrypto.h \
23          ${TOP_INCDIR}/hcrypto/evp-cc.h \
24          ${TOP_INCDIR}/hcrypto/hmac.h \
25          ${TOP_INCDIR}/hcrypto/md2.h \
26          ${TOP_INCDIR}/hcrypto/md4.h \
27          ${TOP_INCDIR}/hcrypto/md5.h \
28          ${TOP_INCDIR}/hcrypto/rand.h \
29          ${TOP_INCDIR}/hcrypto/rc2.h \
30          ${TOP_INCDIR}/hcrypto/rc4.h \
31          ${TOP_INCDIR}/hcrypto/sha.h \
32          ${TOP_INCDIR}/hcrypto/ui.h
33
34 UPSTREAM= ${TOP_SRCDIR}/external/heimdal
35
36 MODULE_INCLUDE=-I${TOP_INCDIR}/hcrypto -I$(UPSTREAM)/hcrypto 
37
38 SHLIBOBJ= libafshcrypto.${SHLIB_SUFFIX}.${LIBMAJOR}.${LIBMINOR}
39
40 all: $(ROKEN_HEADERS) ${HEADERS} ${TOP_LIBDIR}/${SHLIBOBJ} \
41         ${TOP_LIBDIR}/libafshcrypto.a \
42         ${TOP_LIBDIR}/libafshcrypto_lwp.a
43
44 install: libafshcrypto.a ${SHLIBOBJ}
45         ${TOP_OBJDIR}/src/config/shlib-install -d ${DESTDIR}${libdir} \
46                 -l libafshcrypto -M ${LIBMAJOR} -m ${LIBMINOR}
47         ${INSTALL_DATA} libafshcrypto.a ${DESTDIR}${libdir}/libafshcrypto.a
48
49 dest: libafshcrypto.a ${SHLIBOBJ}
50         ${TOP_OBJDIR}/src/config/shlib-install -d ${DEST}/lib \
51                 -l libafshcrypto -M ${LIBMAJOR} -m ${LIBMINOR}
52         ${INSTALL_DATA} libafshcrypto.a ${DEST}/lib/libafshcrypto.a
53
54 clean:
55         $(RM) -f ${OBJECTS} ${SHLIBOBJ} libafshcrypto.a libafshcrypto.exp \
56                  test_cipher test_cipher.o hex.o
57
58 COMMON_OBJS= aes.o camellia.o camellia-ntt.o des.o engine.o evp.o \
59              evp-hcrypto.o evp-cc.o hmac.o md2.o md4.o md5.o pkcs5.o \
60              rand-egd.o rand-timer.o rand-unix.o rand.o rc2.o rc4.o \
61              rijndael-alg-fst.o rnd_keys.o sha.o sha256.o sha512.o ui.o \
62              validate.o \
63              cloexec.o ct.o issuid.o net_read.o net_write.o warnerr.o
64
65 OBJECTS = $(COMMON_OBJS) rand-fortuna.o $(ROKEN_LIBOBJS)
66
67 LWP_OBJS = $(COMMON_OBJS) rand-fortuna_lwp.o $(ROKEN_LIBOBJS)
68
69 LWPRULE=$(CC) $(AFS_CPPFLAGS) $(COMMON_CFLAGS) $(XCFLAGS) $(ARCHFLAGS) \
70         -I$(TOP_INCDIR)/hcrypto -I$(UPSTREAM)/hcrypto -c $?
71
72 ${TOP_LIBDIR}/${SHLIBOBJ}: ${SHLIBOBJ}
73         ${TOP_OBJDIR}/src/config/shlib-install -d ${TOP_LIBDIR} \
74                 -l libafshcrypto -M ${LIBMAJOR} -m ${LIBMINOR}
75
76 ${SHLIBOBJ}: ${OBJECTS} libafshcrypto.map
77         ${TOP_OBJDIR}/src/config/shlib-build -d $(srcdir) -l libafshcrypto \
78                 -M ${LIBMAJOR} -m ${LIBMINOR} -- \
79                 ${OBJECTS} ${MT_LIBS}
80
81 libafshcrypto.a: ${OBJECTS}
82         $(RM) -f $@
83         $(AR) crv $@ ${OBJECTS}
84         $(RANLIB) $@
85
86 libafshcrypto_lwp.a: $(LWP_OBJS)
87         $(RM) -f $@
88         $(AR) crv $@ $(LWP_OBJS)
89         $(RANLIB) $@
90
91 test_cipher: test_cipher.o hex.o libafshcrypto.a
92         $(AFS_LDRULE) test_cipher.o hex.o libafshcrypto.a
93
94 ${TOP_INCDIR}/hcrypto/aes.h: ${UPSTREAM}/hcrypto/aes.h
95         ${INSTALL_DATA} $? $@
96
97 ${TOP_INCDIR}/hcrypto/bn.h: ${UPSTREAM}/hcrypto/bn.h
98         ${INSTALL_DATA} $? $@
99
100 ${TOP_INCDIR}/hcrypto/des.h: ${UPSTREAM}/hcrypto/des.h
101         ${INSTALL_DATA} $? $@
102
103 ${TOP_INCDIR}/hcrypto/dh.h: ${UPSTREAM}/hcrypto/dh.h
104         ${INSTALL_DATA} $? $@
105
106 ${TOP_INCDIR}/hcrypto/dsa.h: ${UPSTREAM}/hcrypto/dsa.h
107         ${INSTALL_DATA} $? $@
108
109 ${TOP_INCDIR}/hcrypto/engine.h: engine.h
110         ${INSTALL_DATA} $? $@
111
112 ${TOP_INCDIR}/hcrypto/evp.h: ${UPSTREAM}/hcrypto/evp.h
113         ${INSTALL_DATA} $? $@
114
115 ${TOP_INCDIR}/hcrypto/evp-hcrypto.h: ${UPSTREAM}/hcrypto/evp-hcrypto.h
116         ${INSTALL_DATA} $? $@
117
118 ${TOP_INCDIR}/hcrypto/evp-cc.h: ${UPSTREAM}/hcrypto/evp-cc.h
119         ${INSTALL_DATA} $? $@
120
121 ${TOP_INCDIR}/hcrypto/hmac.h: ${UPSTREAM}/hcrypto/hmac.h
122         ${INSTALL_DATA} $? $@
123
124 ${TOP_INCDIR}/hcrypto/md2.h: ${UPSTREAM}/hcrypto/md2.h
125         ${INSTALL_DATA} $? $@
126
127 ${TOP_INCDIR}/hcrypto/md4.h: ${UPSTREAM}/hcrypto/md4.h
128         ${INSTALL_DATA} $? $@
129
130 ${TOP_INCDIR}/hcrypto/md5.h: ${UPSTREAM}/hcrypto/md5.h
131         ${INSTALL_DATA} $? $@
132
133 ${TOP_INCDIR}/hcrypto/pkcs12.h: ${UPSTREAM}/hcrypto/pkcs12.h
134         ${INSTALL_DATA} $? $@
135
136 ${TOP_INCDIR}/hcrypto/rand.h: ${UPSTREAM}/hcrypto/rand.h
137         ${INSTALL_DATA} $? $@
138
139 ${TOP_INCDIR}/hcrypto/rc2.h: ${UPSTREAM}/hcrypto/rc2.h
140         ${INSTALL_DATA} $? $@
141
142 ${TOP_INCDIR}/hcrypto/rc4.h: ${UPSTREAM}/hcrypto/rc4.h
143         ${INSTALL_DATA} $? $@
144
145 ${TOP_INCDIR}/hcrypto/rsa.h: ${UPSTREAM}/hcrypto/rsa.h
146         ${INSTALL_DATA} $? $@
147
148 ${TOP_INCDIR}/hcrypto/sha.h: ${UPSTREAM}/hcrypto/sha.h
149         ${INSTALL_DATA} $? $@
150
151 ${TOP_INCDIR}/hcrypto/ui.h: ${UPSTREAM}/hcrypto/ui.h
152         ${INSTALL_DATA} $? $@
153
154 ${TOP_LIBDIR}/libafshcrypto.a: libafshcrypto.a
155         ${INSTALL_DATA} $? $@
156
157 ${TOP_LIBDIR}/libafshcrypto_lwp.a: libafshcrypto_lwp.a
158         ${INSTALL_DATA} $? $@
159
160 # Pthread Targets
161
162 CFLAGS_test_cipher.o= -I${UPSTREAM}/roken/
163 CFLAGS_rand-unix.o=@CFLAGS_NOERROR@
164 CFLAGS_evp.o=-DHAVE_CONFIG_H
165
166 aes.o: ${UPSTREAM}/hcrypto/aes.c
167         $(AFS_CCRULE) $(UPSTREAM)/hcrypto/aes.c
168
169 bn.o: ${UPSTREAM}/hcrypto/bn.c
170         $(AFS_CCRULE) $(UPSTREAM)/hcrypto/bn.c
171
172 camellia.o: ${UPSTREAM}/hcrypto/camellia.c
173         $(AFS_CCRULE) $(UPSTREAM)/hcrypto/camellia.c
174
175 camellia-ntt.o: ${UPSTREAM}/hcrypto/camellia-ntt.c
176         $(AFS_CCRULE) $(UPSTREAM)/hcrypto/camellia-ntt.c
177
178 des.o: ${UPSTREAM}/hcrypto/des.c
179         $(AFS_CCRULE) $(UPSTREAM)/hcrypto/des.c
180         
181 evp.o: ${UPSTREAM}/hcrypto/evp.c
182         $(AFS_CCRULE) $(UPSTREAM)/hcrypto/evp.c
183         
184 evp-hcrypto.o: ${UPSTREAM}/hcrypto/evp-hcrypto.c
185         $(AFS_CCRULE) $(UPSTREAM)/hcrypto/evp-hcrypto.c
186         
187 evp-cc.o: ${UPSTREAM}/hcrypto/evp-cc.c
188         $(AFS_CCRULE) $(UPSTREAM)/hcrypto/evp-cc.c
189
190 hmac.o: ${UPSTREAM}/hcrypto/hmac.c
191         $(AFS_CCRULE) $(UPSTREAM)/hcrypto/hmac.c
192
193 md2.o: ${UPSTREAM}/hcrypto/md2.c
194         $(AFS_CCRULE) $(UPSTREAM)/hcrypto/md2.c
195
196 md4.o: ${UPSTREAM}/hcrypto/md4.c
197         $(AFS_CCRULE) $(UPSTREAM)/hcrypto/md4.c
198
199 md5.o: ${UPSTREAM}/hcrypto/md5.c
200         $(AFS_CCRULE) $(UPSTREAM)/hcrypto/md5.c
201
202 pkcs5.o: ${UPSTREAM}/hcrypto/pkcs5.c
203         $(AFS_CCRULE) $(UPSTREAM)/hcrypto/pkcs5.c
204
205 rand-egd.o: ${UPSTREAM}/hcrypto/rand-egd.c
206         $(AFS_CCRULE) $(UPSTREAM)/hcrypto/rand-egd.c
207
208 rand-fortuna.o: ${UPSTREAM}/hcrypto/rand-fortuna.c
209         $(AFS_CCRULE) $(UPSTREAM)/hcrypto/rand-fortuna.c
210
211 rand-timer.o: ${UPSTREAM}/hcrypto/rand-timer.c
212         $(AFS_CCRULE) $(UPSTREAM)/hcrypto/rand-timer.c
213
214 rand-unix.o: ${UPSTREAM}/hcrypto/rand-unix.c
215         $(AFS_CCRULE) $(UPSTREAM)/hcrypto/rand-unix.c
216
217 rand.o: ${UPSTREAM}/hcrypto/rand.c
218         $(AFS_CCRULE) $(UPSTREAM)/hcrypto/rand.c
219
220 rc2.o: ${UPSTREAM}/hcrypto/rc2.c
221         $(AFS_CCRULE) $(UPSTREAM)/hcrypto/rc2.c
222
223 rc4.o: ${UPSTREAM}/hcrypto/rc4.c
224         $(AFS_CCRULE) $(UPSTREAM)/hcrypto/rc4.c
225
226 rijndael-alg-fst.o: ${UPSTREAM}/hcrypto/rijndael-alg-fst.c
227         $(AFS_CCRULE) $(UPSTREAM)/hcrypto/rijndael-alg-fst.c
228
229 rnd_keys.o: ${UPSTREAM}/hcrypto/rnd_keys.c
230         $(AFS_CCRULE) $(UPSTREAM)/hcrypto/rnd_keys.c
231
232 sha.o: ${UPSTREAM}/hcrypto/sha.c
233         $(AFS_CCRULE) $(UPSTREAM)/hcrypto/sha.c
234
235 sha256.o: ${UPSTREAM}/hcrypto/sha256.c
236         $(AFS_CCRULE) $(UPSTREAM)/hcrypto/sha256.c
237
238 sha512.o: ${UPSTREAM}/hcrypto/sha512.c
239         ${AFS_CCRULE} $(UPSTREAM)/hcrypto/sha512.c
240
241 ui.o: ${UPSTREAM}/hcrypto/ui.c
242         $(AFS_CCRULE) $(UPSTREAM)/hcrypto/ui.c
243
244 validate.o: ${UPSTREAM}/hcrypto/validate.c
245         ${AFS_CCRULE} ${UPSTREAM}/hcrypto/validate.c
246
247 test_cipher.o: ${UPSTREAM}/hcrypto/test_cipher.c
248         $(AFS_CCRULE) $(UPSTREAM)/hcrypto/test_cipher.c
249
250 #┬áThese bits of libroken are new functionality, rather than compatibility
251 # code. Where they should go eventually is unclear.
252
253 cloexec.o: ${UPSTREAM}/roken/cloexec.c
254         $(AFS_CCRULE) $(UPSTREAM)/roken/cloexec.c
255
256 ct.o: ${UPSTREAM}/roken/ct.c
257         $(AFS_CCRULE) $(UPSTREAM)/roken/ct.c
258
259 hex.o: ${UPSTREAM}/roken/hex.c
260         $(AFS_CCRULE) $(UPSTREAM)/roken/hex.c
261
262 issuid.o: ${UPSTREAM}/roken/issuid.c
263         $(AFS_CCRULE) $(UPSTREAM)/roken/issuid.c
264
265 net_read.o: ${UPSTREAM}/roken/net_read.c
266         $(AFS_CCRULE) $(UPSTREAM)/roken/net_read.c
267
268 net_write.o: ${UPSTREAM}/roken/net_write.c
269         $(AFS_CCRULE) $(UPSTREAM)/roken/net_write.c
270
271 # These bits of libroken are compatibility functions. They should get moved
272 # out into a new libroken top level target, which allows the use of an
273 # existing libroken, if one is available.
274
275 strlcpy.o: ${UPSTREAM}/roken/strlcpy.c
276         $(AFS_CCRULE) $(UPSTREAM)/roken/strlcpy.c
277
278 err.h: ${UPSTREAM}/roken/err.hin
279         cp $? $@
280
281 err.o: ${UPSTREAM}/roken/err.c
282         $(AFS_CCRULE) $(UPSTREAM)/roken/err.c
283
284 errx.o: ${UPSTREAM}/roken/errx.c
285         $(AFS_CCRULE) $(UPSTREAM)/roken/errx.c
286         ${CCRULE}
287
288 getprogname.o: ${UPSTREAM}/roken/getprogname.c
289         $(AFS_CCRULE) $(UPSTREAM)/roken/getprogname.c
290         ${CCRULE}
291
292 verr.o: ${UPSTREAM}/roken/verr.c
293         $(AFS_CCRULE) $(UPSTREAM)/roken/verr.c
294         ${CCRULE}
295
296 verrx.o: ${UPSTREAM}/roken/verrx.c
297         $(AFS_CCRULE) $(UPSTREAM)/roken/verrx.c
298         ${CCRULE}
299
300 vwarn.o: ${UPSTREAM}/roken/vwarn.c
301         $(AFS_CCRULE) $(UPSTREAM)/roken/vwarn.c
302         ${CCRULE}
303
304 vwarnx.o: ${UPSTREAM}/roken/vwarnx.c
305         $(AFS_CCRULE) $(UPSTREAM)/roken/vwarnx.c
306         ${CCRULE}
307
308 warn.o: ${UPSTREAM}/roken/warn.c
309         $(AFS_CCRULE) $(UPSTREAM)/roken/warn.c
310         ${CCRULE}
311
312 warnerr.o: ${UPSTREAM}/roken/warnerr.c
313         $(AFS_CCRULE) $(UPSTREAM)/roken/warnerr.c
314         ${CCRULE}
315
316 warnx.o: ${UPSTREAM}/roken/warnx.c
317         $(AFS_CCRULE) $(UPSTREAM)/roken/warnx.c
318         ${CCRULE}
319
320 # LWP Targets
321
322 rand-fortuna_lwp.o: ${UPSTREAM}/hcrypto/rand-fortuna.c
323         ${LWPRULE} -o rand-fortuna_lwp.o
324