xref: /freebsd/secure/lib/libcrypto/Makefile.asm (revision 5dae51da3da0cc94d17bd67b308fad304ebec7e0)
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/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
58
59# aes
60SRCS=	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 \
62	vpaes-x86_64.pl
63
64# bn
65SRCS+=	rsaz-avx2.pl rsaz-x86_64.pl x86_64-gf2m.pl x86_64-mont.pl \
66	x86_64-mont5.pl
67
68# camellia
69SRCS+=	cmll-x86_64.pl
70
71# ec
72SRCS+=	ecp_nistz256-x86_64.pl
73
74# md5
75SRCS+=	md5-x86_64.pl
76
77# modes
78SRCS+=	aesni-gcm-x86_64.pl ghash-x86_64.pl
79
80# rc4
81SRCS+=	rc4-md5-x86_64.pl rc4-x86_64.pl
82
83# sha
84SRCS+=	sha1-mb-x86_64.pl sha1-x86_64.pl sha256-mb-x86_64.pl
85
86# whrlpool
87SRCS+=	wp-x86_64.pl
88
89# cpuid
90SRCS+=	x86_64cpuid.pl
91
92SHA_ASM=	sha256-x86_64 sha512-x86_64
93SHA_SRC=	sha512-x86_64.pl
94SHA_TMP=	${SHA_ASM:S/$/.s/}
95
96ASM=	${SRCS:R:S/$/.S/} ${SHA_ASM:S/$/.S/}
97
98all:	${ASM}
99
100CLEANFILES=	${ASM} ${SHA_ASM:S/$/.s/}
101.SUFFIXES:	.pl
102
103.pl.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}
107
108${SHA_TMP}: ${SHA_SRC}
109	env CC=cc perl ${.ALLSRC} elf ${.TARGET}
110
111.for s in ${SHA_ASM}
112${s}.S: ${s}.s
113	( echo '/* $$'FreeBSD'$$ */' ;\
114	echo '/* Do not modify. This file is auto-generated from ${SHA_SRC}. */' ;\
115	cat ${s}.s ) > ${.TARGET}
116.endfor
117
118.elif defined(ASM_arm)
119
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
125
126PERLPATH=	-I${LCRYPTO_SRC}/crypto/perlasm
127
128# aes
129SRCS=	aesv8-armx.pl bsaes-armv7.pl
130
131# bn
132SRCS+=	armv4-mont.pl armv4-gf2m.pl
133
134# modes
135SRCS+=	ghash-armv4.pl ghashv8-armx.pl
136
137# sha
138SRCS+=	sha1-armv4-large.pl sha256-armv4.pl sha512-armv4.pl
139
140ASM=	aes-armv4.S ${SRCS:R:S/$/.S/}
141
142all:	${ASM}
143
144CLEANFILES=	${ASM} ${SRCS:R:S/$/.s/}
145.SUFFIXES:	.pl
146
147aes-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}
151
152.pl.S:
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}
157
158.elif defined(ASM_i386)
159
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
173
174PERLPATH=	-I${LCRYPTO_SRC}/crypto/des/asm -I${LCRYPTO_SRC}/crypto/perlasm
175
176# aes
177SRCS=	aes-586.pl aesni-x86.pl vpaes-x86.pl
178
179# blowfish
180SRCS+=	bf-586.pl bf-686.pl
181
182# bn
183SRCS+=	bn-586.pl co-586.pl x86-gf2m.pl x86-mont.pl
184
185# camellia
186SRCS+=	cmll-x86.pl
187
188# des
189SRCS+=	crypt586.pl des-586.pl
190
191# md5
192SRCS+=	md5-586.pl
193
194# modes
195SRCS+=	ghash-x86.pl
196
197# rc4
198SRCS+=	rc4-586.pl
199
200# rc5
201SRCS+=	rc5-586.pl
202
203# ripemd
204SRCS+=	rmd-586.pl
205
206# sha
207SRCS+=	sha1-586.pl sha256-586.pl sha512-586.pl
208
209# whrlpool
210SRCS+=	wp-mmx.pl
211
212# cpuid
213SRCS+=	x86cpuid.pl
214
215ASM=	${SRCS:R:S/$/.S/}
216
217all:	${ASM}
218
219CLEANFILES=	${ASM}
220.SUFFIXES:	.pl
221
222.pl.S:
223	( echo '/* $$'FreeBSD'$$ */' ;\
224	echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T}. */' ;\
225	echo '#ifdef PIC' ;\
226	env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} -fpic -DPIC ;\
227	echo '#else' ;\
228	env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} ;\
229	echo '#endif') |\
230	sed -E 's|(\.file[[:blank:]]+)".*"|\1"${.TARGET}"|' > ${.TARGET}
231.endif
232
233.include <bsd.prog.mk>
234