Extract common logic in OpenSSL-specific code
[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         xoshiro.c \
115         version.c version.h \
116         ed25519/ecdh.c \
117         ed25519/ecdsa.c \
118         $(ed25519_SOURCES) \
119         $(chacha_poly1305_SOURCES) \
120         $(lz4_SOURCES)
121
122 tinc_SOURCES = \
123         dropin.c dropin.h \
124         fsck.c fsck.h \
125         ifconfig.c ifconfig.h \
126         info.c info.h \
127         invitation.c invitation.h \
128         conf.c conf.h \
129         keys.c keys.h \
130         splay_tree.c splay_tree.h \
131         list.c list.h \
132         names.c names.h \
133         netutl.c netutl.h \
134         script.c script.h \
135         sptps.c sptps.h \
136         subnet_parse.c subnet.h \
137         tincctl.c tincctl.h \
138         top.c top.h \
139         utils.c utils.h \
140         version.c version.h \
141         ed25519/ecdh.c \
142         ed25519/ecdsa.c \
143         ed25519/ecdsagen.c \
144         xoshiro.c \
145         $(ed25519_SOURCES) \
146         $(chacha_poly1305_SOURCES)
147
148 sptps_test_SOURCES = \
149         logger.c logger.h \
150         sptps.c sptps.h \
151         sptps_test.c \
152         utils.c utils.h \
153         xoshiro.c \
154         ed25519/ecdh.c \
155         ed25519/ecdsa.c \
156         $(ed25519_SOURCES) \
157         $(chacha_poly1305_SOURCES)
158
159 sptps_keypair_SOURCES = \
160         sptps_keypair.c \
161         utils.c utils.h \
162         ed25519/ecdsagen.c \
163         $(ed25519_SOURCES)
164
165 sptps_speed_SOURCES = \
166         logger.c logger.h \
167         sptps.c sptps.h \
168         sptps_speed.c \
169         utils.c utils.h \
170         ed25519/ecdh.c \
171         ed25519/ecdsa.c \
172         ed25519/ecdsagen.c \
173         $(ed25519_SOURCES) \
174         $(chacha_poly1305_SOURCES)
175
176 ## Conditionally compile device drivers
177
178 if !GETOPT
179 tincd_SOURCES += \
180         getopt.c getopt.h \
181         getopt1.c
182 tinc_SOURCES += \
183         getopt.c getopt.h \
184         getopt1.c
185 sptps_test_SOURCES += \
186         getopt.c getopt.h \
187         getopt1.c
188 sptps_keypair_SOURCES += \
189         getopt.c getopt.h \
190         getopt1.c
191 endif
192
193 if LINUX
194 tincd_SOURCES += linux/device.c
195 endif
196
197 if BSD
198 tincd_SOURCES += bsd/device.c
199 if TUNEMU
200 tincd_SOURCES += bsd/tunemu.c bsd/tunemu.h
201 endif
202 endif
203
204 if SOLARIS
205 tincd_SOURCES += solaris/device.c
206 endif
207
208 if MINGW
209 tincd_SOURCES += mingw/device.c mingw/common.h
210 endif
211
212 if UML
213 tincd_SOURCES += uml_device.c
214 endif
215
216 if VDE
217 tincd_SOURCES += vde_device.c
218 endif
219
220 if OPENSSL
221 tincd_SOURCES += \
222         openssl/cipher.c openssl/cipher.h \
223         openssl/crypto.c \
224         openssl/digest.c openssl/digest.h \
225         openssl/prf.c \
226         openssl/rsa.c \
227         openssl/log.c openssl/log.h
228 tinc_SOURCES += \
229         openssl/cipher.c openssl/cipher.h \
230         openssl/crypto.c \
231         openssl/digest.c openssl/digest.h \
232         openssl/prf.c \
233         openssl/rsa.c \
234         openssl/rsagen.c \
235         openssl/log.c openssl/log.h
236 sptps_test_SOURCES += \
237         openssl/crypto.c \
238         openssl/digest.c openssl/digest.h \
239         openssl/prf.c \
240         openssl/log.c openssl/log.h
241 sptps_keypair_SOURCES += \
242         openssl/crypto.c
243 sptps_speed_SOURCES += \
244         openssl/crypto.c \
245         openssl/digest.c openssl/digest.h \
246         openssl/prf.c \
247         openssl/log.c openssl/log.h
248 else
249 if GCRYPT
250 tincd_SOURCES += \
251         gcrypt/cipher.c gcrypt/cipher.h \
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 gcrypt/rsa.h
257 tinc_SOURCES += \
258         gcrypt/cipher.c gcrypt/cipher.h \
259         gcrypt/crypto.c \
260         gcrypt/digest.c gcrypt/digest.h \
261         gcrypt/pem.c gcrypt/pem.h \
262         gcrypt/prf.c \
263         gcrypt/rsa.c gcrypt/rsa.h \
264         gcrypt/rsagen.c
265 sptps_test_SOURCES += \
266         gcrypt/cipher.c gcrypt/cipher.h \
267         gcrypt/crypto.c \
268         gcrypt/digest.c gcrypt/digest.h \
269         gcrypt/prf.c
270 sptps_keypair_SOURCES += \
271         gcrypt/crypto.c
272 sptps_speed_SOURCES += \
273         gcrypt/crypto.c \
274         gcrypt/digest.c gcrypt/digest.h \
275         gcrypt/prf.c
276 else
277 tincd_SOURCES += \
278         nolegacy/crypto.c \
279         nolegacy/prf.c
280 tinc_SOURCES += \
281         nolegacy/crypto.c \
282         nolegacy/prf.c
283 sptps_test_SOURCES += \
284         nolegacy/crypto.c \
285         nolegacy/prf.c
286 sptps_keypair_SOURCES += \
287         nolegacy/crypto.c
288 sptps_speed_SOURCES += \
289         nolegacy/crypto.c \
290         nolegacy/prf.c
291 endif
292 endif
293
294 if WITH_LEGACY_PROTOCOL
295 tinc_SOURCES        += digest.c
296 tincd_SOURCES       += digest.c cipher.c
297 sptps_test_SOURCES  += digest.c
298 sptps_speed_SOURCES += digest.c
299 endif
300
301 if MINIUPNPC
302 tincd_SOURCES += upnp.h upnp.c
303 tincd_LDADD = $(MINIUPNPC_LIBS)
304 tincd_LDFLAGS = -pthread
305 endif
306
307 if MINGW
308 sptps_test_LDFLAGS = -pthread
309 endif
310
311 tinc_LDADD = $(READLINE_LIBS) $(CURSES_LIBS)
312 sptps_speed_LDADD = -lrt
313
314 LIBS = @LIBS@ -lm $(CODE_COVERAGE_LIBS)
315
316 if TUNEMU
317 LIBS += -lpcap
318 endif
319
320 AM_CFLAGS = -DCONFDIR=\"$(sysconfdir)\" -DRUNSTATEDIR=\"$(runstatedir)\" -DLOCALSTATEDIR=\"$(localstatedir)\" -DSBINDIR=\"$(sbindir)\" -iquote. $(CODE_COVERAGE_CFLAGS)
321 AM_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)