Restore libgcrypt support.
[tinc] / src / Makefile.am
1 ## Produce this file with automake to get Makefile.in
2
3 sbin_PROGRAMS = tincd tinc
4 check_PROGRAMS = sptps_test sptps_keypair
5 EXTRA_PROGRAMS = $(check_PROGRAMS)
6
7 CLEANFILES = version_git.h
8
9 .PHONY: extra
10 extra: $(EXTRA_PROGRAMS)
11
12 .PHONY: version-stamp
13 version-stamp:
14
15 version_git.h: version-stamp
16         $(AM_V_GEN)echo >$@
17         @-(cd $(srcdir) && git describe 2>/dev/null >/dev/null) && echo '#define GIT_DESCRIPTION "'`(cd $(srcdir) && git describe) | sed 's/release-//'`'"' >$@ ||:
18 ${srcdir}/version.c: version_git.h
19
20 ## Now a hack to appease some versions of BSD make that don't understand that "./foo" is the same as "foo".
21 if BSD
22 version.c: ${srcdir}/version.c
23 endif
24
25 if LINUX
26 EXTRA_PROGRAMS += sptps_speed
27 endif
28
29 ed25519_SOURCES = \
30         ed25519/ed25519.h \
31         ed25519/fe.c ed25519/fe.h \
32         ed25519/fixedint.h \
33         ed25519/ge.c ed25519/ge.h \
34         ed25519/key_exchange.c \
35         ed25519/keypair.c \
36         ed25519/precomp_data.h \
37         ed25519/sc.c ed25519/sc.h \
38         ed25519/sha512.c ed25519/sha512.h \
39         ed25519/sign.c \
40         ed25519/verify.c
41
42 chacha_poly1305_SOURCES = \
43         chacha-poly1305/chacha.c chacha-poly1305/chacha.h \
44         chacha-poly1305/chacha-poly1305.c chacha-poly1305/chacha-poly1305.h \
45         chacha-poly1305/poly1305.c chacha-poly1305/poly1305.h
46
47 if CONFIGURE_LZ4_BUILTIN
48 lz4_SOURCES = lib/lz4/lz4.c lib/lz4/lz4.h
49 else
50 lz4_SOURCES =
51 endif
52
53 tincd_SOURCES = \
54         address_cache.c address_cache.h \
55         autoconnect.c autoconnect.h \
56         buffer.c buffer.h \
57         cipher.h \
58         compression.h \
59         conf.c conf.h \
60         conf_net.c conf_net.h \
61         connection.c connection.h \
62         control.c control.h \
63         control_common.h \
64         crypto.h \
65         device.h \
66         digest.h \
67         dropin.c dropin.h \
68         dummy_device.c \
69         ecdh.h \
70         ecdsa.h \
71         ecdsagen.h \
72         edge.c edge.h \
73         ethernet.h \
74         event.c event.h \
75         fd_device.c \
76         graph.c graph.h \
77         hash.h \
78         keys.c keys.h \
79         have.h \
80         ipv4.h \
81         ipv6.h \
82         list.c list.h \
83         logger.c logger.h \
84         meta.c meta.h \
85         multicast_device.c \
86         names.c names.h \
87         net.c net.h \
88         net_packet.c \
89         net_setup.c \
90         net_socket.c \
91         netutl.c netutl.h \
92         node.c node.h \
93         prf.h \
94         process.c process.h \
95         protocol.c protocol.h \
96         protocol_auth.c \
97         protocol_edge.c \
98         protocol_key.c \
99         protocol_misc.c \
100         protocol_subnet.c \
101         raw_socket_device.c \
102         route.c route.h \
103         rsa.h \
104         rsagen.h \
105         script.c script.h \
106         splay_tree.c splay_tree.h \
107         sptps.c sptps.h \
108         subnet.c subnet.h \
109         subnet_parse.c \
110         system.h \
111         tincd.c \
112         utils.c utils.h \
113         xalloc.h \
114         version.c version.h \
115         ed25519/ecdh.c \
116         ed25519/ecdsa.c \
117         $(ed25519_SOURCES) \
118         $(chacha_poly1305_SOURCES) \
119         $(lz4_SOURCES)
120
121 tinc_SOURCES = \
122         dropin.c dropin.h \
123         fsck.c fsck.h \
124         ifconfig.c ifconfig.h \
125         info.c info.h \
126         invitation.c invitation.h \
127         conf.c conf.h \
128         keys.c keys.h \
129         splay_tree.c splay_tree.h \
130         list.c list.h \
131         names.c names.h \
132         netutl.c netutl.h \
133         script.c script.h \
134         sptps.c sptps.h \
135         subnet_parse.c subnet.h \
136         tincctl.c tincctl.h \
137         top.c top.h \
138         utils.c utils.h \
139         version.c version.h \
140         ed25519/ecdh.c \
141         ed25519/ecdsa.c \
142         ed25519/ecdsagen.c \
143         $(ed25519_SOURCES) \
144         $(chacha_poly1305_SOURCES)
145
146 sptps_test_SOURCES = \
147         logger.c logger.h \
148         sptps.c sptps.h \
149         sptps_test.c \
150         utils.c utils.h \
151         ed25519/ecdh.c \
152         ed25519/ecdsa.c \
153         $(ed25519_SOURCES) \
154         $(chacha_poly1305_SOURCES)
155
156 sptps_keypair_SOURCES = \
157         sptps_keypair.c \
158         utils.c utils.h \
159         ed25519/ecdsagen.c \
160         $(ed25519_SOURCES)
161
162 sptps_speed_SOURCES = \
163         logger.c logger.h \
164         sptps.c sptps.h \
165         sptps_speed.c \
166         utils.c utils.h \
167         ed25519/ecdh.c \
168         ed25519/ecdsa.c \
169         ed25519/ecdsagen.c \
170         $(ed25519_SOURCES) \
171         $(chacha_poly1305_SOURCES)
172
173 ## Conditionally compile device drivers
174
175 if !GETOPT
176 tincd_SOURCES += \
177         getopt.c getopt.h \
178         getopt1.c
179 tinc_SOURCES += \
180         getopt.c getopt.h \
181         getopt1.c
182 sptps_test_SOURCES += \
183         getopt.c getopt.h \
184         getopt1.c
185 sptps_keypair_SOURCES += \
186         getopt.c getopt.h \
187         getopt1.c
188 endif
189
190 if LINUX
191 tincd_SOURCES += linux/device.c
192 endif
193
194 if BSD
195 tincd_SOURCES += bsd/device.c
196 if TUNEMU
197 tincd_SOURCES += bsd/tunemu.c bsd/tunemu.h
198 endif
199 endif
200
201 if SOLARIS
202 tincd_SOURCES += solaris/device.c
203 endif
204
205 if MINGW
206 tincd_SOURCES += mingw/device.c mingw/common.h
207 endif
208
209 if UML
210 tincd_SOURCES += uml_device.c
211 endif
212
213 if VDE
214 tincd_SOURCES += vde_device.c
215 endif
216
217 if OPENSSL
218 tincd_SOURCES += \
219         openssl/cipher.c openssl/cipher.h \
220         openssl/crypto.c \
221         openssl/digest.c openssl/digest.h \
222         openssl/prf.c \
223         openssl/rsa.c
224 tinc_SOURCES += \
225         openssl/cipher.c openssl/cipher.h \
226         openssl/crypto.c \
227         openssl/digest.c openssl/digest.h \
228         openssl/prf.c \
229         openssl/rsa.c \
230         openssl/rsagen.c
231 sptps_test_SOURCES += \
232         openssl/crypto.c \
233         openssl/digest.c openssl/digest.h \
234         openssl/prf.c
235 sptps_keypair_SOURCES += \
236         openssl/crypto.c
237 sptps_speed_SOURCES += \
238         openssl/crypto.c \
239         openssl/digest.c openssl/digest.h \
240         openssl/prf.c
241 else
242 if GCRYPT
243 tincd_SOURCES += \
244         gcrypt/cipher.c \
245         gcrypt/crypto.c \
246         gcrypt/digest.c gcrypt/digest.h \
247         gcrypt/pem.c gcrypt/pem.h \
248         gcrypt/prf.c \
249         gcrypt/rsa.c
250 tinc_SOURCES += \
251         gcrypt/cipher.c \
252         gcrypt/crypto.c \
253         gcrypt/digest.c gcrypt/digest.h \
254         gcrypt/pem.c gcrypt/pem.h \
255         gcrypt/prf.c \
256         gcrypt/rsa.c \
257         gcrypt/rsagen.c
258 sptps_test_SOURCES += \
259         gcrypt/cipher.c \
260         gcrypt/crypto.c \
261         gcrypt/digest.c gcrypt/digest.h \
262         gcrypt/prf.c
263 sptps_keypair_SOURCES += \
264         gcrypt/crypto.c
265 sptps_speed_SOURCES += \
266         gcrypt/crypto.c \
267         gcrypt/digest.c gcrypt/digest.h \
268         gcrypt/prf.c
269 else
270 tincd_SOURCES += \
271         nolegacy/crypto.c \
272         nolegacy/prf.c
273 tinc_SOURCES += \
274         nolegacy/crypto.c \
275         nolegacy/prf.c
276 sptps_test_SOURCES += \
277         nolegacy/crypto.c \
278         nolegacy/prf.c
279 sptps_keypair_SOURCES += \
280         nolegacy/crypto.c
281 sptps_speed_SOURCES += \
282         nolegacy/crypto.c \
283         nolegacy/prf.c
284 endif
285 endif
286
287 if WITH_LEGACY_PROTOCOL
288 tinc_SOURCES        += digest.c
289 tincd_SOURCES       += digest.c cipher.c
290 sptps_test_SOURCES  += digest.c
291 sptps_speed_SOURCES += digest.c
292 endif
293
294 if MINIUPNPC
295 tincd_SOURCES += upnp.h upnp.c
296 tincd_LDADD = $(MINIUPNPC_LIBS)
297 tincd_LDFLAGS = -pthread
298 endif
299
300 if MINGW
301 sptps_test_LDFLAGS = -pthread
302 endif
303
304 tinc_LDADD = $(READLINE_LIBS) $(CURSES_LIBS)
305 sptps_speed_LDADD = -lrt
306
307 LIBS = @LIBS@ -lm $(CODE_COVERAGE_LIBS)
308
309 if TUNEMU
310 LIBS += -lpcap
311 endif
312
313 AM_CFLAGS = -DCONFDIR=\"$(sysconfdir)\" -DRUNSTATEDIR=\"$(runstatedir)\" -DLOCALSTATEDIR=\"$(localstatedir)\" -DSBINDIR=\"$(sbindir)\" -iquote. $(CODE_COVERAGE_CFLAGS)
314 AM_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)