#--*- Makefile -*--
#*
# Multi-language spell checker.
#**

.PHONY: aspell spell

.PHONY: aspell_en aspell_lt asplell_ru
.PHONY: spell_en spell_lt asplell_ru

aspell: aspell_lt aspell_en aspell_ru

spell: spell_lt spell_en spell_ru

aspell_en: $(sort ${MLTEX_FILES:%.mltex=%_en.tex})
	for i in $^; do \
		aspell -t -x -p ./.words_en.lst -l en_GB check $$i; \
	done

aspell_lt: $(sort ${MLTEX_FILES:%.mltex=%_lt.tex})
	for i in $^; do \
		aspell -t -x -p ./.words_lt.lst -l lt_LT check $$i; \
	done

aspell_ru: $(sort ${MLTEX_FILES:%.mltex=%_ru.tex})
	for i in $^; do \
		aspell -t -x -p ./.words_ru.lst -l ru_RU check $$i; \
	done

spell_en: $(sort ${MLTEX_FILES:%.mltex=%_en.tex})
	for i in $^; do \
		echo "===" $$i; \
		aspell -t -p ./.words_en.lst -l en_GB list < $$i | sort -u; \
	done

spell_lt: $(sort ${MLTEX_FILES:%.mltex=%_lt.tex})
	for i in $^; do \
		echo "===" $$i; \
		aspell -t -p ./.words_lt.lst -l lt_LT list < $$i | sort -u; \
	done

spell_ru: $(sort ${MLTEX_FILES:%.mltex=%_ru.tex})
	for i in $^; do \
		echo "===" $$i; \
		aspell -t -p ./.words_ru.lst -l ru_RU list < $$i | sort -u; \
	done
