xref: /freebsd/secure/lib/libcrypto/Makefile.asm (revision 3d32dc633c5e21bf15dd0d968734efe72776afdc)
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/modes/asm \
14	${LCRYPTO_SRC}/crypto/sha/asm
15
16PERLPATH=	-I${LCRYPTO_SRC}/crypto/perlasm
17
18# aes
19SRCS=	aesv8-armx.pl
20
21# modes
22SRCS+=	ghashv8-armx.pl
23
24# sha
25SRCS+=	sha1-armv8.pl sha512-armv8.pl
26
27ASM=	${SRCS:R:S/$/.S/} sha256-armv8.S
28
29all:	${ASM}
30
31CLEANFILES=	${ASM} ${SRCS:R:S/$/.s/} sha256-armv8.s
32.SUFFIXES:	.pl
33
34sha256-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}
39
40.pl.S:
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}
45
46.elif defined(ASM_amd64)
47
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/chacha/asm \
53	${LCRYPTO_SRC}/crypto/ec/asm \
54	${LCRYPTO_SRC}/crypto/md5/asm \
55	${LCRYPTO_SRC}/crypto/modes/asm \
56	${LCRYPTO_SRC}/crypto/poly1305/asm \
57	${LCRYPTO_SRC}/crypto/rc4/asm \
58	${LCRYPTO_SRC}/crypto/sha/asm \
59	${LCRYPTO_SRC}/crypto/whrlpool/asm \
60	${LCRYPTO_SRC}/engines/asm
61
62# aes
63SRCS=	aes-x86_64.pl aesni-mb-x86_64.pl aesni-sha1-x86_64.pl \
64	aesni-sha256-x86_64.pl aesni-x86_64.pl bsaes-x86_64.pl \
65	vpaes-x86_64.pl
66
67# bn
68SRCS+=	rsaz-avx2.pl rsaz-x86_64.pl x86_64-gf2m.pl x86_64-mont.pl \
69	x86_64-mont5.pl
70
71# camellia
72SRCS+=	cmll-x86_64.pl
73
74# chacha
75SRCS+=	chacha-x86_64.pl
76
77# ec
78SRCS+=	ecp_nistz256-x86_64.pl x25519-x86_64.pl
79
80# engines
81SRCS+=	e_padlock-x86_64.pl
82
83# md5
84SRCS+=	md5-x86_64.pl
85
86# modes
87SRCS+=	aesni-gcm-x86_64.pl ghash-x86_64.pl
88
89# poly1305
90SRCS+=	poly1305-x86_64.pl
91
92# rc4
93SRCS+=	rc4-md5-x86_64.pl rc4-x86_64.pl
94
95# sha
96SRCS+=	keccak1600-x86_64.pl sha1-mb-x86_64.pl sha1-x86_64.pl \
97	sha256-mb-x86_64.pl
98
99# whrlpool
100SRCS+=	wp-x86_64.pl
101
102# cpuid
103SRCS+=	x86_64cpuid.pl
104
105SHA_ASM=	sha256-x86_64 sha512-x86_64
106SHA_SRC=	sha512-x86_64.pl
107SHA_TMP=	${SHA_ASM:S/$/.s/}
108
109ASM=	${SRCS:R:S/$/.S/} ${SHA_ASM:S/$/.S/}
110
111all:	${ASM}
112
113CLEANFILES=	${ASM} ${SHA_ASM:S/$/.s/}
114.SUFFIXES:	.pl
115
116.pl.S:
117	( echo '/* $$'FreeBSD'$$ */' ;\
118	echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T}. */' ;\
119	env CC=cc perl ${.IMPSRC} elf ) > ${.TARGET}
120
121${SHA_TMP}: ${SHA_SRC}
122	env CC=cc perl ${.ALLSRC} elf ${.TARGET}
123
124.for s in ${SHA_ASM}
125${s}.S: ${s}.s
126	( echo '/* $$'FreeBSD'$$ */' ;\
127	echo '/* Do not modify. This file is auto-generated from ${SHA_SRC}. */' ;\
128	cat ${s}.s ) > ${.TARGET}
129.endfor
130
131.elif defined(ASM_arm)
132
133.PATH:	${LCRYPTO_SRC}/crypto \
134	${LCRYPTO_SRC}/crypto/aes/asm \
135	${LCRYPTO_SRC}/crypto/bn/asm \
136	${LCRYPTO_SRC}/crypto/modes/asm \
137	${LCRYPTO_SRC}/crypto/sha/asm
138
139PERLPATH=	-I${LCRYPTO_SRC}/crypto/perlasm
140
141# aes
142SRCS=	aesv8-armx.pl bsaes-armv7.pl
143
144# bn
145SRCS+=	armv4-mont.pl armv4-gf2m.pl
146
147# modes
148SRCS+=	ghash-armv4.pl ghashv8-armx.pl
149
150# sha
151SRCS+=	sha1-armv4-large.pl sha256-armv4.pl sha512-armv4.pl
152
153ASM=	aes-armv4.S ${SRCS:R:S/$/.S/}
154
155all:	${ASM}
156
157CLEANFILES=	${ASM} ${SRCS:R:S/$/.s/}
158.SUFFIXES:	.pl
159
160aes-armv4.S:	aes-armv4.pl
161	( echo '/* $$'FreeBSD'$$ */' ;\
162	echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
163	env CC=cc perl ${.ALLSRC} elf ) > ${.TARGET}
164
165.pl.S:
166	env CC=cc perl ${.IMPSRC} elf ${.TARGET:R:S/$/.s/}
167	( echo '/* $$'FreeBSD'$$ */' ;\
168	echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T:R:S/$/.pl/}. */' ;\
169	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
170
171.elif defined(ASM_i386)
172
173.PATH:	${LCRYPTO_SRC}/crypto \
174	${LCRYPTO_SRC}/crypto/aes/asm \
175	${LCRYPTO_SRC}/crypto/bf/asm \
176	${LCRYPTO_SRC}/crypto/bn/asm \
177	${LCRYPTO_SRC}/crypto/camellia/asm \
178	${LCRYPTO_SRC}/crypto/des/asm \
179	${LCRYPTO_SRC}/crypto/md5/asm \
180	${LCRYPTO_SRC}/crypto/modes/asm \
181	${LCRYPTO_SRC}/crypto/rc4/asm \
182	${LCRYPTO_SRC}/crypto/rc5/asm \
183	${LCRYPTO_SRC}/crypto/ripemd/asm \
184	${LCRYPTO_SRC}/crypto/sha/asm \
185	${LCRYPTO_SRC}/crypto/whrlpool/asm
186
187PERLPATH=	-I${LCRYPTO_SRC}/crypto/des/asm -I${LCRYPTO_SRC}/crypto/perlasm
188
189# aes
190SRCS=	aes-586.pl aesni-x86.pl vpaes-x86.pl
191
192# blowfish
193SRCS+=	bf-586.pl bf-686.pl
194
195# bn
196SRCS+=	bn-586.pl co-586.pl x86-gf2m.pl x86-mont.pl
197
198# camellia
199SRCS+=	cmll-x86.pl
200
201# des
202SRCS+=	crypt586.pl des-586.pl
203
204# md5
205SRCS+=	md5-586.pl
206
207# modes
208SRCS+=	ghash-x86.pl
209
210# rc4
211SRCS+=	rc4-586.pl
212
213# rc5
214SRCS+=	rc5-586.pl
215
216# ripemd
217SRCS+=	rmd-586.pl
218
219# sha
220SRCS+=	sha1-586.pl sha256-586.pl sha512-586.pl
221
222# whrlpool
223SRCS+=	wp-mmx.pl
224
225# cpuid
226SRCS+=	x86cpuid.pl
227
228ASM=	${SRCS:R:S/$/.S/}
229
230all:	${ASM}
231
232CLEANFILES=	${ASM}
233.SUFFIXES:	.pl
234
235.pl.S:
236	( echo '/* $$'FreeBSD'$$ */' ;\
237	echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T}. */' ;\
238	echo '#ifdef PIC' ;\
239	env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} -fpic -DPIC ;\
240	echo '#else' ;\
241	env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} ;\
242	echo '#endif') |\
243	sed -E 's|(\.file[[:blank:]]+)".*"|\1"${.TARGET}"|' > ${.TARGET}
244.endif
245
246.include <bsd.prog.mk>
247