diff options
author | n-peugnet <n.peugnet@free.fr> | 2022-03-26 13:35:09 +0100 |
---|---|---|
committer | n-peugnet <n.peugnet@free.fr> | 2022-03-26 22:03:20 +0100 |
commit | fd62b4255eb0db6aac484f91b23d5cdc94d34892 (patch) | |
tree | a7c98abf11dcfab711291e68d6c08b9c30c6eb99 /Makefile | |
parent | 12971fb7c73a17d2dcf7f86e604d73229266e603 (diff) | |
download | club1-docs-fd62b4255eb0db6aac484f91b23d5cdc94d34892.tar.gz club1-docs-fd62b4255eb0db6aac484f91b23d5cdc94d34892.zip |
make builds all languages for localized builders
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 72 |
1 files changed, 39 insertions, 33 deletions
@@ -1,44 +1,41 @@ # Minimal makefile for Sphinx documentation # # You can set these variables from the command line. -LOCALE ?= fr -PUBHOST ?= club1.fr -PUBDIR ?= /var/www/docs - -ifneq "$(LOCALE)" "fr" -override NOTFR = 1 -else -override NOTFR = -endif - ifneq (,$(filter grouped-target,$(.FEATURES))) -GROUPED_TARGET = 1 +GROUPED_TARGET := 1 else $(warning WARNING: This version of make does not support grouped-target, disabling parallel jobs.) .NOTPARALLEL: endif -SPHINXLANG = -D language=$(LOCALE) -SPHINXOPTS += -a +LOCALES := en +LOCALEFILES := $(LOCALES:%=locales/%/LC_MESSAGES/package.po) +PONAMES := package sphinx +POTS := $(PONAMES:%=locales/%.pot) + +export LANGUAGES := fr $(LOCALES) +export LATEXMKOPTS := -quiet + +SPHINXLANG := -D language=$(LOCALE) +SPHINXOPTS += -a $(if $(CI),,-q) SPHINXBUILD ?= sphinx-build -SPHINXBUILDERS = html dirhtml singlehtml epub latex text man texinfo -SPHINXCMDS = pickle json htmlhelp changes xml pseudoxml linkcheck doctest coverage -SOURCEDIR = . -BUILDDIR = _build -MDFILES = index.md $(shell find . -type f -name '*.md') -TEMPLATES = $(shell find _templates -type f -name '*.html') -LOCALES = en -LOCALEFILES = $(LOCALES:%=locales/%/LC_MESSAGES/package.po) -PONAMES = package sphinx -POTS = $(PONAMES:%=locales/%.pot) - -export LANGUAGES = fr $(LOCALES) +SPHINXBUILDERS := html dirhtml singlehtml epub latex text man texinfo +SPHINXLBUILDERS := $(foreach b,$(SPHINXBUILDERS),$(LANGUAGES:%=$b/%)) +SPHINXHBUILDERS := $(SPHINXBUILDERS:%=_%) +SPHINXCMDS := pickle json htmlhelp changes xml pseudoxml linkcheck doctest coverage +SOURCEDIR := . +BUILDDIR := _build +MDFILES := index.md $(shell find . -type f -name '*.md') +TEMPLATES := $(shell find _templates -type f -name '*.html') + +PUBHOST ?= club1.fr +PUBDIR ?= /var/www/docs # Put it first so that "make" without argument is like "make help". help: $(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $O -.PHONY: help clean update-po gettext latexpdf info publish $(SPHINXBUILDERS) $(SPHINXCMDS) +.PHONY: help clean update-po gettext latexpdf info publish $(SPHINXBUILDERS) $(SPHINXLBUILDERS) $(SPHINXHBUILDERS) $(SPHINXCMDS) update-po: $(LOCALEFILES) @@ -56,18 +53,27 @@ endif $(SPHINXBUILD) -b gettext "$(SOURCEDIR)" locales $(SPHINXOPTS) $O @touch $(POTS) -latexpdf: latex - $(MAKE) -C $(BUILDDIR)/latex/$(LOCALE) +latexpdf info: %: $(LANGUAGES:%=\%/%) -info: texinfo - $(MAKE) -C $(BUILDDIR)/texinfo/$(LOCALE) +$(LANGUAGES:%=latexpdf/%): latexpdf/%: latex/% + $(MAKE) -C $(BUILDDIR)/$< + +$(LANGUAGES:%=info/%): info/%: texinfo/% + $(MAKE) -C $(BUILDDIR)/$< publish: rsync -av --del --exclude='.*' _build/html/ $(USER)@$(PUBHOST):$(PUBDIR) -# Shinx commands that need locales (builders). -$(SPHINXBUILDERS): $(if $(NOTFR),$(PONAMES:%=locales/$(LOCALE)/LC_MESSAGES/%.po)) - $(SPHINXBUILD) -b $@ "$(SOURCEDIR)" "$(BUILDDIR)/$@/$(LOCALE)" $(SPHINXLANG) $(SPHINXOPTS) $O +# Shinx builders that builds localized versions. +$(SPHINXBUILDERS): %: $(LANGUAGES:%=\%/%) + +# Localized Sphinx builders +$(SPHINXLBUILDERS): + $(MAKE) _$(@D) LOCALE=$(@F) + +# Hidden Sphinx builders that need the LOCALE variable +$(SPHINXHBUILDERS): _%: $(if $(filter fr,$(LOCALE)),,$(PONAMES:%=locales/$(LOCALE)/LC_MESSAGES/%.po)) + $(SPHINXBUILD) -b $* "$(SOURCEDIR)" "$(BUILDDIR)/$*/$(LOCALE)" -D language=$(LOCALE) $(SPHINXOPTS) $O # Other Sphinx commands for autocompletion $(SPHINXCMDS): |