Merge https://gitlab.denx.de/u-boot/custodians/u-boot-x86
[platform/kernel/u-boot.git] / doc / conf.py
1 # -*- coding: utf-8 -*-
2 #
3 # The U-Boot 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
15 import sys
16 import os
17 import sphinx
18
19 # Get Sphinx version
20 major, minor, patch = sphinx.version_info[:3]
21
22
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
28
29 # -- General configuration ------------------------------------------------
30
31 # If your documentation needs a minimal Sphinx version, state it here.
32 needs_sphinx = '1.3'
33
34 latex_engine = 'xelatex'
35
36 # Add any Sphinx extension module names here, as strings. They can be
37 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
38 # ones.
39 extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include', 'kfigure']
40
41 #
42 # cdomain is badly broken in Sphinx 3+. Leaving it out generates *most*
43 # of the docs correctly, but not all.
44 #
45 if major >= 3:
46     if (major > 3) or (minor > 0 or patch >= 2):
47         sys.stderr.write('''The build process with Sphinx 3+ is broken.
48 You will have to remove -W in doc/Makefile.
49 ''')
50         # Sphinx c function parser is more pedantic with regards to type
51         # checking. Due to that, having macros at c:function cause problems.
52         # Those needed to be escaped by using c_id_attributes[] array
53         c_id_attributes = [
54
55             # include/linux/compiler.h
56             "__maybe_unused",
57
58             # include/efi.h
59             "EFIAPI",
60
61             # include/efi_loader.h
62             "__efi_runtime",
63         ]
64
65 else:
66     extensions.append('cdomain')
67
68 # The name of the math extension changed on Sphinx 1.4
69 if (major == 1 and minor > 3) or (major > 1):
70     extensions.append("sphinx.ext.imgmath")
71 else:
72     extensions.append("sphinx.ext.pngmath")
73
74 # Add any paths that contain templates here, relative to this directory.
75 templates_path = ['_templates']
76
77 # The suffix(es) of source filenames.
78 # You can specify multiple suffix as a list of string:
79 # source_suffix = ['.rst', '.md']
80 source_suffix = '.rst'
81
82 # The encoding of source files.
83 #source_encoding = 'utf-8-sig'
84
85 # The master toctree document.
86 master_doc = 'index'
87
88 # General information about the project.
89 project = 'Das U-Boot'
90 copyright = 'The U-Boot development community'
91 author = 'The U-Boot development community'
92
93 # The version info for the project you're documenting, acts as replacement for
94 # |version| and |release|, also used in various other places throughout the
95 # built documents.
96 #
97 # In a normal build, version and release are are set to KERNELVERSION and
98 # KERNELRELEASE, respectively, from the Makefile via Sphinx command line
99 # arguments.
100 #
101 # The following code tries to extract the information by reading the Makefile,
102 # when Sphinx is run directly (e.g. by Read the Docs).
103 try:
104     makefile_version = None
105     makefile_patchlevel = None
106     for line in open('../Makefile'):
107         key, val = [x.strip() for x in line.split('=', 2)]
108         if key == 'VERSION':
109             makefile_version = val
110         elif key == 'PATCHLEVEL':
111             makefile_patchlevel = val
112         if makefile_version and makefile_patchlevel:
113             break
114 except:
115     pass
116 finally:
117     if makefile_version and makefile_patchlevel:
118         version = release = makefile_version + '.' + makefile_patchlevel
119     else:
120         version = release = "unknown version"
121
122 # The language for content autogenerated by Sphinx. Refer to documentation
123 # for a list of supported languages.
124 #
125 # This is also used if you do content translation via gettext catalogs.
126 # Usually you set "language" from the command line for these cases.
127 language = None
128
129 # There are two options for replacing |today|: either, you set today to some
130 # non-false value, then it is used:
131 #today = ''
132 # Else, today_fmt is used as the format for a strftime call.
133 #today_fmt = '%B %d, %Y'
134
135 # List of patterns, relative to source directory, that match files and
136 # directories to ignore when looking for source files.
137 exclude_patterns = ['output']
138
139 # The reST default role (used for this markup: `text`) to use for all
140 # documents.
141 #default_role = None
142
143 # If true, '()' will be appended to :func: etc. cross-reference text.
144 #add_function_parentheses = True
145
146 # If true, the current module name will be prepended to all description
147 # unit titles (such as .. function::).
148 #add_module_names = True
149
150 # If true, sectionauthor and moduleauthor directives will be shown in the
151 # output. They are ignored by default.
152 #show_authors = False
153
154 # The name of the Pygments (syntax highlighting) style to use.
155 pygments_style = 'sphinx'
156
157 # A list of ignored prefixes for module index sorting.
158 #modindex_common_prefix = []
159
160 # If true, keep warnings as "system message" paragraphs in the built documents.
161 #keep_warnings = False
162
163 # If true, `todo` and `todoList` produce output, else they produce nothing.
164 todo_include_todos = False
165
166 primary_domain = 'c'
167 highlight_language = 'none'
168
169 # -- Options for HTML output ----------------------------------------------
170
171 # The theme to use for HTML and HTML Help pages.  See the documentation for
172 # a list of builtin themes.
173
174 # The Read the Docs theme is available from
175 # - https://github.com/snide/sphinx_rtd_theme
176 # - https://pypi.python.org/pypi/sphinx_rtd_theme
177 # - python-sphinx-rtd-theme package (on Debian)
178 try:
179     import sphinx_rtd_theme
180     html_theme = 'sphinx_rtd_theme'
181     html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
182 except ImportError:
183     sys.stderr.write('Warning: The Sphinx \'sphinx_rtd_theme\' HTML theme was not found. Make sure you have the theme installed to produce pretty HTML output. Falling back to the default theme.\n')
184
185 # Theme options are theme-specific and customize the look and feel of a theme
186 # further.  For a list of options available for each theme, see the
187 # documentation.
188 #html_theme_options = {}
189
190 # Add any paths that contain custom themes here, relative to this directory.
191 #html_theme_path = []
192
193 # The name for this set of Sphinx documents.  If None, it defaults to
194 # "<project> v<release> documentation".
195 #html_title = None
196
197 # A shorter title for the navigation bar.  Default is the same as html_title.
198 #html_short_title = None
199
200 # The name of an image file (relative to this directory) to place at the top
201 # of the sidebar.
202 html_logo = '../tools/logos/u-boot_logo.svg'
203
204 # The name of an image file (within the static path) to use as favicon of the
205 # docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
206 # pixels large.
207 #html_favicon = None
208
209 # Add any paths that contain custom static files (such as style sheets) here,
210 # relative to this directory. They are copied after the builtin static files,
211 # so a file named "default.css" will overwrite the builtin "default.css".
212
213 html_static_path = ['sphinx-static']
214
215 html_context = {
216     'css_files': [
217         '_static/theme_overrides.css',
218     ],
219 }
220
221 # Add any extra paths that contain custom files (such as robots.txt or
222 # .htaccess) here, relative to this directory. These files are copied
223 # directly to the root of the documentation.
224 #html_extra_path = []
225
226 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
227 # using the given strftime format.
228 #html_last_updated_fmt = '%b %d, %Y'
229
230 # If true, SmartyPants will be used to convert quotes and dashes to
231 # typographically correct entities.
232 #html_use_smartypants = True
233
234 # Custom sidebar templates, maps document names to template names.
235 #html_sidebars = {}
236
237 # Additional templates that should be rendered to pages, maps page names to
238 # template names.
239 #html_additional_pages = {}
240
241 # If false, no module index is generated.
242 #html_domain_indices = True
243
244 # If false, no index is generated.
245 #html_use_index = True
246
247 # If true, the index is split into individual pages for each letter.
248 #html_split_index = False
249
250 # If true, links to the reST sources are added to the pages.
251 #html_show_sourcelink = True
252
253 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
254 #html_show_sphinx = True
255
256 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
257 #html_show_copyright = True
258
259 # If true, an OpenSearch description file will be output, and all pages will
260 # contain a <link> tag referring to it.  The value of this option must be the
261 # base URL from which the finished HTML is served.
262 #html_use_opensearch = ''
263
264 # This is the file name suffix for HTML files (e.g. ".xhtml").
265 #html_file_suffix = None
266
267 # Language to be used for generating the HTML full-text search index.
268 # Sphinx supports the following languages:
269 #   'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
270 #   'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'
271 #html_search_language = 'en'
272
273 # A dictionary with options for the search language support, empty by default.
274 # Now only 'ja' uses this config value
275 #html_search_options = {'type': 'default'}
276
277 # The name of a javascript file (relative to the configuration directory) that
278 # implements a search results scorer. If empty, the default will be used.
279 #html_search_scorer = 'scorer.js'
280
281 # Output file base name for HTML help builder.
282 htmlhelp_basename = 'TheUBootdoc'
283
284 # -- Options for LaTeX output ---------------------------------------------
285
286 latex_elements = {
287 # The paper size ('letterpaper' or 'a4paper').
288 'papersize': 'a4paper',
289
290 # The font size ('10pt', '11pt' or '12pt').
291 'pointsize': '8pt',
292
293 # Latex figure (float) alignment
294 #'figure_align': 'htbp',
295
296 # Don't mangle with UTF-8 chars
297 'inputenc': '',
298 'utf8extra': '',
299
300 # Additional stuff for the LaTeX preamble.
301     'preamble': '''
302         % Use some font with UTF-8 support with XeLaTeX
303         \\usepackage{fontspec}
304         \\setsansfont{DejaVu Serif}
305         \\setromanfont{DejaVu Sans}
306         \\setmonofont{DejaVu Sans Mono}
307
308      '''
309 }
310
311 # Fix reference escape troubles with Sphinx 1.4.x
312 if major == 1 and minor > 3:
313     latex_elements['preamble']  += '\\renewcommand*{\\DUrole}[2]{ #2 }\n'
314
315 if major == 1 and minor <= 4:
316     latex_elements['preamble']  += '\\usepackage[margin=0.5in, top=1in, bottom=1in]{geometry}'
317 elif major == 1 and (minor > 5 or (minor == 5 and patch >= 3)):
318     latex_elements['sphinxsetup'] = 'hmargin=0.5in, vmargin=1in'
319     latex_elements['preamble']  += '\\fvset{fontsize=auto}\n'
320
321 # Customize notice background colors on Sphinx < 1.6:
322 if major == 1 and minor < 6:
323    latex_elements['preamble']  += '''
324         \\usepackage{ifthen}
325
326         % Put notes in color and let them be inside a table
327         \\definecolor{NoteColor}{RGB}{204,255,255}
328         \\definecolor{WarningColor}{RGB}{255,204,204}
329         \\definecolor{AttentionColor}{RGB}{255,255,204}
330         \\definecolor{ImportantColor}{RGB}{192,255,204}
331         \\definecolor{OtherColor}{RGB}{204,204,204}
332         \\newlength{\\mynoticelength}
333         \\makeatletter\\newenvironment{coloredbox}[1]{%
334            \\setlength{\\fboxrule}{1pt}
335            \\setlength{\\fboxsep}{7pt}
336            \\setlength{\\mynoticelength}{\\linewidth}
337            \\addtolength{\\mynoticelength}{-2\\fboxsep}
338            \\addtolength{\\mynoticelength}{-2\\fboxrule}
339            \\begin{lrbox}{\\@tempboxa}\\begin{minipage}{\\mynoticelength}}{\\end{minipage}\\end{lrbox}%
340            \\ifthenelse%
341               {\\equal{\\py@noticetype}{note}}%
342               {\\colorbox{NoteColor}{\\usebox{\\@tempboxa}}}%
343               {%
344                  \\ifthenelse%
345                  {\\equal{\\py@noticetype}{warning}}%
346                  {\\colorbox{WarningColor}{\\usebox{\\@tempboxa}}}%
347                  {%
348                     \\ifthenelse%
349                     {\\equal{\\py@noticetype}{attention}}%
350                     {\\colorbox{AttentionColor}{\\usebox{\\@tempboxa}}}%
351                     {%
352                        \\ifthenelse%
353                        {\\equal{\\py@noticetype}{important}}%
354                        {\\colorbox{ImportantColor}{\\usebox{\\@tempboxa}}}%
355                        {\\colorbox{OtherColor}{\\usebox{\\@tempboxa}}}%
356                     }%
357                  }%
358               }%
359         }\\makeatother
360
361         \\makeatletter
362         \\renewenvironment{notice}[2]{%
363           \\def\\py@noticetype{#1}
364           \\begin{coloredbox}{#1}
365           \\bf\\it
366           \\par\\strong{#2}
367           \\csname py@noticestart@#1\\endcsname
368         }
369         {
370           \\csname py@noticeend@\\py@noticetype\\endcsname
371           \\end{coloredbox}
372         }
373         \\makeatother
374
375      '''
376
377 # With Sphinx 1.6, it is possible to change the Bg color directly
378 # by using:
379 #       \definecolor{sphinxnoteBgColor}{RGB}{204,255,255}
380 #       \definecolor{sphinxwarningBgColor}{RGB}{255,204,204}
381 #       \definecolor{sphinxattentionBgColor}{RGB}{255,255,204}
382 #       \definecolor{sphinximportantBgColor}{RGB}{192,255,204}
383 #
384 # However, it require to use sphinx heavy box with:
385 #
386 #       \renewenvironment{sphinxlightbox} {%
387 #               \\begin{sphinxheavybox}
388 #       }
389 #               \\end{sphinxheavybox}
390 #       }
391 #
392 # Unfortunately, the implementation is buggy: if a note is inside a
393 # table, it isn't displayed well. So, for now, let's use boring
394 # black and white notes.
395
396 # Grouping the document tree into LaTeX files. List of tuples
397 # (source start file, target name, title,
398 #  author, documentclass [howto, manual, or own class]).
399 # Sorted in alphabetical order
400 latex_documents = [
401     ('index', 'u-boot-hacker-manual.tex', 'U-Boot Hacker Manual',
402      'The U-Boot development community', 'manual'),
403 ]
404
405 # The name of an image file (relative to this directory) to place at the top of
406 # the title page.
407 #latex_logo = None
408
409 # For "manual" documents, if this is true, then toplevel headings are parts,
410 # not chapters.
411 #latex_use_parts = False
412
413 # If true, show page references after internal links.
414 #latex_show_pagerefs = False
415
416 # If true, show URL addresses after external links.
417 #latex_show_urls = False
418
419 # Documents to append as an appendix to all manuals.
420 #latex_appendices = []
421
422 # If false, no module index is generated.
423 #latex_domain_indices = True
424
425
426 # -- Options for manual page output ---------------------------------------
427
428 # One entry per manual page. List of tuples
429 # (source start file, name, description, authors, manual section).
430 man_pages = [
431     (master_doc, 'dasuboot', 'The U-Boot Documentation',
432      [author], 1)
433 ]
434
435 # If true, show URL addresses after external links.
436 #man_show_urls = False
437
438
439 # -- Options for Texinfo output -------------------------------------------
440
441 # Grouping the document tree into Texinfo files. List of tuples
442 # (source start file, target name, title, author,
443 #  dir menu entry, description, category)
444 texinfo_documents = [
445     (master_doc, 'DasUBoot', 'The U-Boot Documentation',
446      author, 'DasUBoot', 'One line description of project.',
447      'Miscellaneous'),
448 ]
449
450 # Documents to append as an appendix to all manuals.
451 #texinfo_appendices = []
452
453 # If false, no module index is generated.
454 #texinfo_domain_indices = True
455
456 # How to display URL addresses: 'footnote', 'no', or 'inline'.
457 #texinfo_show_urls = 'footnote'
458
459 # If true, do not generate a @detailmenu in the "Top" node's menu.
460 #texinfo_no_detailmenu = False
461
462
463 # -- Options for Epub output ----------------------------------------------
464
465 # Bibliographic Dublin Core info.
466 epub_title = project
467 epub_author = author
468 epub_publisher = author
469 epub_copyright = copyright
470
471 # The basename for the epub file. It defaults to the project name.
472 #epub_basename = project
473
474 # The HTML theme for the epub output. Since the default themes are not
475 # optimized for small screen space, using the same theme for HTML and epub
476 # output is usually not wise. This defaults to 'epub', a theme designed to save
477 # visual space.
478 #epub_theme = 'epub'
479
480 # The language of the text. It defaults to the language option
481 # or 'en' if the language is not set.
482 #epub_language = ''
483
484 # The scheme of the identifier. Typical schemes are ISBN or URL.
485 #epub_scheme = ''
486
487 # The unique identifier of the text. This can be a ISBN number
488 # or the project homepage.
489 #epub_identifier = ''
490
491 # A unique identification for the text.
492 #epub_uid = ''
493
494 # A tuple containing the cover image and cover page html template filenames.
495 #epub_cover = ()
496
497 # A sequence of (type, uri, title) tuples for the guide element of content.opf.
498 #epub_guide = ()
499
500 # HTML files that should be inserted before the pages created by sphinx.
501 # The format is a list of tuples containing the path and title.
502 #epub_pre_files = []
503
504 # HTML files that should be inserted after the pages created by sphinx.
505 # The format is a list of tuples containing the path and title.
506 #epub_post_files = []
507
508 # A list of files that should not be packed into the epub file.
509 epub_exclude_files = ['search.html']
510
511 # The depth of the table of contents in toc.ncx.
512 #epub_tocdepth = 3
513
514 # Allow duplicate toc entries.
515 #epub_tocdup = True
516
517 # Choose between 'default' and 'includehidden'.
518 #epub_tocscope = 'default'
519
520 # Fix unsupported image types using the Pillow.
521 #epub_fix_images = False
522
523 # Scale large images.
524 #epub_max_image_width = 0
525
526 # How to display URL addresses: 'footnote', 'no', or 'inline'.
527 #epub_show_urls = 'inline'
528
529 # If false, no index is generated.
530 #epub_use_index = True
531
532 #=======
533 # rst2pdf
534 #
535 # Grouping the document tree into PDF files. List of tuples
536 # (source start file, target name, title, author, options).
537 #
538 # See the Sphinx chapter of http://ralsina.me/static/manual.pdf
539 #
540 # FIXME: Do not add the index file here; the result will be too big. Adding
541 # multiple PDF files here actually tries to get the cross-referencing right
542 # *between* PDF files.
543 pdf_documents = [
544     ('uboot-documentation', u'U-Boot', u'U-Boot', u'J. Random Bozo'),
545 ]
546
547 # kernel-doc extension configuration for running Sphinx directly (e.g. by Read
548 # the Docs). In a normal build, these are supplied from the Makefile via command
549 # line arguments.
550 kerneldoc_bin = '../scripts/kernel-doc'
551 kerneldoc_srctree = '..'
552
553 # ------------------------------------------------------------------------------
554 # Since loadConfig overwrites settings from the global namespace, it has to be
555 # the last statement in the conf.py file
556 # ------------------------------------------------------------------------------
557 loadConfig(globals())