diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 44 |
1 files changed, 28 insertions, 16 deletions
@@ -1,6 +1,5 @@ # Minimal makefile for Sphinx documentation # - # You can set these variables from the command line. override LOCALE := $(or $(LOCALE),fr) PUBHOST ?= club1.fr @@ -13,39 +12,52 @@ override NOTFR = endif SPHINXLANG = -D language=$(LOCALE) -SPHINXOPTS ?= +SPHINXOPTS += -a SPHINXBUILD ?= sphinx-build -SPHINXLCMDS = html latexpdf man -SPHINXCMDS = clean gettext +SPHINXLCMDS = html dirhtml singlehtml epub latex latexpdf latexpdfja text man texinfo info +SPHINXCMDS = pickle json htmlhelp changes xml pseudoxml linkcheck doctest coverage SOURCEDIR = . BUILDDIR = _build +MDFILES = index.md $(shell find . -type f -name '*.md') LOCALES = en -LOCALESDIRS = $(LOCALES:%=locales/%) +LOCALEFILES = $(LOCALES:%=locales/%/LC_MESSAGES/package.po) +DIRS = locales # Put it first so that "make" without argument is like "make help". help: $(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $O -.PHONY: help locales publish Makefile $(SPHINXLCMDS) $(SPHINXCMDS) +.PHONY: help clean update-po gettext publish $(SPHINXLCMDS) $(SPHINXCMDS) + +update-po: $(LOCALEFILES) + +gettext: locales/package.pot + +$(LOCALEFILES): locales/%/LC_MESSAGES/package.po: locales/package.pot + sphinx-intl update -p $(<D) -l $* + @touch $@ -locales: $(LOCALESDIRS) +locales/package.pot: $(BUILDDIR)/gettext/package.pot | locales + cp $< $@ -$(LOCALESDIRS): gettext - sphinx-intl update -p $(BUILDDIR)/gettext -l $(@F) - touch $@ +$(DIRS): + mkdir -p $@ + +$(BUILDDIR)/gettext/package.pot: $(MDFILES) + $(SPHINXBUILD) -M gettext "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $O + @touch $@ publish: html rsync -av --del _build/html/ $(USER)@$(PUBHOST):$(PUBDIR) # Shinx commands that need locales. -$(SPHINXLCMDS): $(if $(NOTFR),locales/$(LOCALE)) +$(SPHINXLCMDS): $(if $(NOTFR),locales/$(LOCALE)/LC_MESSAGES/package.po) $(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXLANG) $(SPHINXOPTS) $O # Other Sphinx commands for autocompletion $(SPHINXCMDS): - $(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $0 - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile $(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $O + +clean: + rm -f locales/*/LC_MESSAGES/package.mo + rm -rf $(BUILDDIR)/* |