]> git.ipfire.org Git - thirdparty/git.git/commitdiff
meson: introduce a "docs" alias to compile documentation only
authorPatrick Steinhardt <ps@pks.im>
Thu, 11 Sep 2025 09:16:06 +0000 (11:16 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 11 Sep 2025 16:57:24 +0000 (09:57 -0700)
Meson does not currently provide a target to compile documentation,
only. Instead, users needs to compile the whole project, which may be
way more than they really intend to do.

Introduce a new "docs" alias to plug this gap. This alias can be invoked
e.g. with `meson compile docs`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/howto/meson.build
Documentation/meson.build
Documentation/technical/meson.build
contrib/contacts/meson.build
contrib/subtree/meson.build
meson.build

index 81000028c08ee67ac056ec06d8c7b5129adf3d3f..ece20244af2ad3e875b030a83d83ef459c3d574c 100644 (file)
@@ -29,7 +29,7 @@ howto_index = custom_target(
   output: 'howto-index.adoc',
 )
 
-custom_target(
+doc_targets += custom_target(
   command: asciidoc_html_options,
   input: howto_index,
   output: 'howto-index.html',
@@ -51,7 +51,7 @@ foreach howto : howto_sources
     capture: true,
   )
 
-  custom_target(
+  doc_targets += custom_target(
     command: asciidoc_html_options,
     input: howto_stripped,
     output: fs.stem(howto_stripped.full_path()) + '.html',
index 4404c623f006dbc2f20a9e373576891701c8cb90..f0169fcf9c60f07d76e8339a93276bd99d12b622 100644 (file)
@@ -375,7 +375,7 @@ foreach manpage, category : manpages
       output: fs.stem(manpage) + '.xml',
     )
 
-    custom_target(
+    doc_targets += custom_target(
       command: [
         xmlto,
         '-m', '@INPUT0@',
@@ -398,7 +398,7 @@ foreach manpage, category : manpages
   endif
 
   if get_option('docs').contains('html')
-    custom_target(
+    doc_targets += custom_target(
       command: asciidoc_common_options + [
         '--backend=' + asciidoc_html,
         '--doctype=manpage',
@@ -450,7 +450,7 @@ if get_option('docs').contains('html')
     depends: documentation_deps,
   )
 
-  custom_target(
+  doc_targets += custom_target(
     command: [
       xsltproc,
       '--xinclude',
@@ -479,7 +479,7 @@ if get_option('docs').contains('html')
   ]
 
   foreach article : articles
-    custom_target(
+    doc_targets += custom_target(
       command: asciidoc_common_options + [
         '--backend=' + asciidoc_html,
         '--out-file=@OUTPUT@',
index a13aafcfbb8c75d8627d61b70421502096afc668..858af811a7bcc1484dd1cf5182cf282178482f13 100644 (file)
@@ -46,7 +46,7 @@ api_index = custom_target(
   output: 'api-index.adoc',
 )
 
-custom_target(
+doc_targets += custom_target(
   command: asciidoc_html_options,
   input: api_index,
   output: 'api-index.html',
@@ -56,7 +56,7 @@ custom_target(
 )
 
 foreach article : api_docs + articles
-  custom_target(
+  doc_targets += custom_target(
     command: asciidoc_html_options,
     input: article,
     output: fs.stem(article) + '.html',
index 73d82dfe52b85f0498f518cebff030a255fa7ea3..c8fdb35ed990ee80aa41665904b2bdfb72729081 100644 (file)
@@ -20,7 +20,7 @@ if get_option('docs').contains('man')
     output: 'git-contacts.xml',
   )
 
-  custom_target(
+  doc_targets += custom_target(
     command: [
       xmlto,
       '-m', '@INPUT@',
@@ -39,7 +39,7 @@ if get_option('docs').contains('man')
 endif
 
 if get_option('docs').contains('html')
-  custom_target(
+  doc_targets += custom_target(
     command: asciidoc_common_options + [
       '--backend=' + asciidoc_html,
       '--doctype=manpage',
index 98dd8e0c8eaceadc39dfa0a44c0b6aeb8fd9d41d..46cdbcc30c9bd766866821d53e9ad37b927d186a 100644 (file)
@@ -38,7 +38,7 @@ if get_option('docs').contains('man')
     output: 'git-subtree.xml',
   )
 
-  custom_target(
+  doc_targets += custom_target(
     command: [
       xmlto,
       '-m', '@INPUT@',
@@ -57,7 +57,7 @@ if get_option('docs').contains('man')
 endif
 
 if get_option('docs').contains('html')
-  custom_target(
+  doc_targets += custom_target(
     command: asciidoc_common_options + [
       '--backend=' + asciidoc_html,
       '--doctype=manpage',
index 5dd299b4962d847fc85db656b76a94da15fa0699..f7dd6ee30d7251ede7a333ede7684e5d16d1d7e9 100644 (file)
@@ -2099,11 +2099,18 @@ endif
 
 subdir('bin-wrappers')
 if get_option('docs') != []
+  doc_targets = []
   subdir('Documentation')
 endif
 
 subdir('contrib')
 
+# Note that the target is intentionally configured after including the
+# 'contrib' directory, as some tool there also have their own manpages.
+if get_option('docs') != []
+  alias_target('docs', doc_targets)
+endif
+
 exclude_from_check_headers = [
   'compat/',
   'unicode-width.h',