#--*- Makefile -*--

# Check the spelling of the input files.

TEXT_FILES_LT ?= $(wildcard lt/*.txt)
TEXT_FILES_EN ?= $(wildcard en/*.txt)

LANG_LT ?= lt_LT
LANG_EN ?= en_GB

.PHONY: all spell aspell spell-en aspell-en spell-lt aspell-lt

all: spell

spell: spell-en spell-lt

aspell: aspell-en aspell-lt

spell-lt: ${TEXT_FILES_LT}
	cat $^ \
	| aspell -x -p ./lt/words.lst -l ${LANG_LT} list \
	| sort -u

spell-en: ${TEXT_FILES_EN}
	cat $^ \
	| aspell -x -p ./en/words.lst -l ${LANG_EN} list \
	| sort -u

aspell-lt: ${TEXT_FILES_LT}
	for FILE in $^; do \
		aspell -x -p ./lt/words.lst -l ${LANG_LT} check $$FILE; \
	done

aspell-en: ${TEXT_FILES_EN}
	for FILE in $^; do \
		aspell -x -p ./en/words.lst -l ${LANG_EN} check $$FILE; \
	done
