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