Skip to content

Commit 6a32a8f

Browse files
committed
build: add dedicated docs target
Introduce a 'docs' target which only builds the documentation. This avoids overhead in the CI build and reduces dependencies when building just the documentation. Signed-off-by: Daniel Wagner <[email protected]>
1 parent 75d20d5 commit 6a32a8f

5 files changed

Lines changed: 67 additions & 11 deletions

File tree

Documentation/meson.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ if want_docs != 'false'
302302
'@INPUT@',
303303
],
304304
)
305-
custom_target(
305+
doc_tgts += custom_target(
306306
adoc.underscorify() + '_man',
307307
input: xml,
308308
output: '@[email protected]',
@@ -330,7 +330,7 @@ if want_docs != 'false'
330330
output: adoc + '.hsubst',
331331
configuration: substs,
332332
)
333-
custom_target(
333+
doc_tgts += custom_target(
334334
adoc.underscorify() + '_html',
335335
input: subst,
336336
output: '@[email protected]',

libnvme/doc/meson.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ if want_docs != 'false'
6262
c = run_command(list_man_pages, apif, check: true)
6363
man_pages = c.stdout().split()
6464
foreach page : man_pages
65-
custom_target(
65+
doc_tgts += custom_target(
6666
page.underscorify() + '_man',
6767
input: apif,
6868
output: page + '.2',
@@ -94,7 +94,7 @@ if want_docs != 'false'
9494
htmldir = join_paths(get_option('htmldir'), 'nvme')
9595
sphinx_build = find_program('sphinx-build-3', 'sphinx-build')
9696
if sphinx_build.found() and want_docs_build
97-
custom_target(
97+
doc_tgts += custom_target(
9898
'generate_doc_html',
9999
input: [static_sources, rst],
100100
output: 'html',

libnvme/doc/rst/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if want_docs != 'false'
1616
output: '@[email protected]',
1717
configuration: rst_conf,
1818
)
19-
rst = custom_target(
19+
doc_tgts += custom_target(
2020
apif.underscorify() + '_rst',
2121
input: subst,
2222
output: '@[email protected]',

meson.build

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,8 @@ substs.set('VERSION_MAJOR', libnvme_so_version.split('.')[0])
464464

465465

466466
################################################################################
467+
doc_tgts = []
468+
467469
subdir('ccan') # declares: ccan_dep
468470
subdir('libnvme') # declares: libnvme_dep
469471

@@ -607,6 +609,17 @@ if want_nvme
607609
subdir('Documentation')
608610
endif
609611

612+
if doc_tgts.length() == 0
613+
doc_tgts += custom_target(
614+
'docs-dummy',
615+
output: 'docs.stamp',
616+
command: ['true'],
617+
build_by_default: false,
618+
)
619+
endif
620+
621+
alias_target('docs', doc_tgts)
622+
610623

611624
################################################################################
612625
path_dict = {

scripts/build.sh

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ usage() {
3131
echo " coverage build coverage report"
3232
echo " distro build libnvme and nvme-cli separately"
3333
echo " docs build all documentation"
34+
echo " man_docs build man documentation only"
3435
echo " html_docs build html documentation only"
3536
echo " rst_docs build rst documentation only"
3637
echo " static build a static binary"
@@ -153,18 +154,22 @@ config_meson_coverage() {
153154

154155
config_meson_docs() {
155156
CC="${CC}" "${MESON}" setup \
156-
-Dnvme=disabled \
157-
-Dlibnvme=disabled \
158157
-Ddocs=all \
159158
-Ddocs-build=true \
160159
--prefix=/tmp/usr \
161160
"${BUILDDIR}"
162161
}
163162

163+
config_meson_man_docs() {
164+
CC="${CC}" "${MESON}" setup \
165+
-Ddocs=man \
166+
-Ddocs-build=true \
167+
--prefix=/tmp/usr \
168+
"${BUILDDIR}"
169+
}
170+
164171
config_meson_html_docs() {
165172
CC="${CC}" "${MESON}" setup \
166-
-Dnvme=disabled \
167-
-Dlibnvme=disabled \
168173
-Ddocs=html \
169174
-Ddocs-build=true \
170175
--prefix=/tmp/usr \
@@ -173,8 +178,6 @@ config_meson_html_docs() {
173178

174179
config_meson_rst_docs() {
175180
CC="${CC}" "${MESON}" setup \
176-
-Dnvme=disabled \
177-
-Dlibnvme=disabled \
178181
-Ddocs=rst \
179182
-Ddocs-build=true \
180183
--prefix=/tmp/usr \
@@ -252,6 +255,30 @@ build_meson() {
252255
-C "${BUILDDIR}"
253256
}
254257

258+
build_meson_docs() {
259+
"${MESON}" compile \
260+
-C "${BUILDDIR}" \
261+
docs
262+
}
263+
264+
build_meson_man_docs() {
265+
"${MESON}" compile \
266+
-C "${BUILDDIR}" \
267+
docs
268+
}
269+
270+
build_meson_html_docs() {
271+
"${MESON}" compile \
272+
-C "${BUILDDIR}" \
273+
docs
274+
}
275+
276+
build_meson_rst_docs() {
277+
"${MESON}" compile \
278+
-C "${BUILDDIR}" \
279+
docs
280+
}
281+
255282
test_meson() {
256283
local args=(-C "${BUILDDIR}")
257284

@@ -266,6 +293,22 @@ test_meson() {
266293
"${MESON}" test "${args[@]}"
267294
}
268295

296+
test_meson_docs() {
297+
true
298+
}
299+
300+
test_meson_man_docs() {
301+
true
302+
}
303+
304+
test_meson_html_docs() {
305+
true
306+
}
307+
308+
test_meson_rst_docs() {
309+
true
310+
}
311+
269312
test_meson_coverage() {
270313
"${MESON}" test \
271314
-C "${BUILDDIR}"

0 commit comments

Comments
 (0)