1From 25e12bb39eea3d433602de6390796fec8a8f3620 Mon Sep 17 00:00:00 2001
2From: Mike Gelfand <mikedld@mikedld.com>
3Date: Sun, 1 Jan 2017 16:23:21 +0300
4Subject: [PATCH] Remove Makefile, add Makefile.am and CMakeLists.txt
5
6Downloaded from transmission repo:
7https://github.com/transmission/dht/commit/25e12bb39eea3d433602de6390796fec8a8f3620
8
9Upstream status: rejected (https://github.com/jech/dht/pull/19)
10
11Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
12---
13 CMakeLists.txt |  9 +++++++++
14 Makefile       |  9 ---------
15 Makefile.am    | 11 +++++++++++
16 3 files changed, 20 insertions(+), 9 deletions(-)
17 create mode 100644 CMakeLists.txt
18 delete mode 100644 Makefile
19 create mode 100644 Makefile.am
20
21diff --git a/CMakeLists.txt b/CMakeLists.txt
22new file mode 100644
23index 0000000..6d4aa99
24--- /dev/null
25+++ b/CMakeLists.txt
26@@ -0,0 +1,9 @@
27+cmake_minimum_required(VERSION 2.8)
28+project(dht C)
29+
30+add_library(${PROJECT_NAME} STATIC
31+    dht.c
32+)
33+
34+install(TARGETS ${PROJECT_NAME} DESTINATION lib)
35+install(FILES dht.h DESTINATION include/dht)
36diff --git a/Makefile b/Makefile
37deleted file mode 100644
38index e012945..0000000
39--- a/Makefile
40+++ /dev/null
41@@ -1,9 +0,0 @@
42-CFLAGS = -g -Wall
43-LDLIBS = -lcrypt
44-
45-dht-example: dht-example.o dht.o
46-
47-all: dht-example
48-
49-clean:
50-	-rm -f dht-example dht-example.o dht-example.id dht.o *~ core
51diff --git a/Makefile.am b/Makefile.am
52new file mode 100644
53index 0000000..2dba648
54--- /dev/null
55+++ b/Makefile.am
56@@ -0,0 +1,11 @@
57+AM_CFLAGS = @PTHREAD_CFLAGS@
58+
59+noinst_LIBRARIES = libdht.a
60+libdht_a_SOURCES = dht.c
61+libdht_a_DEPENDENCIES = $(builddir)/include/dht
62+noinst_HEADERS = dht.h
63+EXTRA_DIST = CHANGES CMakeLists.txt dht-example.c LICENCE README
64+
65+$(builddir)/include/dht:
66+	$(MKDIR_P) $(builddir)/include
67+	(cd $(builddir)/include && $(LN_S) $(abs_srcdir) dht)
68