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.
20 major, minor, patch = sphinx.version_info[:3]
23 # If extensions (or modules to document with autodoc) are in another directory,
24 # add these directories to sys.path here. If the directory is relative to the
25 # documentation root, use os.path.abspath to make it absolute, like shown here.
26 sys.path.insert(0, os.path.abspath('sphinx'))
27 from load_config import loadConfig
29 # -- General configuration ------------------------------------------------
31 # If your documentation needs a minimal Sphinx version, state it here.
34 # Add any Sphinx extension module names here, as strings. They can be
35 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
37 extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include',
38 'kfigure', 'sphinx.ext.ifconfig', 'automarkup',
39 'maintainers_include', 'sphinx.ext.autosectionlabel',
40 'kernel_abi', 'kernel_feat']
43 if (major > 3) or (minor > 0 or patch >= 2):
44 # Sphinx c function parser is more pedantic with regards to type
45 # checking. Due to that, having macros at c:function cause problems.
46 # Those needed to be scaped by using c_id_attributes[] array
48 # GCC Compiler types not parsed by Sphinx:
51 # include/linux/compiler_types.h:
60 # include/linux/compiler_attributes.h:
67 "__attribute_const__",
77 "__no_caller_saved_registers",
91 # include/linux/memblock.h:
95 # include/linux/init.h:
99 # include/linux/linkage.h:
104 extensions.append('cdomain')
106 # Ensure that autosectionlabel will produce unique names
107 autosectionlabel_prefix_document = True
108 autosectionlabel_maxdepth = 2
110 extensions.append("sphinx.ext.imgmath")
112 # Add any paths that contain templates here, relative to this directory.
113 templates_path = ['_templates']
115 # The suffix(es) of source filenames.
116 # You can specify multiple suffix as a list of string:
117 # source_suffix = ['.rst', '.md']
118 source_suffix = '.rst'
120 # The encoding of source files.
121 #source_encoding = 'utf-8-sig'
123 # The master toctree document.
126 # General information about the project.
127 project = 'The Linux Kernel'
128 copyright = 'The kernel development community'
129 author = 'The kernel development community'
131 # The version info for the project you're documenting, acts as replacement for
132 # |version| and |release|, also used in various other places throughout the
135 # In a normal build, version and release are are set to KERNELVERSION and
136 # KERNELRELEASE, respectively, from the Makefile via Sphinx command line
139 # The following code tries to extract the information by reading the Makefile,
140 # when Sphinx is run directly (e.g. by Read the Docs).
142 makefile_version = None
143 makefile_patchlevel = None
144 for line in open('../Makefile'):
145 key, val = [x.strip() for x in line.split('=', 2)]
147 makefile_version = val
148 elif key == 'PATCHLEVEL':
149 makefile_patchlevel = val
150 if makefile_version and makefile_patchlevel:
155 if makefile_version and makefile_patchlevel:
156 version = release = makefile_version + '.' + makefile_patchlevel
158 version = release = "unknown version"
160 # The language for content autogenerated by Sphinx. Refer to documentation
161 # for a list of supported languages.
163 # This is also used if you do content translation via gettext catalogs.
164 # Usually you set "language" from the command line for these cases.
167 # There are two options for replacing |today|: either, you set today to some
168 # non-false value, then it is used:
170 # Else, today_fmt is used as the format for a strftime call.
171 #today_fmt = '%B %d, %Y'
173 # List of patterns, relative to source directory, that match files and
174 # directories to ignore when looking for source files.
175 exclude_patterns = ['output']
177 # The reST default role (used for this markup: `text`) to use for all
181 # If true, '()' will be appended to :func: etc. cross-reference text.
182 #add_function_parentheses = True
184 # If true, the current module name will be prepended to all description
185 # unit titles (such as .. function::).
186 #add_module_names = True
188 # If true, sectionauthor and moduleauthor directives will be shown in the
189 # output. They are ignored by default.
190 #show_authors = False
192 # The name of the Pygments (syntax highlighting) style to use.
193 pygments_style = 'sphinx'
195 # A list of ignored prefixes for module index sorting.
196 #modindex_common_prefix = []
198 # If true, keep warnings as "system message" paragraphs in the built documents.
199 #keep_warnings = False
201 # If true, `todo` and `todoList` produce output, else they produce nothing.
202 todo_include_todos = False
205 highlight_language = 'none'
207 # -- Options for HTML output ----------------------------------------------
209 # The theme to use for HTML and HTML Help pages. See the documentation for
210 # a list of builtin themes.
213 html_theme = 'sphinx_rtd_theme'
216 if "DOCS_THEME" in os.environ:
217 html_theme = os.environ["DOCS_THEME"]
219 if html_theme == 'sphinx_rtd_theme' or html_theme == 'sphinx_rtd_dark_mode':
220 # Read the Docs theme
222 import sphinx_rtd_theme
223 html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
225 # Add any paths that contain custom static files (such as style sheets) here,
226 # relative to this directory. They are copied after the builtin static files,
227 # so a file named "default.css" will overwrite the builtin "default.css".
229 'theme_overrides.css',
232 # Read the Docs dark mode override theme
233 if html_theme == 'sphinx_rtd_dark_mode':
235 import sphinx_rtd_dark_mode
236 extensions.append('sphinx_rtd_dark_mode')
238 html_theme == 'sphinx_rtd_theme'
240 if html_theme == 'sphinx_rtd_theme':
241 # Add color-specific RTD normal mode
242 html_css_files.append('theme_rtd_colors.css')
245 html_theme = 'classic'
247 if "DOCS_CSS" in os.environ:
248 css = os.environ["DOCS_CSS"].split(" ")
251 html_css_files.append(l)
253 if major <= 1 and minor < 8:
258 for l in html_css_files:
259 html_context['css_files'].append('_static/' + l)
261 if html_theme == 'classic':
262 html_theme_options = {
263 'rightsidebar': False,
264 'stickysidebar': True,
265 'collapsiblesidebar': True,
266 'externalrefs': False,
268 'footerbgcolor': "white",
269 'footertextcolor': "white",
270 'sidebarbgcolor': "white",
271 'sidebarbtncolor': "black",
272 'sidebartextcolor': "black",
273 'sidebarlinkcolor': "#686bff",
274 'relbarbgcolor': "#133f52",
275 'relbartextcolor': "white",
276 'relbarlinkcolor': "white",
278 'textcolor': "black",
279 'headbgcolor': "#f2f2f2",
280 'headtextcolor': "#20435c",
281 'headlinkcolor': "#c60f0f",
282 'linkcolor': "#355f7c",
283 'visitedlinkcolor': "#355f7c",
284 'codebgcolor': "#3f3f3f",
285 'codetextcolor': "white",
288 'headfont': "sans-serif",
291 sys.stderr.write("Using %s theme\n" % html_theme)
293 # Theme options are theme-specific and customize the look and feel of a theme
294 # further. For a list of options available for each theme, see the
296 #html_theme_options = {}
298 # Add any paths that contain custom themes here, relative to this directory.
299 #html_theme_path = []
301 # The name for this set of Sphinx documents. If None, it defaults to
302 # "<project> v<release> documentation".
305 # A shorter title for the navigation bar. Default is the same as html_title.
306 #html_short_title = None
308 # The name of an image file (relative to this directory) to place at the top
312 # The name of an image file (within the static path) to use as favicon of the
313 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
317 # Add any paths that contain custom static files (such as style sheets) here,
318 # relative to this directory. They are copied after the builtin static files,
319 # so a file named "default.css" will overwrite the builtin "default.css".
320 html_static_path = ['sphinx-static']
322 # Add any extra paths that contain custom files (such as robots.txt or
323 # .htaccess) here, relative to this directory. These files are copied
324 # directly to the root of the documentation.
325 #html_extra_path = []
327 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
328 # using the given strftime format.
329 #html_last_updated_fmt = '%b %d, %Y'
331 # If true, SmartyPants will be used to convert quotes and dashes to
332 # typographically correct entities.
333 html_use_smartypants = False
335 # Custom sidebar templates, maps document names to template names.
338 # Additional templates that should be rendered to pages, maps page names to
340 #html_additional_pages = {}
342 # If false, no module index is generated.
343 #html_domain_indices = True
345 # If false, no index is generated.
346 #html_use_index = True
348 # If true, the index is split into individual pages for each letter.
349 #html_split_index = False
351 # If true, links to the reST sources are added to the pages.
352 #html_show_sourcelink = True
354 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
355 #html_show_sphinx = True
357 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
358 #html_show_copyright = True
360 # If true, an OpenSearch description file will be output, and all pages will
361 # contain a <link> tag referring to it. The value of this option must be the
362 # base URL from which the finished HTML is served.
363 #html_use_opensearch = ''
365 # This is the file name suffix for HTML files (e.g. ".xhtml").
366 #html_file_suffix = None
368 # Language to be used for generating the HTML full-text search index.
369 # Sphinx supports the following languages:
370 # 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
371 # 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'
372 #html_search_language = 'en'
374 # A dictionary with options for the search language support, empty by default.
375 # Now only 'ja' uses this config value
376 #html_search_options = {'type': 'default'}
378 # The name of a javascript file (relative to the configuration directory) that
379 # implements a search results scorer. If empty, the default will be used.
380 #html_search_scorer = 'scorer.js'
382 # Output file base name for HTML help builder.
383 htmlhelp_basename = 'TheLinuxKerneldoc'
385 # -- Options for LaTeX output ---------------------------------------------
388 # The paper size ('letterpaper' or 'a4paper').
389 'papersize': 'a4paper',
391 # The font size ('10pt', '11pt' or '12pt').
394 # Latex figure (float) alignment
395 #'figure_align': 'htbp',
397 # Don't mangle with UTF-8 chars
401 # Set document margins
403 hmargin=0.5in, vmargin=1in,
404 parsedliteralwraps=true,
405 verbatimhintsturnover=false,
408 # For CJK One-half spacing, need to be in front of hyperref
409 'extrapackages': r'\usepackage{setspace}',
411 # Additional stuff for the LaTeX preamble.
413 % Use some font with UTF-8 support with XeLaTeX
414 \\usepackage{fontspec}
415 \\setsansfont{DejaVu Sans}
416 \\setromanfont{DejaVu Serif}
417 \\setmonofont{DejaVu Sans Mono}
421 # Fix reference escape troubles with Sphinx 1.4.x
423 latex_elements['preamble'] += '\\renewcommand*{\\DUrole}[2]{ #2 }\n'
426 # Load kerneldoc specific LaTeX settings
427 latex_elements['preamble'] += '''
428 % Load kerneldoc specific LaTeX settings
429 \\input{kerneldoc-preamble.sty}
432 # With Sphinx 1.6, it is possible to change the Bg color directly
434 # \definecolor{sphinxnoteBgColor}{RGB}{204,255,255}
435 # \definecolor{sphinxwarningBgColor}{RGB}{255,204,204}
436 # \definecolor{sphinxattentionBgColor}{RGB}{255,255,204}
437 # \definecolor{sphinximportantBgColor}{RGB}{192,255,204}
439 # However, it require to use sphinx heavy box with:
441 # \renewenvironment{sphinxlightbox} {%
442 # \\begin{sphinxheavybox}
444 # \\end{sphinxheavybox}
447 # Unfortunately, the implementation is buggy: if a note is inside a
448 # table, it isn't displayed well. So, for now, let's use boring
449 # black and white notes.
451 # Grouping the document tree into LaTeX files. List of tuples
452 # (source start file, target name, title,
453 # author, documentclass [howto, manual, or own class]).
454 # Sorted in alphabetical order
458 # Add all other index files from Documentation/ subdirectories
459 for fn in os.listdir('.'):
460 doc = os.path.join(fn, "index")
461 if os.path.exists(doc + ".rst"):
463 for l in latex_documents:
468 latex_documents.append((doc, fn + '.tex',
469 'Linux %s Documentation' % fn.capitalize(),
470 'The kernel development community',
473 # The name of an image file (relative to this directory) to place at the top of
477 # For "manual" documents, if this is true, then toplevel headings are parts,
479 #latex_use_parts = False
481 # If true, show page references after internal links.
482 #latex_show_pagerefs = False
484 # If true, show URL addresses after external links.
485 #latex_show_urls = False
487 # Documents to append as an appendix to all manuals.
488 #latex_appendices = []
490 # If false, no module index is generated.
491 #latex_domain_indices = True
493 # Additional LaTeX stuff to be copied to build directory
494 latex_additional_files = [
495 'sphinx/kerneldoc-preamble.sty',
499 # -- Options for manual page output ---------------------------------------
501 # One entry per manual page. List of tuples
502 # (source start file, name, description, authors, manual section).
504 (master_doc, 'thelinuxkernel', 'The Linux Kernel Documentation',
508 # If true, show URL addresses after external links.
509 #man_show_urls = False
512 # -- Options for Texinfo output -------------------------------------------
514 # Grouping the document tree into Texinfo files. List of tuples
515 # (source start file, target name, title, author,
516 # dir menu entry, description, category)
517 texinfo_documents = [
518 (master_doc, 'TheLinuxKernel', 'The Linux Kernel Documentation',
519 author, 'TheLinuxKernel', 'One line description of project.',
523 # Documents to append as an appendix to all manuals.
524 #texinfo_appendices = []
526 # If false, no module index is generated.
527 #texinfo_domain_indices = True
529 # How to display URL addresses: 'footnote', 'no', or 'inline'.
530 #texinfo_show_urls = 'footnote'
532 # If true, do not generate a @detailmenu in the "Top" node's menu.
533 #texinfo_no_detailmenu = False
536 # -- Options for Epub output ----------------------------------------------
538 # Bibliographic Dublin Core info.
541 epub_publisher = author
542 epub_copyright = copyright
544 # The basename for the epub file. It defaults to the project name.
545 #epub_basename = project
547 # The HTML theme for the epub output. Since the default themes are not
548 # optimized for small screen space, using the same theme for HTML and epub
549 # output is usually not wise. This defaults to 'epub', a theme designed to save
553 # The language of the text. It defaults to the language option
554 # or 'en' if the language is not set.
557 # The scheme of the identifier. Typical schemes are ISBN or URL.
560 # The unique identifier of the text. This can be a ISBN number
561 # or the project homepage.
562 #epub_identifier = ''
564 # A unique identification for the text.
567 # A tuple containing the cover image and cover page html template filenames.
570 # A sequence of (type, uri, title) tuples for the guide element of content.opf.
573 # HTML files that should be inserted before the pages created by sphinx.
574 # The format is a list of tuples containing the path and title.
577 # HTML files that should be inserted after the pages created by sphinx.
578 # The format is a list of tuples containing the path and title.
579 #epub_post_files = []
581 # A list of files that should not be packed into the epub file.
582 epub_exclude_files = ['search.html']
584 # The depth of the table of contents in toc.ncx.
587 # Allow duplicate toc entries.
590 # Choose between 'default' and 'includehidden'.
591 #epub_tocscope = 'default'
593 # Fix unsupported image types using the Pillow.
594 #epub_fix_images = False
596 # Scale large images.
597 #epub_max_image_width = 0
599 # How to display URL addresses: 'footnote', 'no', or 'inline'.
600 #epub_show_urls = 'inline'
602 # If false, no index is generated.
603 #epub_use_index = True
608 # Grouping the document tree into PDF files. List of tuples
609 # (source start file, target name, title, author, options).
611 # See the Sphinx chapter of https://ralsina.me/static/manual.pdf
613 # FIXME: Do not add the index file here; the result will be too big. Adding
614 # multiple PDF files here actually tries to get the cross-referencing right
615 # *between* PDF files.
617 ('kernel-documentation', u'Kernel', u'Kernel', u'J. Random Bozo'),
620 # kernel-doc extension configuration for running Sphinx directly (e.g. by Read
621 # the Docs). In a normal build, these are supplied from the Makefile via command
623 kerneldoc_bin = '../scripts/kernel-doc'
624 kerneldoc_srctree = '..'
626 # ------------------------------------------------------------------------------
627 # Since loadConfig overwrites settings from the global namespace, it has to be
628 # the last statement in the conf.py file
629 # ------------------------------------------------------------------------------
630 loadConfig(globals())