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.
7 .include "Makefile.inc"
9 .if defined(ASM_aarch64)
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
20 PERLPATH= -I${LCRYPTO_SRC}/crypto/perlasm
26 SRCS+= aesv8-armx.pl vpaes-armv8.pl
32 SRCS+= chacha-armv8.pl
35 SRCS+= ecp_nistz256-armv8.pl
38 SRCS+= ghashv8-armx.pl
41 SRCS+= poly1305-armv8.pl
44 SRCS+= keccak1600-armv8.pl sha1-armv8.pl sha512-armv8.pl
46 ASM= ${SRCS:R:S/$/.S/} sha256-armv8.S
50 CLEANFILES= ${ASM} ${SRCS:R:S/$/.s/} sha256-armv8.s
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}
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}
65 .elif defined(ASM_amd64)
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
85 SRCS= aesni-mb-x86_64.pl aesni-sha1-x86_64.pl aesni-sha256-x86_64.pl \
86 aesni-x86_64.pl vpaes-x86_64.pl
89 SRCS+= rsaz-avx2.pl rsaz-x86_64.pl x86_64-gf2m.pl x86_64-mont.pl \
96 SRCS+= chacha-x86_64.pl
99 SRCS+= ecp_nistz256-x86_64.pl x25519-x86_64.pl
105 SRCS+= aesni-gcm-x86_64.pl ghash-x86_64.pl
108 SRCS+= poly1305-x86_64.pl
111 SRCS+= rc4-md5-x86_64.pl rc4-x86_64.pl
114 SRCS+= keccak1600-x86_64.pl sha1-mb-x86_64.pl sha1-x86_64.pl \
121 SRCS+= e_padlock-x86_64.pl
123 SHA_ASM= sha256-x86_64 sha512-x86_64
124 SHA_SRC= sha512-x86_64.pl
125 SHA_TMP= ${SHA_ASM:S/$/.s/}
127 ASM= ${SRCS:R:S/$/.S/} ${SHA_ASM:S/$/.S/}
131 CLEANFILES= ${ASM} ${SHA_ASM:S/$/.s/}
135 ( echo '/* $$'FreeBSD'$$ */' ;\
136 echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T}. */' ;\
137 env CC=cc perl ${.IMPSRC} elf ) > ${.TARGET}
139 ${SHA_TMP}: ${SHA_SRC}
140 env CC=cc perl ${.ALLSRC} elf ${.TARGET}
144 ( echo '/* $$'FreeBSD'$$ */' ;\
145 echo '/* Do not modify. This file is auto-generated from ${SHA_SRC}. */' ;\
146 cat ${s}.s ) > ${.TARGET}
149 .elif defined(ASM_arm)
151 .PATH: ${LCRYPTO_SRC}/crypto \
152 ${LCRYPTO_SRC}/crypto/aes/asm \
153 ${LCRYPTO_SRC}/crypto/bn/asm \
154 ${LCRYPTO_SRC}/crypto/chacha/asm \
155 ${LCRYPTO_SRC}/crypto/ec/asm \
156 ${LCRYPTO_SRC}/crypto/modes/asm \
157 ${LCRYPTO_SRC}/crypto/poly1305/asm \
158 ${LCRYPTO_SRC}/crypto/sha/asm
160 PERLPATH= -I${LCRYPTO_SRC}/crypto/perlasm
166 SRCS+= aes-armv4.pl aesv8-armx.pl bsaes-armv7.pl
169 SRCS+= armv4-mont.pl armv4-gf2m.pl
172 SRCS+= chacha-armv4.pl
175 SRCS+= ecp_nistz256-armv4.pl
178 SRCS+= ghash-armv4.pl ghashv8-armx.pl
181 SRCS+= poly1305-armv4.pl
184 SRCS+= keccak1600-armv4.pl sha1-armv4-large.pl sha256-armv4.pl sha512-armv4.pl
186 ASM= aes-armv4.S ${SRCS:R:S/$/.S/}
190 CLEANFILES= ${ASM} ${SRCS:R:S/$/.s/}
193 aes-armv4.S: aes-armv4.pl
194 ( echo '/* $$'FreeBSD'$$ */' ;\
195 echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
196 env CC=cc perl ${.ALLSRC} linux32 ) > ${.TARGET}
199 env CC=cc perl ${.IMPSRC} linux32 ${.TARGET:R:S/$/.s/}
200 ( echo '/* $$'FreeBSD'$$ */' ;\
201 echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T:R:S/$/.pl/}. */' ;\
202 cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
204 .elif defined(ASM_i386)
206 .PATH: ${LCRYPTO_SRC}/crypto \
207 ${LCRYPTO_SRC}/crypto/aes/asm \
208 ${LCRYPTO_SRC}/crypto/bf/asm \
209 ${LCRYPTO_SRC}/crypto/bn/asm \
210 ${LCRYPTO_SRC}/crypto/camellia/asm \
211 ${LCRYPTO_SRC}/crypto/cast/asm \
212 ${LCRYPTO_SRC}/crypto/chacha/asm \
213 ${LCRYPTO_SRC}/crypto/des/asm \
214 ${LCRYPTO_SRC}/crypto/ec/asm \
215 ${LCRYPTO_SRC}/crypto/md5/asm \
216 ${LCRYPTO_SRC}/crypto/modes/asm \
217 ${LCRYPTO_SRC}/crypto/poly1305/asm \
218 ${LCRYPTO_SRC}/crypto/rc4/asm \
219 ${LCRYPTO_SRC}/crypto/rc5/asm \
220 ${LCRYPTO_SRC}/crypto/ripemd/asm \
221 ${LCRYPTO_SRC}/crypto/sha/asm \
222 ${LCRYPTO_SRC}/crypto/whrlpool/asm \
223 ${LCRYPTO_SRC}/engines/asm
225 #PERLPATH= -I${LCRYPTO_SRC}/crypto/des/asm -I${LCRYPTO_SRC}/crypto/perlasm
231 SRCS+= aesni-x86.pl vpaes-x86.pl
237 SRCS+= bn-586.pl co-586.pl x86-gf2m.pl x86-mont.pl
249 SRCS+= crypt586.pl des-586.pl
252 SRCS+= ecp_nistz256-x86.pl
261 SRCS+= poly1305-x86.pl
273 SRCS+= sha1-586.pl sha256-586.pl sha512-586.pl
279 SRCS+= e_padlock-x86.pl
281 ASM= ${SRCS:R:S/$/.S/}
285 CLEANFILES= ${ASM} ${SRCS:R:S/$/.s/}
289 ( echo '/* $$'FreeBSD'$$ */' ;\
290 echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T}. */' ;\
292 env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} -fpic -DPIC ${.IMPSRC:R:S/$/.s/} ;\
293 cat ${.IMPSRC:R:S/$/.s/} ;\
295 env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} ${.IMPSRC:R:S/$/.s/} ;\
296 cat ${.IMPSRC:R:S/$/.s/} ;\
297 echo '#endif' ) > ${.TARGET}
300 .include <bsd.prog.mk>