-CFLAGS = @CFLAGS@ -DPKGLIBDIR=$(pkglibdir) -DCONFDIR=\"$(sysconfdir)\" \
- -DLOCALEDIR=\"$(localedir)\" -DLOCALSTATEDIR=\"$(localstatedir)\"
+if CYGWIN
+tincd_SOURCES += cygwin/device.c
+endif
+
+if UML
+tincd_SOURCES += uml_device.c
+endif
+
+if VDE
+tincd_SOURCES += vde_device.c
+endif
+
+if OPENSSL
+tincd_SOURCES += \
+ openssl/cipher.c \
+ openssl/crypto.c \
+ openssl/ecdh.c \
+ openssl/ecdsa.c \
+ openssl/digest.c \
+ openssl/prf.c \
+ openssl/rsa.c
+tinc_SOURCES += \
+ openssl/ecdsa.c \
+ openssl/ecdsagen.c \
+ openssl/rsa.c \
+ openssl/rsagen.c
+sptps_test_SOURCES += \
+ openssl/cipher.c \
+ openssl/crypto.c \
+ openssl/ecdh.c \
+ openssl/ecdsa.c \
+ openssl/digest.c \
+ openssl/prf.c
+endif
+
+if GCRYPT
+tincd_SOURCES += \
+ gcrypt/cipher.c \
+ gcrypt/crypto.c \
+ gcrypt/ecdh.c \
+ gcrypt/ecdsa.c \
+ gcrypt/digest.c \
+ gcrypt/prf.c \
+ gcrypt/rsa.c
+tinc_SOURCES += \
+ gcrypt/ecdsa.c \
+ gcrypt/ecdsagen.c \
+ gcrypt/rsa.c \
+ gcrypt/rsagen.c
+sptps_test_SOURCES += \
+ gcrypt/cipher.c \
+ gcrypt/crypto.c \
+ gcrypt/ecdh.c \
+ gcrypt/ecdsa.c \
+ gcrypt/digest.c \
+ gcrypt/prf.c
+endif
+
+tinc_LDADD = $(READLINE_LIBS) $(CURSES_LIBS)
+
+DEFAULT_INCLUDES =
+
+INCLUDES = @INCLUDES@
+
+noinst_HEADERS = \
+ xalloc.h utils.h getopt.h list.h splay_tree.h dropin.h fake-getaddrinfo.h fake-getnameinfo.h fake-gai-errnos.h ipv6.h ipv4.h ethernet.h \
+ buffer.h conf.h connection.h control.h control_common.h device.h edge.h graph.h info.h logger.h meta.h net.h netutl.h node.h process.h \
+ protocol.h route.h subnet.h sptps.h tincctl.h top.h hash.h event.h names.h have.h system.h
+
+LIBS = @LIBS@ @LIBGCRYPT_LIBS@
+
+if TUNEMU
+LIBS += -lpcap
+endif
+
+AM_CFLAGS = -DCONFDIR=\"$(sysconfdir)\" -DLOCALSTATEDIR=\"$(localstatedir)\" -DSBINDIR=\"$(sbindir)\"