diff --git a/src/Makefile.am b/src/Makefile.am
index 5e52ebf6332d5a2810825c036f4001970c85e7f3..27524e0dbe073719e21f972d9fc000cb7bbadfd5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -83,122 +83,6 @@ libknot_la_LDFLAGS =				\
 	$(AM_LDFLAGS)				\
 	$(RELEASE_INFO) $(VERSION_INFO)
 
-libknot_la_SOURCES =				\
-	libknot/binary.c			\
-	libknot/binary.h			\
-	libknot/consts.c			\
-	libknot/consts.h			\
-	libknot/descriptor.c			\
-	libknot/descriptor.h			\
-	libknot/dname.c				\
-	libknot/dname.h				\
-	libknot/dnssec/bitmap.h			\
-	libknot/dnssec/config.h			\
-	libknot/dnssec/crypto.c			\
-	libknot/dnssec/crypto.h			\
-	libknot/dnssec/key.c			\
-	libknot/dnssec/key.h			\
-	libknot/dnssec/policy.c			\
-	libknot/dnssec/policy.h			\
-	libknot/dnssec/random.h			\
-	libknot/dnssec/rrset-sign.c		\
-	libknot/dnssec/rrset-sign.h		\
-	libknot/dnssec/sig0.c			\
-	libknot/dnssec/sig0.h			\
-	libknot/dnssec/sign.c			\
-	libknot/dnssec/sign.h			\
-	libknot/errcode.c			\
-	libknot/errcode.h			\
-	libknot/libknot.h			\
-	libknot/packet/compr.c			\
-	libknot/packet/compr.h			\
-	libknot/packet/pkt.c			\
-	libknot/packet/pkt.h			\
-	libknot/packet/rrset-wire.c		\
-	libknot/packet/rrset-wire.h		\
-	libknot/packet/wire.h			\
-	libknot/processing/layer.c		\
-	libknot/processing/layer.h		\
-	libknot/processing/overlay.c		\
-	libknot/processing/overlay.h		\
-	libknot/processing/requestor.c		\
-	libknot/processing/requestor.h		\
-	libknot/rdata.c				\
-	libknot/rdata.h				\
-	libknot/rdataset.c			\
-	libknot/rdataset.h			\
-	libknot/rrset-dump.c			\
-	libknot/rrset-dump.h			\
-	libknot/rrset.c				\
-	libknot/rrset.h				\
-	libknot/rrtype/aaaa.h			\
-	libknot/rrtype/dnskey.h			\
-	libknot/rrtype/naptr.h			\
-	libknot/rrtype/nsec.h			\
-	libknot/rrtype/nsec3.c			\
-	libknot/rrtype/nsec3.h			\
-	libknot/rrtype/nsec3param.c		\
-	libknot/rrtype/nsec3param.h		\
-	libknot/rrtype/opt.c			\
-	libknot/rrtype/opt.h			\
-	libknot/rrtype/rdname.h			\
-	libknot/rrtype/rrsig.h			\
-	libknot/rrtype/soa.h			\
-	libknot/rrtype/tsig.c			\
-	libknot/rrtype/tsig.h			\
-	libknot/tsig-op.c			\
-	libknot/tsig-op.h			\
-	libknot/internal/array-sort.h		\
-	libknot/internal/base32hex.c		\
-	libknot/internal/base32hex.h		\
-	libknot/internal/base64.c		\
-	libknot/internal/base64.h		\
-	libknot/internal/binsearch.h		\
-	libknot/internal/debug.h		\
-	libknot/internal/endian.h		\
-	libknot/internal/errors.c		\
-	libknot/internal/errors.h		\
-	libknot/internal/getline.c		\
-	libknot/internal/getline.h		\
-	libknot/internal/heap.c			\
-	libknot/internal/heap.h			\
-	libknot/internal/hhash.c		\
-	libknot/internal/hhash.h		\
-	libknot/internal/lists.c		\
-	libknot/internal/lists.h		\
-	libknot/internal/log.c			\
-	libknot/internal/log.h			\
-	libknot/internal/macros.h		\
-	libknot/internal/mem.c			\
-	libknot/internal/mem.h			\
-	libknot/internal/mempattern.c		\
-	libknot/internal/mempattern.h		\
-	libknot/internal/mempool.c		\
-	libknot/internal/mempool.h		\
-	libknot/internal/namedb/namedb.h	\
-	libknot/internal/namedb/namedb_lmdb.c	\
-	libknot/internal/namedb/namedb_lmdb.h	\
-	libknot/internal/namedb/namedb_trie.c	\
-	libknot/internal/namedb/namedb_trie.h	\
-	libknot/internal/net.c			\
-	libknot/internal/net.h			\
-	libknot/internal/print.c		\
-	libknot/internal/print.h		\
-	libknot/internal/sockaddr.c		\
-	libknot/internal/sockaddr.h		\
-	libknot/internal/strlcat.c		\
-	libknot/internal/strlcat.h		\
-	libknot/internal/strlcpy.c		\
-	libknot/internal/strlcpy.h		\
-	libknot/internal/tolower.c		\
-	libknot/internal/tolower.h		\
-	libknot/internal/trie/hat-trie.c	\
-	libknot/internal/trie/hat-trie.h	\
-	libknot/internal/trie/murmurhash3.c	\
-	libknot/internal/trie/murmurhash3.h	\
-	libknot/internal/utils.c		\
-	libknot/internal/utils.h
-
 # dynamic: libknot headers
 nobase_libknot_la_HEADERS =				\
 	libknot/binary.h			\
@@ -268,6 +152,57 @@ nobase_libknot_la_HEADERS =				\
 	libknot/internal/trie/murmurhash3.h	\
 	libknot/internal/utils.h
 
+libknot_la_SOURCES =				\
+	libknot/binary.c			\
+	libknot/consts.c			\
+	libknot/descriptor.c			\
+	libknot/dname.c				\
+	libknot/dnssec/crypto.c			\
+	libknot/dnssec/key.c			\
+	libknot/dnssec/policy.c			\
+	libknot/dnssec/rrset-sign.c		\
+	libknot/dnssec/sig0.c			\
+	libknot/dnssec/sign.c			\
+	libknot/errcode.c			\
+	libknot/packet/compr.c			\
+	libknot/packet/pkt.c			\
+	libknot/packet/rrset-wire.c		\
+	libknot/processing/layer.c		\
+	libknot/processing/overlay.c		\
+	libknot/processing/requestor.c		\
+	libknot/rdata.c				\
+	libknot/rdataset.c			\
+	libknot/rrset-dump.c			\
+	libknot/rrset.c				\
+	libknot/rrtype/nsec3.c			\
+	libknot/rrtype/nsec3param.c		\
+	libknot/rrtype/opt.c			\
+	libknot/rrtype/tsig.c			\
+	libknot/tsig-op.c			\
+	libknot/internal/base32hex.c		\
+	libknot/internal/base64.c		\
+	libknot/internal/errors.c		\
+	libknot/internal/getline.c		\
+	libknot/internal/heap.c			\
+	libknot/internal/hhash.c		\
+	libknot/internal/lists.c		\
+	libknot/internal/log.c			\
+	libknot/internal/mem.c			\
+	libknot/internal/mempattern.c		\
+	libknot/internal/mempool.c		\
+	libknot/internal/namedb/namedb_lmdb.c	\
+	libknot/internal/namedb/namedb_trie.c	\
+	libknot/internal/net.c			\
+	libknot/internal/print.c		\
+	libknot/internal/sockaddr.c		\
+	libknot/internal/strlcat.c		\
+	libknot/internal/strlcpy.c		\
+	libknot/internal/tolower.c		\
+	libknot/internal/trie/hat-trie.c	\
+	libknot/internal/trie/murmurhash3.c	\
+	libknot/internal/utils.c		\
+	$(libknot_la_HEADERS)
+
 # static: server shared
 libknotd_la_SOURCES =				\
 	knot/conf/cf-lex.l			\