Makefile.asm revision 299966
1# $FreeBSD: stable/10/secure/lib/libcrypto/Makefile.asm 299966 2016-05-16 19:30:27Z 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 ${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/md5/asm \
16	${LCRYPTO_SRC}/crypto/modes/asm \
17	${LCRYPTO_SRC}/crypto/rc4/asm \
18	${LCRYPTO_SRC}/crypto/rc5/asm \
19	${LCRYPTO_SRC}/crypto/sha/asm \
20	${LCRYPTO_SRC}/crypto/whrlpool/asm
21
22# aes
23SRCS=	aes-x86_64.pl aesni-sha1-x86_64.pl aesni-x86_64.pl bsaes-x86_64.pl \
24	vpaes-x86_64.pl
25
26# bn
27SRCS+=	modexp512-x86_64.pl x86_64-gf2m.pl x86_64-mont.pl x86_64-mont5.pl
28
29# camellia
30SRCS+=	cmll-x86_64.pl
31
32# md5
33SRCS+=	md5-x86_64.pl
34
35# modes
36SRCS+=	ghash-x86_64.pl
37
38# rc4
39SRCS+=	rc4-md5-x86_64.pl rc4-x86_64.pl
40
41# sha
42SRCS+=	sha1-x86_64.pl
43
44# whrlpool
45SRCS+=	wp-x86_64.pl
46
47# cpuid
48SRCS+=	x86_64cpuid.pl
49
50SHA_ASM=	sha256-x86_64 sha512-x86_64
51SHA_SRC=	sha512-x86_64.pl
52SHA_TMP=	${SHA_ASM:S/$/.s/}
53
54ASM=	${SRCS:R:S/$/.S/} ${SHA_ASM:S/$/.S/}
55
56all:	${ASM}
57
58CLEANFILES=	${ASM} ${SHA_ASM:S/$/.s/}
59.SUFFIXES:	.pl
60
61.pl.S:
62	( echo '# $$'FreeBSD'$$' ;\
63	echo '# Do not modify. This file is auto-generated from ${.IMPSRC:T}.' ;\
64	env CC=cc perl ${.IMPSRC} elf ) > ${.TARGET}
65
66${SHA_TMP}: ${SHA_SRC}
67	env CC=cc perl ${.ALLSRC} elf ${.TARGET}
68
69.for s in ${SHA_ASM}
70${s}.S: ${s}.s
71	( echo '	# $$'FreeBSD'$$' ;\
72	echo '	# Do not modify. This file is auto-generated from ${SHA_SRC}.' ;\
73	cat ${s}.s ) > ${.TARGET}
74.endfor
75
76.elif ${MACHINE_CPUARCH} == "i386"
77
78.PATH:	${LCRYPTO_SRC}/crypto \
79	${LCRYPTO_SRC}/crypto/aes/asm \
80	${LCRYPTO_SRC}/crypto/bf/asm \
81	${LCRYPTO_SRC}/crypto/bn/asm \
82	${LCRYPTO_SRC}/crypto/camellia/asm \
83	${LCRYPTO_SRC}/crypto/cast/asm \
84	${LCRYPTO_SRC}/crypto/des/asm \
85	${LCRYPTO_SRC}/crypto/md5/asm \
86	${LCRYPTO_SRC}/crypto/modes/asm \
87	${LCRYPTO_SRC}/crypto/rc4/asm \
88	${LCRYPTO_SRC}/crypto/rc5/asm \
89	${LCRYPTO_SRC}/crypto/ripemd/asm \
90	${LCRYPTO_SRC}/crypto/sha/asm \
91	${LCRYPTO_SRC}/crypto/whrlpool/asm
92
93PERLPATH=	-I${LCRYPTO_SRC}/crypto/des/asm -I${LCRYPTO_SRC}/crypto/perlasm
94
95# aes
96SRCS=	aes-586.pl aesni-x86.pl vpaes-x86.pl
97
98# blowfish
99SRCS+=	bf-586.pl bf-686.pl
100
101# bn
102SRCS+=	bn-586.pl co-586.pl x86-gf2m.pl x86-mont.pl
103
104# camellia
105SRCS+=	cmll-x86.pl
106
107# cast
108SRCS+=	cast-586.pl
109
110# des
111SRCS+=	crypt586.pl des-586.pl
112
113# md5
114SRCS+=	md5-586.pl
115
116# modes
117SRCS+=	ghash-x86.pl
118
119# rc4
120SRCS+=	rc4-586.pl
121
122# rc5
123SRCS+=	rc5-586.pl
124
125# ripemd
126SRCS+=	rmd-586.pl
127
128# sha
129SRCS+=	sha1-586.pl sha256-586.pl sha512-586.pl
130
131# whrlpool
132SRCS+=	wp-mmx.pl
133
134# cpuid
135SRCS+=	x86cpuid.pl
136
137ASM=	${SRCS:R:S/$/.S/}
138
139all:	${ASM}
140
141CLEANFILES=	${ASM}
142.SUFFIXES:	.pl
143
144.pl.S:
145	( echo '# $$'FreeBSD'$$' ;\
146	echo '# Do not modify. This file is auto-generated from ${.IMPSRC:T}.' ;\
147	echo '#ifdef PIC' ;\
148	env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} -fpic -DPIC ;\
149	echo '#else' ;\
150	env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} ;\
151	echo '#endif') |\
152	sed -E 's|(\.file[[:blank:]]+)".*"|\1"${.TARGET}"|' > ${.TARGET}
153.endif
154
155.include <bsd.prog.mk>
156