Makefile.asm revision 299464
1# $FreeBSD: head/secure/lib/libcrypto/Makefile.asm 299464 2016-05-11 16:53:56Z emaste $
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 sha512-x86_64.pl
48
49# whrlpool
50SRCS+=	wp-x86_64.pl
51
52ASM=	${SRCS:S/.pl/.S/}
53ASM+=	sha256-x86_64.S x86_64cpuid.S
54
55all:	${ASM}
56
57CLEANFILES+=	${SRCS:M*.pl:S/.pl$/.cmt/} ${SRCS:M*.pl:S/.pl$/.S/}
58CLEANFILES+=	sha256-x86_64.cmt sha256-x86_64.S x86_64cpuid.cmt x86_64cpuid.S
59.SUFFIXES:	.pl .cmt
60
61.pl.cmt:
62	( cd `dirname ${.IMPSRC}`/.. ; perl ${.IMPSRC} ${.OBJDIR}/${.TARGET} )
63
64.cmt.S:
65	( echo '	# $$'FreeBSD'$$' ;\
66	echo '	# Do not modify. This file is auto-generated.' ;\
67	cat ${.IMPSRC} ) > ${.TARGET}
68
69sha256-x86_64.cmt: sha512-x86_64.pl
70	( cd `dirname ${.ALLSRC}`/.. ; perl ${.ALLSRC} ${.OBJDIR}/${.TARGET} )
71
72x86_64cpuid.cmt: x86_64cpuid.pl
73	( cd `dirname ${.ALLSRC}` ; perl ${.ALLSRC} ${.OBJDIR}/${.TARGET} )
74
75.elif ${MACHINE_CPUARCH} == "i386"
76
77.PATH:	${LCRYPTO_SRC}/crypto \
78	${LCRYPTO_SRC}/crypto/aes/asm \
79	${LCRYPTO_SRC}/crypto/bf/asm \
80	${LCRYPTO_SRC}/crypto/bn/asm \
81	${LCRYPTO_SRC}/crypto/camellia/asm \
82	${LCRYPTO_SRC}/crypto/des/asm \
83	${LCRYPTO_SRC}/crypto/md5/asm \
84	${LCRYPTO_SRC}/crypto/modes/asm \
85	${LCRYPTO_SRC}/crypto/rc4/asm \
86	${LCRYPTO_SRC}/crypto/rc5/asm \
87	${LCRYPTO_SRC}/crypto/ripemd/asm \
88	${LCRYPTO_SRC}/crypto/sha/asm \
89	${LCRYPTO_SRC}/crypto/whrlpool/asm
90
91PERLPATH=	-I${LCRYPTO_SRC}/crypto/des/asm -I${LCRYPTO_SRC}/crypto/perlasm
92
93# aes
94SRCS=	aes-586.pl aesni-x86.pl vpaes-x86.pl
95
96# blowfish
97SRCS+=	bf-586.pl bf-686.pl
98
99# bn
100SRCS+=	bn-586.pl co-586.pl x86-gf2m.pl x86-mont.pl
101
102# camellia
103SRCS+=	cmll-x86.pl
104
105# des
106SRCS+=	crypt586.pl des-586.pl
107
108# md5
109SRCS+=	md5-586.pl
110
111# modes
112SRCS+=	ghash-x86.pl
113
114# rc4
115SRCS+=	rc4-586.pl
116
117# rc5
118SRCS+=	rc5-586.pl
119
120# ripemd
121SRCS+=	rmd-586.pl
122
123# sha
124SRCS+=	sha1-586.pl sha256-586.pl sha512-586.pl
125
126# whrlpool
127SRCS+=	wp-mmx.pl
128
129# cpuid
130SRCS+=	x86cpuid.pl
131
132ASM=	${SRCS:S/.pl/.S/}
133
134all:	${ASM}
135
136CLEANFILES+=	${SRCS:M*.pl:S/.pl$/.S/}
137.SUFFIXES:	.pl
138
139.pl.S:
140	( echo '	# $$'FreeBSD'$$' ;\
141	echo '	# Do not modify. This file is auto-generated.' ;\
142	echo '#ifdef PIC' ;\
143	perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} -fpic -DPIC ;\
144	echo '#else' ;\
145	perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} ;\
146	echo '#endif') |\
147	sed -E 's|(\.file[[:blank:]]+)".*"|\1"${.TARGET}"|' > ${.TARGET}
148.endif
149
150.include <bsd.prog.mk>
151