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/modes/asm \
14 ${LCRYPTO_SRC}/crypto/sha/asm
16 PERLPATH= -I${LCRYPTO_SRC}/crypto/perlasm
22 SRCS+= ghashv8-armx.pl
25 SRCS+= sha1-armv8.pl sha512-armv8.pl
27 ASM= ${SRCS:R:S/$/.S/} sha256-armv8.S
31 CLEANFILES= ${ASM} ${SRCS:R:S/$/.s/} sha256-armv8.s
34 sha256-armv8.S: sha512-armv8.pl
35 env CC=cc perl ${.ALLSRC} 64 ${.TARGET:R:S/$/.s/}
36 ( echo '/* $$'FreeBSD'$$ */' ;\
37 echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T:R:S/$/.pl/}. */' ;\
38 cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
41 env CC=cc perl ${.IMPSRC} 64 ${.TARGET:R:S/$/.s/}
42 ( echo '/* $$'FreeBSD'$$ */' ;\
43 echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T:R:S/$/.pl/}. */' ;\
44 cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
46 .elif defined(ASM_amd64)
48 .PATH: ${LCRYPTO_SRC}/crypto \
49 ${LCRYPTO_SRC}/crypto/aes/asm \
50 ${LCRYPTO_SRC}/crypto/bn/asm \
51 ${LCRYPTO_SRC}/crypto/camellia/asm \
52 ${LCRYPTO_SRC}/crypto/ec/asm \
53 ${LCRYPTO_SRC}/crypto/md5/asm \
54 ${LCRYPTO_SRC}/crypto/modes/asm \
55 ${LCRYPTO_SRC}/crypto/rc4/asm \
56 ${LCRYPTO_SRC}/crypto/sha/asm \
57 ${LCRYPTO_SRC}/crypto/whrlpool/asm
60 SRCS= aes-x86_64.pl aesni-mb-x86_64.pl aesni-sha1-x86_64.pl \
61 aesni-sha256-x86_64.pl aesni-x86_64.pl bsaes-x86_64.pl \
65 SRCS+= rsaz-avx2.pl rsaz-x86_64.pl x86_64-gf2m.pl x86_64-mont.pl \
72 SRCS+= ecp_nistz256-x86_64.pl
78 SRCS+= aesni-gcm-x86_64.pl ghash-x86_64.pl
81 SRCS+= rc4-md5-x86_64.pl rc4-x86_64.pl
84 SRCS+= sha1-mb-x86_64.pl sha1-x86_64.pl sha256-mb-x86_64.pl
92 SHA_ASM= sha256-x86_64 sha512-x86_64
93 SHA_SRC= sha512-x86_64.pl
94 SHA_TMP= ${SHA_ASM:S/$/.s/}
96 ASM= ${SRCS:R:S/$/.S/} ${SHA_ASM:S/$/.S/}
100 CLEANFILES= ${ASM} ${SHA_ASM:S/$/.s/}
104 ( echo '/* $$'FreeBSD'$$ */' ;\
105 echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T}. */' ;\
106 env CC=cc perl ${.IMPSRC} elf ) > ${.TARGET}
108 ${SHA_TMP}: ${SHA_SRC}
109 env CC=cc perl ${.ALLSRC} elf ${.TARGET}
113 ( echo '/* $$'FreeBSD'$$ */' ;\
114 echo '/* Do not modify. This file is auto-generated from ${SHA_SRC}. */' ;\
115 cat ${s}.s ) > ${.TARGET}
118 .elif defined(ASM_arm)
120 .PATH: ${LCRYPTO_SRC}/crypto \
121 ${LCRYPTO_SRC}/crypto/aes/asm \
122 ${LCRYPTO_SRC}/crypto/bn/asm \
123 ${LCRYPTO_SRC}/crypto/modes/asm \
124 ${LCRYPTO_SRC}/crypto/sha/asm
126 PERLPATH= -I${LCRYPTO_SRC}/crypto/perlasm
129 SRCS= aesv8-armx.pl bsaes-armv7.pl
132 SRCS+= armv4-mont.pl armv4-gf2m.pl
135 SRCS+= ghash-armv4.pl ghashv8-armx.pl
138 SRCS+= sha1-armv4-large.pl sha256-armv4.pl sha512-armv4.pl
140 ASM= aes-armv4.S ${SRCS:R:S/$/.S/}
144 CLEANFILES= ${ASM} ${SRCS:R:S/$/.s/}
147 aes-armv4.S: aes-armv4.pl
148 ( echo '/* $$'FreeBSD'$$ */' ;\
149 echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
150 env CC=cc perl ${.ALLSRC} elf ) > ${.TARGET}
153 env CC=cc perl ${.IMPSRC} elf ${.TARGET:R:S/$/.s/}
154 ( echo '/* $$'FreeBSD'$$ */' ;\
155 echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T:R:S/$/.pl/}. */' ;\
156 cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
158 .elif defined(ASM_i386)
160 .PATH: ${LCRYPTO_SRC}/crypto \
161 ${LCRYPTO_SRC}/crypto/aes/asm \
162 ${LCRYPTO_SRC}/crypto/bf/asm \
163 ${LCRYPTO_SRC}/crypto/bn/asm \
164 ${LCRYPTO_SRC}/crypto/camellia/asm \
165 ${LCRYPTO_SRC}/crypto/des/asm \
166 ${LCRYPTO_SRC}/crypto/md5/asm \
167 ${LCRYPTO_SRC}/crypto/modes/asm \
168 ${LCRYPTO_SRC}/crypto/rc4/asm \
169 ${LCRYPTO_SRC}/crypto/rc5/asm \
170 ${LCRYPTO_SRC}/crypto/ripemd/asm \
171 ${LCRYPTO_SRC}/crypto/sha/asm \
172 ${LCRYPTO_SRC}/crypto/whrlpool/asm
174 PERLPATH= -I${LCRYPTO_SRC}/crypto/des/asm -I${LCRYPTO_SRC}/crypto/perlasm
177 SRCS= aes-586.pl aesni-x86.pl vpaes-x86.pl
180 SRCS+= bf-586.pl bf-686.pl
183 SRCS+= bn-586.pl co-586.pl x86-gf2m.pl x86-mont.pl
189 SRCS+= crypt586.pl des-586.pl
207 SRCS+= sha1-586.pl sha256-586.pl sha512-586.pl
215 ASM= ${SRCS:R:S/$/.S/}
223 ( echo '/* $$'FreeBSD'$$ */' ;\
224 echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T}. */' ;\
226 env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} -fpic -DPIC ;\
228 env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} ;\
230 sed -E 's|(\.file[[:blank:]]+)".*"|\1"${.TARGET}"|' > ${.TARGET}
233 .include <bsd.prog.mk>