]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - secure/lib/libcrypto/Makefile.asm
MFC: r340703
[FreeBSD/FreeBSD.git] / secure / lib / libcrypto / Makefile.asm
1 # $FreeBSD$
2 # Use this to help generate the asm *.S files after an import.  It is not
3 # perfect by any means, but does what is needed.
4 # Do a 'make -f Makefile.asm all' and it will generate *.S.  Move them
5 # to the arch subdir, and correct any exposed paths and $ FreeBSD $ tags.
6
7 .include "Makefile.inc"
8
9 .if defined(ASM_aarch64)
10
11 .PATH:  ${LCRYPTO_SRC}/crypto \
12         ${LCRYPTO_SRC}/crypto/aes/asm \
13         ${LCRYPTO_SRC}/crypto/bn/asm \
14         ${LCRYPTO_SRC}/crypto/chacha/asm \
15         ${LCRYPTO_SRC}/crypto/ec/asm \
16         ${LCRYPTO_SRC}/crypto/modes/asm \
17         ${LCRYPTO_SRC}/crypto/poly1305/asm \
18         ${LCRYPTO_SRC}/crypto/sha/asm
19
20 PERLPATH=       -I${LCRYPTO_SRC}/crypto/perlasm
21
22 # cpuid
23 SRCS=   arm64cpuid.pl
24
25 # aes
26 SRCS+=  aesv8-armx.pl vpaes-armv8.pl
27
28 # bn
29 SRCS+=  armv8-mont.pl
30
31 # chacha
32 SRCS+=  chacha-armv8.pl
33
34 # ec
35 SRCS+=  ecp_nistz256-armv8.pl
36
37 # modes
38 SRCS+=  ghashv8-armx.pl
39
40 # poly1305
41 SRCS+=  poly1305-armv8.pl
42
43 # sha
44 SRCS+=  keccak1600-armv8.pl sha1-armv8.pl sha512-armv8.pl
45
46 ASM=    ${SRCS:R:S/$/.S/} sha256-armv8.S
47
48 all:    ${ASM}
49
50 CLEANFILES=     ${ASM} ${SRCS:R:S/$/.s/} sha256-armv8.s
51 .SUFFIXES:      .pl
52
53 sha256-armv8.S: sha512-armv8.pl
54         env CC=cc perl ${.ALLSRC} linux64 ${.TARGET:R:S/$/.s/}
55         ( echo '/* $$'FreeBSD'$$ */' ;\
56         echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T:R:S/$/.pl/}. */' ;\
57         cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
58
59 .pl.S:
60         env CC=cc perl ${.IMPSRC} linux64 ${.TARGET:R:S/$/.s/}
61         ( echo '/* $$'FreeBSD'$$ */' ;\
62         echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T:R:S/$/.pl/}. */' ;\
63         cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
64
65 .elif defined(ASM_amd64)
66
67 .PATH:  ${LCRYPTO_SRC}/crypto \
68         ${LCRYPTO_SRC}/crypto/aes/asm \
69         ${LCRYPTO_SRC}/crypto/bn/asm \
70         ${LCRYPTO_SRC}/crypto/camellia/asm \
71         ${LCRYPTO_SRC}/crypto/chacha/asm \
72         ${LCRYPTO_SRC}/crypto/ec/asm \
73         ${LCRYPTO_SRC}/crypto/md5/asm \
74         ${LCRYPTO_SRC}/crypto/modes/asm \
75         ${LCRYPTO_SRC}/crypto/poly1305/asm \
76         ${LCRYPTO_SRC}/crypto/rc4/asm \
77         ${LCRYPTO_SRC}/crypto/sha/asm \
78         ${LCRYPTO_SRC}/crypto/whrlpool/asm \
79         ${LCRYPTO_SRC}/engines/asm
80
81 # cpuid
82 SRCS+=  x86_64cpuid.pl
83
84 # aes
85 SRCS=   aes-x86_64.pl aesni-mb-x86_64.pl aesni-sha1-x86_64.pl \
86         aesni-sha256-x86_64.pl aesni-x86_64.pl bsaes-x86_64.pl \
87         vpaes-x86_64.pl
88
89 # bn
90 SRCS+=  rsaz-avx2.pl rsaz-x86_64.pl x86_64-gf2m.pl x86_64-mont.pl \
91         x86_64-mont5.pl
92
93 # camellia
94 SRCS+=  cmll-x86_64.pl
95
96 # chacha
97 SRCS+=  chacha-x86_64.pl
98
99 # ec
100 SRCS+=  ecp_nistz256-x86_64.pl x25519-x86_64.pl
101
102 # md5
103 SRCS+=  md5-x86_64.pl
104
105 # modes
106 SRCS+=  aesni-gcm-x86_64.pl ghash-x86_64.pl
107
108 # poly1305
109 SRCS+=  poly1305-x86_64.pl
110
111 # rc4
112 SRCS+=  rc4-md5-x86_64.pl rc4-x86_64.pl
113
114 # sha
115 SRCS+=  keccak1600-x86_64.pl sha1-mb-x86_64.pl sha1-x86_64.pl \
116         sha256-mb-x86_64.pl
117
118 # whrlpool
119 SRCS+=  wp-x86_64.pl
120
121 # engines
122 SRCS+=  e_padlock-x86_64.pl
123
124 SHA_ASM=        sha256-x86_64 sha512-x86_64
125 SHA_SRC=        sha512-x86_64.pl
126 SHA_TMP=        ${SHA_ASM:S/$/.s/}
127
128 ASM=    ${SRCS:R:S/$/.S/} ${SHA_ASM:S/$/.S/}
129
130 all:    ${ASM}
131
132 CLEANFILES=     ${ASM} ${SHA_ASM:S/$/.s/}
133 .SUFFIXES:      .pl
134
135 .pl.S:
136         ( echo '/* $$'FreeBSD'$$ */' ;\
137         echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T}. */' ;\
138         env CC=cc perl ${.IMPSRC} elf ) > ${.TARGET}
139
140 ${SHA_TMP}: ${SHA_SRC}
141         env CC=cc perl ${.ALLSRC} elf ${.TARGET}
142
143 .for s in ${SHA_ASM}
144 ${s}.S: ${s}.s
145         ( echo '/* $$'FreeBSD'$$ */' ;\
146         echo '/* Do not modify. This file is auto-generated from ${SHA_SRC}. */' ;\
147         cat ${s}.s ) > ${.TARGET}
148 .endfor
149
150 .elif defined(ASM_arm)
151
152 .PATH:  ${LCRYPTO_SRC}/crypto \
153         ${LCRYPTO_SRC}/crypto/aes/asm \
154         ${LCRYPTO_SRC}/crypto/bn/asm \
155         ${LCRYPTO_SRC}/crypto/chacha/asm \
156         ${LCRYPTO_SRC}/crypto/ec/asm \
157         ${LCRYPTO_SRC}/crypto/modes/asm \
158         ${LCRYPTO_SRC}/crypto/poly1305/asm \
159         ${LCRYPTO_SRC}/crypto/sha/asm
160
161 PERLPATH=       -I${LCRYPTO_SRC}/crypto/perlasm
162
163 # cpuid
164 SRCS=   armv4cpuid.pl
165
166 # aes
167 SRCS+=  aes-armv4.pl aesv8-armx.pl bsaes-armv7.pl
168
169 # bn
170 SRCS+=  armv4-mont.pl armv4-gf2m.pl
171
172 # chacha
173 SRCS+=  chacha-armv4.pl
174
175 # ec
176 SRCS+=  ecp_nistz256-armv4.pl
177
178 # modes
179 SRCS+=  ghash-armv4.pl ghashv8-armx.pl
180
181 # poly1305
182 SRCS+=  poly1305-armv4.pl
183
184 # sha
185 SRCS+=  keccak1600-armv4.pl sha1-armv4-large.pl sha256-armv4.pl sha512-armv4.pl
186
187 ASM=    aes-armv4.S ${SRCS:R:S/$/.S/}
188
189 all:    ${ASM}
190
191 CLEANFILES=     ${ASM} ${SRCS:R:S/$/.s/}
192 .SUFFIXES:      .pl
193
194 aes-armv4.S:    aes-armv4.pl
195         ( echo '/* $$'FreeBSD'$$ */' ;\
196         echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
197         env CC=cc perl ${.ALLSRC} linux32 ) > ${.TARGET}
198
199 .pl.S:
200         env CC=cc perl ${.IMPSRC} linux32 ${.TARGET:R:S/$/.s/}
201         ( echo '/* $$'FreeBSD'$$ */' ;\
202         echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T:R:S/$/.pl/}. */' ;\
203         cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
204
205 .elif defined(ASM_i386)
206
207 .PATH:  ${LCRYPTO_SRC}/crypto \
208         ${LCRYPTO_SRC}/crypto/aes/asm \
209         ${LCRYPTO_SRC}/crypto/bf/asm \
210         ${LCRYPTO_SRC}/crypto/bn/asm \
211         ${LCRYPTO_SRC}/crypto/camellia/asm \
212         ${LCRYPTO_SRC}/crypto/cast/asm \
213         ${LCRYPTO_SRC}/crypto/chacha/asm \
214         ${LCRYPTO_SRC}/crypto/des/asm \
215         ${LCRYPTO_SRC}/crypto/ec/asm \
216         ${LCRYPTO_SRC}/crypto/md5/asm \
217         ${LCRYPTO_SRC}/crypto/modes/asm \
218         ${LCRYPTO_SRC}/crypto/poly1305/asm \
219         ${LCRYPTO_SRC}/crypto/rc4/asm \
220         ${LCRYPTO_SRC}/crypto/rc5/asm \
221         ${LCRYPTO_SRC}/crypto/ripemd/asm \
222         ${LCRYPTO_SRC}/crypto/sha/asm \
223         ${LCRYPTO_SRC}/crypto/whrlpool/asm \
224         ${LCRYPTO_SRC}/engines/asm
225
226 #PERLPATH=      -I${LCRYPTO_SRC}/crypto/des/asm -I${LCRYPTO_SRC}/crypto/perlasm
227
228 # cpuid
229 SRCS=   x86cpuid.pl
230
231 # aes
232 SRCS+=  aes-586.pl aesni-x86.pl vpaes-x86.pl
233
234 # blowfish
235 SRCS+=  bf-586.pl
236
237 # bn
238 SRCS+=  bn-586.pl co-586.pl x86-gf2m.pl x86-mont.pl
239
240 # camellia
241 SRCS+=  cmll-x86.pl
242
243 # cast
244 SRCS+=  cast-586.pl
245
246 # chacha
247 SRCS+=  chacha-x86.pl
248
249 # des
250 SRCS+=  crypt586.pl des-586.pl
251
252 # ec
253 SRCS+=  ecp_nistz256-x86.pl
254
255 # md5
256 SRCS+=  md5-586.pl
257
258 # modes
259 SRCS+=  ghash-x86.pl
260
261 # poly1305
262 SRCS+=  poly1305-x86.pl
263
264 # rc4
265 SRCS+=  rc4-586.pl
266
267 # rc5
268 SRCS+=  rc5-586.pl
269
270 # ripemd
271 SRCS+=  rmd-586.pl
272
273 # sha
274 SRCS+=  sha1-586.pl sha256-586.pl sha512-586.pl
275
276 # whrlpool
277 SRCS+=  wp-mmx.pl
278
279 # engines
280 SRCS+=  e_padlock-x86.pl
281
282 ASM=    ${SRCS:R:S/$/.S/}
283
284 all:    ${ASM}
285
286 CLEANFILES=     ${ASM} ${SRCS:R:S/$/.s/}
287 .SUFFIXES:      .pl
288
289 .pl.S:
290         ( echo '/* $$'FreeBSD'$$ */' ;\
291         echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T}. */' ;\
292         echo '#ifdef PIC' ;\
293         env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} -fpic -DPIC ${.IMPSRC:R:S/$/.s/} ;\
294         cat ${.IMPSRC:R:S/$/.s/} ;\
295         echo '#else' ;\
296         env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} ${.IMPSRC:R:S/$/.s/} ;\
297         cat ${.IMPSRC:R:S/$/.s/} ;\
298         echo '#endif' ) > ${.TARGET}
299 .endif
300
301 .include <bsd.prog.mk>