1# -*- coding: utf-8 -*- 2# 3# The Linux Kernel documentation build configuration file, created by 4# sphinx-quickstart on Fri Feb 12 13:51:46 2016. 5# 6# This file is execfile()d with the current directory set to its 7# containing dir. 8# 9# Note that not all possible configuration values are present in this 10# autogenerated file. 11# 12# All configuration values have a default; values that are commented out 13# serve to show the default. 14 15import sys 16import os 17import sphinx 18import shutil 19 20# helper 21# ------ 22 23def have_command(cmd): 24 """Search ``cmd`` in the ``PATH`` environment. 25 26 If found, return True. 27 If not found, return False. 28 """ 29 return shutil.which(cmd) is not None 30 31# Get Sphinx version 32major, minor, patch = sphinx.version_info[:3] 33 34 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. 38sys.path.insert(0, os.path.abspath('sphinx')) 39from load_config import loadConfig 40 41# -- General configuration ------------------------------------------------ 42 43# If your documentation needs a minimal Sphinx version, state it here. 44needs_sphinx = '1.7' 45 46# Add any Sphinx extension module names here, as strings. They can be 47# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 48# ones. 49extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include', 50 'kfigure', 'sphinx.ext.ifconfig', 'automarkup', 51 'maintainers_include', 'sphinx.ext.autosectionlabel', 52 'kernel_abi', 'kernel_feat'] 53 54if major >= 3: 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 59 c_id_attributes = [ 60 # GCC Compiler types not parsed by Sphinx: 61 "__restrict__", 62 63 # include/linux/compiler_types.h: 64 "__iomem", 65 "__kernel", 66 "noinstr", 67 "notrace", 68 "__percpu", 69 "__rcu", 70 "__user", 71 72 # include/linux/compiler_attributes.h: 73 "__alias", 74 "__aligned", 75 "__aligned_largest", 76 "__always_inline", 77 "__assume_aligned", 78 "__cold", 79 "__attribute_const__", 80 "__copy", 81 "__pure", 82 "__designated_init", 83 "__visible", 84 "__printf", 85 "__scanf", 86 "__gnu_inline", 87 "__malloc", 88 "__mode", 89 "__no_caller_saved_registers", 90 "__noclone", 91 "__nonstring", 92 "__noreturn", 93 "__packed", 94 "__pure", 95 "__section", 96 "__always_unused", 97 "__maybe_unused", 98 "__used", 99 "__weak", 100 "noinline", 101 102 # include/linux/memblock.h: 103 "__init_memblock", 104 "__meminit", 105 106 # include/linux/init.h: 107 "__init", 108 "__ref", 109 110 # include/linux/linkage.h: 111 "asmlinkage", 112 ] 113 114else: 115 extensions.append('cdomain') 116 117# Ensure that autosectionlabel will produce unique names 118autosectionlabel_prefix_document = True 119autosectionlabel_maxdepth = 2 120 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. 124have_latex = have_command('latex') 125have_dvipng = have_command('dvipng') 126load_imgmath = have_latex and have_dvipng 127 128# Respect SPHINX_IMGMATH (for html docs only) 129if 'SPHINX_IMGMATH' in os.environ: 130 env_sphinx_imgmath = os.environ['SPHINX_IMGMATH'] 131 if 'yes' in env_sphinx_imgmath: 132 load_imgmath = True 133 elif 'no' in env_sphinx_imgmath: 134 load_imgmath = False 135 else: 136 sys.stderr.write("Unknown env SPHINX_IMGMATH=%s ignored.\n" % env_sphinx_imgmath) 137 138# Always load imgmath for Sphinx <1.8 or for epub docs 139load_imgmath = (load_imgmath or (major == 1 and minor < 8) 140 or 'epub' in sys.argv) 141 142if load_imgmath: 143 extensions.append("sphinx.ext.imgmath") 144 math_renderer = 'imgmath' 145else: 146 math_renderer = 'mathjax' 147 148# Add any paths that contain templates here, relative to this directory. 149templates_path = ['_templates'] 150 151# The suffix(es) of source filenames. 152# You can specify multiple suffix as a list of string: 153# source_suffix = ['.rst', '.md'] 154source_suffix = '.rst' 155 156# The encoding of source files. 157#source_encoding = 'utf-8-sig' 158 159# The master toctree document. 160master_doc = 'index' 161 162# General information about the project. 163project = 'The Linux Kernel' 164copyright = 'The kernel development community' 165author = 'The kernel development community' 166 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 169# built documents. 170# 171# In a normal build, version and release are are set to KERNELVERSION and 172# KERNELRELEASE, respectively, from the Makefile via Sphinx command line 173# arguments. 174# 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). 177try: 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)] 182 if key == 'VERSION': 183 makefile_version = val 184 elif key == 'PATCHLEVEL': 185 makefile_patchlevel = val 186 if makefile_version and makefile_patchlevel: 187 break 188except: 189 pass 190finally: 191 if makefile_version and makefile_patchlevel: 192 version = release = makefile_version + '.' + makefile_patchlevel 193 else: 194 version = release = "unknown version" 195 196# The language for content autogenerated by Sphinx. Refer to documentation 197# for a list of supported languages. 198# 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. 201language = 'en' 202 203# There are two options for replacing |today|: either, you set today to some 204# non-false value, then it is used: 205#today = '' 206# Else, today_fmt is used as the format for a strftime call. 207#today_fmt = '%B %d, %Y' 208 209# List of patterns, relative to source directory, that match files and 210# directories to ignore when looking for source files. 211exclude_patterns = ['output'] 212 213# The reST default role (used for this markup: `text`) to use for all 214# documents. 215#default_role = None 216 217# If true, '()' will be appended to :func: etc. cross-reference text. 218#add_function_parentheses = True 219 220# If true, the current module name will be prepended to all description 221# unit titles (such as .. function::). 222#add_module_names = True 223 224# If true, sectionauthor and moduleauthor directives will be shown in the 225# output. They are ignored by default. 226#show_authors = False 227 228# The name of the Pygments (syntax highlighting) style to use. 229pygments_style = 'sphinx' 230 231# A list of ignored prefixes for module index sorting. 232#modindex_common_prefix = [] 233 234# If true, keep warnings as "system message" paragraphs in the built documents. 235#keep_warnings = False 236 237# If true, `todo` and `todoList` produce output, else they produce nothing. 238todo_include_todos = False 239 240primary_domain = 'c' 241highlight_language = 'none' 242 243# -- Options for HTML output ---------------------------------------------- 244 245# The theme to use for HTML and HTML Help pages. See the documentation for 246# a list of builtin themes. 247 248# Default theme 249html_theme = 'sphinx_rtd_theme' 250html_css_files = [] 251 252if "DOCS_THEME" in os.environ: 253 html_theme = os.environ["DOCS_THEME"] 254 255if html_theme == 'sphinx_rtd_theme' or html_theme == 'sphinx_rtd_dark_mode': 256 # Read the Docs theme 257 try: 258 import sphinx_rtd_theme 259 html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] 260 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". 264 html_css_files = [ 265 'theme_overrides.css', 266 ] 267 268 # Read the Docs dark mode override theme 269 if html_theme == 'sphinx_rtd_dark_mode': 270 try: 271 import sphinx_rtd_dark_mode 272 extensions.append('sphinx_rtd_dark_mode') 273 except ImportError: 274 html_theme == 'sphinx_rtd_theme' 275 276 if html_theme == 'sphinx_rtd_theme': 277 # Add color-specific RTD normal mode 278 html_css_files.append('theme_rtd_colors.css') 279 280 except ImportError: 281 html_theme = 'classic' 282 283if "DOCS_CSS" in os.environ: 284 css = os.environ["DOCS_CSS"].split(" ") 285 286 for l in css: 287 html_css_files.append(l) 288 289if major <= 1 and minor < 8: 290 html_context = { 291 'css_files': [], 292 } 293 294 for l in html_css_files: 295 html_context['css_files'].append('_static/' + l) 296 297if html_theme == 'classic': 298 html_theme_options = { 299 'rightsidebar': False, 300 'stickysidebar': True, 301 'collapsiblesidebar': True, 302 'externalrefs': False, 303 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", 313 'bgcolor': "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", 322 323 'bodyfont': "serif", 324 'headfont': "sans-serif", 325 } 326 327sys.stderr.write("Using %s theme\n" % html_theme) 328 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 331# documentation. 332#html_theme_options = {} 333 334# Add any paths that contain custom themes here, relative to this directory. 335#html_theme_path = [] 336 337# The name for this set of Sphinx documents. If None, it defaults to 338# "<project> v<release> documentation". 339#html_title = None 340 341# A shorter title for the navigation bar. Default is the same as html_title. 342#html_short_title = None 343 344# The name of an image file (relative to this directory) to place at the top 345# of the sidebar. 346#html_logo = None 347 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 350# pixels large. 351#html_favicon = None 352 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". 356html_static_path = ['sphinx-static'] 357 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 = [] 362 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' 366 367# If true, SmartyPants will be used to convert quotes and dashes to 368# typographically correct entities. 369html_use_smartypants = False 370 371# Custom sidebar templates, maps document names to template names. 372#html_sidebars = {} 373 374# Additional templates that should be rendered to pages, maps page names to 375# template names. 376#html_additional_pages = {} 377 378# If false, no module index is generated. 379#html_domain_indices = True 380 381# If false, no index is generated. 382#html_use_index = True 383 384# If true, the index is split into individual pages for each letter. 385#html_split_index = False 386 387# If true, links to the reST sources are added to the pages. 388#html_show_sourcelink = True 389 390# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 391#html_show_sphinx = True 392 393# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 394#html_show_copyright = True 395 396# If true, an OpenSearch description file will be output, and all pages will 397# contain a <link> tag referring to it. The value of this option must be the 398# base URL from which the finished HTML is served. 399#html_use_opensearch = '' 400 401# This is the file name suffix for HTML files (e.g. ".xhtml"). 402#html_file_suffix = None 403 404# Language to be used for generating the HTML full-text search index. 405# Sphinx supports the following languages: 406# 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja' 407# 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr' 408#html_search_language = 'en' 409 410# A dictionary with options for the search language support, empty by default. 411# Now only 'ja' uses this config value 412#html_search_options = {'type': 'default'} 413 414# The name of a javascript file (relative to the configuration directory) that 415# implements a search results scorer. If empty, the default will be used. 416#html_search_scorer = 'scorer.js' 417 418# Output file base name for HTML help builder. 419htmlhelp_basename = 'TheLinuxKerneldoc' 420 421# -- Options for LaTeX output --------------------------------------------- 422 423latex_elements = { 424 # The paper size ('letterpaper' or 'a4paper'). 425 'papersize': 'a4paper', 426 427 # The font size ('10pt', '11pt' or '12pt'). 428 'pointsize': '11pt', 429 430 # Latex figure (float) alignment 431 #'figure_align': 'htbp', 432 433 # Don't mangle with UTF-8 chars 434 'inputenc': '', 435 'utf8extra': '', 436 437 # Set document margins 438 'sphinxsetup': ''' 439 hmargin=0.5in, vmargin=1in, 440 parsedliteralwraps=true, 441 verbatimhintsturnover=false, 442 ''', 443 444 # For CJK One-half spacing, need to be in front of hyperref 445 'extrapackages': r'\usepackage{setspace}', 446 447 # Additional stuff for the LaTeX preamble. 448 'preamble': ''' 449 % Use some font with UTF-8 support with XeLaTeX 450 \\usepackage{fontspec} 451 \\setsansfont{DejaVu Sans} 452 \\setromanfont{DejaVu Serif} 453 \\setmonofont{DejaVu Sans Mono} 454 ''', 455} 456 457# Fix reference escape troubles with Sphinx 1.4.x 458if major == 1: 459 latex_elements['preamble'] += '\\renewcommand*{\\DUrole}[2]{ #2 }\n' 460 461 462# Load kerneldoc specific LaTeX settings 463latex_elements['preamble'] += ''' 464 % Load kerneldoc specific LaTeX settings 465 \\input{kerneldoc-preamble.sty} 466''' 467 468# With Sphinx 1.6, it is possible to change the Bg color directly 469# by using: 470# \definecolor{sphinxnoteBgColor}{RGB}{204,255,255} 471# \definecolor{sphinxwarningBgColor}{RGB}{255,204,204} 472# \definecolor{sphinxattentionBgColor}{RGB}{255,255,204} 473# \definecolor{sphinximportantBgColor}{RGB}{192,255,204} 474# 475# However, it require to use sphinx heavy box with: 476# 477# \renewenvironment{sphinxlightbox} {% 478# \\begin{sphinxheavybox} 479# } 480# \\end{sphinxheavybox} 481# } 482# 483# Unfortunately, the implementation is buggy: if a note is inside a 484# table, it isn't displayed well. So, for now, let's use boring 485# black and white notes. 486 487# Grouping the document tree into LaTeX files. List of tuples 488# (source start file, target name, title, 489# author, documentclass [howto, manual, or own class]). 490# Sorted in alphabetical order 491latex_documents = [ 492] 493 494# Add all other index files from Documentation/ subdirectories 495for fn in os.listdir('.'): 496 doc = os.path.join(fn, "index") 497 if os.path.exists(doc + ".rst"): 498 has = False 499 for l in latex_documents: 500 if l[0] == doc: 501 has = True 502 break 503 if not has: 504 latex_documents.append((doc, fn + '.tex', 505 'Linux %s Documentation' % fn.capitalize(), 506 'The kernel development community', 507 'manual')) 508 509# The name of an image file (relative to this directory) to place at the top of 510# the title page. 511#latex_logo = None 512 513# For "manual" documents, if this is true, then toplevel headings are parts, 514# not chapters. 515#latex_use_parts = False 516 517# If true, show page references after internal links. 518#latex_show_pagerefs = False 519 520# If true, show URL addresses after external links. 521#latex_show_urls = False 522 523# Documents to append as an appendix to all manuals. 524#latex_appendices = [] 525 526# If false, no module index is generated. 527#latex_domain_indices = True 528 529# Additional LaTeX stuff to be copied to build directory 530latex_additional_files = [ 531 'sphinx/kerneldoc-preamble.sty', 532] 533 534 535# -- Options for manual page output --------------------------------------- 536 537# One entry per manual page. List of tuples 538# (source start file, name, description, authors, manual section). 539man_pages = [ 540 (master_doc, 'thelinuxkernel', 'The Linux Kernel Documentation', 541 [author], 1) 542] 543 544# If true, show URL addresses after external links. 545#man_show_urls = False 546 547 548# -- Options for Texinfo output ------------------------------------------- 549 550# Grouping the document tree into Texinfo files. List of tuples 551# (source start file, target name, title, author, 552# dir menu entry, description, category) 553texinfo_documents = [ 554 (master_doc, 'TheLinuxKernel', 'The Linux Kernel Documentation', 555 author, 'TheLinuxKernel', 'One line description of project.', 556 'Miscellaneous'), 557] 558 559# Documents to append as an appendix to all manuals. 560#texinfo_appendices = [] 561 562# If false, no module index is generated. 563#texinfo_domain_indices = True 564 565# How to display URL addresses: 'footnote', 'no', or 'inline'. 566#texinfo_show_urls = 'footnote' 567 568# If true, do not generate a @detailmenu in the "Top" node's menu. 569#texinfo_no_detailmenu = False 570 571 572# -- Options for Epub output ---------------------------------------------- 573 574# Bibliographic Dublin Core info. 575epub_title = project 576epub_author = author 577epub_publisher = author 578epub_copyright = copyright 579 580# The basename for the epub file. It defaults to the project name. 581#epub_basename = project 582 583# The HTML theme for the epub output. Since the default themes are not 584# optimized for small screen space, using the same theme for HTML and epub 585# output is usually not wise. This defaults to 'epub', a theme designed to save 586# visual space. 587#epub_theme = 'epub' 588 589# The language of the text. It defaults to the language option 590# or 'en' if the language is not set. 591#epub_language = '' 592 593# The scheme of the identifier. Typical schemes are ISBN or URL. 594#epub_scheme = '' 595 596# The unique identifier of the text. This can be a ISBN number 597# or the project homepage. 598#epub_identifier = '' 599 600# A unique identification for the text. 601#epub_uid = '' 602 603# A tuple containing the cover image and cover page html template filenames. 604#epub_cover = () 605 606# A sequence of (type, uri, title) tuples for the guide element of content.opf. 607#epub_guide = () 608 609# HTML files that should be inserted before the pages created by sphinx. 610# The format is a list of tuples containing the path and title. 611#epub_pre_files = [] 612 613# HTML files that should be inserted after the pages created by sphinx. 614# The format is a list of tuples containing the path and title. 615#epub_post_files = [] 616 617# A list of files that should not be packed into the epub file. 618epub_exclude_files = ['search.html'] 619 620# The depth of the table of contents in toc.ncx. 621#epub_tocdepth = 3 622 623# Allow duplicate toc entries. 624#epub_tocdup = True 625 626# Choose between 'default' and 'includehidden'. 627#epub_tocscope = 'default' 628 629# Fix unsupported image types using the Pillow. 630#epub_fix_images = False 631 632# Scale large images. 633#epub_max_image_width = 0 634 635# How to display URL addresses: 'footnote', 'no', or 'inline'. 636#epub_show_urls = 'inline' 637 638# If false, no index is generated. 639#epub_use_index = True 640 641#======= 642# rst2pdf 643# 644# Grouping the document tree into PDF files. List of tuples 645# (source start file, target name, title, author, options). 646# 647# See the Sphinx chapter of https://ralsina.me/static/manual.pdf 648# 649# FIXME: Do not add the index file here; the result will be too big. Adding 650# multiple PDF files here actually tries to get the cross-referencing right 651# *between* PDF files. 652pdf_documents = [ 653 ('kernel-documentation', u'Kernel', u'Kernel', u'J. Random Bozo'), 654] 655 656# kernel-doc extension configuration for running Sphinx directly (e.g. by Read 657# the Docs). In a normal build, these are supplied from the Makefile via command 658# line arguments. 659kerneldoc_bin = '../scripts/kernel-doc' 660kerneldoc_srctree = '..' 661 662# ------------------------------------------------------------------------------ 663# Since loadConfig overwrites settings from the global namespace, it has to be 664# the last statement in the conf.py file 665# ------------------------------------------------------------------------------ 666loadConfig(globals()) 667