Skip to content

Commit

Permalink
doc: use new kconfig extension
Browse files Browse the repository at this point in the history
Enable the new extension and delete usage of the old script/extensions.

Signed-off-by: Gerard Marull-Paretas <[email protected]>
  • Loading branch information
gmarull authored and carlescufi committed Mar 2, 2022
1 parent 8bdeac6 commit fc942ef
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 81 deletions.
67 changes: 3 additions & 64 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ set(DOCS_LATEX_DIR ${CMAKE_CURRENT_BINARY_DIR}/latex)
#
# Both targets will produce same result, but target 2 must have no dependencies.
# This is useful to, e.g. re-run the Sphinx build without dependencies such as
# devicetree or Kconfig generators.
# devicetree generator.
#
function(add_doc_target name)
add_custom_target(${name} ${ARGN})
Expand Down Expand Up @@ -94,67 +94,6 @@ set_target_properties(
ADDITIONAL_CLEAN_FILES "${DOXY_OUT}"
)

#-------------------------------------------------------------------------------
# kconfig

set(KCONFIG_BINARY_DIR ${CMAKE_BINARY_DIR}/Kconfig)

foreach(module_name ${ZEPHYR_MODULE_NAMES})
zephyr_string(SANITIZE TOUPPER MODULE_NAME_UPPER ${module_name})
list(APPEND
ZEPHYR_KCONFIG_MODULES
"ZEPHYR_${MODULE_NAME_UPPER}_MODULE_DIR=${ZEPHYR_${MODULE_NAME_UPPER}_MODULE_DIR}"
)

if(ZEPHYR_${MODULE_NAME_UPPER}_KCONFIG)
list(APPEND
ZEPHYR_KCONFIG_MODULES
"ZEPHYR_${MODULE_NAME_UPPER}_KCONFIG=${ZEPHYR_${MODULE_NAME_UPPER}_KCONFIG}"
)
endif()
endforeach()

if(WIN32)
set(SEP $<SEMICOLON>)
else()
set(SEP :)
endif()

set(GEN_KCONFIG_REST_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/_scripts/gen_kconfig_rest.py)

add_custom_target(
kconfig
COMMAND ${CMAKE_COMMAND} -E make_directory ${DOCS_SRC_DIR}/reference/kconfig
COMMAND ${CMAKE_COMMAND} -E env
PYTHONPATH=${ZEPHYR_BASE}/scripts/kconfig${SEP}$ENV{PYTHONPATH}
ZEPHYR_BASE=${ZEPHYR_BASE}
srctree=${ZEPHYR_BASE}
BOARD_DIR=boards/*/*
ARCH=*
ARCH_DIR=arch
SOC_DIR=soc
TOOLCHAIN_HAS_NEWLIB=y
KCONFIG_BINARY_DIR=${KCONFIG_BINARY_DIR}
KCONFIG_WARN_UNDEF=y
KCONFIG_TURBO_MODE=${KCONFIG_TURBO_MODE}
KCONFIG_DOC_MODE=1
${ZEPHYR_KCONFIG_MODULES}
${PYTHON_EXECUTABLE} ${GEN_KCONFIG_REST_SCRIPT} ${DOCS_SRC_DIR}/reference/kconfig/
--separate-all-index
--keep-module-paths
--modules Architecture,arch,${ZEPHYR_BASE}/arch
Driver,drivers,${ZEPHYR_BASE}/drivers
Kernel,kernel,${ZEPHYR_BASE}/kernel
Library,lib,${ZEPHYR_BASE}/lib
Subsystem,subsys,${ZEPHYR_BASE}/subsys
"External Module,modules,${ZEPHYR_BASE}/modules"

VERBATIM
COMMENT "Generating Kconfig documentation..."
)

set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${GEN_KCONFIG_REST_SCRIPT})

#-------------------------------------------------------------------------------
# devicetree

Expand Down Expand Up @@ -210,7 +149,7 @@ set_target_properties(
ADDITIONAL_CLEAN_FILES "${DOCS_SRC_DIR};${DOCS_HTML_DIR};${DOCS_DOCTREE_DIR}"
)

add_dependencies(html devicetree kconfig)
add_dependencies(html devicetree)

#-------------------------------------------------------------------------------
# pdf
Expand Down Expand Up @@ -238,7 +177,7 @@ set_target_properties(
ADDITIONAL_CLEAN_FILES "${DOCS_SRC_DIR};${DOCS_LATEX_DIR};${DOCS_DOCTREE_DIR}"
)

add_dependencies(latex kconfig devicetree)
add_dependencies(latex devicetree)

if(LATEX_PDFLATEX_FOUND AND LATEXMK)
if(WIN32)
Expand Down
4 changes: 1 addition & 3 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ BUILDDIR ?= _build
DOC_TAG ?= development
SPHINXOPTS ?= -j auto
LATEXMKOPTS ?= -halt-on-error -no-shell-escape
KCONFIG_TURBO_MODE ?= 0
DT_TURBO_MODE ?= 0

# ------------------------------------------------------------------------------
Expand All @@ -15,7 +14,7 @@ DT_TURBO_MODE ?= 0
.PHONY: configure clean html html-fast latex pdf doxygen

html-fast:
${MAKE} html KCONFIG_TURBO_MODE=1 DT_TURBO_MODE=1
${MAKE} html DT_TURBO_MODE=1

html latex pdf doxygen: configure
cmake --build ${BUILDDIR} --target $@
Expand All @@ -28,7 +27,6 @@ configure:
-DDOC_TAG=${DOC_TAG} \
-DSPHINXOPTS="${SPHINXOPTS}" \
-DLATEXMKOPTS="${LATEXMKOPTS}" \
-DKCONFIG_TURBO_MODE=${KCONFIG_TURBO_MODE} \
-DDT_TURBO_MODE=${DT_TURBO_MODE}

clean:
Expand Down
4 changes: 2 additions & 2 deletions doc/application/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,8 @@ started.

See :ref:`setting_configuration_values` for detailed documentation on setting
Kconfig configuration values. The :ref:`initial-conf` section on the same page
explains how the initial configuration is derived. See
:ref:`configuration_options` for a complete list of configuration options.
explains how the initial configuration is derived. See :ref:`kconfig-search`
for a complete list of configuration options.
See :ref:`hardening` for security information related with Kconfig options.

The other pages in the :ref:`Kconfig section of the manual <kconfig>` are also
Expand Down
9 changes: 7 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"sphinx.ext.graphviz",
"zephyr.application",
"zephyr.html_redirects",
"zephyr.kconfig-role",
"zephyr.kconfig",
"zephyr.dtcompatible-role",
"zephyr.link-roles",
"sphinx_tabs.tabs",
Expand Down Expand Up @@ -150,7 +150,7 @@
"display_vcs_link": True,
"reference_links": {
"API": f"{reference_prefix}/doxygen/html/index.html",
"Kconfig Options": f"{reference_prefix}/reference/kconfig/index.html",
"Kconfig Options": f"{reference_prefix}/kconfig.html",
"Devicetree Bindings": f"{reference_prefix}/reference/devicetree/bindings.html",
}
}
Expand Down Expand Up @@ -241,6 +241,11 @@
"reference/devicetree/compatibles.*",
]

# -- Options for zephyr.kconfig -------------------------------------------

kconfig_generate_db = True
kconfig_ext_paths = [ZEPHYR_BASE]

# -- Options for zephyr.external_content ----------------------------------

external_content_contents = [
Expand Down
8 changes: 4 additions & 4 deletions doc/guides/build/kconfig/setting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ The :ref:`menuconfig and guiconfig interfaces <menuconfig>` can be used to test
out configurations during application development. This page explains how to
make settings permanent.

An auto-generated list of all Kconfig options can be found in the :ref:`Kconfig
symbol reference <configuration_options>`.
All Kconfig options can be searched in the :ref:`Kconfig search page
<kconfig-search>`.

.. note::

Expand Down Expand Up @@ -115,8 +115,8 @@ Assignments in configuration files are only respected if the dependencies for
the symbol are satisfied. A warning is printed otherwise. To figure out what
the dependencies of a symbol are, use one of the :ref:`interactive
configuration interfaces <menuconfig>` (you can jump directly to a symbol with
:kbd:`/`), or look up the symbol in the :ref:`Kconfig symbol reference
<configuration_options>`.
:kbd:`/`), or look up the symbol in the :ref:`Kconfig search page
<kconfig-search>`.


.. _initial-conf:
Expand Down
10 changes: 4 additions & 6 deletions doc/guides/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,13 @@ declarations. This warning may be caused by different Sphinx/Breathe issues:
Developer-mode Document Building
********************************

Building the documentation for all the Kconfig options significantly
adds to the total doc build time. When making and testing major changes
to the documentation, we provide an option to temporarily stub-out
the auto-generated configuration and Devicetree bindings documentation so the
doc build process runs much faster.
When making and testing major changes to the documentation, we provide an option
to temporarily stub-out the auto-generated Devicetree bindings documentation so
the doc build process runs faster.

To enable this mode, set the following option when invoking cmake::

-DKCONFIG_TURBO_MODE=1 -DDT_TURBO_MODE=1
-DDT_TURBO_MODE=1

or invoke make with the following target::

Expand Down
8 changes: 8 additions & 0 deletions doc/kconfig.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
:orphan:

.. _kconfig-search:

Kconfig Search
==============

.. kconfig:search::

0 comments on commit fc942ef

Please sign in to comment.