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= 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 \
90 SRCS+= rsaz-avx2.pl rsaz-x86_64.pl x86_64-gf2m.pl x86_64-mont.pl \
97 SRCS+= chacha-x86_64.pl
100 SRCS+= ecp_nistz256-x86_64.pl x25519-x86_64.pl
106 SRCS+= aesni-gcm-x86_64.pl ghash-x86_64.pl
109 SRCS+= poly1305-x86_64.pl
112 SRCS+= rc4-md5-x86_64.pl rc4-x86_64.pl
115 SRCS+= keccak1600-x86_64.pl sha1-mb-x86_64.pl sha1-x86_64.pl \
122 SRCS+= e_padlock-x86_64.pl
124 SHA_ASM= sha256-x86_64 sha512-x86_64
125 SHA_SRC= sha512-x86_64.pl
126 SHA_TMP= ${SHA_ASM:S/$/.s/}
128 ASM= ${SRCS:R:S/$/.S/} ${SHA_ASM:S/$/.S/}
132 CLEANFILES= ${ASM} ${SHA_ASM:S/$/.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}
140 ${SHA_TMP}: ${SHA_SRC}
141 env CC=cc perl ${.ALLSRC} elf ${.TARGET}
145 ( echo '/* $$'FreeBSD'$$ */' ;\
146 echo '/* Do not modify. This file is auto-generated from ${SHA_SRC}. */' ;\
147 cat ${s}.s ) > ${.TARGET}
150 .elif defined(ASM_arm)
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
161 PERLPATH= -I${LCRYPTO_SRC}/crypto/perlasm
167 SRCS+= aes-armv4.pl aesv8-armx.pl bsaes-armv7.pl
170 SRCS+= armv4-mont.pl armv4-gf2m.pl
173 SRCS+= chacha-armv4.pl
176 SRCS+= ecp_nistz256-armv4.pl
179 SRCS+= ghash-armv4.pl ghashv8-armx.pl
182 SRCS+= poly1305-armv4.pl
185 SRCS+= keccak1600-armv4.pl sha1-armv4-large.pl sha256-armv4.pl sha512-armv4.pl
187 ASM= aes-armv4.S ${SRCS:R:S/$/.S/}
191 CLEANFILES= ${ASM} ${SRCS:R:S/$/.s/}
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}
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}
205 .elif defined(ASM_i386)
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
226 #PERLPATH= -I${LCRYPTO_SRC}/crypto/des/asm -I${LCRYPTO_SRC}/crypto/perlasm
232 SRCS+= aes-586.pl aesni-x86.pl vpaes-x86.pl
238 SRCS+= bn-586.pl co-586.pl x86-gf2m.pl x86-mont.pl
250 SRCS+= crypt586.pl des-586.pl
253 SRCS+= ecp_nistz256-x86.pl
262 SRCS+= poly1305-x86.pl
274 SRCS+= sha1-586.pl sha256-586.pl sha512-586.pl
280 SRCS+= e_padlock-x86.pl
282 ASM= ${SRCS:R:S/$/.S/}
286 CLEANFILES= ${ASM} ${SRCS:R:S/$/.s/}
290 ( echo '/* $$'FreeBSD'$$ */' ;\
291 echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T}. */' ;\
293 env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} -fpic -DPIC ${.IMPSRC:R:S/$/.s/} ;\
294 cat ${.IMPSRC:R:S/$/.s/} ;\
296 env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} ${.IMPSRC:R:S/$/.s/} ;\
297 cat ${.IMPSRC:R:S/$/.s/} ;\
298 echo '#endif' ) > ${.TARGET}
301 .include <bsd.prog.mk>