|
1 | 1 | # Makefile for Sphinx documentation
|
2 |
| -# |
3 | 2 |
|
4 |
| -# You can set these variables from the command line. |
5 |
| -SPHINXOPTS = |
6 |
| -SPHINXBUILD = sphinx-build |
7 |
| -PAPER = |
8 |
| -BUILDDIR = _build |
9 |
| -LESSOPTS = |
10 |
| - |
11 |
| -# User-friendly check for sphinx-build |
12 |
| -ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) |
13 |
| -$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed; then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively, you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) |
| 3 | +SPHINX_BUILD = sphinx-build |
| 4 | +CONFIG_DIR = . |
| 5 | +SPHINXOPTS = -D project_root=$(ROOT) -D canonical_version=$(CANONICAL_VERSION) \ |
| 6 | + -D versions=$(VERSIONS) -D languages=$(LANGUAGES) -D language=$(CURRENT_LANG) \ |
| 7 | + -D is_remote_build=$(IS_REMOTE_BUILD) \ |
| 8 | + -A google_analytics_key=$(GOOGLE_ANALYTICS_KEY) \ |
| 9 | + -j auto |
| 10 | +SOURCE_DIR = content |
| 11 | +BUILD_DIR = _build |
| 12 | + |
| 13 | +HTML_BUILD_DIR = $(BUILD_DIR)/html |
| 14 | +ifdef VERSIONS |
| 15 | + HTML_BUILD_DIR := $(HTML_BUILD_DIR)/master |
| 16 | +endif |
| 17 | +ifneq ($(CURRENT_LANG),en) |
| 18 | + HTML_BUILD_DIR := $(HTML_BUILD_DIR)/$(CURRENT_LANG) |
14 | 19 | endif
|
15 | 20 |
|
16 |
| -# Internal variables. |
17 |
| -PAPEROPT_a4 = -D latex_paper_size=a4 |
18 |
| -PAPEROPT_letter = -D latex_paper_size=letter |
19 |
| -ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . |
20 |
| -ALLI18NSPHINXOPTS = -d $(BUILDDIR)/doctrees/$(LANG) $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) -D language=$(LANG) . |
21 |
| -# the i18n builder cannot share the environment and doctrees with the others |
22 |
| -I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . |
23 |
| - |
24 |
| -lessfiles = _extensions/odoo/static/*.less |
25 |
| -_extensions/odoo/static/style.css: $(lessfiles) |
26 |
| - lessc $(LESSOPTS) $(subst .css,.less,$@) $@ |
| 21 | +#=== Standard rules ===# |
27 | 22 |
|
28 |
| -.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext |
| 23 | +# In first position to build the documentation from scratch by default |
| 24 | +all: html |
29 | 25 |
|
30 |
| -# Displays list of commands |
31 | 26 | help:
|
32 |
| - @echo "Please use \`make <target>' where <target> is one of" |
33 |
| - @echo " clean to delete the build" |
34 |
| - @echo " html to make standalone HTML files" |
35 |
| - @echo " i18nhtml to make standalone translated HTML files" |
36 |
| - @echo " dirhtml to make HTML files named index.html in directories" |
37 |
| - @echo " singlehtml to make a single large HTML file" |
38 |
| - @echo " pickle to make pickle files" |
39 |
| - @echo " json to make JSON files" |
40 |
| - @echo " htmlhelp to make HTML files and an HTML help project" |
41 |
| - @echo " qthelp to make HTML files and a qthelp project" |
42 |
| - @echo " devhelp to make HTML files and a Devhelp project" |
43 |
| - @echo " epub to make an epub" |
44 |
| - @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" |
45 |
| - @echo " latexpdf to make LaTeX files and run them through pdflatex" |
46 |
| - @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" |
47 |
| - @echo " text to make text files" |
48 |
| - @echo " man to make manual pages" |
49 |
| - @echo " texinfo to make Texinfo files" |
50 |
| - @echo " info to make Texinfo files and run them through makeinfo" |
51 |
| - @echo " gettext to make PO message catalogs" |
52 |
| - @echo " changes to make an overview of all changed/added/deprecated items" |
53 |
| - @echo " xml to make Docutils-native XML files" |
54 |
| - @echo " pseudoxml to make pseudoxml-XML files for display purposes" |
55 |
| - @echo " linkcheck to check all external links for integrity" |
56 |
| - @echo " doctest to run all doctests embedded in the documentation (if enabled)" |
| 27 | + @echo "Please use 'make <target>' where <target> is one of" |
| 28 | + @echo " html to build the documentation to HTML" |
| 29 | + @echo " fast to build the documentation to HTML with shallow menu (faster)" |
| 30 | + @echo " clean to delete the build files" |
57 | 31 |
|
58 |
| -# Deletes the build |
59 | 32 | clean:
|
60 |
| - rm -rf $(BUILDDIR)/* |
61 |
| - |
62 |
| -# These commands are used to create files or run tests |
63 |
| -html: _extensions/odoo/static/style.css |
64 |
| - $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html |
65 |
| - @echo |
66 |
| - @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." |
67 |
| - |
68 |
| -i18nhtml: _extensions/odoo/static/style.css |
69 |
| - $(SPHINXBUILD) -b html $(ALLI18NSPHINXOPTS) $(BUILDDIR)/html/$(LANG) |
70 |
| - @echo |
71 |
| - @echo "Build finished. The HTML pages are in $(BUILDDIR)/html/$(LANG)." |
72 |
| - |
73 |
| -dirhtml: |
74 |
| - $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml |
75 |
| - @echo |
76 |
| - @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." |
77 |
| - |
78 |
| -singlehtml: |
79 |
| - $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml |
80 |
| - @echo |
81 |
| - @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." |
82 |
| - |
83 |
| -pickle: |
84 |
| - $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle |
85 |
| - @echo |
86 |
| - @echo "Build finished. Now you can process the pickle files." |
87 |
| - |
88 |
| -json: |
89 |
| - $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json |
90 |
| - @echo |
91 |
| - @echo "Build finished. Now you can process the JSON files." |
92 |
| - |
93 |
| -htmlhelp: |
94 |
| - $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp |
95 |
| - @echo |
96 |
| - @echo "Build finished. Now you can run HTML Help Workshop with the" \ |
97 |
| - ".hhp project file in $(BUILDDIR)/htmlhelp." |
98 |
| - |
99 |
| -qthelp: |
100 |
| - $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp |
101 |
| - @echo |
102 |
| - @echo "Build finished. Now you can run "qcollectiongenerator" with the" \ |
103 |
| - ".qhcp project file in $(BUILDDIR)/qthelp, like this:" |
104 |
| - @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/UnderstandingAccountingForEntrepreneurs.qhcp" |
105 |
| - @echo "To view the help file:" |
106 |
| - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/UnderstandingAccountingForEntrepreneurs.qhc" |
107 |
| - |
108 |
| -devhelp: |
109 |
| - $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp |
110 |
| - @echo |
| 33 | + @echo "Cleaning build files..." |
| 34 | + rm -rf $(BUILD_DIR)/* |
| 35 | + rm extensions/odoo_theme/static/style.css |
| 36 | + @echo "Cleaning finished." |
| 37 | + |
| 38 | +html: extensions/odoo_theme/static/style.css |
| 39 | + @echo "Starting build..." |
| 40 | + $(SPHINX_BUILD) -c $(CONFIG_DIR) -b html $(SPHINXOPTS) $(SOURCE_DIR) $(HTML_BUILD_DIR) |
111 | 41 | @echo "Build finished."
|
112 |
| - @echo "To view the help file:" |
113 |
| - @echo "# mkdir -p $$HOME/.local/share/devhelp/UnderstandingAccountingForEntrepreneurs" |
114 |
| - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/UnderstandingAccountingForEntrepreneurs" |
115 |
| - @echo "# devhelp" |
116 |
| - |
117 |
| -epub: |
118 |
| - $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub |
119 |
| - @echo |
120 |
| - @echo "Build finished. The epub file is in $(BUILDDIR)/epub." |
121 |
| - |
122 |
| -latex: |
123 |
| - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex |
124 |
| - @echo |
125 |
| - @echo "Build finished. The LaTeX files are in $(BUILDDIR)/latex." |
126 |
| - @echo "Run \`make' in that directory to run these through (pdf)latex" \ |
127 |
| - "(use \`make latexpdf' here to do that automatically)." |
128 | 42 |
|
| 43 | +# To call *after* `make html` |
| 44 | +# Binary dependencies (Debian): texlive-fonts-recommended texlive-latex-extra |
| 45 | +# texlive-generic-recommended texlive-fonts-extra |
129 | 46 | latexpdf:
|
130 |
| - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex |
131 |
| - @echo "Running LaTeX files through pdflatex..." |
132 |
| - $(MAKE) -C $(BUILDDIR)/latex all-pdf |
133 |
| - @echo "pdflatex finished. The PDF files are in $(BUILDDIR)/latex." |
134 |
| - cp $(BUILDDIR)/latex/*.pdf $(BUILDDIR)/html/ |
135 |
| - |
136 |
| -latexpdfja: |
137 |
| - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex |
138 |
| - @echo "Running LaTeX files through platex and dvipdfmx..." |
139 |
| - $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja |
140 |
| - @echo "pdflatex finished. The PDF files are in $(BUILDDIR)/latex." |
141 |
| - |
142 |
| -text: |
143 |
| - $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text |
144 |
| - @echo |
145 |
| - @echo "Build finished. The text files are in $(BUILDDIR)/text." |
146 |
| - |
147 |
| -man: |
148 |
| - $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man |
149 |
| - @echo |
150 |
| - @echo "Build finished. The manual pages are in $(BUILDDIR)/man." |
151 |
| - |
152 |
| -texinfo: |
153 |
| - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo |
154 |
| - @echo |
155 |
| - @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." |
156 |
| - @echo "Run \`make' in that directory to run these through makeinfo" \ |
157 |
| - "(use \`make info' here to do that automatically)." |
158 |
| - |
159 |
| -info: |
160 |
| - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo |
161 |
| - @echo "Running Texinfo files through makeinfo..." |
162 |
| - make -C $(BUILDDIR)/texinfo info |
163 |
| - @echo "makeinfo finished. The Info files are in $(BUILDDIR)/texinfo." |
164 |
| - |
165 |
| -gettext: |
166 |
| - $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) locale/sources |
167 |
| - @echo |
168 |
| - @echo "Build finished. The message catalogs are in locale/sources." |
| 47 | + @echo "Starting build..." |
| 48 | + $(SPHINX_BUILD) -c $(CONFIG_DIR) -b latex $(SPHINXOPTS) $(SOURCE_DIR) $(BUILD_DIR)/latex |
| 49 | + $(MAKE) -C $(BUILD_DIR)/latex |
| 50 | + cp $(BUILD_DIR)/latex/*.pdf $(BUILD_DIR)/html/ |
| 51 | + @echo "Build finished." |
169 | 52 |
|
170 |
| -changes: |
171 |
| - $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes |
172 |
| - @echo |
173 |
| - @echo "The overview file is in $(BUILDDIR)/changes." |
| 53 | +l10n: |
| 54 | + @echo "Generating translatable files..." |
| 55 | + $(SPHINX_BUILD) -c $(CONFIG_DIR) -b gettext $(SOURCE_DIR) $(BUILD_DIR)/gettext |
| 56 | + @echo "Generation finished." |
| 57 | + @echo "Localizing translation strings..." |
| 58 | + sphinx-intl update -p $(BUILD_DIR)/gettext -l $(L10N_LANGUAGES) |
| 59 | + @echo "Localization finished." |
174 | 60 |
|
175 |
| -linkcheck: |
176 |
| - $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck |
177 |
| - @echo |
178 |
| - @echo "Link check complete. Look for any errors in the above output " \ |
179 |
| - "or in $(BUILDDIR)/linkcheck/output.txt." |
| 61 | +extensions/odoo_theme/static/style.css: extensions/odoo_theme/static/style.scss extensions/odoo_theme/static/scss/*.scss |
| 62 | + @echo "Compiling stylesheets..." |
| 63 | + pysassc $(subst .css,.scss,$@) $@ |
| 64 | + @echo "Compilation finished." |
180 | 65 |
|
181 |
| -doctest: |
182 |
| - $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest |
183 |
| - @echo "Testing of doctests in the sources finished. Look at the " \ |
184 |
| - "results in $(BUILDDIR)/doctest/output.txt." |
| 66 | +#=== Development and debugging rules ===# |
185 | 67 |
|
186 |
| -xml: |
187 |
| - $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml |
188 |
| - @echo |
189 |
| - @echo "Build finished. The XML files are in $(BUILDDIR)/xml." |
| 68 | +fast: SPHINXOPTS += -A collapse_menu=True |
| 69 | +fast: html |
190 | 70 |
|
191 |
| -pseudoxml: |
192 |
| - $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml |
193 |
| - @echo |
194 |
| - @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." |
| 71 | +static: extensions/odoo_theme/static/style.css |
| 72 | + cp -r extensions/odoo_theme/static/* _build/html/_static/ |
| 73 | + cp -r static/* _build/html/_static/ |
0 commit comments