Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@ clean:
distclean: clean
rm -rf dist MANIFEST

SPHINXOPTS += -D version=$(VERSION) -D release=$(VERSION)
sphinx-%: install
mkdir $(BUILD_DIR) && cd $(BUILD_DIR) && $(PYTHON) -m sphinx -b $* $(SPHINXOPTS) ../docs $*
@echo Output has been generated in $(BUILD_DIR)/$*

doc: sphinx-html

check: build install
($(PYTHON) -m pytest src/systemd/test docs $(TESTFLAGS))

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ Online documentation can be found at [freedesktop.org](https://www.freedesktop.o

To build it locally run:

make sphinx-html
ninja -C build docs

Or use any other builder, see `man sphinx-build` for a list. The compiled docs will be e.g. in `docs/html`.
Or use any other builder, see `man sphinx-build` for a list. The compiled docs will be e.g. in `build/html`.

Viewing Output
==============
Expand Down
16 changes: 16 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,19 @@ test(
)

alias_target('update-constants', update_constants)

# Docs
sphinx_build = find_program('sphinx-build', disabler: true, required: get_option('docs'))
sphinx_args = ['-Dversion=' + meson.project_version(), '-Drelease=' + meson.project_version()]

input_dir = meson.current_source_dir() / 'docs'
output_dir = meson.current_build_dir() / 'html'
doc_target = custom_target('docs',
output: 'html',
input: files('docs/conf.py'),
command: [sphinx_build, '-b', 'html', sphinx_args, input_dir, output_dir],
env: { 'PYTHONPATH': meson.current_build_dir() / 'src' },
build_by_default: get_option('docs'),
install: get_option('docs'),
install_dir: get_option('datadir') / 'doc' / meson.project_name()
)
3 changes: 3 additions & 0 deletions meson.options
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: LGPL-2.1-or-later

option('docs', type : 'boolean', value : false)