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",
103 # include/linux/memblock.h:
107 # include/linux/init.h:
111 # include/linux/linkage.h:
116 extensions.append('cdomain')
118 # Ensure that autosectionlabel will produce unique names
119 autosectionlabel_prefix_document = True
120 autosectionlabel_maxdepth = 2
122 # Load math renderer:
123 # For html builder, load imgmath only when its dependencies are met.
124 # mathjax is the default math renderer since Sphinx 1.8.
125 have_latex = have_command('latex')
126 have_dvipng = have_command('dvipng')
127 load_imgmath = have_latex and have_dvipng
129 # Respect SPHINX_IMGMATH (for html docs only)
130 if 'SPHINX_IMGMATH' in os.environ:
131 env_sphinx_imgmath = os.environ['SPHINX_IMGMATH']
132 if 'yes' in env_sphinx_imgmath:
134 elif 'no' in env_sphinx_imgmath:
137 sys.stderr.write("Unknown env SPHINX_IMGMATH=%s ignored.\n" % env_sphinx_imgmath)
139 # Always load imgmath for Sphinx <1.8 or for epub docs
140 load_imgmath = (load_imgmath or (major == 1 and minor < 8)
141 or 'epub' in sys.argv)
144 extensions.append("sphinx.ext.imgmath")
145 math_renderer = 'imgmath'
147 math_renderer = 'mathjax'
149 # Add any paths that contain templates here, relative to this directory.
150 templates_path = ['_templates']
152 # The suffix(es) of source filenames.
153 # You can specify multiple suffix as a list of string:
154 # source_suffix = ['.rst', '.md']
155 source_suffix = '.rst'
157 # The encoding of source files.
158 #source_encoding = 'utf-8-sig'
160 # The master toctree document.
163 # General information about the project.
164 project = 'The Linux Kernel'
165 copyright = 'The kernel development community'
166 author = 'The kernel development community'
168 # The version info for the project you're documenting, acts as replacement for
169 # |version| and |release|, also used in various other places throughout the
172 # In a normal build, version and release are are set to KERNELVERSION and
173 # KERNELRELEASE, respectively, from the Makefile via Sphinx command line
176 # The following code tries to extract the information by reading the Makefile,
177 # when Sphinx is run directly (e.g. by Read the Docs).
179 makefile_version = None
180 makefile_patchlevel = None
181 for line in open('../Makefile'):
182 key, val = [x.strip() for x in line.split('=', 2)]
184 makefile_version = val
185 elif key == 'PATCHLEVEL':
186 makefile_patchlevel = val
187 if makefile_version and makefile_patchlevel:
192 if makefile_version and makefile_patchlevel:
193 version = release = makefile_version + '.' + makefile_patchlevel
195 version = release = "unknown version"
197 # The language for content autogenerated by Sphinx. Refer to documentation
198 # for a list of supported languages.
200 # This is also used if you do content translation via gettext catalogs.
201 # Usually you set "language" from the command line for these cases.
204 # There are two options for replacing |today|: either, you set today to some
205 # non-false value, then it is used:
207 # Else, today_fmt is used as the format for a strftime call.
208 #today_fmt = '%B %d, %Y'
210 # List of patterns, relative to source directory, that match files and
211 # directories to ignore when looking for source files.
212 exclude_patterns = ['output']
214 # The reST default role (used for this markup: `text`) to use for all
218 # If true, '()' will be appended to :func: etc. cross-reference text.
219 #add_function_parentheses = True
221 # If true, the current module name will be prepended to all description
222 # unit titles (such as .. function::).
223 #add_module_names = True
225 # If true, sectionauthor and moduleauthor directives will be shown in the
226 # output. They are ignored by default.
227 #show_authors = False
229 # The name of the Pygments (syntax highlighting) style to use.
230 pygments_style = 'sphinx'
232 # A list of ignored prefixes for module index sorting.
233 #modindex_common_prefix = []
235 # If true, keep warnings as "system message" paragraphs in the built documents.
236 #keep_warnings = False
238 # If true, `todo` and `todoList` produce output, else they produce nothing.
239 todo_include_todos = False
242 highlight_language = 'none'
244 # -- Options for HTML output ----------------------------------------------
246 # The theme to use for HTML and HTML Help pages. See the documentation for
247 # a list of builtin themes.
250 html_theme = 'sphinx_rtd_theme'
253 if "DOCS_THEME" in os.environ:
254 html_theme = os.environ["DOCS_THEME"]
256 if html_theme == 'sphinx_rtd_theme' or html_theme == 'sphinx_rtd_dark_mode':
257 # Read the Docs theme
259 import sphinx_rtd_theme
260 html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
262 # Add any paths that contain custom static files (such as style sheets) here,
263 # relative to this directory. They are copied after the builtin static files,
264 # so a file named "default.css" will overwrite the builtin "default.css".
266 'theme_overrides.css',
269 # Read the Docs dark mode override theme
270 if html_theme == 'sphinx_rtd_dark_mode':
272 import sphinx_rtd_dark_mode
273 extensions.append('sphinx_rtd_dark_mode')
275 html_theme == 'sphinx_rtd_theme'
277 if html_theme == 'sphinx_rtd_theme':
278 # Add color-specific RTD normal mode
279 html_css_files.append('theme_rtd_colors.css')
282 html_theme = 'classic'
284 if "DOCS_CSS" in os.environ:
285 css = os.environ["DOCS_CSS"].split(" ")
288 html_css_files.append(l)
290 if major <= 1 and minor < 8:
295 for l in html_css_files:
296 html_context['css_files'].append('_static/' + l)
298 if html_theme == 'classic':
299 html_theme_options = {
300 'rightsidebar': False,
301 'stickysidebar': True,
302 'collapsiblesidebar': True,
303 'externalrefs': False,
305 'footerbgcolor': "white",
306 'footertextcolor': "white",
307 'sidebarbgcolor': "white",
308 'sidebarbtncolor': "black",
309 'sidebartextcolor': "black",
310 'sidebarlinkcolor': "#686bff",
311 'relbarbgcolor': "#133f52",
312 'relbartextcolor': "white",
313 'relbarlinkcolor': "white",
315 'textcolor': "black",
316 'headbgcolor': "#f2f2f2",
317 'headtextcolor': "#20435c",
318 'headlinkcolor': "#c60f0f",
319 'linkcolor': "#355f7c",
320 'visitedlinkcolor': "#355f7c",
321 'codebgcolor': "#3f3f3f",
322 'codetextcolor': "white",
325 'headfont': "sans-serif",
328 sys.stderr.write("Using %s theme\n" % html_theme)
330 # Theme options are theme-specific and customize the look and feel of a theme
331 # further. For a list of options available for each theme, see the
333 #html_theme_options = {}
335 # Add any paths that contain custom themes here, relative to this directory.
336 #html_theme_path = []
338 # The name for this set of Sphinx documents. If None, it defaults to
339 # "<project> v<release> documentation".
342 # A shorter title for the navigation bar. Default is the same as html_title.
343 #html_short_title = None
345 # The name of an image file (relative to this directory) to place at the top
349 # The name of an image file (within the static path) to use as favicon of the
350 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
354 # Add any paths that contain custom static files (such as style sheets) here,
355 # relative to this directory. They are copied after the builtin static files,
356 # so a file named "default.css" will overwrite the builtin "default.css".
357 html_static_path = ['sphinx-static']
359 # Add any extra paths that contain custom files (such as robots.txt or
360 # .htaccess) here, relative to this directory. These files are copied
361 # directly to the root of the documentation.
362 #html_extra_path = []
364 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
365 # using the given strftime format.
366 #html_last_updated_fmt = '%b %d, %Y'
368 # If true, SmartyPants will be used to convert quotes and dashes to
369 # typographically correct entities.
370 html_use_smartypants = False
372 # Custom sidebar templates, maps document names to template names.
373 # Note that the RTD theme ignores this.
374 html_sidebars = { '**': ['searchbox.html', 'localtoc.html', 'sourcelink.html']}
376 # Additional templates that should be rendered to pages, maps page names to
378 #html_additional_pages = {}
380 # If false, no module index is generated.
381 #html_domain_indices = True
383 # If false, no index is generated.
384 #html_use_index = True
386 # If true, the index is split into individual pages for each letter.
387 #html_split_index = False
389 # If true, links to the reST sources are added to the pages.
390 #html_show_sourcelink = True
392 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
393 #html_show_sphinx = True
395 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
396 #html_show_copyright = True
398 # If true, an OpenSearch description file will be output, and all pages will
399 # contain a <link> tag referring to it. The value of this option must be the
400 # base URL from which the finished HTML is served.
401 #html_use_opensearch = ''
403 # This is the file name suffix for HTML files (e.g. ".xhtml").
404 #html_file_suffix = None
406 # Language to be used for generating the HTML full-text search index.
407 # Sphinx supports the following languages:
408 # 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
409 # 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'
410 #html_search_language = 'en'
412 # A dictionary with options for the search language support, empty by default.
413 # Now only 'ja' uses this config value
414 #html_search_options = {'type': 'default'}
416 # The name of a javascript file (relative to the configuration directory) that
417 # implements a search results scorer. If empty, the default will be used.
418 #html_search_scorer = 'scorer.js'
420 # Output file base name for HTML help builder.
421 htmlhelp_basename = 'TheLinuxKerneldoc'
423 # -- Options for LaTeX output ---------------------------------------------
426 # The paper size ('letterpaper' or 'a4paper').
427 'papersize': 'a4paper',
429 # The font size ('10pt', '11pt' or '12pt').
432 # Latex figure (float) alignment
433 #'figure_align': 'htbp',
435 # Don't mangle with UTF-8 chars
439 # Set document margins
441 hmargin=0.5in, vmargin=1in,
442 parsedliteralwraps=true,
443 verbatimhintsturnover=false,
446 # For CJK One-half spacing, need to be in front of hyperref
447 'extrapackages': r'\usepackage{setspace}',
449 # Additional stuff for the LaTeX preamble.
451 % Use some font with UTF-8 support with XeLaTeX
452 \\usepackage{fontspec}
453 \\setsansfont{DejaVu Sans}
454 \\setromanfont{DejaVu Serif}
455 \\setmonofont{DejaVu Sans Mono}
459 # Fix reference escape troubles with Sphinx 1.4.x
461 latex_elements['preamble'] += '\\renewcommand*{\\DUrole}[2]{ #2 }\n'
464 # Load kerneldoc specific LaTeX settings
465 latex_elements['preamble'] += '''
466 % Load kerneldoc specific LaTeX settings
467 \\input{kerneldoc-preamble.sty}
470 # With Sphinx 1.6, it is possible to change the Bg color directly
472 # \definecolor{sphinxnoteBgColor}{RGB}{204,255,255}
473 # \definecolor{sphinxwarningBgColor}{RGB}{255,204,204}
474 # \definecolor{sphinxattentionBgColor}{RGB}{255,255,204}
475 # \definecolor{sphinximportantBgColor}{RGB}{192,255,204}
477 # However, it require to use sphinx heavy box with:
479 # \renewenvironment{sphinxlightbox} {%
480 # \\begin{sphinxheavybox}
482 # \\end{sphinxheavybox}
485 # Unfortunately, the implementation is buggy: if a note is inside a
486 # table, it isn't displayed well. So, for now, let's use boring
487 # black and white notes.
489 # Grouping the document tree into LaTeX files. List of tuples
490 # (source start file, target name, title,
491 # author, documentclass [howto, manual, or own class]).
492 # Sorted in alphabetical order
496 # Add all other index files from Documentation/ subdirectories
497 for fn in os.listdir('.'):
498 doc = os.path.join(fn, "index")
499 if os.path.exists(doc + ".rst"):
501 for l in latex_documents:
506 latex_documents.append((doc, fn + '.tex',
507 'Linux %s Documentation' % fn.capitalize(),
508 'The kernel development community',
511 # The name of an image file (relative to this directory) to place at the top of
515 # For "manual" documents, if this is true, then toplevel headings are parts,
517 #latex_use_parts = False
519 # If true, show page references after internal links.
520 #latex_show_pagerefs = False
522 # If true, show URL addresses after external links.
523 #latex_show_urls = False
525 # Documents to append as an appendix to all manuals.
526 #latex_appendices = []
528 # If false, no module index is generated.
529 #latex_domain_indices = True
531 # Additional LaTeX stuff to be copied to build directory
532 latex_additional_files = [
533 'sphinx/kerneldoc-preamble.sty',
537 # -- Options for manual page output ---------------------------------------
539 # One entry per manual page. List of tuples
540 # (source start file, name, description, authors, manual section).
542 (master_doc, 'thelinuxkernel', 'The Linux Kernel Documentation',
546 # If true, show URL addresses after external links.
547 #man_show_urls = False
550 # -- Options for Texinfo output -------------------------------------------
552 # Grouping the document tree into Texinfo files. List of tuples
553 # (source start file, target name, title, author,
554 # dir menu entry, description, category)
555 texinfo_documents = [
556 (master_doc, 'TheLinuxKernel', 'The Linux Kernel Documentation',
557 author, 'TheLinuxKernel', 'One line description of project.',
561 # Documents to append as an appendix to all manuals.
562 #texinfo_appendices = []
564 # If false, no module index is generated.
565 #texinfo_domain_indices = True
567 # How to display URL addresses: 'footnote', 'no', or 'inline'.
568 #texinfo_show_urls = 'footnote'
570 # If true, do not generate a @detailmenu in the "Top" node's menu.
571 #texinfo_no_detailmenu = False
574 # -- Options for Epub output ----------------------------------------------
576 # Bibliographic Dublin Core info.
579 epub_publisher = author
580 epub_copyright = copyright
582 # The basename for the epub file. It defaults to the project name.
583 #epub_basename = project
585 # The HTML theme for the epub output. Since the default themes are not
586 # optimized for small screen space, using the same theme for HTML and epub
587 # output is usually not wise. This defaults to 'epub', a theme designed to save
591 # The language of the text. It defaults to the language option
592 # or 'en' if the language is not set.
595 # The scheme of the identifier. Typical schemes are ISBN or URL.
598 # The unique identifier of the text. This can be a ISBN number
599 # or the project homepage.
600 #epub_identifier = ''
602 # A unique identification for the text.
605 # A tuple containing the cover image and cover page html template filenames.
608 # A sequence of (type, uri, title) tuples for the guide element of content.opf.
611 # HTML files that should be inserted before the pages created by sphinx.
612 # The format is a list of tuples containing the path and title.
615 # HTML files that should be inserted after the pages created by sphinx.
616 # The format is a list of tuples containing the path and title.
617 #epub_post_files = []
619 # A list of files that should not be packed into the epub file.
620 epub_exclude_files = ['search.html']
622 # The depth of the table of contents in toc.ncx.
625 # Allow duplicate toc entries.
628 # Choose between 'default' and 'includehidden'.
629 #epub_tocscope = 'default'
631 # Fix unsupported image types using the Pillow.
632 #epub_fix_images = False
634 # Scale large images.
635 #epub_max_image_width = 0
637 # How to display URL addresses: 'footnote', 'no', or 'inline'.
638 #epub_show_urls = 'inline'
640 # If false, no index is generated.
641 #epub_use_index = True
646 # Grouping the document tree into PDF files. List of tuples
647 # (source start file, target name, title, author, options).
649 # See the Sphinx chapter of https://ralsina.me/static/manual.pdf
651 # FIXME: Do not add the index file here; the result will be too big. Adding
652 # multiple PDF files here actually tries to get the cross-referencing right
653 # *between* PDF files.
655 ('kernel-documentation', u'Kernel', u'Kernel', u'J. Random Bozo'),
658 # kernel-doc extension configuration for running Sphinx directly (e.g. by Read
659 # the Docs). In a normal build, these are supplied from the Makefile via command
661 kerneldoc_bin = '../scripts/kernel-doc'
662 kerneldoc_srctree = '..'
664 # ------------------------------------------------------------------------------
665 # Since loadConfig overwrites settings from the global namespace, it has to be
666 # the last statement in the conf.py file
667 # ------------------------------------------------------------------------------
668 loadConfig(globals())