summaryrefslogtreecommitdiffstats
path: root/lib/lib.mk
blob: 8ac4e91b95dfb0d7b8c6dacf8480b5ab2cfe333f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
libkres_SOURCES := \
	lib/cache/api.c \
	lib/cache/cdb_lmdb.c \
	lib/cache/entry_list.c \
	lib/cache/entry_pkt.c \
	lib/cache/entry_rr.c \
	lib/cache/knot_pkt.c \
	lib/cache/nsec1.c \
	lib/cache/nsec3.c \
	lib/cache/peek.c \
	lib/dnssec.c \
	lib/dnssec/nsec.c \
	lib/dnssec/nsec3.c \
	lib/dnssec/signature.c \
	lib/dnssec/ta.c \
	lib/generic/lru.c \
	lib/generic/map.c \
	lib/generic/queue.c \
	lib/generic/trie.c \
	lib/layer/cache.c \
	lib/layer/iterate.c \
	lib/layer/validate.c \
	lib/module.c \
	lib/nsrep.c \
	lib/resolve.c \
	lib/rplan.c \
	lib/utils.c \
	lib/zonecut.c

libkres_HEADERS := \
	lib/cache/api.h \
	lib/cache/cdb_api.h \
	lib/cache/cdb_lmdb.h \
	lib/cache/impl.h \
	lib/defines.h \
	lib/dnssec.h \
	lib/dnssec/nsec.h \
	lib/dnssec/nsec3.h \
	lib/dnssec/signature.h \
	lib/dnssec/ta.h \
	lib/generic/array.h \
	lib/generic/lru.h \
	lib/generic/map.h \
	lib/generic/pack.h \
	lib/generic/queue.h \
	lib/generic/trie.h \
	lib/layer.h \
	lib/layer/iterate.h \
	lib/module.h \
	lib/nsrep.h \
	lib/resolve.h \
	lib/rplan.h \
	lib/utils.h \
	lib/zonecut.h

# Dependencies
libkres_DEPEND := $(contrib)
libkres_CFLAGS := -fPIC $(lmdb_CFLAGS)
libkres_LIBS := $(contrib_TARGET) $(libknot_LIBS) $(libdnssec_LIBS) $(lmdb_LIBS) \
				$(libuv_LIBS) $(gnutls_LIBS)
libkres_TARGET := -L$(abspath lib) -lkres

ifeq ($(ENABLE_COOKIES),yes)
libkres_SOURCES += \
	lib/cookies/alg_containers.c \
	lib/cookies/alg_sha.c \
	lib/cookies/helper.c \
	lib/cookies/lru_cache.c \
	lib/cookies/nonce.c

libkres_HEADERS += \
	lib/cookies/alg_containers.h \
	lib/cookies/alg_sha.h \
	lib/cookies/control.h \
	lib/cookies/helper.h \
	lib/cookies/lru_cache.h \
	lib/cookies/nonce.h

libkres_LIBS += $(nettle_LIBS)
endif

# Make library
ifeq ($(BUILDMODE), static)
$(eval $(call make_static,libkres,lib,yes))
else
$(eval $(call make_lib,libkres,lib,yes,$(ABIVER)))
endif

# Generate pkg-config file
libkres.pc:
	@echo 'prefix='$(PREFIX) > $@
	@echo 'exec_prefix=$${prefix}' >> $@
	@echo 'libdir='$(LIBDIR) >> $@
	@echo 'includedir='$(INCLUDEDIR) >> $@
	@echo 'Name: libkres' >> $@
	@echo 'Description: Knot Resolver library' >> $@
	@echo 'URL: https://www.knot-resolver.cz' >> $@
	@echo 'Version: $(VERSION)' >> $@
	@echo 'Libs: -L$${libdir} -lkres' >> $@
	@echo 'Cflags: -I$${includedir}' >> $@
libkres-pcinstall: libkres.pc libkres-install
	$(INSTALL) -d -m 755 $(DESTDIR)$(PKGCONFIGDIR)
	$(INSTALL)    -m 644 $< $(DESTDIR)$(PKGCONFIGDIR)

# Targets
lib: $(libkres)
lib-install: libkres-install libkres-pcinstall
lib-clean: libkres-clean

.PHONY: lib lib-install lib-clean libkres.pc