0d79c906aca41f2aca261452004b9fe323b64cd4
[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 tinc_SOURCES += \
228         openssl/cipher.c openssl/cipher.h \
229         openssl/crypto.c \
230         openssl/digest.c openssl/digest.h \
231         openssl/prf.c \
232         openssl/rsa.c \
233         openssl/rsagen.c
234 sptps_test_SOURCES += \
235         openssl/crypto.c \
236         openssl/digest.c openssl/digest.h \
237         openssl/prf.c
238 sptps_keypair_SOURCES += \
239         openssl/crypto.c
240 sptps_speed_SOURCES += \
241         openssl/crypto.c \
242         openssl/digest.c openssl/digest.h \
243         openssl/prf.c
244 else
245 if GCRYPT
246 tincd_SOURCES += \
247         gcrypt/cipher.c \
248         gcrypt/crypto.c \
249         gcrypt/digest.c gcrypt/digest.h \
250         gcrypt/pem.c gcrypt/pem.h \
251         gcrypt/prf.c \
252         gcrypt/rsa.c
253 tinc_SOURCES += \
254         gcrypt/cipher.c \
255         gcrypt/crypto.c \
256         gcrypt/digest.c gcrypt/digest.h \
257         gcrypt/pem.c gcrypt/pem.h \
258         gcrypt/prf.c \
259         gcrypt/rsa.c \
260         gcrypt/rsagen.c
261 sptps_test_SOURCES += \
262         gcrypt/cipher.c \
263         gcrypt/crypto.c \
264         gcrypt/digest.c gcrypt/digest.h \
265         gcrypt/prf.c
266 sptps_keypair_SOURCES += \
267         gcrypt/crypto.c
268 sptps_speed_SOURCES += \
269         gcrypt/crypto.c \
270         gcrypt/digest.c gcrypt/digest.h \
271         gcrypt/prf.c
272 else
273 tincd_SOURCES += \
274         nolegacy/crypto.c \
275         nolegacy/prf.c
276 tinc_SOURCES += \
277         nolegacy/crypto.c \
278         nolegacy/prf.c
279 sptps_test_SOURCES += \
280         nolegacy/crypto.c \
281         nolegacy/prf.c
282 sptps_keypair_SOURCES += \
283         nolegacy/crypto.c
284 sptps_speed_SOURCES += \
285         nolegacy/crypto.c \
286         nolegacy/prf.c
287 endif
288 endif
289
290 if WITH_LEGACY_PROTOCOL
291 tinc_SOURCES        += digest.c
292 tincd_SOURCES       += digest.c cipher.c
293 sptps_test_SOURCES  += digest.c
294 sptps_speed_SOURCES += digest.c
295 endif
296
297 if MINIUPNPC
298 tincd_SOURCES += upnp.h upnp.c
299 tincd_LDADD = $(MINIUPNPC_LIBS)
300 tincd_LDFLAGS = -pthread
301 endif
302
303 if MINGW
304 sptps_test_LDFLAGS = -pthread
305 endif
306
307 tinc_LDADD = $(READLINE_LIBS) $(CURSES_LIBS)
308 sptps_speed_LDADD = -lrt
309
310 LIBS = @LIBS@ -lm $(CODE_COVERAGE_LIBS)
311
312 if TUNEMU
313 LIBS += -lpcap
314 endif
315
316 AM_CFLAGS = -DCONFDIR=\"$(sysconfdir)\" -DRUNSTATEDIR=\"$(runstatedir)\" -DLOCALSTATEDIR=\"$(localstatedir)\" -DSBINDIR=\"$(sbindir)\" -iquote. $(CODE_COVERAGE_CFLAGS)
317 AM_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)