Fix building t-lock for WIN32
[libgcrypt.git] / cipher / Makefile.am
1 # Makefile for cipher modules
2 # Copyright (C) 1998, 1999, 2000, 2001, 2002,
3 #               2003, 2009 Free Software Foundation, Inc.
4 #
5 # This file is part of Libgcrypt.
6 #
7 # Libgcrypt is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU Lesser General Public License as
9 # published by the Free Software Foundation; either version 2.1 of
10 # the License, or (at your option) any later version.
11 #
12 # Libgcrypt is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU Lesser General Public License for more details.
16 #
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this program; if not, see <http://www.gnu.org/licenses/>.
19
20 # Process this file with automake to produce Makefile.in
21
22 # Need to include ../src in addition to top_srcdir because gcrypt.h is
23 # a built header.
24 AM_CPPFLAGS = -I../src -I$(top_srcdir)/src -I../mpi -I$(top_srcdir)/mpi
25 AM_CFLAGS = $(GPG_ERROR_CFLAGS)
26
27 AM_CCASFLAGS = $(NOEXECSTACK_FLAGS)
28
29 EXTRA_DIST = gost-s-box.c
30
31 CLEANFILES = gost-s-box
32 DISTCLEANFILES = gost-sb.h
33
34 noinst_LTLIBRARIES = libcipher.la
35
36 GCRYPT_MODULES = @GCRYPT_CIPHERS@ @GCRYPT_PUBKEY_CIPHERS@ \
37                  @GCRYPT_DIGESTS@ @GCRYPT_KDFS@
38
39 libcipher_la_DEPENDENCIES = $(GCRYPT_MODULES)
40 libcipher_la_LIBADD = $(GCRYPT_MODULES)
41
42 libcipher_la_SOURCES = \
43         cipher.c cipher-internal.h \
44         cipher-cbc.c \
45         cipher-cfb.c \
46         cipher-ofb.c \
47         cipher-ctr.c \
48         cipher-aeswrap.c \
49         cipher-ccm.c \
50         cipher-cmac.c \
51         cipher-gcm.c cipher-gcm-intel-pclmul.c cipher-gcm-armv7-neon.S \
52         cipher-gcm-armv8-aarch32-ce.S cipher-gcm-armv8-aarch64-ce.S \
53         cipher-poly1305.c \
54         cipher-ocb.c \
55         cipher-xts.c \
56         cipher-eax.c \
57         cipher-selftest.c cipher-selftest.h \
58         pubkey.c pubkey-internal.h pubkey-util.c \
59         md.c \
60         mac.c mac-internal.h \
61         mac-hmac.c mac-cmac.c mac-gmac.c mac-poly1305.c \
62         poly1305.c poly1305-internal.h \
63         kdf.c kdf-internal.h \
64         hmac-tests.c \
65         bithelp.h  \
66         bufhelp.h  \
67         primegen.c  \
68         hash-common.c hash-common.h \
69         dsa-common.c rsa-common.c \
70         sha1.h
71
72 EXTRA_libcipher_la_SOURCES = \
73         asm-common-aarch64.h \
74         asm-common-amd64.h \
75         asm-poly1305-aarch64.h \
76         asm-poly1305-amd64.h \
77         arcfour.c arcfour-amd64.S \
78         blowfish.c blowfish-amd64.S blowfish-arm.S \
79         cast5.c cast5-amd64.S cast5-arm.S \
80         chacha20.c chacha20-amd64-ssse3.S chacha20-amd64-avx2.S \
81         chacha20-armv7-neon.S chacha20-aarch64.S \
82         chacha20-ppc.c \
83         crc.c crc-intel-pclmul.c crc-armv8-ce.c \
84         crc-armv8-aarch64-ce.S \
85         crc-ppc.c \
86         des.c des-amd64.S \
87         dsa.c \
88         elgamal.c \
89         ecc.c ecc-curves.c ecc-misc.c ecc-common.h \
90         ecc-ecdh.c ecc-ecdsa.c ecc-eddsa.c ecc-gost.c \
91         idea.c \
92         gost28147.c gost.h \
93         gostr3411-94.c \
94         md4.c \
95         md5.c \
96         rijndael.c rijndael-internal.h rijndael-tables.h   \
97         rijndael-aesni.c rijndael-padlock.c                \
98         rijndael-amd64.S rijndael-arm.S                    \
99         rijndael-ssse3-amd64.c rijndael-ssse3-amd64-asm.S  \
100         rijndael-armv8-ce.c rijndael-armv8-aarch32-ce.S    \
101         rijndael-armv8-aarch64-ce.S rijndael-aarch64.S     \
102         rijndael-ppc.c                                     \
103         rmd160.c \
104         rsa.c \
105         salsa20.c salsa20-amd64.S salsa20-armv7-neon.S \
106         scrypt.c \
107         seed.c \
108         serpent.c serpent-sse2-amd64.S \
109         serpent-avx2-amd64.S serpent-armv7-neon.S \
110         sha1.c sha1-ssse3-amd64.S sha1-avx-amd64.S sha1-avx-bmi2-amd64.S \
111         sha1-avx2-bmi2-amd64.S sha1-armv7-neon.S sha1-armv8-aarch32-ce.S \
112         sha1-armv8-aarch64-ce.S sha1-intel-shaext.c \
113         sha256.c sha256-ssse3-amd64.S sha256-avx-amd64.S \
114         sha256-avx2-bmi2-amd64.S \
115         sha256-armv8-aarch32-ce.S sha256-armv8-aarch64-ce.S \
116         sha256-intel-shaext.c sha256-ppc.c \
117         sha512.c sha512-ssse3-amd64.S sha512-avx-amd64.S \
118         sha512-avx2-bmi2-amd64.S \
119         sha512-armv7-neon.S sha512-arm.S \
120         sha512-ppc.c \
121         sm3.c \
122         keccak.c keccak_permute_32.h keccak_permute_64.h keccak-armv7-neon.S \
123         stribog.c \
124         tiger.c \
125         whirlpool.c whirlpool-sse2-amd64.S \
126         twofish.c twofish-amd64.S twofish-arm.S twofish-aarch64.S \
127         twofish-avx2-amd64.S \
128         rfc2268.c \
129         camellia.c camellia.h camellia-glue.c camellia-aesni-avx-amd64.S \
130         camellia-aesni-avx2-amd64.S camellia-arm.S camellia-aarch64.S \
131         blake2.c \
132         blake2b-amd64-avx2.S blake2s-amd64-avx.S
133
134 gost28147.lo: gost-sb.h
135 gost-sb.h: gost-s-box
136         ./gost-s-box $@
137
138 gost-s-box: gost-s-box.c
139         $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) \
140             $(CPPFLAGS_FOR_BUILD)-o $@ $(srcdir)/gost-s-box.c
141
142
143 if ENABLE_O_FLAG_MUNGING
144 o_flag_munging = sed -e 's/-O\([2-9s][2-9s]*\)/-O1/' -e 's/-Ofast/-O1/g'
145 else
146 o_flag_munging = cat
147 endif
148
149
150 # We need to lower the optimization for this module.
151 tiger.o: $(srcdir)/tiger.c Makefile
152         `echo $(COMPILE) -c $< | $(o_flag_munging) `
153
154 tiger.lo: $(srcdir)/tiger.c Makefile
155         `echo $(LTCOMPILE) -c $< | $(o_flag_munging) `
156
157
158 # We need to disable instrumentation for these modules as they use cc as
159 # thin assembly front-end and do not tolerate in-between function calls
160 # inserted by compiler as those functions may clobber the XMM registers.
161 if ENABLE_INSTRUMENTATION_MUNGING
162 instrumentation_munging = sed \
163         -e 's/-fsanitize[=,\-][=,a-z,A-Z,0-9,\,,\-]*//g' \
164         -e 's/-fprofile[=,\-][=,a-z,A-Z,0-9,\,,\-]*//g' \
165         -e 's/-fcoverage[=,\-][=,a-z,A-Z,0-9,\,,\-]*//g'
166 else
167 instrumentation_munging = cat
168 endif
169
170 rijndael-aesni.o: $(srcdir)/rijndael-aesni.c Makefile
171         `echo $(COMPILE) -c $< | $(instrumentation_munging) `
172
173 rijndael-aesni.lo: $(srcdir)/rijndael-aesni.c Makefile
174         `echo $(LTCOMPILE) -c $< | $(instrumentation_munging) `
175
176 rijndael-ssse3-amd64.o: $(srcdir)/rijndael-ssse3-amd64.c Makefile
177         `echo $(COMPILE) -c $< | $(instrumentation_munging) `
178
179 rijndael-ssse3-amd64.lo: $(srcdir)/rijndael-ssse3-amd64.c Makefile
180         `echo $(LTCOMPILE) -c $< | $(instrumentation_munging) `
181
182 cipher-gcm-intel-pclmul.o: $(srcdir)/cipher-gcm-intel-pclmul.c Makefile
183         `echo $(COMPILE) -c $< | $(instrumentation_munging) `
184
185 cipher-gcm-intel-pclmul.lo: $(srcdir)/cipher-gcm-intel-pclmul.c Makefile
186         `echo $(LTCOMPILE) -c $< | $(instrumentation_munging) `
187
188 sha1-intel-shaext.o: $(srcdir)/sha1-intel-shaext.c Makefile
189         `echo $(COMPILE) -c $< | $(instrumentation_munging) `
190
191 sha1-intel-shaext.lo: $(srcdir)/sha1-intel-shaext.c Makefile
192         `echo $(LTCOMPILE) -c $< | $(instrumentation_munging) `
193
194 sha256-intel-shaext.o: $(srcdir)/sha256-intel-shaext.c Makefile
195         `echo $(COMPILE) -c $< | $(instrumentation_munging) `
196
197 sha256-intel-shaext.lo: $(srcdir)/sha256-intel-shaext.c Makefile
198         `echo $(LTCOMPILE) -c $< | $(instrumentation_munging) `
199
200 crc-intel-pclmul.o: $(srcdir)/crc-intel-pclmul.c Makefile
201         `echo $(COMPILE) -c $< | $(instrumentation_munging) `
202
203 crc-intel-pclmul.lo: $(srcdir)/crc-intel-pclmul.c Makefile
204         `echo $(LTCOMPILE) -c $< | $(instrumentation_munging) `
205
206 if ENABLE_PPC_VCRYPTO_EXTRA_CFLAGS
207 ppc_vcrypto_cflags = -maltivec -mvsx -mcrypto
208 else
209 ppc_vcrypto_cflags =
210 endif
211
212 rijndael-ppc.o: $(srcdir)/rijndael-ppc.c Makefile
213         `echo $(COMPILE) $(ppc_vcrypto_cflags) -c $< | $(instrumentation_munging) `
214
215 rijndael-ppc.lo: $(srcdir)/rijndael-ppc.c Makefile
216         `echo $(LTCOMPILE) $(ppc_vcrypto_cflags) -c $< | $(instrumentation_munging) `
217
218 sha256-ppc.o: $(srcdir)/sha256-ppc.c Makefile
219         `echo $(COMPILE) $(ppc_vcrypto_cflags) -c $< | $(instrumentation_munging) `
220
221 sha256-ppc.lo: $(srcdir)/sha256-ppc.c Makefile
222         `echo $(LTCOMPILE) $(ppc_vcrypto_cflags) -c $< | $(instrumentation_munging) `
223
224 sha512-ppc.o: $(srcdir)/sha512-ppc.c Makefile
225         `echo $(COMPILE) $(ppc_vcrypto_cflags) -c $< | $(instrumentation_munging) `
226
227 sha512-ppc.lo: $(srcdir)/sha512-ppc.c Makefile
228         `echo $(LTCOMPILE) $(ppc_vcrypto_cflags) -c $< | $(instrumentation_munging) `
229
230 chacha20-ppc.o: $(srcdir)/chacha20-ppc.c Makefile
231         `echo $(COMPILE) $(ppc_vcrypto_cflags) -c $< | $(instrumentation_munging) `
232
233 chacha20-ppc.lo: $(srcdir)/chacha20-ppc.c Makefile
234         `echo $(LTCOMPILE) $(ppc_vcrypto_cflags) -c $< | $(instrumentation_munging) `
235
236 crc-ppc.o: $(srcdir)/crc-ppc.c Makefile
237         `echo $(COMPILE) $(ppc_vcrypto_cflags) -c $< | $(instrumentation_munging) `
238
239 crc-ppc.lo: $(srcdir)/crc-ppc.c Makefile
240         `echo $(LTCOMPILE) $(ppc_vcrypto_cflags) -c $< | $(instrumentation_munging) `