# HG changeset patch
# Node ID 37dc9d8db842227322fd74aafc915db24dd9dad5
# Parent  18ba0f636076fb1b38d0c1ba8e928ed966d3ec90
diff --git a/doc/meson.build b/doc/meson.build
--- a/doc/meson.build
+++ b/doc/meson.build
@@ -1,5 +1,3 @@
-subdir('reference')
-
 if ENABLE_GTK
 	configure_file(
 	    input : 'pidgin3.1.in',
diff --git a/doc/reference/libpurple/contributing.md b/libpurple/reference/contributing.md
rename from doc/reference/libpurple/contributing.md
rename to libpurple/reference/contributing.md
diff --git a/doc/reference/libpurple/libpurple.toml.in b/libpurple/reference/libpurple.toml.in
rename from doc/reference/libpurple/libpurple.toml.in
rename to libpurple/reference/libpurple.toml.in
diff --git a/doc/reference/libpurple/meson.build b/libpurple/reference/meson.build
rename from doc/reference/libpurple/meson.build
rename to libpurple/reference/meson.build
--- a/doc/reference/libpurple/meson.build
+++ b/libpurple/reference/meson.build
@@ -48,5 +48,7 @@
 		depends: libpurple_gir[0],
 		verbose: true,
 	)
+
+	doc_targets += libpurple_doc
 endif
 
diff --git a/doc/reference/libpurple/signals_connection.md b/libpurple/reference/signals_connection.md
rename from doc/reference/libpurple/signals_connection.md
rename to libpurple/reference/signals_connection.md
diff --git a/doc/reference/libpurple/signals_core.md b/libpurple/reference/signals_core.md
rename from doc/reference/libpurple/signals_core.md
rename to libpurple/reference/signals_core.md
diff --git a/doc/reference/libpurple/tut_c_plugins.md b/libpurple/reference/tut_c_plugins.md
rename from doc/reference/libpurple/tut_c_plugins.md
rename to libpurple/reference/tut_c_plugins.md
diff --git a/doc/reference/libpurple/urlmap.js b/libpurple/reference/urlmap.js
rename from doc/reference/libpurple/urlmap.js
rename to libpurple/reference/urlmap.js
diff --git a/doc/reference/meson.build b/doc/reference/meson.build
deleted file mode 100644
--- a/doc/reference/meson.build
+++ /dev/null
@@ -1,15 +0,0 @@
-if get_option('doc')
-
-subdir('libpurple')
-subdir('protocols')
-
-if ENABLE_GTK
-	subdir('pidgin')
-else
-	pidgin_doc = []
-endif
-
-alias_target('doc', libpurple_doc, protocols_doc, pidgin_doc)
-
-endif
-
diff --git a/doc/reference/pidgin/meson.build b/pidgin/reference/meson.build
rename from doc/reference/pidgin/meson.build
rename to pidgin/reference/meson.build
--- a/doc/reference/pidgin/meson.build
+++ b/pidgin/reference/meson.build
@@ -48,5 +48,7 @@
 		],
 		depends: [libpurple_gir[0], pidgin_gir[0]],
 	)
+
+	doc_targets += pidgin_doc
 endif
 
diff --git a/doc/reference/pidgin/pidgin.toml.in b/pidgin/reference/pidgin.toml.in
rename from doc/reference/pidgin/pidgin.toml.in
rename to pidgin/reference/pidgin.toml.in
diff --git a/doc/reference/pidgin/urlmap.js b/pidgin/reference/urlmap.js
rename from doc/reference/pidgin/urlmap.js
rename to pidgin/reference/urlmap.js
diff --git a/doc/reference/protocols/meson.build b/doc/reference/protocols/meson.build
deleted file mode 100644
--- a/doc/reference/protocols/meson.build
+++ /dev/null
@@ -1,2 +0,0 @@
-protocols_doc = []
-
diff --git a/libpurple/meson.build b/libpurple/meson.build
--- a/libpurple/meson.build
+++ b/libpurple/meson.build
@@ -342,6 +342,7 @@
 
 subdir('tests')
 subdir('plugins')
+subdir('reference')
 
 test(
 	'purple_license_headers',
diff --git a/meson.build b/meson.build
--- a/meson.build
+++ b/meson.build
@@ -74,6 +74,10 @@
     output : 'package_revision.h',
     fallback : meson.project_version())
 
+# Global variable for doc targets to add themselves to which we use for the
+# doc alias below.
+doc_targets = []
+
 # For running `meson devenv`.
 devenv = environment()
 
@@ -441,6 +445,10 @@
 		command : ['ninja', '-C', '@BUILD_ROOT@', 'pidgin3-pot', 'all', 'test'])
 endif
 
+# doc alias target, depends on doc_targets defined above and populated in sub
+# directories.
+alias_target('doc', doc_targets)
+
 summary({
     'prefix': get_option('prefix'),
     'bindir': get_option('bindir'),
diff --git a/pidgin/meson.build b/pidgin/meson.build
--- a/pidgin/meson.build
+++ b/pidgin/meson.build
@@ -241,3 +241,5 @@
 subdir('data')
 subdir('plugins')
 subdir('tests')
+subdir('reference')
+
