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