diff --git a/configure.ac b/configure.ac
index 9bd16848292af6c1cf331a991e5bc9e3cb74bbd9..a626120860fb19dfc25e5b30b7705d5d531b2b70 100644
--- a/configure.ac
+++ b/configure.ac
@@ -174,6 +174,9 @@ doc/man/Makefile
 doc/example-config/Makefile
 doc/example-config/conf.d/Makefile
 doc/rfc/Makefile
+doc/extensions/Makefile
+doc/locations/Makefile
+doc/plugins/Makefile
 src/Makefile
 src/lib-sieve/Makefile
 src/lib-sieve/util/Makefile
diff --git a/doc/Makefile.am b/doc/Makefile.am
index b5bb82a7007772e876bc5fd9da5ab7c04e979069..5131ece602d3f69ad26d34d2e6ebafc8ae2a025e 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,7 +1,12 @@
-SUBDIRS = man example-config rfc
+SUBDIRS = \
+	man \
+	example-config \
+	rfc \
+	extensions \
+	locations \
+	plugins
 
-docfiles = \
-	script-location-dict.txt
+docfiles =
 
 if BUILD_DOCS
 sieve_doc_DATA = $(docfiles)
@@ -9,7 +14,5 @@ endif
 
 EXTRA_DIST = \
 	devel \
-	extensions \
-	plugins \
 	$(docfiles)
 
diff --git a/doc/extensions/Makefile.am b/doc/extensions/Makefile.am
new file mode 100644
index 0000000000000000000000000000000000000000..20281c38c1bb3844051b3f7718598d8c45de3774
--- /dev/null
+++ b/doc/extensions/Makefile.am
@@ -0,0 +1,15 @@
+docfiles = \
+	duplicate.txt \
+	editheader.txt \
+	include.txt \
+	spamtest-virustest.txt \
+	vacation.txt
+
+if BUILD_DOCS
+extensions_docdir = $(sieve_docdir)/extensions
+extensions_doc_DATA = $(docfiles)
+endif
+
+EXTRA_DIST = \
+	$(docfiles)
+
diff --git a/doc/locations/Makefile.am b/doc/locations/Makefile.am
new file mode 100644
index 0000000000000000000000000000000000000000..d6be0df232d77e21bebcc2f5f6d783de60fe15a0
--- /dev/null
+++ b/doc/locations/Makefile.am
@@ -0,0 +1,13 @@
+docfiles = \
+	dict.txt \
+	file.txt \
+	ldap.txt
+
+if BUILD_DOCS
+locations_docdir = $(sieve_docdir)/locations
+locations_doc_DATA = $(docfiles)
+endif
+
+EXTRA_DIST = \
+	$(docfiles)
+
diff --git a/doc/plugins/Makefile.am b/doc/plugins/Makefile.am
new file mode 100644
index 0000000000000000000000000000000000000000..35d6a7b5573f4a451d7db38981e37adb0e96c37c
--- /dev/null
+++ b/doc/plugins/Makefile.am
@@ -0,0 +1,11 @@
+docfiles = \
+	sieve_extprograms.txt
+
+if BUILD_DOCS
+plugins_docdir = $(sieve_docdir)/plugins
+plugins_doc_DATA = $(docfiles)
+endif
+
+EXTRA_DIST = \
+	$(docfiles)
+
diff --git a/doc/rfc/Makefile.am b/doc/rfc/Makefile.am
index 682bd724a596199c6b7d135248748afe83beaa08..386287a50f3b5ff2399ad5c5973b9a38e2adccd6 100644
--- a/doc/rfc/Makefile.am
+++ b/doc/rfc/Makefile.am
@@ -1,30 +1,33 @@
 docfiles = \
-	body.rfc5173.txt
-	collation.rfc4790.txt
-	copy.rfc3894.txt
-	draft-degener-sieve-multiscript-00.txt
-	draft-duerst-mailto-bis-05.txt
-	draft-ietf-sieve-include-05.txt
-	draft-murchison-sieve-regex-07.txt
-	editheader.rfc5293.txt
-	environment.rfc5183.txt
-	ihave.rfc5463.txt
-	imail.rfc2822.txt
-	imap4flags.rfc5232.txt
-	mailto.rfc2368.txt
-	managesieve.rfc5804.txt
-	notify-mailto.rfc5436.txt
-	notify.rfc5435.txt
-	reject-ereject.rfc5429.txt
-	relational.rfc5231.txt
-	sieve.rfc5228.txt
-	spamvirustest.rfc5235.txt
-	spec-bosch-sieve-duplicate.txt
-	subaddress.rfc5233.txt
-	uri.rfc3986.txt
-	utf-8.rfc3629.txt
-	vacation.rfc5230.txt
-	vacation-seconds.rfc6131.txt
+	body.rfc5173.txt \
+	collation.rfc4790.txt \
+	copy.rfc3894.txt \
+	draft-degener-sieve-multiscript-00.txt \
+	draft-duerst-mailto-bis-05.txt \
+	draft-ietf-appsawg-sieve-duplicate-03.txt \
+	draft-murchison-sieve-regex-07.txt \
+	editheader.rfc5293.txt \
+	environment.rfc5183.txt \
+	ihave.rfc5463.txt \
+	imail.rfc2822.txt \
+	imap4flags.rfc5232.txt \
+	include.rfc6609.txt \
+	mailto.rfc2368.txt \
+	managesieve.rfc5804.txt \
+	notify-mailto.rfc5436.txt \
+	notify.rfc5435.txt \
+	reject-ereject.rfc5429.txt \
+	relational.rfc5231.txt \
+	sieve.rfc5228.txt \
+	spamvirustest.rfc5235.txt \
+	spec-bosch-sieve-debug.txt \
+	spec-bosch-sieve-duplicate.txt \
+	spec-bosch-sieve-extprograms.txt \
+	subaddress.rfc5233.txt \
+	uri.rfc3986.txt \
+	utf-8.rfc3629.txt \
+	vacation.rfc5230.txt \
+	vacation-seconds.rfc6131.txt \
 	variables.rfc5229.txt
 
 EXTRA_DIST = \