GitHub CI: check project for warnings with clang/gcc.
[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         conf.c conf.h \
59         conf_net.c conf_net.h \
60         connection.c connection.h \
61         control.c control.h \
62         control_common.h \
63         crypto.h \
64         device.h \
65         digest.h \
66         dropin.c dropin.h \
67         dummy_device.c \
68         ecdh.h \
69         ecdsa.h \
70         ecdsagen.h \
71         edge.c edge.h \
72         ethernet.h \
73         event.c event.h \
74         fd_device.c \
75         graph.c graph.h \
76         hash.c hash.h \
77         keys.c keys.h \
78         have.h \
79         ipv4.h \
80         ipv6.h \
81         list.c list.h \
82         logger.c logger.h \
83         meta.c meta.h \
84         multicast_device.c \
85         names.c names.h \
86         net.c net.h \
87         net_packet.c \
88         net_setup.c \
89         net_socket.c \
90         netutl.c netutl.h \
91         node.c node.h \
92         prf.h \
93         process.c process.h \
94         protocol.c protocol.h \
95         protocol_auth.c \
96         protocol_edge.c \
97         protocol_key.c \
98         protocol_misc.c \
99         protocol_subnet.c \
100         raw_socket_device.c \
101         route.c route.h \
102         rsa.h \
103         rsagen.h \
104         script.c script.h \
105         splay_tree.c splay_tree.h \
106         sptps.c sptps.h \
107         subnet.c subnet.h \
108         subnet_parse.c \
109         system.h \
110         tincd.c \
111         utils.c utils.h \
112         xalloc.h \
113         version.c version.h \
114         ed25519/ecdh.c \
115         ed25519/ecdsa.c \
116         $(ed25519_SOURCES) \
117         $(chacha_poly1305_SOURCES) \
118         $(lz4_SOURCES)
119
120 tinc_SOURCES = \
121         dropin.c dropin.h \
122         fsck.c fsck.h \
123         ifconfig.c ifconfig.h \
124         info.c info.h \
125         invitation.c invitation.h \
126         conf.c conf.h \
127         keys.c keys.h \
128         splay_tree.c splay_tree.h \
129         list.c list.h \
130         names.c names.h \
131         netutl.c netutl.h \
132         script.c script.h \
133         sptps.c sptps.h \
134         subnet_parse.c subnet.h \
135         tincctl.c tincctl.h \
136         top.c top.h \
137         utils.c utils.h \
138         version.c version.h \
139         ed25519/ecdh.c \
140         ed25519/ecdsa.c \
141         ed25519/ecdsagen.c \
142         $(ed25519_SOURCES) \
143         $(chacha_poly1305_SOURCES)
144
145 sptps_test_SOURCES = \
146         logger.c logger.h \
147         sptps.c sptps.h \
148         sptps_test.c \
149         utils.c utils.h \
150         ed25519/ecdh.c \
151         ed25519/ecdsa.c \
152         $(ed25519_SOURCES) \
153         $(chacha_poly1305_SOURCES)
154
155 sptps_keypair_SOURCES = \
156         sptps_keypair.c \
157         utils.c utils.h \
158         ed25519/ecdsagen.c \
159         $(ed25519_SOURCES)
160
161 sptps_speed_SOURCES = \
162         logger.c logger.h \
163         sptps.c sptps.h \
164         sptps_speed.c \
165         utils.c utils.h \
166         ed25519/ecdh.c \
167         ed25519/ecdsa.c \
168         ed25519/ecdsagen.c \
169         $(ed25519_SOURCES) \
170         $(chacha_poly1305_SOURCES)
171
172 ## Conditionally compile device drivers
173
174 if !GETOPT
175 tincd_SOURCES += \
176         getopt.c getopt.h \
177         getopt1.c
178 tinc_SOURCES += \
179         getopt.c getopt.h \
180         getopt1.c
181 sptps_test_SOURCES += \
182         getopt.c getopt.h \
183         getopt1.c
184 sptps_keypair_SOURCES += \
185         getopt.c getopt.h \
186         getopt1.c
187 endif
188
189 if LINUX
190 tincd_SOURCES += linux/device.c
191 endif
192
193 if BSD
194 tincd_SOURCES += bsd/device.c
195 if TUNEMU
196 tincd_SOURCES += bsd/tunemu.c bsd/tunemu.h
197 endif
198 endif
199
200 if SOLARIS
201 tincd_SOURCES += solaris/device.c
202 endif
203
204 if MINGW
205 tincd_SOURCES += mingw/device.c mingw/common.h
206 endif
207
208 if UML
209 tincd_SOURCES += uml_device.c
210 endif
211
212 if VDE
213 tincd_SOURCES += vde_device.c
214 endif
215
216 if OPENSSL
217 tincd_SOURCES += \
218         openssl/cipher.c \
219         openssl/crypto.c \
220         openssl/digest.c openssl/digest.h \
221         openssl/prf.c \
222         openssl/rsa.c
223 tinc_SOURCES += \
224         openssl/cipher.c \
225         openssl/crypto.c \
226         openssl/digest.c openssl/digest.h \
227         openssl/prf.c \
228         openssl/rsa.c \
229         openssl/rsagen.c
230 sptps_test_SOURCES += \
231         openssl/crypto.c \
232         openssl/digest.c openssl/digest.h \
233         openssl/prf.c
234 sptps_keypair_SOURCES += \
235         openssl/crypto.c
236 sptps_speed_SOURCES += \
237         openssl/crypto.c \
238         openssl/digest.c openssl/digest.h \
239         openssl/prf.c
240 else
241 if GCRYPT
242 tincd_SOURCES += \
243         gcrypt/cipher.c \
244         gcrypt/crypto.c \
245         gcrypt/digest.c gcrypt/digest.h \
246         gcrypt/prf.c \
247         gcrypt/rsa.c
248 tinc_SOURCES += \
249         gcrypt/cipher.c \
250         gcrypt/crypto.c \
251         gcrypt/digest.c gcrypt/digest.h \
252         gcrypt/prf.c \
253         gcrypt/rsa.c \
254         gcrypt/rsagen.c
255 sptps_test_SOURCES += \
256         gcrypt/cipher.c \
257         gcrypt/crypto.c \
258         gcrypt/digest.c gcrypt/digest.h \
259         gcrypt/prf.c
260 sptps_keypair_SOURCES += \
261         openssl/crypto.c
262 sptps_speed_SOURCES += \
263         openssl/crypto.c \
264         openssl/digest.c openssl/digest.h \
265         openssl/prf.c
266 else
267 tincd_SOURCES += \
268         nolegacy/crypto.c \
269         nolegacy/prf.c
270 tinc_SOURCES += \
271         nolegacy/crypto.c \
272         nolegacy/prf.c
273 sptps_test_SOURCES += \
274         nolegacy/crypto.c \
275         nolegacy/prf.c
276 sptps_keypair_SOURCES += \
277         nolegacy/crypto.c
278 sptps_speed_SOURCES += \
279         nolegacy/crypto.c \
280         nolegacy/prf.c
281 endif
282 endif
283
284 if MINIUPNPC
285 tincd_SOURCES += upnp.h upnp.c
286 tincd_LDADD = $(MINIUPNPC_LIBS)
287 tincd_LDFLAGS = -pthread
288 endif
289
290 if MINGW
291 sptps_test_LDFLAGS = -pthread
292 endif
293
294 tinc_LDADD = $(READLINE_LIBS) $(CURSES_LIBS)
295 sptps_speed_LDADD = -lrt
296
297 LIBS = @LIBS@ -lm $(CODE_COVERAGE_LIBS)
298
299 if TUNEMU
300 LIBS += -lpcap
301 endif
302
303 AM_CFLAGS = -DCONFDIR=\"$(sysconfdir)\" -DRUNSTATEDIR=\"$(runstatedir)\" -DLOCALSTATEDIR=\"$(localstatedir)\" -DSBINDIR=\"$(sbindir)\" -iquote. $(CODE_COVERAGE_CFLAGS)
304 AM_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)