Skip to content

Commit 197f0d0

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c44beea commit 197f0d0

File tree

6 files changed

+19
-12
lines changed

6 files changed

+19
-12
lines changed

Documentation/howto/meson.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ howto_index = custom_target(
2929
output: 'howto-index.adoc',
3030
)
3131

32-
custom_target(
32+
doc_targets += custom_target(
3333
command: asciidoc_html_options,
3434
input: howto_index,
3535
output: 'howto-index.html',
@@ -51,7 +51,7 @@ foreach howto : howto_sources
5151
capture: true,
5252
)
5353

54-
custom_target(
54+
doc_targets += custom_target(
5555
command: asciidoc_html_options,
5656
input: howto_stripped,
5757
output: fs.stem(howto_stripped.full_path()) + '.html',

Documentation/meson.build

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ foreach manpage, category : manpages
375375
output: fs.stem(manpage) + '.xml',
376376
)
377377

378-
custom_target(
378+
doc_targets += custom_target(
379379
command: [
380380
xmlto,
381381
'-m', '@INPUT0@',
@@ -398,7 +398,7 @@ foreach manpage, category : manpages
398398
endif
399399

400400
if get_option('docs').contains('html')
401-
custom_target(
401+
doc_targets += custom_target(
402402
command: asciidoc_common_options + [
403403
'--backend=' + asciidoc_html,
404404
'--doctype=manpage',
@@ -450,7 +450,7 @@ if get_option('docs').contains('html')
450450
depends: documentation_deps,
451451
)
452452

453-
custom_target(
453+
doc_targets += custom_target(
454454
command: [
455455
xsltproc,
456456
'--xinclude',
@@ -479,7 +479,7 @@ if get_option('docs').contains('html')
479479
]
480480

481481
foreach article : articles
482-
custom_target(
482+
doc_targets += custom_target(
483483
command: asciidoc_common_options + [
484484
'--backend=' + asciidoc_html,
485485
'--out-file=@OUTPUT@',

Documentation/technical/meson.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ api_index = custom_target(
4646
output: 'api-index.adoc',
4747
)
4848

49-
custom_target(
49+
doc_targets += custom_target(
5050
command: asciidoc_html_options,
5151
input: api_index,
5252
output: 'api-index.html',
@@ -56,7 +56,7 @@ custom_target(
5656
)
5757

5858
foreach article : api_docs + articles
59-
custom_target(
59+
doc_targets += custom_target(
6060
command: asciidoc_html_options,
6161
input: article,
6262
output: fs.stem(article) + '.html',

contrib/contacts/meson.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ if get_option('docs').contains('man')
2020
output: 'git-contacts.xml',
2121
)
2222

23-
custom_target(
23+
doc_targets += custom_target(
2424
command: [
2525
xmlto,
2626
'-m', '@INPUT@',
@@ -39,7 +39,7 @@ if get_option('docs').contains('man')
3939
endif
4040

4141
if get_option('docs').contains('html')
42-
custom_target(
42+
doc_targets += custom_target(
4343
command: asciidoc_common_options + [
4444
'--backend=' + asciidoc_html,
4545
'--doctype=manpage',

contrib/subtree/meson.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ if get_option('docs').contains('man')
3838
output: 'git-subtree.xml',
3939
)
4040

41-
custom_target(
41+
doc_targets += custom_target(
4242
command: [
4343
xmlto,
4444
'-m', '@INPUT@',
@@ -57,7 +57,7 @@ if get_option('docs').contains('man')
5757
endif
5858

5959
if get_option('docs').contains('html')
60-
custom_target(
60+
doc_targets += custom_target(
6161
command: asciidoc_common_options + [
6262
'--backend=' + asciidoc_html,
6363
'--doctype=manpage',

meson.build

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2099,11 +2099,18 @@ endif
20992099

21002100
subdir('bin-wrappers')
21012101
if get_option('docs') != []
2102+
doc_targets = []
21022103
subdir('Documentation')
21032104
endif
21042105

21052106
subdir('contrib')
21062107

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+
21072114
exclude_from_check_headers = [
21082115
'compat/',
21092116
'unicode-width.h',

0 commit comments

Comments
 (0)