parrot-wtf/Makefile

93 lines
3.5 KiB
Makefile
Raw Normal View History

2023-11-26 20:37:34 -07:00
2023-11-26 15:54:31 -07:00
# Makefile
# Jeff Moe with Parrot and Phind-CodeLlama-34B-v2_q8.gguf
2023-11-26 16:26:31 -07:00
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = docs/source
BUILDDIR = docs/build
AUTOBUILDOPTS = --host 127.0.0.1 --port 8000 --ignore "*.swp" --ignore "*.swx"
2023-11-26 20:29:32 -07:00
GETTEXT_BUILD = gettext_build
2023-11-27 12:47:11 -07:00
UPDATE_LOCALE = sphinx-intl update -p $(BUILDDIR)/locale/gettext -d $(SOURCEDIR)/locale -l
2023-12-03 16:43:55 -07:00
PO_FILES = $(wildcard docs/source/locale/*/LC_MESSAGES/*.po)
MSGATTRIB = msgattrib
LANGUAGES = am ar bg bn ca cak cs cy da de el en eo es et eu fa fi fil fr he hi hr hu id it ja ko lkt lt lv mk mr ms ne nl no pl pt ro ru si sk sl sq sr sv ta te th tr uk ur vi zh
2023-11-26 16:26:31 -07:00
2023-12-03 14:00:58 -07:00
.PHONY: check help html livehtml clean_sphinx clean gettext_build update_locale build_html all copy clean_po latex latexpdf
2023-11-27 09:10:33 -07:00
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " clean Remove all build files and directories (including translations)"
@echo " all Clean and make all targets"
2023-12-03 14:09:22 -07:00
@echo " gettext_build Build localisation strings for translation"
@echo " update_locale Update localisation"
@echo " update_locale_<lang> Update localisation for <lang>"
@echo " html Build the HTML documentation for all languages"
2023-12-02 17:19:48 -07:00
@echo " html_<lang> Build HTML documentation for <lang>"
2023-12-03 14:04:43 -07:00
@echo " latex Build the documentation using LaTeX for all languages"
@echo " latex_<lang> Build the documentation using LaTeX for <lang>"
2023-12-03 14:09:22 -07:00
@echo " latexpdf Build the PDFS documentation using LaTeX for all languages"
@echo " latexpdf_<lang> Build the PDFS documentation using LaTeX for <lang>"
@echo " index Copy static docs/index.html to docs/build/html/index.html"
2023-11-26 20:37:34 -07:00
2023-12-02 16:39:34 -07:00
all: clean gettext_build update_locale html index
2023-11-27 11:52:30 -07:00
check:
@for po in $(PO_FILES); do \
echo "Checking $$po..."; \
msgfmt --check --output-file=- "$$po" || exit 1; \
done
2023-12-02 16:39:34 -07:00
index:
cp -p docs/index.html docs/build/html/index.html
2023-11-26 16:19:12 -07:00
2023-11-27 12:29:23 -07:00
clean:
for file in $(PO_FILES); do \
$(MSGATTRIB) --no-obsolete -o $$file $$file; \
done
2023-11-26 16:26:31 -07:00
cd docs && make clean
2023-11-27 12:43:31 -07:00
find $(SOURCEDIR) -type f -name "*.mo" -delete
2023-11-26 16:26:31 -07:00
rm -rf $(BUILDDIR)/*
2023-11-26 20:29:32 -07:00
gettext_build:
$(SPHINXBUILD) -b gettext -c $(SOURCEDIR) -d $(BUILDDIR)/doctrees/$(GETTEXT_BUILD) $(SOURCEDIR) $(BUILDDIR)/locale/gettext
2023-11-26 20:33:43 -07:00
2023-11-27 12:28:00 -07:00
update_locale:
2023-11-29 09:09:10 -07:00
@pids="" ; \
for lang in $(LANGUAGES); do \
( echo "Updating locale for $$lang..." ; $(UPDATE_LOCALE) $$lang ) & pids="$$pids $$!" ; \
done ; \
for pid in $$pids; do \
wait $$pid ; \
2023-11-27 12:47:11 -07:00
done
2023-11-27 10:19:44 -07:00
update_locale_%:
$(UPDATE_LOCALE) $*
2023-11-27 12:37:19 -07:00
html:
@for lang in $(LANGUAGES); do \
2023-11-27 12:47:11 -07:00
echo "Building HTML documentation for $$lang..."; \
$(SPHINXBUILD) -b html -d $(BUILDDIR)/doctrees -D language=$$lang $(SOURCEDIR) $(BUILDDIR)/html/$$lang; \
2023-11-27 12:47:11 -07:00
done
2023-12-03 14:04:43 -07:00
html_%: gettext_build
$(SPHINXBUILD) -b html -d $(BUILDDIR)/doctrees -D language=$* -c $(SOURCEDIR) $(SOURCEDIR) $(BUILDDIR)/html/$*/
2023-12-03 12:20:51 -07:00
latex:
2023-12-03 14:00:58 -07:00
@for lang in $(LANGUAGES); do \
echo "Building LaTeX documentation for $$lang..."; \
$(SPHINXBUILD) -b latex -d $(BUILDDIR)/doctrees -D language=$$lang -Dlatex_engine=xelatex $(SOURCEDIR) $(BUILDDIR)/latex/$$lang; \
done
2023-12-03 12:20:51 -07:00
2023-12-03 14:04:43 -07:00
latex_%:
$(SPHINXBUILD) -b latex -d $(BUILDDIR)/doctrees -D language=$* -Dlatex_engine=xelatex $(SOURCEDIR) $(BUILDDIR)/latex/$*/; \
2023-12-03 14:00:58 -07:00
latexpdf:
@for lang in $(filter-out ar he ja,$(LANGUAGES)); do \
2023-12-03 14:00:58 -07:00
echo "Building PDF documentation for $$lang..."; \
$(MAKE) -C $(BUILDDIR)/latex/$$lang ; \
done
2023-12-03 12:20:51 -07:00
2023-12-03 14:09:22 -07:00
latexpdf_%:
2023-12-03 16:43:55 -07:00
$(MAKE) -C $(BUILDDIR)/latex/$* ; \