Makefile.asm revision 305152
1# $FreeBSD: stable/11/secure/lib/libcrypto/Makefile.asm 305152 2016-08-31 20:30:49Z jkim $
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_amd64)
10
11.PATH:	${LCRYPTO_SRC}/crypto \
12	${LCRYPTO_SRC}/crypto/aes/asm \
13	${LCRYPTO_SRC}/crypto/bn/asm \
14	${LCRYPTO_SRC}/crypto/camellia/asm \
15	${LCRYPTO_SRC}/crypto/ec/asm \
16	${LCRYPTO_SRC}/crypto/md5/asm \
17	${LCRYPTO_SRC}/crypto/modes/asm \
18	${LCRYPTO_SRC}/crypto/rc4/asm \
19	${LCRYPTO_SRC}/crypto/sha/asm \
20	${LCRYPTO_SRC}/crypto/whrlpool/asm
21
22# aes
23SRCS=	aes-x86_64.pl aesni-mb-x86_64.pl aesni-sha1-x86_64.pl \
24	aesni-sha256-x86_64.pl aesni-x86_64.pl bsaes-x86_64.pl \
25	vpaes-x86_64.pl
26
27# bn
28SRCS+=	rsaz-avx2.pl rsaz-x86_64.pl x86_64-gf2m.pl x86_64-mont.pl \
29	x86_64-mont5.pl
30
31# camellia
32SRCS+=	cmll-x86_64.pl
33
34# ec
35SRCS+=	ecp_nistz256-x86_64.pl
36
37# md5
38SRCS+=	md5-x86_64.pl
39
40# modes
41SRCS+=	aesni-gcm-x86_64.pl ghash-x86_64.pl
42
43# rc4
44SRCS+=	rc4-md5-x86_64.pl rc4-x86_64.pl
45
46# sha
47SRCS+=	sha1-mb-x86_64.pl sha1-x86_64.pl sha256-mb-x86_64.pl
48
49# whrlpool
50SRCS+=	wp-x86_64.pl
51
52# cpuid
53SRCS+=	x86_64cpuid.pl
54
55SHA_ASM=	sha256-x86_64 sha512-x86_64
56SHA_SRC=	sha512-x86_64.pl
57SHA_TMP=	${SHA_ASM:S/$/.s/}
58
59ASM=	${SRCS:R:S/$/.S/} ${SHA_ASM:S/$/.S/}
60
61all:	${ASM}
62
63CLEANFILES=	${ASM} ${SHA_ASM:S/$/.s/}
64.SUFFIXES:	.pl
65
66.pl.S:
67	( echo '# $$'FreeBSD'$$' ;\
68	echo '# Do not modify. This file is auto-generated from ${.IMPSRC:T}.' ;\
69	env CC=cc perl ${.IMPSRC} elf ) > ${.TARGET}
70
71${SHA_TMP}: ${SHA_SRC}
72	env CC=cc perl ${.ALLSRC} elf ${.TARGET}
73
74.for s in ${SHA_ASM}
75${s}.S: ${s}.s
76	( echo '	# $$'FreeBSD'$$' ;\
77	echo '	# Do not modify. This file is auto-generated from ${SHA_SRC}.' ;\
78	cat ${s}.s ) > ${.TARGET}
79.endfor
80
81.elif defined(ASM_arm)
82
83.PATH:	${LCRYPTO_SRC}/crypto \
84	${LCRYPTO_SRC}/crypto/aes/asm \
85	${LCRYPTO_SRC}/crypto/bn/asm \
86	${LCRYPTO_SRC}/crypto/modes/asm \
87	${LCRYPTO_SRC}/crypto/sha/asm
88
89PERLPATH=	-I${LCRYPTO_SRC}/crypto/perlasm
90
91# aes
92SRCS=	aesv8-armx.pl bsaes-armv7.pl
93
94# bn
95SRCS+=	armv4-mont.pl armv4-gf2m.pl
96
97# modes
98SRCS+=	ghash-armv4.pl ghashv8-armx.pl
99
100# sha
101SRCS+=	sha1-armv4-large.pl sha256-armv4.pl sha512-armv4.pl
102
103ASM=	aes-armv4.S ${SRCS:R:S/$/.S/}
104
105all:	${ASM}
106
107CLEANFILES=	${ASM} ${SRCS:R:S/$/.s/}
108.SUFFIXES:	.pl
109
110aes-armv4.S:	aes-armv4.pl
111	( echo '# $$'FreeBSD'$$' ;\
112	echo '# Do not modify. This file is auto-generated from ${.ALLSRC:T}.' ;\
113	env CC=cc perl ${.ALLSRC} elf ) > ${.TARGET}
114
115.pl.S:
116	env CC=cc perl ${.IMPSRC} elf ${.TARGET:R:S/$/.s/}
117	( echo '	# $$'FreeBSD'$$' ;\
118	echo '	# Do not modify. This file is auto-generated from ${.IMPSRC:T:R:S/$/.pl/}.' ;\
119	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
120
121.elif defined(ASM_i386)
122
123.PATH:	${LCRYPTO_SRC}/crypto \
124	${LCRYPTO_SRC}/crypto/aes/asm \
125	${LCRYPTO_SRC}/crypto/bf/asm \
126	${LCRYPTO_SRC}/crypto/bn/asm \
127	${LCRYPTO_SRC}/crypto/camellia/asm \
128	${LCRYPTO_SRC}/crypto/des/asm \
129	${LCRYPTO_SRC}/crypto/md5/asm \
130	${LCRYPTO_SRC}/crypto/modes/asm \
131	${LCRYPTO_SRC}/crypto/rc4/asm \
132	${LCRYPTO_SRC}/crypto/rc5/asm \
133	${LCRYPTO_SRC}/crypto/ripemd/asm \
134	${LCRYPTO_SRC}/crypto/sha/asm \
135	${LCRYPTO_SRC}/crypto/whrlpool/asm
136
137PERLPATH=	-I${LCRYPTO_SRC}/crypto/des/asm -I${LCRYPTO_SRC}/crypto/perlasm
138
139# aes
140SRCS=	aes-586.pl aesni-x86.pl vpaes-x86.pl
141
142# blowfish
143SRCS+=	bf-586.pl bf-686.pl
144
145# bn
146SRCS+=	bn-586.pl co-586.pl x86-gf2m.pl x86-mont.pl
147
148# camellia
149SRCS+=	cmll-x86.pl
150
151# des
152SRCS+=	crypt586.pl des-586.pl
153
154# md5
155SRCS+=	md5-586.pl
156
157# modes
158SRCS+=	ghash-x86.pl
159
160# rc4
161SRCS+=	rc4-586.pl
162
163# rc5
164SRCS+=	rc5-586.pl
165
166# ripemd
167SRCS+=	rmd-586.pl
168
169# sha
170SRCS+=	sha1-586.pl sha256-586.pl sha512-586.pl
171
172# whrlpool
173SRCS+=	wp-mmx.pl
174
175# cpuid
176SRCS+=	x86cpuid.pl
177
178ASM=	${SRCS:R:S/$/.S/}
179
180all:	${ASM}
181
182CLEANFILES=	${ASM}
183.SUFFIXES:	.pl
184
185.pl.S:
186	( echo '# $$'FreeBSD'$$' ;\
187	echo '# Do not modify. This file is auto-generated from ${.IMPSRC:T}.' ;\
188	echo '#ifdef PIC' ;\
189	env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} -fpic -DPIC ;\
190	echo '#else' ;\
191	env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} ;\
192	echo '#endif') |\
193	sed -E 's|(\.file[[:blank:]]+)".*"|\1"${.TARGET}"|' > ${.TARGET}
194.endif
195
196.include <bsd.prog.mk>
197