2015-02-11 15:22:56 +07:00
|
|
|
# Makefile for Sphinx documentation
|
|
|
|
|
2021-01-29 01:05:48 +07:00
|
|
|
SPHINX_BUILD = sphinx-build
|
|
|
|
CONFIG_DIR = .
|
2021-02-01 14:58:35 +07:00
|
|
|
SPHINXOPTS = -D project_root=$(ROOT) -D canonical_version=$(CANONICAL_VERSION) \
|
|
|
|
-D versions=$(VERSIONS) -D languages=$(LANGUAGES) -D language=$(CURRENT_LANG) \
|
2021-04-27 22:37:13 +07:00
|
|
|
-D is_remote_build=$(IS_REMOTE_BUILD) \
|
2021-04-28 18:47:01 +07:00
|
|
|
-A google_analytics_key=$(GOOGLE_ANALYTICS_KEY) \
|
|
|
|
-j auto
|
2021-01-29 01:05:48 +07:00
|
|
|
SOURCE_DIR = content
|
|
|
|
BUILD_DIR = _build
|
|
|
|
|
2021-04-27 22:37:13 +07:00
|
|
|
HTML_BUILD_DIR = $(BUILD_DIR)/html
|
|
|
|
ifdef VERSIONS
|
|
|
|
HTML_BUILD_DIR := $(HTML_BUILD_DIR)/12.0
|
|
|
|
endif
|
|
|
|
ifneq ($(CURRENT_LANG),en)
|
|
|
|
HTML_BUILD_DIR := $(HTML_BUILD_DIR)/$(CURRENT_LANG)
|
2021-03-10 22:48:02 +07:00
|
|
|
endif
|
|
|
|
|
|
|
|
#=== Standard rules ===#
|
|
|
|
|
2021-01-29 01:05:48 +07:00
|
|
|
# In first position to build the documentation from scratch by default
|
|
|
|
all: html
|
2015-02-11 15:22:56 +07:00
|
|
|
|
|
|
|
help:
|
2021-01-29 01:05:48 +07:00
|
|
|
@echo "Please use 'make <target>' where <target> is one of"
|
|
|
|
@echo " html to build the documentation to HTML"
|
2021-01-29 15:27:18 +07:00
|
|
|
@echo " fast to build the documentation to HTML with shallow menu (faster)"
|
2021-01-29 01:05:48 +07:00
|
|
|
@echo " clean to delete the build files"
|
2015-02-11 15:22:56 +07:00
|
|
|
|
|
|
|
clean:
|
2021-01-29 01:05:48 +07:00
|
|
|
@echo "Cleaning build files..."
|
2021-04-27 22:37:13 +07:00
|
|
|
rm -rf $(BUILD_DIR)/*
|
|
|
|
rm extensions/odoo_theme/static/style.css
|
2021-01-29 01:05:48 +07:00
|
|
|
@echo "Cleaning finished."
|
2015-02-11 15:22:56 +07:00
|
|
|
|
2021-01-29 01:05:48 +07:00
|
|
|
html: extensions/odoo_theme/static/style.css
|
|
|
|
@echo "Starting build..."
|
2021-04-27 22:37:13 +07:00
|
|
|
$(SPHINX_BUILD) -c $(CONFIG_DIR) -b html $(SPHINXOPTS) $(SOURCE_DIR) $(HTML_BUILD_DIR)
|
2015-02-11 15:22:56 +07:00
|
|
|
@echo "Build finished."
|
|
|
|
|
2021-04-26 21:53:25 +07:00
|
|
|
# To call *after* `make html`
|
|
|
|
# Binary dependencies (Debian): texlive-fonts-recommended texlive-latex-extra
|
|
|
|
# texlive-generic-recommended texlive-fonts-extra
|
2021-03-15 20:25:32 +07:00
|
|
|
latexpdf:
|
|
|
|
@echo "Starting build..."
|
|
|
|
$(SPHINX_BUILD) -c $(CONFIG_DIR) -b latex $(SPHINXOPTS) $(SOURCE_DIR) $(BUILD_DIR)/latex
|
|
|
|
$(MAKE) -C $(BUILD_DIR)/latex
|
2021-03-18 22:33:10 +07:00
|
|
|
cp $(BUILD_DIR)/latex/*.pdf $(BUILD_DIR)/html/
|
2021-03-15 20:25:32 +07:00
|
|
|
@echo "Build finished."
|
|
|
|
|
2021-03-10 22:48:02 +07:00
|
|
|
l10n:
|
|
|
|
@echo "Generating translatable files..."
|
|
|
|
$(SPHINX_BUILD) -c $(CONFIG_DIR) -b gettext $(SOURCE_DIR) $(BUILD_DIR)/gettext
|
|
|
|
@echo "Generation finished."
|
|
|
|
@echo "Localizing translation strings..."
|
2021-04-27 20:10:00 +07:00
|
|
|
sphinx-intl update -p $(BUILD_DIR)/gettext -l $(L10N_LANGUAGES)
|
2021-03-10 22:48:02 +07:00
|
|
|
@echo "Localization finished."
|
2021-01-29 15:27:18 +07:00
|
|
|
|
2021-02-26 22:43:12 +07:00
|
|
|
extensions/odoo_theme/static/style.css: extensions/odoo_theme/static/style.scss extensions/odoo_theme/static/scss/*.scss
|
2021-01-29 01:05:48 +07:00
|
|
|
@echo "Compiling stylesheets..."
|
|
|
|
pysassc $(subst .css,.scss,$@) $@
|
|
|
|
@echo "Compilation finished."
|
2021-03-10 22:48:02 +07:00
|
|
|
|
2021-04-26 21:53:25 +07:00
|
|
|
#=== Development and debugging rules ===#
|
2021-03-10 22:48:02 +07:00
|
|
|
|
|
|
|
fast: SPHINXOPTS += -A collapse_menu=True
|
|
|
|
fast: html
|
|
|
|
|
|
|
|
static: extensions/odoo_theme/static/style.css
|
|
|
|
cp -r extensions/odoo_theme/static/* _build/html/_static/
|
|
|
|
cp -r static/* _build/html/_static/
|