xref: /freebsd/secure/lib/libcrypto/Makefile.asm (revision 42249ef2)
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
20PERLPATH=	-I${LCRYPTO_SRC}/crypto/perlasm
21
22# cpuid
23SRCS=	arm64cpuid.pl
24
25# aes
26SRCS+=	aesv8-armx.pl vpaes-armv8.pl
27
28# bn
29SRCS+=	armv8-mont.pl
30
31# chacha
32SRCS+=	chacha-armv8.pl
33
34# ec
35SRCS+=	ecp_nistz256-armv8.pl
36
37# modes
38SRCS+=	ghashv8-armx.pl
39
40# poly1305
41SRCS+=	poly1305-armv8.pl
42
43# sha
44SRCS+=	keccak1600-armv8.pl sha1-armv8.pl sha512-armv8.pl
45
46ASM=	${SRCS:R:S/$/.S/} sha256-armv8.S
47
48all:	${ASM}
49
50CLEANFILES=	${ASM} ${SRCS:R:S/$/.s/} sha256-armv8.s
51.SUFFIXES:	.pl
52
53sha256-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
82SRCS+=	x86_64cpuid.pl
83
84# aes
85SRCS=	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
90SRCS+=	rsaz-avx2.pl rsaz-x86_64.pl x86_64-gf2m.pl x86_64-mont.pl \
91	x86_64-mont5.pl
92
93# camellia
94SRCS+=	cmll-x86_64.pl
95
96# chacha
97SRCS+=	chacha-x86_64.pl
98
99# ec
100SRCS+=	ecp_nistz256-x86_64.pl x25519-x86_64.pl
101
102# md5
103SRCS+=	md5-x86_64.pl
104
105# modes
106SRCS+=	aesni-gcm-x86_64.pl ghash-x86_64.pl
107
108# poly1305
109SRCS+=	poly1305-x86_64.pl
110
111# rc4
112SRCS+=	rc4-md5-x86_64.pl rc4-x86_64.pl
113
114# sha
115SRCS+=	keccak1600-x86_64.pl sha1-mb-x86_64.pl sha1-x86_64.pl \
116	sha256-mb-x86_64.pl
117
118# whrlpool
119SRCS+=	wp-x86_64.pl
120
121# engines
122SRCS+=	e_padlock-x86_64.pl
123
124SHA_ASM=	sha256-x86_64 sha512-x86_64
125SHA_SRC=	sha512-x86_64.pl
126SHA_TMP=	${SHA_ASM:S/$/.s/}
127
128ASM=	${SRCS:R:S/$/.S/} ${SHA_ASM:S/$/.S/}
129
130all:	${ASM}
131
132CLEANFILES=	${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
161PERLPATH=	-I${LCRYPTO_SRC}/crypto/perlasm
162
163# cpuid
164SRCS=	armv4cpuid.pl
165
166# aes
167SRCS+=	aes-armv4.pl aesv8-armx.pl bsaes-armv7.pl
168
169# bn
170SRCS+=	armv4-mont.pl armv4-gf2m.pl
171
172# chacha
173SRCS+=	chacha-armv4.pl
174
175# ec
176SRCS+=	ecp_nistz256-armv4.pl
177
178# modes
179SRCS+=	ghash-armv4.pl ghashv8-armx.pl
180
181# poly1305
182SRCS+=	poly1305-armv4.pl
183
184# sha
185SRCS+=	keccak1600-armv4.pl sha1-armv4-large.pl sha256-armv4.pl sha512-armv4.pl
186
187ASM=	aes-armv4.S ${SRCS:R:S/$/.S/}
188
189all:	${ASM}
190
191CLEANFILES=	${ASM} ${SRCS:R:S/$/.s/}
192.SUFFIXES:	.pl
193
194aes-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
229SRCS=	x86cpuid.pl
230
231# aes
232SRCS+=	aes-586.pl aesni-x86.pl vpaes-x86.pl
233
234# blowfish
235SRCS+=	bf-586.pl
236
237# bn
238SRCS+=	bn-586.pl co-586.pl x86-gf2m.pl x86-mont.pl
239
240# camellia
241SRCS+=	cmll-x86.pl
242
243# cast
244SRCS+=	cast-586.pl
245
246# chacha
247SRCS+=	chacha-x86.pl
248
249# des
250SRCS+=	crypt586.pl des-586.pl
251
252# ec
253SRCS+=	ecp_nistz256-x86.pl
254
255# md5
256SRCS+=	md5-586.pl
257
258# modes
259SRCS+=	ghash-x86.pl
260
261# poly1305
262SRCS+=	poly1305-x86.pl
263
264# rc4
265SRCS+=	rc4-586.pl
266
267# rc5
268SRCS+=	rc5-586.pl
269
270# ripemd
271SRCS+=	rmd-586.pl
272
273# sha
274SRCS+=	sha1-586.pl sha256-586.pl sha512-586.pl
275
276# whrlpool
277SRCS+=	wp-mmx.pl
278
279# engines
280SRCS+=	e_padlock-x86.pl
281
282ASM=	${SRCS:R:S/$/.S/}
283
284all:	${ASM}
285
286CLEANFILES=	${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>
302