meson: introduce a "docs" alias to compile documentation only
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>
Patrick Steinhardt committed
Sep 11, 2025 at 11:16 UTC
197f0d0f390ef2f1e573a57c27ed7db8df7a46fd
6 files changed
+19
-12
Documentation/howto/meson.build
+2
-2
@@ -29,7 +29,7 @@ howto_index = custom_target(
29
output: 'howto-index.adoc',
30
)
31
32
-custom_target(
32
+doc_targets += custom_target(
33
command: asciidoc_html_options,
34
input: howto_index,
35
output: 'howto-index.html',
@@ -51,7 +51,7 @@ foreach howto : howto_sources
51
capture: true,
52
)
53
54
- custom_target(
54
+ doc_targets += custom_target(
55
command: asciidoc_html_options,
56
input: howto_stripped,
57
output: fs.stem(howto_stripped.full_path()) + '.html',
Documentation/meson.build
+4
-4
@@ -375,7 +375,7 @@ foreach manpage, category : manpages
375
output: fs.stem(manpage) + '.xml',
376
)
377
378
- custom_target(
378
+ doc_targets += custom_target(
379
command: [
380
xmlto,
381
'-m', '@INPUT0@',
@@ -398,7 +398,7 @@ foreach manpage, category : manpages
398
endif
399
400
if get_option('docs').contains('html')
401
- custom_target(
401
+ doc_targets += custom_target(
402
command: asciidoc_common_options + [
403
'--backend=' + asciidoc_html,
404
'--doctype=manpage',
@@ -450,7 +450,7 @@ if get_option('docs').contains('html')
450
depends: documentation_deps,
451
)
452
453
- custom_target(
453
+ doc_targets += custom_target(
454
command: [
455
xsltproc,
456
'--xinclude',
@@ -479,7 +479,7 @@ if get_option('docs').contains('html')
479
]
480
481
foreach article : articles
482
- custom_target(
482
+ doc_targets += custom_target(
483
command: asciidoc_common_options + [
484
'--backend=' + asciidoc_html,
485
'--out-file=@OUTPUT@',
Documentation/technical/meson.build
+2
-2
@@ -46,7 +46,7 @@ api_index = custom_target(
46
output: 'api-index.adoc',
47
)
48
49
-custom_target(
49
+doc_targets += custom_target(
50
command: asciidoc_html_options,
51
input: api_index,
52
output: 'api-index.html',
@@ -56,7 +56,7 @@ custom_target(
56
)
57
58
foreach article : api_docs + articles
59
- custom_target(
59
+ doc_targets += custom_target(
60
command: asciidoc_html_options,
61
input: article,
62
output: fs.stem(article) + '.html',
contrib/contacts/meson.build
+2
-2
@@ -20,7 +20,7 @@ if get_option('docs').contains('man')
20
output: 'git-contacts.xml',
21
)
22
23
- custom_target(
23
+ doc_targets += custom_target(
24
command: [
25
xmlto,
26
'-m', '@INPUT@',
@@ -39,7 +39,7 @@ if get_option('docs').contains('man')
39
endif
40
41
if get_option('docs').contains('html')
42
- custom_target(
42
+ doc_targets += custom_target(
43
command: asciidoc_common_options + [
44
'--backend=' + asciidoc_html,
45
'--doctype=manpage',
contrib/subtree/meson.build
+2
-2
@@ -38,7 +38,7 @@ if get_option('docs').contains('man')
38
output: 'git-subtree.xml',
39
)
40
41
- custom_target(
41
+ doc_targets += custom_target(
42
command: [
43
xmlto,
44
'-m', '@INPUT@',
@@ -57,7 +57,7 @@ if get_option('docs').contains('man')
57
endif
58
59
if get_option('docs').contains('html')
60
- custom_target(
60
+ doc_targets += custom_target(
61
command: asciidoc_common_options + [
62
'--backend=' + asciidoc_html,
63
'--doctype=manpage',
meson.build
+7
@@ -2099,11 +2099,18 @@ endif
2099
2100
subdir('bin-wrappers')
2101
if get_option('docs') != []
2102
+ doc_targets = []
2103
subdir('Documentation')
2104
endif
2105
2106
subdir('contrib')
2107
2108
+# Note that the target is intentionally configured after including the
2109
+# 'contrib' directory, as some tool there also have their own manpages.
2110
+if get_option('docs') != []
2111
+ alias_target('docs', doc_targets)
2112
+endif
2113
+
2114
exclude_from_check_headers = [
2115
'compat/',
2116
'unicode-width.h',