Files
documentation/Makefile
T

85 lines
2.6 KiB
Makefile
Raw Normal View History

2015-02-11 09:22:56 +01:00
# Makefile for Sphinx documentation
# Pass WORKERS=1 for single-worker build
2021-04-30 12:40:29 +02:00
ifndef WORKERS
WORKERS = auto
2015-02-11 09:22:56 +01:00
endif
ifndef BUILD_DIR
BUILD_DIR = _build
endif
ifndef CURRENT_LANG
CURRENT_LANG = en
endif
2021-04-30 12:40:29 +02:00
SPHINX_BUILD = sphinx-build
CONFIG_DIR = .
SPHINXOPTS = -D project_root=$(ROOT) -D canonical_version=$(CANONICAL_VERSION) \
-D versions=$(VERSIONS) -D languages=$(LANGUAGES) -D language=$(CURRENT_LANG) \
-D is_remote_build=$(IS_REMOTE_BUILD) \
-A google_analytics_key=$(GOOGLE_ANALYTICS_KEY) \
-A plausible_script=$(PLAUSIBLE_SCRIPT) \
-A plausible_domain=$(PLAUSIBLE_DOMAIN) \
2021-04-30 12:40:29 +02:00
-j $(WORKERS)
SOURCE_DIR = content
2021-04-30 12:40:29 +02:00
HTML_BUILD_DIR = $(BUILD_DIR)/html
ifdef VERSIONS
HTML_BUILD_DIR := $(HTML_BUILD_DIR)/master
2021-04-30 12:40:29 +02:00
endif
ifneq ($(CURRENT_LANG),en)
HTML_BUILD_DIR := $(HTML_BUILD_DIR)/$(CURRENT_LANG)
endif
2015-02-11 09:22:56 +01:00
2021-04-30 12:40:29 +02:00
#=== Standard rules ===#
2021-04-30 12:40:29 +02:00
# In first position to build the documentation from scratch by default
all: html
2015-02-11 09:22:56 +01:00
help:
2021-04-30 12:40:29 +02:00
@echo "Please use 'make <target>' where <target> is one of"
@echo " html to build the documentation to HTML"
@echo " fast to build the documentation to HTML with shallow menu (faster)"
@echo " clean to delete the build files"
2015-02-11 09:22:56 +01:00
clean:
2021-04-30 12:40:29 +02:00
@echo "Cleaning build files..."
rm -rf $(BUILD_DIR)/*
@echo "Cleaning finished."
2021-08-05 08:18:09 +00:00
html: $(HTML_BUILD_DIR)/_static/style.css
2021-04-30 12:40:29 +02:00
@echo "Starting build..."
$(SPHINX_BUILD) -c $(CONFIG_DIR) -b html $(SPHINXOPTS) $(SOURCE_DIR) $(HTML_BUILD_DIR)
2015-02-11 09:22:56 +01:00
@echo "Build finished."
2021-04-30 12:40:29 +02:00
# To call *after* `make html`
# Binary dependencies (Debian): texlive-fonts-recommended texlive-latex-extra
# texlive-generic-recommended texlive-fonts-extra
2015-02-11 09:22:56 +01:00
latexpdf:
2021-04-30 12:40:29 +02:00
@echo "Starting build..."
$(SPHINX_BUILD) -c $(CONFIG_DIR) -b latex $(SPHINXOPTS) $(SOURCE_DIR) $(BUILD_DIR)/latex
$(MAKE) -C $(BUILD_DIR)/latex
cp $(BUILD_DIR)/latex/*.pdf $(BUILD_DIR)/html/
@echo "Build finished."
2015-02-11 09:22:56 +01:00
2021-05-06 16:55:55 +02:00
gettext:
2021-04-30 12:40:29 +02:00
@echo "Generating translatable files..."
2021-05-06 16:55:55 +02:00
$(SPHINX_BUILD) -c $(CONFIG_DIR) -b gettext $(SOURCE_DIR) locale/sources
2021-04-30 12:40:29 +02:00
@echo "Generation finished."
2015-02-11 09:22:56 +01:00
2021-08-05 08:18:09 +00:00
$(HTML_BUILD_DIR)/_static/style.css: extensions/odoo_theme/static/style.scss extensions/odoo_theme/static/scss/*.scss
2021-04-30 12:40:29 +02:00
@echo "Compiling stylesheets..."
mkdir -p $(HTML_BUILD_DIR)/_static
python3 -m pysassc extensions/odoo_theme/static/style.scss $(HTML_BUILD_DIR)/_static/style.css
2021-04-30 12:40:29 +02:00
@echo "Compilation finished."
2015-02-11 09:22:56 +01:00
2021-04-30 12:40:29 +02:00
#=== Development and debugging rules ===#
2015-02-11 09:22:56 +01:00
fast: SPHINXOPTS += -A collapse_menu=True
2021-04-30 12:40:29 +02:00
fast: html
2015-02-11 09:22:56 +01:00
static: $(HTML_BUILD_DIR)/_static/style.css
2021-08-05 08:18:09 +00:00
cp -r extensions/odoo_theme/static/* $(HTML_BUILD_DIR)/_static/
cp -r static/* $(HTML_BUILD_DIR)/_static/