parrot-wtf/Makefile

67 lines
2.6 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
UPDATE_LOCALE_AR = sphinx-intl update -p $(BUILDDIR)/locale/gettext -d $(SOURCEDIR)/locale -l ar
2023-11-26 23:02:28 -07:00
UPDATE_LOCALE_EN = sphinx-intl update -p $(BUILDDIR)/locale/gettext -d $(SOURCEDIR)/locale -l en
UPDATE_LOCALE_ES = sphinx-intl update -p $(BUILDDIR)/locale/gettext -d $(SOURCEDIR)/locale -l es
2023-11-27 10:19:44 -07:00
UPDATE_LOCALE_ZH = sphinx-intl update -p $(BUILDDIR)/locale/gettext -d $(SOURCEDIR)/locale -l zh
2023-11-27 10:10:14 -07:00
PO_FILES = $(wildcard docs/source/locale/*/LC_MESSAGES/*.po)
MSGATTRIB = msgattrib
2023-11-26 16:26:31 -07:00
2023-11-27 11:52:30 -07:00
.PHONY: check help html livehtml clean_sphinx clean gettext_build update_locale_en update_locale_es update_locale_zh build_html_en build_html_es build_html_zh all copy clean_po
2023-11-27 09:10:33 -07:00
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " clean to remove all build files and directories (including translations)"
@echo " all to clean and make all targets"
2023-11-27 12:37:19 -07:00
@echo " html to build the HTML documentation"
@echo " livehtml to serve the documentation with live reloading"
@echo " update_locale to update localisation"
@echo " gettext_build to build localisation strings for translation"
2023-11-27 09:10:33 -07:00
@echo " copy to copy docs/index.html to docs/build/html/index.html"
2023-11-26 20:37:34 -07:00
2023-11-27 12:37:19 -07:00
all: clean html gettext_build update_locale copy
2023-11-27 11:52:30 -07:00
.PHONY: check
check:
@for po in $(PO_FILES); do \
echo "Checking $$po..."; \
msgfmt --check --output-file=- "$$po" || exit 1; \
done
copy:
cp -p docs/index.html docs/build/html/index.html
2023-11-26 16:19:12 -07:00
2023-11-26 16:26:31 -07:00
livehtml:
sphinx-autobuild $(AUTOBUILDOPTS) $(SOURCEDIR) $(BUILDDIR)/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:
$(UPDATE_LOCALE_AR)
2023-11-26 20:33:43 -07:00
$(UPDATE_LOCALE_EN)
$(UPDATE_LOCALE_ES)
2023-11-27 10:19:44 -07:00
$(UPDATE_LOCALE_ZH)
2023-11-27 12:37:19 -07:00
html:
$(SPHINXBUILD) -b html -d $(BUILDDIR)/doctrees -D language=ar $(SOURCEDIR) $(BUILDDIR)/html/ar
2023-11-26 20:33:43 -07:00
$(SPHINXBUILD) -b html -d $(BUILDDIR)/doctrees -D language=en $(SOURCEDIR) $(BUILDDIR)/html/en
$(SPHINXBUILD) -b html -d $(BUILDDIR)/doctrees -D language=es $(SOURCEDIR) $(BUILDDIR)/html/es
2023-11-27 10:19:44 -07:00
$(SPHINXBUILD) -b html -d $(BUILDDIR)/doctrees -D language=zh $(SOURCEDIR) $(BUILDDIR)/html/zh