aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorn-peugnet <n.peugnet@free.fr>2022-03-25 19:32:53 +0100
committern-peugnet <n.peugnet@free.fr>2022-03-26 22:03:20 +0100
commita8fa2b290b1329ec576f264dc6bb470f819fda4d (patch)
tree4127e0dbdf90ea357b1798337aec4b07e6c38d3e /Makefile
parentf688d73fa32bbdaa0a229a945ebd4c78b3bb6f61 (diff)
downloadclub1-docs-a8fa2b290b1329ec576f264dc6bb470f819fda4d.tar.gz
club1-docs-a8fa2b290b1329ec576f264dc6bb470f819fda4d.zip
add language switcher in sidebar
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile28
1 files changed, 22 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index b9fe36e..2ff019a 100644
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,13 @@ else
override NOTFR =
endif
+ifneq (,$(filter grouped-target,$(.FEATURES)))
+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
SPHINXBUILD ?= sphinx-build
@@ -19,8 +26,13 @@ SPHINXCMDS = pickle json htmlhelp changes xml pseudoxml linkcheck doctest
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)
# Put it first so that "make" without argument is like "make help".
help:
@@ -30,15 +42,19 @@ help:
update-po: $(LOCALEFILES)
-gettext: locales/package.pot
+gettext: $(POTS)
-$(LOCALEFILES): locales/%/LC_MESSAGES/package.po: locales/package.pot
+$(LOCALEFILES): locales/%/LC_MESSAGES/package.po: $(POTS)
sphinx-intl update -p $(<D) -l $*
@touch $@
-locales/package.pot: $(MDFILES)
+ifdef GROUPED_TARGET
+$(POTS)&: $(MDFILES) $(TEMPLATES)
+else
+$(POTS): $(MDFILES) $(TEMPLATES)
+endif
$(SPHINXBUILD) -b gettext "$(SOURCEDIR)" locales $(SPHINXOPTS) $O
- @touch $@
+ @touch $(POTS)
latexpdf: latex
$(MAKE) -C $(BUILDDIR)/latex/$(LOCALE)
@@ -50,7 +66,7 @@ publish:
rsync -av --del --exclude='.*' _build/html/ $(USER)@$(PUBHOST):$(PUBDIR)
# Shinx commands that need locales (builders).
-$(SPHINXBUILDERS): $(if $(NOTFR),locales/$(LOCALE)/LC_MESSAGES/package.po)
+$(SPHINXBUILDERS): $(if $(NOTFR),$(PONAMES:%=locales/$(LOCALE)/LC_MESSAGES/%.po))
$(SPHINXBUILD) -b $@ "$(SOURCEDIR)" "$(BUILDDIR)/$@/$(LOCALE)" $(SPHINXLANG) $(SPHINXOPTS) $O
# Other Sphinx commands for autocompletion
@@ -58,6 +74,6 @@ $(SPHINXCMDS):
$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $O
clean:
- rm -f locales/*/LC_MESSAGES/package.mo
+ rm -f locales/*/LC_MESSAGES/*.mo
rm -rf locales/.doctrees
rm -rf $(BUILDDIR)/*