lib.mk 2.44 KB
Newer Older
1
libkres_SOURCES := \
2
	lib/generic/lru.c      \
3
	lib/generic/map.c      \
Marek Vavruša's avatar
Marek Vavruša committed
4
	lib/layer/iterate.c    \
5
	lib/layer/validate.c   \
6
	lib/layer/rrcache.c    \
7
	lib/layer/pktcache.c   \
8
	lib/dnssec/nsec.c      \
9
	lib/dnssec/nsec3.c     \
10
	lib/dnssec/signature.c \
11
	lib/dnssec/ta.c        \
12
	lib/dnssec.c           \
13
	lib/utils.c            \
14
	lib/nsrep.c            \
15
	lib/module.c           \
Marek Vavruša's avatar
Marek Vavruša committed
16 17 18
	lib/resolve.c          \
	lib/zonecut.c          \
	lib/rplan.c            \
19 20
	lib/cache.c            \
	lib/cdb_lmdb.c
Marek Vavruša's avatar
Marek Vavruša committed
21

22
libkres_HEADERS := \
23
	lib/generic/array.h    \
24
	lib/generic/lru.h      \
25 26
	lib/generic/map.h      \
	lib/generic/set.h      \
Marek Vavruša's avatar
Marek Vavruša committed
27
	lib/layer.h            \
28
	lib/dnssec/nsec.h      \
29
	lib/dnssec/nsec3.h     \
30
	lib/dnssec/signature.h \
31
	lib/dnssec/ta.h        \
32
	lib/dnssec.h           \
33
	lib/utils.h            \
34
	lib/nsrep.h            \
35
	lib/module.h           \
Marek Vavruša's avatar
Marek Vavruša committed
36 37 38
	lib/resolve.h          \
	lib/zonecut.h          \
	lib/rplan.h            \
39 40 41
	lib/cache.h            \
	lib/cdb.h              \
	lib/cdb_lmdb.h
Marek Vavruša's avatar
Marek Vavruša committed
42 43

# Dependencies
44
libkres_DEPEND := $(contrib)
45 46
libkres_CFLAGS := -fvisibility=hidden -fPIC $(lmdb_CFLAGS)
libkres_LIBS := $(contrib_TARGET) $(libknot_LIBS) $(libdnssec_LIBS) $(lmdb_LIBS)
47
libkres_TARGET := -L$(abspath lib) -lkres
Marek Vavruša's avatar
Marek Vavruša committed
48

49
ifeq ($(ENABLE_COOKIES),yes)
50
libkres_SOURCES += \
51
	lib/cookies/alg_containers.c \
52 53
	lib/cookies/alg_sha.c \
	lib/cookies/helper.c \
54
	lib/cookies/lru_cache.c \
55
	lib/cookies/nonce.c
56 57

libkres_HEADERS += \
58 59 60 61
	lib/cookies/alg_containers.h \
	lib/cookies/alg_sha.h \
	lib/cookies/control.h \
	lib/cookies/helper.h \
62
	lib/cookies/lru_cache.h \
63
	lib/cookies/nonce.h
64

65
libkres_LIBS += $(nettle_LIBS)
66 67
endif

Marek Vavruša's avatar
Marek Vavruša committed
68
# Make library
69
ifeq ($(BUILDMODE), static)
70
$(eval $(call make_static,libkres,lib,yes))
71 72 73 74 75 76 77 78 79 80 81 82
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 DNS Resolver library' >> $@
Marek Vavrusa's avatar
Marek Vavrusa committed
83
	@echo 'URL: https://www.knot-resolver.cz' >> $@
84
	@echo 'Version: $(VERSION)' >> $@
85 86 87
	@echo 'Libs: -L$${libdir} -lkres' >> $@
	@echo 'Cflags: -I$${includedir}' >> $@
libkres-pcinstall: libkres.pc libkres-install
88 89
	$(INSTALL) -d -m 755 $(DESTDIR)$(PKGCONFIGDIR)
	$(INSTALL)    -m 644 $< $(DESTDIR)$(PKGCONFIGDIR)
90 91

# Targets
92
lib: $(libkres)
93
lib-install: libkres-install libkres-pcinstall
94
lib-clean: libkres-clean
95

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