162306a36Sopenharmony_ci# -*- coding: utf-8 -*-
262306a36Sopenharmony_ci#
362306a36Sopenharmony_ci# The Linux Kernel documentation build configuration file, created by
462306a36Sopenharmony_ci# sphinx-quickstart on Fri Feb 12 13:51:46 2016.
562306a36Sopenharmony_ci#
662306a36Sopenharmony_ci# This file is execfile()d with the current directory set to its
762306a36Sopenharmony_ci# containing dir.
862306a36Sopenharmony_ci#
962306a36Sopenharmony_ci# Note that not all possible configuration values are present in this
1062306a36Sopenharmony_ci# autogenerated file.
1162306a36Sopenharmony_ci#
1262306a36Sopenharmony_ci# All configuration values have a default; values that are commented out
1362306a36Sopenharmony_ci# serve to show the default.
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciimport sys
1662306a36Sopenharmony_ciimport os
1762306a36Sopenharmony_ciimport sphinx
1862306a36Sopenharmony_ciimport shutil
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci# helper
2162306a36Sopenharmony_ci# ------
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_cidef have_command(cmd):
2462306a36Sopenharmony_ci    """Search ``cmd`` in the ``PATH`` environment.
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci    If found, return True.
2762306a36Sopenharmony_ci    If not found, return False.
2862306a36Sopenharmony_ci    """
2962306a36Sopenharmony_ci    return shutil.which(cmd) is not None
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci# Get Sphinx version
3262306a36Sopenharmony_cimajor, minor, patch = sphinx.version_info[:3]
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#
3562306a36Sopenharmony_ci# Warn about older versions that we don't want to support for much
3662306a36Sopenharmony_ci# longer.
3762306a36Sopenharmony_ci#
3862306a36Sopenharmony_ciif (major < 2) or (major == 2 and minor < 4):
3962306a36Sopenharmony_ci    print('WARNING: support for Sphinx < 2.4 will be removed soon.')
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci# If extensions (or modules to document with autodoc) are in another directory,
4262306a36Sopenharmony_ci# add these directories to sys.path here. If the directory is relative to the
4362306a36Sopenharmony_ci# documentation root, use os.path.abspath to make it absolute, like shown here.
4462306a36Sopenharmony_cisys.path.insert(0, os.path.abspath('sphinx'))
4562306a36Sopenharmony_cifrom load_config import loadConfig
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci# -- General configuration ------------------------------------------------
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci# If your documentation needs a minimal Sphinx version, state it here.
5062306a36Sopenharmony_cineeds_sphinx = '1.7'
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci# Add any Sphinx extension module names here, as strings. They can be
5362306a36Sopenharmony_ci# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
5462306a36Sopenharmony_ci# ones.
5562306a36Sopenharmony_ciextensions = ['kerneldoc', 'rstFlatTable', 'kernel_include',
5662306a36Sopenharmony_ci              'kfigure', 'sphinx.ext.ifconfig', 'automarkup',
5762306a36Sopenharmony_ci              'maintainers_include', 'sphinx.ext.autosectionlabel',
5862306a36Sopenharmony_ci              'kernel_abi', 'kernel_feat']
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ciif major >= 3:
6162306a36Sopenharmony_ci    if (major > 3) or (minor > 0 or patch >= 2):
6262306a36Sopenharmony_ci        # Sphinx c function parser is more pedantic with regards to type
6362306a36Sopenharmony_ci        # checking. Due to that, having macros at c:function cause problems.
6462306a36Sopenharmony_ci        # Those needed to be scaped by using c_id_attributes[] array
6562306a36Sopenharmony_ci        c_id_attributes = [
6662306a36Sopenharmony_ci            # GCC Compiler types not parsed by Sphinx:
6762306a36Sopenharmony_ci            "__restrict__",
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci            # include/linux/compiler_types.h:
7062306a36Sopenharmony_ci            "__iomem",
7162306a36Sopenharmony_ci            "__kernel",
7262306a36Sopenharmony_ci            "noinstr",
7362306a36Sopenharmony_ci            "notrace",
7462306a36Sopenharmony_ci            "__percpu",
7562306a36Sopenharmony_ci            "__rcu",
7662306a36Sopenharmony_ci            "__user",
7762306a36Sopenharmony_ci            "__force",
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci            # include/linux/compiler_attributes.h:
8062306a36Sopenharmony_ci            "__alias",
8162306a36Sopenharmony_ci            "__aligned",
8262306a36Sopenharmony_ci            "__aligned_largest",
8362306a36Sopenharmony_ci            "__always_inline",
8462306a36Sopenharmony_ci            "__assume_aligned",
8562306a36Sopenharmony_ci            "__cold",
8662306a36Sopenharmony_ci            "__attribute_const__",
8762306a36Sopenharmony_ci            "__copy",
8862306a36Sopenharmony_ci            "__pure",
8962306a36Sopenharmony_ci            "__designated_init",
9062306a36Sopenharmony_ci            "__visible",
9162306a36Sopenharmony_ci            "__printf",
9262306a36Sopenharmony_ci            "__scanf",
9362306a36Sopenharmony_ci            "__gnu_inline",
9462306a36Sopenharmony_ci            "__malloc",
9562306a36Sopenharmony_ci            "__mode",
9662306a36Sopenharmony_ci            "__no_caller_saved_registers",
9762306a36Sopenharmony_ci            "__noclone",
9862306a36Sopenharmony_ci            "__nonstring",
9962306a36Sopenharmony_ci            "__noreturn",
10062306a36Sopenharmony_ci            "__packed",
10162306a36Sopenharmony_ci            "__pure",
10262306a36Sopenharmony_ci            "__section",
10362306a36Sopenharmony_ci            "__always_unused",
10462306a36Sopenharmony_ci            "__maybe_unused",
10562306a36Sopenharmony_ci            "__used",
10662306a36Sopenharmony_ci            "__weak",
10762306a36Sopenharmony_ci            "noinline",
10862306a36Sopenharmony_ci            "__fix_address",
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_ci            # include/linux/memblock.h:
11162306a36Sopenharmony_ci            "__init_memblock",
11262306a36Sopenharmony_ci            "__meminit",
11362306a36Sopenharmony_ci
11462306a36Sopenharmony_ci            # include/linux/init.h:
11562306a36Sopenharmony_ci            "__init",
11662306a36Sopenharmony_ci            "__ref",
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ci            # include/linux/linkage.h:
11962306a36Sopenharmony_ci            "asmlinkage",
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ci            # include/linux/btf.h
12262306a36Sopenharmony_ci            "__bpf_kfunc",
12362306a36Sopenharmony_ci        ]
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_cielse:
12662306a36Sopenharmony_ci    extensions.append('cdomain')
12762306a36Sopenharmony_ci
12862306a36Sopenharmony_ci# Ensure that autosectionlabel will produce unique names
12962306a36Sopenharmony_ciautosectionlabel_prefix_document = True
13062306a36Sopenharmony_ciautosectionlabel_maxdepth = 2
13162306a36Sopenharmony_ci
13262306a36Sopenharmony_ci# Load math renderer:
13362306a36Sopenharmony_ci# For html builder, load imgmath only when its dependencies are met.
13462306a36Sopenharmony_ci# mathjax is the default math renderer since Sphinx 1.8.
13562306a36Sopenharmony_cihave_latex =  have_command('latex')
13662306a36Sopenharmony_cihave_dvipng = have_command('dvipng')
13762306a36Sopenharmony_ciload_imgmath = have_latex and have_dvipng
13862306a36Sopenharmony_ci
13962306a36Sopenharmony_ci# Respect SPHINX_IMGMATH (for html docs only)
14062306a36Sopenharmony_ciif 'SPHINX_IMGMATH' in os.environ:
14162306a36Sopenharmony_ci    env_sphinx_imgmath = os.environ['SPHINX_IMGMATH']
14262306a36Sopenharmony_ci    if 'yes' in env_sphinx_imgmath:
14362306a36Sopenharmony_ci        load_imgmath = True
14462306a36Sopenharmony_ci    elif 'no' in env_sphinx_imgmath:
14562306a36Sopenharmony_ci        load_imgmath = False
14662306a36Sopenharmony_ci    else:
14762306a36Sopenharmony_ci        sys.stderr.write("Unknown env SPHINX_IMGMATH=%s ignored.\n" % env_sphinx_imgmath)
14862306a36Sopenharmony_ci
14962306a36Sopenharmony_ci# Always load imgmath for Sphinx <1.8 or for epub docs
15062306a36Sopenharmony_ciload_imgmath = (load_imgmath or (major == 1 and minor < 8)
15162306a36Sopenharmony_ci                or 'epub' in sys.argv)
15262306a36Sopenharmony_ci
15362306a36Sopenharmony_ciif load_imgmath:
15462306a36Sopenharmony_ci    extensions.append("sphinx.ext.imgmath")
15562306a36Sopenharmony_ci    math_renderer = 'imgmath'
15662306a36Sopenharmony_cielse:
15762306a36Sopenharmony_ci    math_renderer = 'mathjax'
15862306a36Sopenharmony_ci
15962306a36Sopenharmony_ci# Add any paths that contain templates here, relative to this directory.
16062306a36Sopenharmony_citemplates_path = ['sphinx/templates']
16162306a36Sopenharmony_ci
16262306a36Sopenharmony_ci# The suffix(es) of source filenames.
16362306a36Sopenharmony_ci# You can specify multiple suffix as a list of string:
16462306a36Sopenharmony_ci# source_suffix = ['.rst', '.md']
16562306a36Sopenharmony_cisource_suffix = '.rst'
16662306a36Sopenharmony_ci
16762306a36Sopenharmony_ci# The encoding of source files.
16862306a36Sopenharmony_ci#source_encoding = 'utf-8-sig'
16962306a36Sopenharmony_ci
17062306a36Sopenharmony_ci# The master toctree document.
17162306a36Sopenharmony_cimaster_doc = 'index'
17262306a36Sopenharmony_ci
17362306a36Sopenharmony_ci# General information about the project.
17462306a36Sopenharmony_ciproject = 'The Linux Kernel'
17562306a36Sopenharmony_cicopyright = 'The kernel development community'
17662306a36Sopenharmony_ciauthor = 'The kernel development community'
17762306a36Sopenharmony_ci
17862306a36Sopenharmony_ci# The version info for the project you're documenting, acts as replacement for
17962306a36Sopenharmony_ci# |version| and |release|, also used in various other places throughout the
18062306a36Sopenharmony_ci# built documents.
18162306a36Sopenharmony_ci#
18262306a36Sopenharmony_ci# In a normal build, version and release are are set to KERNELVERSION and
18362306a36Sopenharmony_ci# KERNELRELEASE, respectively, from the Makefile via Sphinx command line
18462306a36Sopenharmony_ci# arguments.
18562306a36Sopenharmony_ci#
18662306a36Sopenharmony_ci# The following code tries to extract the information by reading the Makefile,
18762306a36Sopenharmony_ci# when Sphinx is run directly (e.g. by Read the Docs).
18862306a36Sopenharmony_citry:
18962306a36Sopenharmony_ci    makefile_version = None
19062306a36Sopenharmony_ci    makefile_patchlevel = None
19162306a36Sopenharmony_ci    for line in open('../Makefile'):
19262306a36Sopenharmony_ci        key, val = [x.strip() for x in line.split('=', 2)]
19362306a36Sopenharmony_ci        if key == 'VERSION':
19462306a36Sopenharmony_ci            makefile_version = val
19562306a36Sopenharmony_ci        elif key == 'PATCHLEVEL':
19662306a36Sopenharmony_ci            makefile_patchlevel = val
19762306a36Sopenharmony_ci        if makefile_version and makefile_patchlevel:
19862306a36Sopenharmony_ci            break
19962306a36Sopenharmony_ciexcept:
20062306a36Sopenharmony_ci    pass
20162306a36Sopenharmony_cifinally:
20262306a36Sopenharmony_ci    if makefile_version and makefile_patchlevel:
20362306a36Sopenharmony_ci        version = release = makefile_version + '.' + makefile_patchlevel
20462306a36Sopenharmony_ci    else:
20562306a36Sopenharmony_ci        version = release = "unknown version"
20662306a36Sopenharmony_ci
20762306a36Sopenharmony_ci#
20862306a36Sopenharmony_ci# HACK: there seems to be no easy way for us to get at the version and
20962306a36Sopenharmony_ci# release information passed in from the makefile...so go pawing through the
21062306a36Sopenharmony_ci# command-line options and find it for ourselves.
21162306a36Sopenharmony_ci#
21262306a36Sopenharmony_cidef get_cline_version():
21362306a36Sopenharmony_ci    c_version = c_release = ''
21462306a36Sopenharmony_ci    for arg in sys.argv:
21562306a36Sopenharmony_ci        if arg.startswith('version='):
21662306a36Sopenharmony_ci            c_version = arg[8:]
21762306a36Sopenharmony_ci        elif arg.startswith('release='):
21862306a36Sopenharmony_ci            c_release = arg[8:]
21962306a36Sopenharmony_ci    if c_version:
22062306a36Sopenharmony_ci        if c_release:
22162306a36Sopenharmony_ci            return c_version + '-' + c_release
22262306a36Sopenharmony_ci        return c_version
22362306a36Sopenharmony_ci    return version # Whatever we came up with before
22462306a36Sopenharmony_ci
22562306a36Sopenharmony_ci# The language for content autogenerated by Sphinx. Refer to documentation
22662306a36Sopenharmony_ci# for a list of supported languages.
22762306a36Sopenharmony_ci#
22862306a36Sopenharmony_ci# This is also used if you do content translation via gettext catalogs.
22962306a36Sopenharmony_ci# Usually you set "language" from the command line for these cases.
23062306a36Sopenharmony_cilanguage = 'en'
23162306a36Sopenharmony_ci
23262306a36Sopenharmony_ci# There are two options for replacing |today|: either, you set today to some
23362306a36Sopenharmony_ci# non-false value, then it is used:
23462306a36Sopenharmony_ci#today = ''
23562306a36Sopenharmony_ci# Else, today_fmt is used as the format for a strftime call.
23662306a36Sopenharmony_ci#today_fmt = '%B %d, %Y'
23762306a36Sopenharmony_ci
23862306a36Sopenharmony_ci# List of patterns, relative to source directory, that match files and
23962306a36Sopenharmony_ci# directories to ignore when looking for source files.
24062306a36Sopenharmony_ciexclude_patterns = ['output']
24162306a36Sopenharmony_ci
24262306a36Sopenharmony_ci# The reST default role (used for this markup: `text`) to use for all
24362306a36Sopenharmony_ci# documents.
24462306a36Sopenharmony_ci#default_role = None
24562306a36Sopenharmony_ci
24662306a36Sopenharmony_ci# If true, '()' will be appended to :func: etc. cross-reference text.
24762306a36Sopenharmony_ci#add_function_parentheses = True
24862306a36Sopenharmony_ci
24962306a36Sopenharmony_ci# If true, the current module name will be prepended to all description
25062306a36Sopenharmony_ci# unit titles (such as .. function::).
25162306a36Sopenharmony_ci#add_module_names = True
25262306a36Sopenharmony_ci
25362306a36Sopenharmony_ci# If true, sectionauthor and moduleauthor directives will be shown in the
25462306a36Sopenharmony_ci# output. They are ignored by default.
25562306a36Sopenharmony_ci#show_authors = False
25662306a36Sopenharmony_ci
25762306a36Sopenharmony_ci# The name of the Pygments (syntax highlighting) style to use.
25862306a36Sopenharmony_cipygments_style = 'sphinx'
25962306a36Sopenharmony_ci
26062306a36Sopenharmony_ci# A list of ignored prefixes for module index sorting.
26162306a36Sopenharmony_ci#modindex_common_prefix = []
26262306a36Sopenharmony_ci
26362306a36Sopenharmony_ci# If true, keep warnings as "system message" paragraphs in the built documents.
26462306a36Sopenharmony_ci#keep_warnings = False
26562306a36Sopenharmony_ci
26662306a36Sopenharmony_ci# If true, `todo` and `todoList` produce output, else they produce nothing.
26762306a36Sopenharmony_citodo_include_todos = False
26862306a36Sopenharmony_ci
26962306a36Sopenharmony_ciprimary_domain = 'c'
27062306a36Sopenharmony_cihighlight_language = 'none'
27162306a36Sopenharmony_ci
27262306a36Sopenharmony_ci# -- Options for HTML output ----------------------------------------------
27362306a36Sopenharmony_ci
27462306a36Sopenharmony_ci# The theme to use for HTML and HTML Help pages.  See the documentation for
27562306a36Sopenharmony_ci# a list of builtin themes.
27662306a36Sopenharmony_ci
27762306a36Sopenharmony_ci# Default theme
27862306a36Sopenharmony_cihtml_theme = 'alabaster'
27962306a36Sopenharmony_cihtml_css_files = []
28062306a36Sopenharmony_ci
28162306a36Sopenharmony_ciif "DOCS_THEME" in os.environ:
28262306a36Sopenharmony_ci    html_theme = os.environ["DOCS_THEME"]
28362306a36Sopenharmony_ci
28462306a36Sopenharmony_ciif html_theme == 'sphinx_rtd_theme' or html_theme == 'sphinx_rtd_dark_mode':
28562306a36Sopenharmony_ci    # Read the Docs theme
28662306a36Sopenharmony_ci    try:
28762306a36Sopenharmony_ci        import sphinx_rtd_theme
28862306a36Sopenharmony_ci        html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
28962306a36Sopenharmony_ci
29062306a36Sopenharmony_ci        # Add any paths that contain custom static files (such as style sheets) here,
29162306a36Sopenharmony_ci        # relative to this directory. They are copied after the builtin static files,
29262306a36Sopenharmony_ci        # so a file named "default.css" will overwrite the builtin "default.css".
29362306a36Sopenharmony_ci        html_css_files = [
29462306a36Sopenharmony_ci            'theme_overrides.css',
29562306a36Sopenharmony_ci        ]
29662306a36Sopenharmony_ci
29762306a36Sopenharmony_ci        # Read the Docs dark mode override theme
29862306a36Sopenharmony_ci        if html_theme == 'sphinx_rtd_dark_mode':
29962306a36Sopenharmony_ci            try:
30062306a36Sopenharmony_ci                import sphinx_rtd_dark_mode
30162306a36Sopenharmony_ci                extensions.append('sphinx_rtd_dark_mode')
30262306a36Sopenharmony_ci            except ImportError:
30362306a36Sopenharmony_ci                html_theme == 'sphinx_rtd_theme'
30462306a36Sopenharmony_ci
30562306a36Sopenharmony_ci        if html_theme == 'sphinx_rtd_theme':
30662306a36Sopenharmony_ci                # Add color-specific RTD normal mode
30762306a36Sopenharmony_ci                html_css_files.append('theme_rtd_colors.css')
30862306a36Sopenharmony_ci
30962306a36Sopenharmony_ci        html_theme_options = {
31062306a36Sopenharmony_ci            'navigation_depth': -1,
31162306a36Sopenharmony_ci        }
31262306a36Sopenharmony_ci
31362306a36Sopenharmony_ci    except ImportError:
31462306a36Sopenharmony_ci        html_theme = 'alabaster'
31562306a36Sopenharmony_ci
31662306a36Sopenharmony_ciif "DOCS_CSS" in os.environ:
31762306a36Sopenharmony_ci    css = os.environ["DOCS_CSS"].split(" ")
31862306a36Sopenharmony_ci
31962306a36Sopenharmony_ci    for l in css:
32062306a36Sopenharmony_ci        html_css_files.append(l)
32162306a36Sopenharmony_ci
32262306a36Sopenharmony_ciif major <= 1 and minor < 8:
32362306a36Sopenharmony_ci    html_context = {
32462306a36Sopenharmony_ci        'css_files': [],
32562306a36Sopenharmony_ci    }
32662306a36Sopenharmony_ci
32762306a36Sopenharmony_ci    for l in html_css_files:
32862306a36Sopenharmony_ci        html_context['css_files'].append('_static/' + l)
32962306a36Sopenharmony_ci
33062306a36Sopenharmony_ciif  html_theme == 'alabaster':
33162306a36Sopenharmony_ci    html_theme_options = {
33262306a36Sopenharmony_ci        'description': get_cline_version(),
33362306a36Sopenharmony_ci        'page_width': '65em',
33462306a36Sopenharmony_ci        'sidebar_width': '15em',
33562306a36Sopenharmony_ci        'fixed_sidebar': 'true',
33662306a36Sopenharmony_ci        'font_size': 'inherit',
33762306a36Sopenharmony_ci        'font_family': 'serif',
33862306a36Sopenharmony_ci    }
33962306a36Sopenharmony_ci
34062306a36Sopenharmony_cisys.stderr.write("Using %s theme\n" % html_theme)
34162306a36Sopenharmony_ci
34262306a36Sopenharmony_ci# Add any paths that contain custom static files (such as style sheets) here,
34362306a36Sopenharmony_ci# relative to this directory. They are copied after the builtin static files,
34462306a36Sopenharmony_ci# so a file named "default.css" will overwrite the builtin "default.css".
34562306a36Sopenharmony_cihtml_static_path = ['sphinx-static']
34662306a36Sopenharmony_ci
34762306a36Sopenharmony_ci# If true, Docutils "smart quotes" will be used to convert quotes and dashes
34862306a36Sopenharmony_ci# to typographically correct entities.  However, conversion of "--" to "—"
34962306a36Sopenharmony_ci# is not always what we want, so enable only quotes.
35062306a36Sopenharmony_cismartquotes_action = 'q'
35162306a36Sopenharmony_ci
35262306a36Sopenharmony_ci# Custom sidebar templates, maps document names to template names.
35362306a36Sopenharmony_ci# Note that the RTD theme ignores this
35462306a36Sopenharmony_cihtml_sidebars = { '**': ['searchbox.html', 'kernel-toc.html', 'sourcelink.html']}
35562306a36Sopenharmony_ci
35662306a36Sopenharmony_ci# about.html is available for alabaster theme. Add it at the front.
35762306a36Sopenharmony_ciif html_theme == 'alabaster':
35862306a36Sopenharmony_ci    html_sidebars['**'].insert(0, 'about.html')
35962306a36Sopenharmony_ci
36062306a36Sopenharmony_ci# Output file base name for HTML help builder.
36162306a36Sopenharmony_cihtmlhelp_basename = 'TheLinuxKerneldoc'
36262306a36Sopenharmony_ci
36362306a36Sopenharmony_ci# -- Options for LaTeX output ---------------------------------------------
36462306a36Sopenharmony_ci
36562306a36Sopenharmony_cilatex_elements = {
36662306a36Sopenharmony_ci    # The paper size ('letterpaper' or 'a4paper').
36762306a36Sopenharmony_ci    'papersize': 'a4paper',
36862306a36Sopenharmony_ci
36962306a36Sopenharmony_ci    # The font size ('10pt', '11pt' or '12pt').
37062306a36Sopenharmony_ci    'pointsize': '11pt',
37162306a36Sopenharmony_ci
37262306a36Sopenharmony_ci    # Latex figure (float) alignment
37362306a36Sopenharmony_ci    #'figure_align': 'htbp',
37462306a36Sopenharmony_ci
37562306a36Sopenharmony_ci    # Don't mangle with UTF-8 chars
37662306a36Sopenharmony_ci    'inputenc': '',
37762306a36Sopenharmony_ci    'utf8extra': '',
37862306a36Sopenharmony_ci
37962306a36Sopenharmony_ci    # Set document margins
38062306a36Sopenharmony_ci    'sphinxsetup': '''
38162306a36Sopenharmony_ci        hmargin=0.5in, vmargin=1in,
38262306a36Sopenharmony_ci        parsedliteralwraps=true,
38362306a36Sopenharmony_ci        verbatimhintsturnover=false,
38462306a36Sopenharmony_ci    ''',
38562306a36Sopenharmony_ci
38662306a36Sopenharmony_ci    #
38762306a36Sopenharmony_ci    # Some of our authors are fond of deep nesting; tell latex to
38862306a36Sopenharmony_ci    # cope.
38962306a36Sopenharmony_ci    #
39062306a36Sopenharmony_ci    'maxlistdepth': '10',
39162306a36Sopenharmony_ci
39262306a36Sopenharmony_ci    # For CJK One-half spacing, need to be in front of hyperref
39362306a36Sopenharmony_ci    'extrapackages': r'\usepackage{setspace}',
39462306a36Sopenharmony_ci
39562306a36Sopenharmony_ci    # Additional stuff for the LaTeX preamble.
39662306a36Sopenharmony_ci    'preamble': '''
39762306a36Sopenharmony_ci        % Use some font with UTF-8 support with XeLaTeX
39862306a36Sopenharmony_ci        \\usepackage{fontspec}
39962306a36Sopenharmony_ci        \\setsansfont{DejaVu Sans}
40062306a36Sopenharmony_ci        \\setromanfont{DejaVu Serif}
40162306a36Sopenharmony_ci        \\setmonofont{DejaVu Sans Mono}
40262306a36Sopenharmony_ci    ''',
40362306a36Sopenharmony_ci}
40462306a36Sopenharmony_ci
40562306a36Sopenharmony_ci# Fix reference escape troubles with Sphinx 1.4.x
40662306a36Sopenharmony_ciif major == 1:
40762306a36Sopenharmony_ci    latex_elements['preamble']  += '\\renewcommand*{\\DUrole}[2]{ #2 }\n'
40862306a36Sopenharmony_ci
40962306a36Sopenharmony_ci
41062306a36Sopenharmony_ci# Load kerneldoc specific LaTeX settings
41162306a36Sopenharmony_cilatex_elements['preamble'] += '''
41262306a36Sopenharmony_ci        % Load kerneldoc specific LaTeX settings
41362306a36Sopenharmony_ci	\\input{kerneldoc-preamble.sty}
41462306a36Sopenharmony_ci'''
41562306a36Sopenharmony_ci
41662306a36Sopenharmony_ci# With Sphinx 1.6, it is possible to change the Bg color directly
41762306a36Sopenharmony_ci# by using:
41862306a36Sopenharmony_ci#	\definecolor{sphinxnoteBgColor}{RGB}{204,255,255}
41962306a36Sopenharmony_ci#	\definecolor{sphinxwarningBgColor}{RGB}{255,204,204}
42062306a36Sopenharmony_ci#	\definecolor{sphinxattentionBgColor}{RGB}{255,255,204}
42162306a36Sopenharmony_ci#	\definecolor{sphinximportantBgColor}{RGB}{192,255,204}
42262306a36Sopenharmony_ci#
42362306a36Sopenharmony_ci# However, it require to use sphinx heavy box with:
42462306a36Sopenharmony_ci#
42562306a36Sopenharmony_ci#	\renewenvironment{sphinxlightbox} {%
42662306a36Sopenharmony_ci#		\\begin{sphinxheavybox}
42762306a36Sopenharmony_ci#	}
42862306a36Sopenharmony_ci#		\\end{sphinxheavybox}
42962306a36Sopenharmony_ci#	}
43062306a36Sopenharmony_ci#
43162306a36Sopenharmony_ci# Unfortunately, the implementation is buggy: if a note is inside a
43262306a36Sopenharmony_ci# table, it isn't displayed well. So, for now, let's use boring
43362306a36Sopenharmony_ci# black and white notes.
43462306a36Sopenharmony_ci
43562306a36Sopenharmony_ci# Grouping the document tree into LaTeX files. List of tuples
43662306a36Sopenharmony_ci# (source start file, target name, title,
43762306a36Sopenharmony_ci#  author, documentclass [howto, manual, or own class]).
43862306a36Sopenharmony_ci# Sorted in alphabetical order
43962306a36Sopenharmony_cilatex_documents = [
44062306a36Sopenharmony_ci]
44162306a36Sopenharmony_ci
44262306a36Sopenharmony_ci# Add all other index files from Documentation/ subdirectories
44362306a36Sopenharmony_cifor fn in os.listdir('.'):
44462306a36Sopenharmony_ci    doc = os.path.join(fn, "index")
44562306a36Sopenharmony_ci    if os.path.exists(doc + ".rst"):
44662306a36Sopenharmony_ci        has = False
44762306a36Sopenharmony_ci        for l in latex_documents:
44862306a36Sopenharmony_ci            if l[0] == doc:
44962306a36Sopenharmony_ci                has = True
45062306a36Sopenharmony_ci                break
45162306a36Sopenharmony_ci        if not has:
45262306a36Sopenharmony_ci            latex_documents.append((doc, fn + '.tex',
45362306a36Sopenharmony_ci                                    'Linux %s Documentation' % fn.capitalize(),
45462306a36Sopenharmony_ci                                    'The kernel development community',
45562306a36Sopenharmony_ci                                    'manual'))
45662306a36Sopenharmony_ci
45762306a36Sopenharmony_ci# The name of an image file (relative to this directory) to place at the top of
45862306a36Sopenharmony_ci# the title page.
45962306a36Sopenharmony_ci#latex_logo = None
46062306a36Sopenharmony_ci
46162306a36Sopenharmony_ci# For "manual" documents, if this is true, then toplevel headings are parts,
46262306a36Sopenharmony_ci# not chapters.
46362306a36Sopenharmony_ci#latex_use_parts = False
46462306a36Sopenharmony_ci
46562306a36Sopenharmony_ci# If true, show page references after internal links.
46662306a36Sopenharmony_ci#latex_show_pagerefs = False
46762306a36Sopenharmony_ci
46862306a36Sopenharmony_ci# If true, show URL addresses after external links.
46962306a36Sopenharmony_ci#latex_show_urls = False
47062306a36Sopenharmony_ci
47162306a36Sopenharmony_ci# Documents to append as an appendix to all manuals.
47262306a36Sopenharmony_ci#latex_appendices = []
47362306a36Sopenharmony_ci
47462306a36Sopenharmony_ci# If false, no module index is generated.
47562306a36Sopenharmony_ci#latex_domain_indices = True
47662306a36Sopenharmony_ci
47762306a36Sopenharmony_ci# Additional LaTeX stuff to be copied to build directory
47862306a36Sopenharmony_cilatex_additional_files = [
47962306a36Sopenharmony_ci    'sphinx/kerneldoc-preamble.sty',
48062306a36Sopenharmony_ci]
48162306a36Sopenharmony_ci
48262306a36Sopenharmony_ci
48362306a36Sopenharmony_ci# -- Options for manual page output ---------------------------------------
48462306a36Sopenharmony_ci
48562306a36Sopenharmony_ci# One entry per manual page. List of tuples
48662306a36Sopenharmony_ci# (source start file, name, description, authors, manual section).
48762306a36Sopenharmony_ciman_pages = [
48862306a36Sopenharmony_ci    (master_doc, 'thelinuxkernel', 'The Linux Kernel Documentation',
48962306a36Sopenharmony_ci     [author], 1)
49062306a36Sopenharmony_ci]
49162306a36Sopenharmony_ci
49262306a36Sopenharmony_ci# If true, show URL addresses after external links.
49362306a36Sopenharmony_ci#man_show_urls = False
49462306a36Sopenharmony_ci
49562306a36Sopenharmony_ci
49662306a36Sopenharmony_ci# -- Options for Texinfo output -------------------------------------------
49762306a36Sopenharmony_ci
49862306a36Sopenharmony_ci# Grouping the document tree into Texinfo files. List of tuples
49962306a36Sopenharmony_ci# (source start file, target name, title, author,
50062306a36Sopenharmony_ci#  dir menu entry, description, category)
50162306a36Sopenharmony_citexinfo_documents = [
50262306a36Sopenharmony_ci    (master_doc, 'TheLinuxKernel', 'The Linux Kernel Documentation',
50362306a36Sopenharmony_ci     author, 'TheLinuxKernel', 'One line description of project.',
50462306a36Sopenharmony_ci     'Miscellaneous'),
50562306a36Sopenharmony_ci]
50662306a36Sopenharmony_ci
50762306a36Sopenharmony_ci# -- Options for Epub output ----------------------------------------------
50862306a36Sopenharmony_ci
50962306a36Sopenharmony_ci# Bibliographic Dublin Core info.
51062306a36Sopenharmony_ciepub_title = project
51162306a36Sopenharmony_ciepub_author = author
51262306a36Sopenharmony_ciepub_publisher = author
51362306a36Sopenharmony_ciepub_copyright = copyright
51462306a36Sopenharmony_ci
51562306a36Sopenharmony_ci# A list of files that should not be packed into the epub file.
51662306a36Sopenharmony_ciepub_exclude_files = ['search.html']
51762306a36Sopenharmony_ci
51862306a36Sopenharmony_ci#=======
51962306a36Sopenharmony_ci# rst2pdf
52062306a36Sopenharmony_ci#
52162306a36Sopenharmony_ci# Grouping the document tree into PDF files. List of tuples
52262306a36Sopenharmony_ci# (source start file, target name, title, author, options).
52362306a36Sopenharmony_ci#
52462306a36Sopenharmony_ci# See the Sphinx chapter of https://ralsina.me/static/manual.pdf
52562306a36Sopenharmony_ci#
52662306a36Sopenharmony_ci# FIXME: Do not add the index file here; the result will be too big. Adding
52762306a36Sopenharmony_ci# multiple PDF files here actually tries to get the cross-referencing right
52862306a36Sopenharmony_ci# *between* PDF files.
52962306a36Sopenharmony_cipdf_documents = [
53062306a36Sopenharmony_ci    ('kernel-documentation', u'Kernel', u'Kernel', u'J. Random Bozo'),
53162306a36Sopenharmony_ci]
53262306a36Sopenharmony_ci
53362306a36Sopenharmony_ci# kernel-doc extension configuration for running Sphinx directly (e.g. by Read
53462306a36Sopenharmony_ci# the Docs). In a normal build, these are supplied from the Makefile via command
53562306a36Sopenharmony_ci# line arguments.
53662306a36Sopenharmony_cikerneldoc_bin = '../scripts/kernel-doc'
53762306a36Sopenharmony_cikerneldoc_srctree = '..'
53862306a36Sopenharmony_ci
53962306a36Sopenharmony_ci# ------------------------------------------------------------------------------
54062306a36Sopenharmony_ci# Since loadConfig overwrites settings from the global namespace, it has to be
54162306a36Sopenharmony_ci# the last statement in the conf.py file
54262306a36Sopenharmony_ci# ------------------------------------------------------------------------------
54362306a36Sopenharmony_ciloadConfig(globals())
544