1 # -*- coding: utf-8 -*-
3 # The Linux Kernel documentation build configuration file, created by
4 # sphinx-quickstart on Fri Feb 12 13:51:46 2016.
6 # This file is execfile()d with the current directory set to its
9 # Note that not all possible configuration values are present in this
12 # All configuration values have a default; values that are commented out
13 # serve to show the default.
23 def have_command(cmd):
24 """Search ``cmd`` in the ``PATH`` environment.
26 If found, return True.
27 If not found, return False.
29 return shutil.which(cmd) is not None
32 major, minor, patch = sphinx.version_info[:3]
35 # If extensions (or modules to document with autodoc) are in another directory,
36 # add these directories to sys.path here. If the directory is relative to the
37 # documentation root, use os.path.abspath to make it absolute, like shown here.
38 sys.path.insert(0, os.path.abspath('sphinx'))
39 from load_config import loadConfig
41 # -- General configuration ------------------------------------------------
43 # If your documentation needs a minimal Sphinx version, state it here.
46 # Add any Sphinx extension module names here, as strings. They can be
47 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
49 extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include',
50 'kfigure', 'sphinx.ext.ifconfig', 'automarkup',
51 'maintainers_include', 'sphinx.ext.autosectionlabel',
52 'kernel_abi', 'kernel_feat']
55 if (major > 3) or (minor > 0 or patch >= 2):
56 # Sphinx c function parser is more pedantic with regards to type
57 # checking. Due to that, having macros at c:function cause problems.
58 # Those needed to be scaped by using c_id_attributes[] array
60 # GCC Compiler types not parsed by Sphinx:
63 # include/linux/compiler_types.h:
72 # include/linux/compiler_attributes.h:
79 "__attribute_const__",
89 "__no_caller_saved_registers",
102 # include/linux/memblock.h:
106 # include/linux/init.h:
110 # include/linux/linkage.h:
115 extensions.append('cdomain')
117 # Ensure that autosectionlabel will produce unique names
118 autosectionlabel_prefix_document = True
119 autosectionlabel_maxdepth = 2
121 # Load math renderer:
122 # For html builder, load imgmath only when its dependencies are met.
123 # mathjax is the default math renderer since Sphinx 1.8.
124 have_latex = have_command('latex')
125 have_dvipng = have_command('dvipng')
126 load_imgmath = have_latex and have_dvipng
128 # Respect SPHINX_IMGMATH (for html docs only)
129 if 'SPHINX_IMGMATH' in os.environ:
130 env_sphinx_imgmath = os.environ['SPHINX_IMGMATH']
131 if 'yes' in env_sphinx_imgmath:
133 elif 'no' in env_sphinx_imgmath:
136 sys.stderr.write("Unknown env SPHINX_IMGMATH=%s ignored.\n" % env_sphinx_imgmath)
138 # Always load imgmath for Sphinx <1.8 or for epub docs
139 load_imgmath = (load_imgmath or (major == 1 and minor < 8)
140 or 'epub' in sys.argv)
143 extensions.append("sphinx.ext.imgmath")
144 math_renderer = 'imgmath'
146 math_renderer = 'mathjax'
148 # Add any paths that contain templates here, relative to this directory.
149 templates_path = ['_templates']
151 # The suffix(es) of source filenames.
152 # You can specify multiple suffix as a list of string:
153 # source_suffix = ['.rst', '.md']
154 source_suffix = '.rst'
156 # The encoding of source files.
157 #source_encoding = 'utf-8-sig'
159 # The master toctree document.
162 # General information about the project.
163 project = 'The Linux Kernel'
164 copyright = 'The kernel development community'
165 author = 'The kernel development community'
167 # The version info for the project you're documenting, acts as replacement for
168 # |version| and |release|, also used in various other places throughout the
171 # In a normal build, version and release are are set to KERNELVERSION and
172 # KERNELRELEASE, respectively, from the Makefile via Sphinx command line
175 # The following code tries to extract the information by reading the Makefile,
176 # when Sphinx is run directly (e.g. by Read the Docs).
178 makefile_version = None
179 makefile_patchlevel = None
180 for line in open('../Makefile'):
181 key, val = [x.strip() for x in line.split('=', 2)]
183 makefile_version = val
184 elif key == 'PATCHLEVEL':
185 makefile_patchlevel = val
186 if makefile_version and makefile_patchlevel:
191 if makefile_version and makefile_patchlevel:
192 version = release = makefile_version + '.' + makefile_patchlevel
194 version = release = "unknown version"
196 # The language for content autogenerated by Sphinx. Refer to documentation
197 # for a list of supported languages.
199 # This is also used if you do content translation via gettext catalogs.
200 # Usually you set "language" from the command line for these cases.
203 # There are two options for replacing |today|: either, you set today to some
204 # non-false value, then it is used:
206 # Else, today_fmt is used as the format for a strftime call.
207 #today_fmt = '%B %d, %Y'
209 # List of patterns, relative to source directory, that match files and
210 # directories to ignore when looking for source files.
211 exclude_patterns = ['output']
213 # The reST default role (used for this markup: `text`) to use for all
217 # If true, '()' will be appended to :func: etc. cross-reference text.
218 #add_function_parentheses = True
220 # If true, the current module name will be prepended to all description
221 # unit titles (such as .. function::).
222 #add_module_names = True
224 # If true, sectionauthor and moduleauthor directives will be shown in the
225 # output. They are ignored by default.
226 #show_authors = False
228 # The name of the Pygments (syntax highlighting) style to use.
229 pygments_style = 'sphinx'
231 # A list of ignored prefixes for module index sorting.
232 #modindex_common_prefix = []
234 # If true, keep warnings as "system message" paragraphs in the built documents.
235 #keep_warnings = False
237 # If true, `todo` and `todoList` produce output, else they produce nothing.
238 todo_include_todos = False
241 highlight_language = 'none'
243 # -- Options for HTML output ----------------------------------------------
245 # The theme to use for HTML and HTML Help pages. See the documentation for
246 # a list of builtin themes.
249 html_theme = 'sphinx_rtd_theme'
252 if "DOCS_THEME" in os.environ:
253 html_theme = os.environ["DOCS_THEME"]
255 if html_theme == 'sphinx_rtd_theme' or html_theme == 'sphinx_rtd_dark_mode':
256 # Read the Docs theme
258 import sphinx_rtd_theme
259 html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
261 # Add any paths that contain custom static files (such as style sheets) here,
262 # relative to this directory. They are copied after the builtin static files,
263 # so a file named "default.css" will overwrite the builtin "default.css".
265 'theme_overrides.css',
268 # Read the Docs dark mode override theme
269 if html_theme == 'sphinx_rtd_dark_mode':
271 import sphinx_rtd_dark_mode
272 extensions.append('sphinx_rtd_dark_mode')
274 html_theme == 'sphinx_rtd_theme'
276 if html_theme == 'sphinx_rtd_theme':
277 # Add color-specific RTD normal mode
278 html_css_files.append('theme_rtd_colors.css')
281 html_theme = 'classic'
283 if "DOCS_CSS" in os.environ:
284 css = os.environ["DOCS_CSS"].split(" ")
287 html_css_files.append(l)
289 if major <= 1 and minor < 8:
294 for l in html_css_files:
295 html_context['css_files'].append('_static/' + l)
297 if html_theme == 'classic':
298 html_theme_options = {
299 'rightsidebar': False,
300 'stickysidebar': True,
301 'collapsiblesidebar': True,
302 'externalrefs': False,
304 'footerbgcolor': "white",
305 'footertextcolor': "white",
306 'sidebarbgcolor': "white",
307 'sidebarbtncolor': "black",
308 'sidebartextcolor': "black",
309 'sidebarlinkcolor': "#686bff",
310 'relbarbgcolor': "#133f52",
311 'relbartextcolor': "white",
312 'relbarlinkcolor': "white",
314 'textcolor': "black",
315 'headbgcolor': "#f2f2f2",
316 'headtextcolor': "#20435c",
317 'headlinkcolor': "#c60f0f",
318 'linkcolor': "#355f7c",
319 'visitedlinkcolor': "#355f7c",
320 'codebgcolor': "#3f3f3f",
321 'codetextcolor': "white",
324 'headfont': "sans-serif",
327 sys.stderr.write("Using %s theme\n" % html_theme)
329 # Theme options are theme-specific and customize the look and feel of a theme
330 # further. For a list of options available for each theme, see the
332 #html_theme_options = {}
334 # Add any paths that contain custom themes here, relative to this directory.
335 #html_theme_path = []
337 # The name for this set of Sphinx documents. If None, it defaults to
338 # "<project> v<release> documentation".
341 # A shorter title for the navigation bar. Default is the same as html_title.
342 #html_short_title = None
344 # The name of an image file (relative to this directory) to place at the top
348 # The name of an image file (within the static path) to use as favicon of the
349 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
353 # Add any paths that contain custom static files (such as style sheets) here,
354 # relative to this directory. They are copied after the builtin static files,
355 # so a file named "default.css" will overwrite the builtin "default.css".
356 html_static_path = ['sphinx-static']
358 # Add any extra paths that contain custom files (such as robots.txt or
359 # .htaccess) here, relative to this directory. These files are copied
360 # directly to the root of the documentation.
361 #html_extra_path = []
363 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
364 # using the given strftime format.
365 #html_last_updated_fmt = '%b %d, %Y'
367 # If true, SmartyPants will be used to convert quotes and dashes to
368 # typographically correct entities.
369 html_use_smartypants = False
371 # Custom sidebar templates, maps document names to template names.
372 # Note that the RTD theme ignores this.
373 html_sidebars = { '**': ['searchbox.html', 'localtoc.html', 'sourcelink.html']}
375 # Additional templates that should be rendered to pages, maps page names to
377 #html_additional_pages = {}
379 # If false, no module index is generated.
380 #html_domain_indices = True
382 # If false, no index is generated.
383 #html_use_index = True
385 # If true, the index is split into individual pages for each letter.
386 #html_split_index = False
388 # If true, links to the reST sources are added to the pages.
389 #html_show_sourcelink = True
391 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
392 #html_show_sphinx = True
394 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
395 #html_show_copyright = True
397 # If true, an OpenSearch description file will be output, and all pages will
398 # contain a <link> tag referring to it. The value of this option must be the
399 # base URL from which the finished HTML is served.
400 #html_use_opensearch = ''
402 # This is the file name suffix for HTML files (e.g. ".xhtml").
403 #html_file_suffix = None
405 # Language to be used for generating the HTML full-text search index.
406 # Sphinx supports the following languages:
407 # 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
408 # 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'
409 #html_search_language = 'en'
411 # A dictionary with options for the search language support, empty by default.
412 # Now only 'ja' uses this config value
413 #html_search_options = {'type': 'default'}
415 # The name of a javascript file (relative to the configuration directory) that
416 # implements a search results scorer. If empty, the default will be used.
417 #html_search_scorer = 'scorer.js'
419 # Output file base name for HTML help builder.
420 htmlhelp_basename = 'TheLinuxKerneldoc'
422 # -- Options for LaTeX output ---------------------------------------------
425 # The paper size ('letterpaper' or 'a4paper').
426 'papersize': 'a4paper',
428 # The font size ('10pt', '11pt' or '12pt').
431 # Latex figure (float) alignment
432 #'figure_align': 'htbp',
434 # Don't mangle with UTF-8 chars
438 # Set document margins
440 hmargin=0.5in, vmargin=1in,
441 parsedliteralwraps=true,
442 verbatimhintsturnover=false,
445 # For CJK One-half spacing, need to be in front of hyperref
446 'extrapackages': r'\usepackage{setspace}',
448 # Additional stuff for the LaTeX preamble.
450 % Use some font with UTF-8 support with XeLaTeX
451 \\usepackage{fontspec}
452 \\setsansfont{DejaVu Sans}
453 \\setromanfont{DejaVu Serif}
454 \\setmonofont{DejaVu Sans Mono}
458 # Fix reference escape troubles with Sphinx 1.4.x
460 latex_elements['preamble'] += '\\renewcommand*{\\DUrole}[2]{ #2 }\n'
463 # Load kerneldoc specific LaTeX settings
464 latex_elements['preamble'] += '''
465 % Load kerneldoc specific LaTeX settings
466 \\input{kerneldoc-preamble.sty}
469 # With Sphinx 1.6, it is possible to change the Bg color directly
471 # \definecolor{sphinxnoteBgColor}{RGB}{204,255,255}
472 # \definecolor{sphinxwarningBgColor}{RGB}{255,204,204}
473 # \definecolor{sphinxattentionBgColor}{RGB}{255,255,204}
474 # \definecolor{sphinximportantBgColor}{RGB}{192,255,204}
476 # However, it require to use sphinx heavy box with:
478 # \renewenvironment{sphinxlightbox} {%
479 # \\begin{sphinxheavybox}
481 # \\end{sphinxheavybox}
484 # Unfortunately, the implementation is buggy: if a note is inside a
485 # table, it isn't displayed well. So, for now, let's use boring
486 # black and white notes.
488 # Grouping the document tree into LaTeX files. List of tuples
489 # (source start file, target name, title,
490 # author, documentclass [howto, manual, or own class]).
491 # Sorted in alphabetical order
495 # Add all other index files from Documentation/ subdirectories
496 for fn in os.listdir('.'):
497 doc = os.path.join(fn, "index")
498 if os.path.exists(doc + ".rst"):
500 for l in latex_documents:
505 latex_documents.append((doc, fn + '.tex',
506 'Linux %s Documentation' % fn.capitalize(),
507 'The kernel development community',
510 # The name of an image file (relative to this directory) to place at the top of
514 # For "manual" documents, if this is true, then toplevel headings are parts,
516 #latex_use_parts = False
518 # If true, show page references after internal links.
519 #latex_show_pagerefs = False
521 # If true, show URL addresses after external links.
522 #latex_show_urls = False
524 # Documents to append as an appendix to all manuals.
525 #latex_appendices = []
527 # If false, no module index is generated.
528 #latex_domain_indices = True
530 # Additional LaTeX stuff to be copied to build directory
531 latex_additional_files = [
532 'sphinx/kerneldoc-preamble.sty',
536 # -- Options for manual page output ---------------------------------------
538 # One entry per manual page. List of tuples
539 # (source start file, name, description, authors, manual section).
541 (master_doc, 'thelinuxkernel', 'The Linux Kernel Documentation',
545 # If true, show URL addresses after external links.
546 #man_show_urls = False
549 # -- Options for Texinfo output -------------------------------------------
551 # Grouping the document tree into Texinfo files. List of tuples
552 # (source start file, target name, title, author,
553 # dir menu entry, description, category)
554 texinfo_documents = [
555 (master_doc, 'TheLinuxKernel', 'The Linux Kernel Documentation',
556 author, 'TheLinuxKernel', 'One line description of project.',
560 # Documents to append as an appendix to all manuals.
561 #texinfo_appendices = []
563 # If false, no module index is generated.
564 #texinfo_domain_indices = True
566 # How to display URL addresses: 'footnote', 'no', or 'inline'.
567 #texinfo_show_urls = 'footnote'
569 # If true, do not generate a @detailmenu in the "Top" node's menu.
570 #texinfo_no_detailmenu = False
573 # -- Options for Epub output ----------------------------------------------
575 # Bibliographic Dublin Core info.
578 epub_publisher = author
579 epub_copyright = copyright
581 # The basename for the epub file. It defaults to the project name.
582 #epub_basename = project
584 # The HTML theme for the epub output. Since the default themes are not
585 # optimized for small screen space, using the same theme for HTML and epub
586 # output is usually not wise. This defaults to 'epub', a theme designed to save
590 # The language of the text. It defaults to the language option
591 # or 'en' if the language is not set.
594 # The scheme of the identifier. Typical schemes are ISBN or URL.
597 # The unique identifier of the text. This can be a ISBN number
598 # or the project homepage.
599 #epub_identifier = ''
601 # A unique identification for the text.
604 # A tuple containing the cover image and cover page html template filenames.
607 # A sequence of (type, uri, title) tuples for the guide element of content.opf.
610 # HTML files that should be inserted before the pages created by sphinx.
611 # The format is a list of tuples containing the path and title.
614 # HTML files that should be inserted after the pages created by sphinx.
615 # The format is a list of tuples containing the path and title.
616 #epub_post_files = []
618 # A list of files that should not be packed into the epub file.
619 epub_exclude_files = ['search.html']
621 # The depth of the table of contents in toc.ncx.
624 # Allow duplicate toc entries.
627 # Choose between 'default' and 'includehidden'.
628 #epub_tocscope = 'default'
630 # Fix unsupported image types using the Pillow.
631 #epub_fix_images = False
633 # Scale large images.
634 #epub_max_image_width = 0
636 # How to display URL addresses: 'footnote', 'no', or 'inline'.
637 #epub_show_urls = 'inline'
639 # If false, no index is generated.
640 #epub_use_index = True
645 # Grouping the document tree into PDF files. List of tuples
646 # (source start file, target name, title, author, options).
648 # See the Sphinx chapter of https://ralsina.me/static/manual.pdf
650 # FIXME: Do not add the index file here; the result will be too big. Adding
651 # multiple PDF files here actually tries to get the cross-referencing right
652 # *between* PDF files.
654 ('kernel-documentation', u'Kernel', u'Kernel', u'J. Random Bozo'),
657 # kernel-doc extension configuration for running Sphinx directly (e.g. by Read
658 # the Docs). In a normal build, these are supplied from the Makefile via command
660 kerneldoc_bin = '../scripts/kernel-doc'
661 kerneldoc_srctree = '..'
663 # ------------------------------------------------------------------------------
664 # Since loadConfig overwrites settings from the global namespace, it has to be
665 # the last statement in the conf.py file
666 # ------------------------------------------------------------------------------
667 loadConfig(globals())