Fix UBSAN warnings about conversions and overflows.
[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 \
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 \
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/prf.c \
248         gcrypt/rsa.c
249 tinc_SOURCES += \
250         gcrypt/cipher.c \
251         gcrypt/crypto.c \
252         gcrypt/digest.c gcrypt/digest.h \
253         gcrypt/prf.c \
254         gcrypt/rsa.c \
255         gcrypt/rsagen.c
256 sptps_test_SOURCES += \
257         gcrypt/cipher.c \
258         gcrypt/crypto.c \
259         gcrypt/digest.c gcrypt/digest.h \
260         gcrypt/prf.c
261 sptps_keypair_SOURCES += \
262         openssl/crypto.c
263 sptps_speed_SOURCES += \
264         openssl/crypto.c \
265         openssl/digest.c openssl/digest.h \
266         openssl/prf.c
267 else
268 tincd_SOURCES += \
269         nolegacy/crypto.c \
270         nolegacy/prf.c
271 tinc_SOURCES += \
272         nolegacy/crypto.c \
273         nolegacy/prf.c
274 sptps_test_SOURCES += \
275         nolegacy/crypto.c \
276         nolegacy/prf.c
277 sptps_keypair_SOURCES += \
278         nolegacy/crypto.c
279 sptps_speed_SOURCES += \
280         nolegacy/crypto.c \
281         nolegacy/prf.c
282 endif
283 endif
284
285 if MINIUPNPC
286 tincd_SOURCES += upnp.h upnp.c
287 tincd_LDADD = $(MINIUPNPC_LIBS)
288 tincd_LDFLAGS = -pthread
289 endif
290
291 if MINGW
292 sptps_test_LDFLAGS = -pthread
293 endif
294
295 tinc_LDADD = $(READLINE_LIBS) $(CURSES_LIBS)
296 sptps_speed_LDADD = -lrt
297
298 LIBS = @LIBS@ -lm $(CODE_COVERAGE_LIBS)
299
300 if TUNEMU
301 LIBS += -lpcap
302 endif
303
304 AM_CFLAGS = -DCONFDIR=\"$(sysconfdir)\" -DRUNSTATEDIR=\"$(runstatedir)\" -DLOCALSTATEDIR=\"$(localstatedir)\" -DSBINDIR=\"$(sbindir)\" -iquote. $(CODE_COVERAGE_CFLAGS)
305 AM_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)