1
# this makefile is used to automate building of dictionaries
2
# based on affix files etc...
4
# if you need to adapt this Makefile for another language,
5
# all you should have to do is change these variables.
6
# if you need to change anything else, please submit it back
7
# to the project so other people can benefit
9
# The version will automatically be read in from the VERSION file
10
VERSION=$(shell cat VERSION)
11
VERSION_ASPELL=$(shell cat ../VERSION.aspell)
13
# Only set these if the user has not overridden them in the language Makefile
15
REGION_FAKE?=$(REGION)
17
.PHONY: all clean clean-myspell clean-ispell clean-aspell clean-autocorr ispell myspell aspell count check wordlist autocorr
20
TARGETS_MYSPELL=myspell/wordlist.$(CHARSET) myspell/pack-$(LANG)-$(REGION)-$(VERSION).zip myspell/$(LANG)_$(REGION).zip myspell/$(LANG)_$(REGION).dic myspell/spell.txt myspell/VERSION_$(LANG)_$(REGION).txt myspell/install.js myspell/spell-$(LANG)-$(REGION).xpi myspell/$(LANG)-$(REGION).dic myspell/$(LANG)-$(REGION).aff myspell/README-$(LANG)-$(REGION).txt
22
TARGETS_ISPELL=ispell/$(LANGNAMELOW).hash ispell/$(LANGNAMELOW)-ispell-$(VERSION).tar.bz2 ispell/wordlist.$(CHARSET) ispell/wordlist.$(CHARSET).cnt ispell/wordlist.$(CHARSET).stat
24
TARGET_ASPELL=aspell/wordlist.$(CHARSET) aspell/$(LANG).rws aspell/aspell-$(LANG)-$(VERSION_ASPELL)-$(VERSION).tar.bz2 aspell/proc aspell/configure aspell/$(LANG).cwl aspell/info aspell/Makefile aspell/Makefile.pre aspell/$(LANG).* aspell/*.alias aspell/COPYING aspell/README aspell/aspell-$(LANG)-$(VERSION_ASPELL)-$(VERSION)
26
TARGET_AUTOCORR=acor/acor_$(LANG)-$(REGION).dat*
28
TARGET_WORDLISTS=wordlists/wordlist.$(CHARSET) $(WORDLIST.CHARSET)
30
all: myspell aspell wordlist acor
32
clean: clean-myspell clean-ispell clean-aspell clean-wordlists clean-acor
36
count: wordlists/wordlist.$(CHARSET) $(WORDLIST.IN)
37
@echo "Comments removed"
40
egrep -v "^#" $$f | sort --unique | wc -l; \
43
@echo "Comments and words with whitespace removed"
46
egrep -v "(^#| )" $$f | sort --unique | wc -l; \
49
@echo "Comments removed words with whitespace split"
52
egrep -v "^#" $$f | tr " " "\n" | sort --unique | wc -l; \
57
check: wordlists/wordlist.$(CHARSET)
58
@echo First line is existing TRY sequence. Second line is new TRY sequence.
59
@egrep "^TRY" myspell/$(LANG)_$(REGION).aff | sed "s/TRY //g"
60
@LC_ALL=en_US.utf8 LANG=en_US.utf8 LANGUAGE=en_US.utf8 ../../src/wordlist/letter-frequency.py -i $^ -len_US
65
WORDLIST.CHARSET=$(patsubst %.in, %.$(CHARSET), $(WORDLIST.IN))
68
iconv -f utf-8 -t $(CHARSET) < $< >$@
70
wordlists/wordlist.$(CHARSET): $(WORDLIST.CHARSET)
71
cat $^ | egrep -v "^#|^$$" | sort --unique > $@
73
wordlists/wordlist-$(LANG)-$(VERSION).zip: $(WORDLIST.IN) wordlists/wordlist.$(CHARSET)
76
wordlist: wordlists/wordlist-$(LANG)-$(VERSION).zip
79
rm -rf $(TARGET_WORDLISTS)
84
rm -f $(TARGETS_MYSPELL)
86
# make myspell will make the required zip files
87
myspell: myspell/myspell-$(LANG)_$(REGION)-$(VERSION).zip myspell/myspell-pack-$(LANG)-$(REGION)-$(VERSION).zip myspell/spell-$(LANG)-$(REGION)-$(VERSION).xpi
89
# this is a package that is usable for offline installation
90
myspell/myspell-pack-$(LANG)-$(REGION)-$(VERSION).zip: myspell/myspell-$(LANG)_$(REGION)-$(VERSION).zip myspell/spell.txt
93
# we autogenerate the index file...
95
echo '$(LANG_FAKE),$(REGION_FAKE),$(LANG_FAKE)_$(REGION_FAKE),$(LANGNAME) ($(REGIONNAME)),myspell-$(LANG)_$(REGION)-$(VERSION).zip' >$@
97
# this is the standard myspell package
98
myspell/myspell-$(LANG)_$(REGION)-$(VERSION).zip: myspell/$(LANG)_$(REGION).dic myspell/$(LANG)_$(REGION).aff myspell/README_$(LANG)_$(REGION).txt myspell/VERSION_$(LANG)_$(REGION).txt
101
# make sure the VERSION file name doesn't conflict with other packages
102
myspell/VERSION_$(LANG)_$(REGION).txt: VERSION
105
# myspell/ispell don't like the header, or words with spaces in them
106
myspell/wordlist.$(CHARSET): wordlists/wordlist.$(CHARSET)
107
egrep -v '(^#| )' <$< >$@
110
# this does the work of converting a wordlist into a myspell dictionary
111
# it can take a while
112
# the munch utility is located under the dict/utils project
113
myspell/$(LANG)_$(REGION).dic: myspell/wordlist.$(CHARSET) myspell/$(LANG)_$(REGION).aff ../utils/munch
114
../utils/munch myspell/wordlist.$(CHARSET) myspell/$(LANG)_$(REGION).aff >$@
116
# The following are for building a Mozilla XPI of the spellchecker
117
# Customise the install.js
118
myspell/install.js: ../utils/install.js.in
119
sed "s/{LANG}/$(LANG)/; s/{REGION}/$(REGION)/; s/{LANGNAME}/$(LANGNAME)/; s/{REGIONNAME}/$(REGIONNAME)/; s/{VERSION}/$(VERSION)/" < $< > $@
121
myspell/README-$(LANG)-$(REGION).txt: myspell/README_$(LANG)_$(REGION).txt
124
myspell/$(LANG)-$(REGION).dic: myspell/$(LANG)_$(REGION).dic
127
myspell/$(LANG)-$(REGION).aff: myspell/$(LANG)_$(REGION).aff
130
myspell/spell-$(LANG)-$(REGION)-$(VERSION).xpi: myspell/$(LANG)-$(REGION).aff myspell/$(LANG)-$(REGION).dic myspell/README-$(LANG)-$(REGION).txt myspell/install.js
136
rm -f $(TARGETS_ISPELL)
138
ispell/$(LANGNAMELOW).hash: ispell/wordlist.$(CHARSET) ispell/$(LANGNAMELOW).aff
141
ispell/$(LANGNAMELOW)-ispell-$(VERSION).tar.bz2: ispell/$(LANGNAMELOW).hash ispell/$(LANGNAMELOW).aff ispell/README
144
ispell: ispell/$(LANGNAMELOW)-ispell-$(VERSION).tar.bz2
146
ispell/wordlist.$(CHARSET): wordlists/wordlist.$(CHARSET)
147
egrep -v '(^#| )' <$< >$@
151
aspell: aspell/aspell-$(LANG)-$(VERSION_ASPELL)-$(VERSION).tar.bz2
154
rm -rf $(TARGET_ASPELL)
156
aspell/$(LANG).cwl: aspell/wordlist.$(CHARSET)
157
(export LC_COLLATE=C; cat $< | sort -u | word-list-compress compress > $@)
159
aspell/proc: ../utils/proc
162
aspell/configure: ../utils/configure
165
aspell/wordlist.$(CHARSET): wordlists/wordlist.$(CHARSET)
166
cat $< | egrep -v '(^#| |\.|-$$|[0-9]|/|=$$)' | LC_COLLATE=C sort --unique >$@
168
aspell/aspell-$(LANG)-$(VERSION_ASPELL)-$(VERSION).tar.bz2: aspell/$(LANG).cwl aspell/configure aspell/Makefile.pre aspell/Copyright
169
cd aspell; ./configure; make dist && make distcheck && rm -rf aspell-$(LANG)-$(VERSION_ASPELL)-$(VERSION)
171
aspell/info: aspell/info.in ../VERSION.aspell VERSION
172
sed "s/{VERSION}/$(VERSION_ASPELL)\-$(VERSION)/" < $< > $@
174
aspell/Makefile.pre: aspell/proc aspell/info
175
(cd aspell; export LC_COLLATE=C; ./proc create)
179
# Naming format for OpenOffice.org 2
180
acor/acor_$(LANG)-$(REGION).dat: acor/DocumentList.csv acor/SentenceExceptList.csv acor/WordExceptList.csv
181
(cd acor; ../../utils/csv2acor.py $(@F))
183
acor: acor/acor_$(LANG)-$(REGION).dat
188
rm -rf $(TARGET_AUTOCORR)