xref: /freebsd/secure/lib/libcrypto/Makefile.asm (revision 8ef24a0d4b28fe230e20637f56869cc4148cd2ca)
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 ${MACHINE_CPUARCH} == "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 ${MACHINE_CPUARCH} == "i386"
82
83.PATH:	${LCRYPTO_SRC}/crypto \
84	${LCRYPTO_SRC}/crypto/aes/asm \
85	${LCRYPTO_SRC}/crypto/bf/asm \
86	${LCRYPTO_SRC}/crypto/bn/asm \
87	${LCRYPTO_SRC}/crypto/camellia/asm \
88	${LCRYPTO_SRC}/crypto/des/asm \
89	${LCRYPTO_SRC}/crypto/md5/asm \
90	${LCRYPTO_SRC}/crypto/modes/asm \
91	${LCRYPTO_SRC}/crypto/rc4/asm \
92	${LCRYPTO_SRC}/crypto/rc5/asm \
93	${LCRYPTO_SRC}/crypto/ripemd/asm \
94	${LCRYPTO_SRC}/crypto/sha/asm \
95	${LCRYPTO_SRC}/crypto/whrlpool/asm
96
97PERLPATH=	-I${LCRYPTO_SRC}/crypto/des/asm -I${LCRYPTO_SRC}/crypto/perlasm
98
99# aes
100SRCS=	aes-586.pl aesni-x86.pl vpaes-x86.pl
101
102# blowfish
103SRCS+=	bf-586.pl bf-686.pl
104
105# bn
106SRCS+=	bn-586.pl co-586.pl x86-gf2m.pl x86-mont.pl
107
108# camellia
109SRCS+=	cmll-x86.pl
110
111# des
112SRCS+=	crypt586.pl des-586.pl
113
114# md5
115SRCS+=	md5-586.pl
116
117# modes
118SRCS+=	ghash-x86.pl
119
120# rc4
121SRCS+=	rc4-586.pl
122
123# rc5
124SRCS+=	rc5-586.pl
125
126# ripemd
127SRCS+=	rmd-586.pl
128
129# sha
130SRCS+=	sha1-586.pl sha256-586.pl sha512-586.pl
131
132# whrlpool
133SRCS+=	wp-mmx.pl
134
135# cpuid
136SRCS+=	x86cpuid.pl
137
138ASM=	${SRCS:R:S/$/.S/}
139
140all:	${ASM}
141
142CLEANFILES=	${ASM}
143.SUFFIXES:	.pl
144
145.pl.S:
146	( echo '# $$'FreeBSD'$$' ;\
147	echo '# Do not modify. This file is auto-generated from ${.IMPSRC:T}.' ;\
148	echo '#ifdef PIC' ;\
149	env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} -fpic -DPIC ;\
150	echo '#else' ;\
151	env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} ;\
152	echo '#endif') |\
153	sed -E 's|(\.file[[:blank:]]+)".*"|\1"${.TARGET}"|' > ${.TARGET}
154.endif
155
156.include <bsd.prog.mk>
157