1# Makefile for the dictionary igerman98
2#
3# Author: Bjoern Jacke <bjoern@j3e.de>
4#
5# Copyright: GNU GPLv2 and GPLv3
6
7# we need want out own executables first:
8export PATH := .:bin:$(PATH)
9LANGS=de_DE de_AT de_CH
10LANGS2=$(LANGS) de_all
11DATE=`date +%Y%m%d`
12VERSION=`cat VERSION`
13VERSION_EXTRA=$(shell find . -name "VERSION.*" -print | while read i ; do echo -n "+"; head -1 "$$i" | tr -d "\n" ; done)
14# the build string makes the reproducible builds impossible. And builddate isn't really that much needed:
15# VERSION_STRING=$(VERSION)$(VERSION_EXTRA) (build $(DATE))
16VERSION_STRING=$(VERSION)$(VERSION_EXTRA)
17
18all:
19	@echo "A default make target doesn't exist. You might want to use one of those:"
20	@echo "  make hunspell/de_DE.dic hunspell/de_DE.aff (or de_AT or de_CH)"
21	@echo "  make myspell/de_DE.dic myspell/de_DE.aff (or de_AT or de_CH)"
22	@echo "  make ispell/de_DE.aff ispell/de_DE.hash (or de_AT, de_CH ...)"
23	@echo "  make aspell/de_DE.rws (or de_AT, de_CH ...)"
24	@echo "  make ligature/rmligs"
25	@echo "  make isowordlist-de_DE (or de_AT, de_CH ...)"
26	@echo "Did I forget an important one ?-)"
27
28
29
30#MYLANG = $(shell echo -n $@ | sed "s/^.*_\(de_.*$$\)/\1/")
31MYLANG = $(shell echo $@ | sed "s/^.*[_/]\(de_[a-zA-Z]*\).*/\1/")
32
33# FIND_OPTS can be used to exclude directories from being used, like:
34# FIND_OPTS = ! -name "*-a-*"
35
36define WORDS_define_template
37
38WORDS_$(1) = $$(shell $$(FIND) ./dicts/ -name "*$(1)*.txt" ! -name "*compound*" $$(FIND_OPTS) -print)
39
40WORDS_COMP_$(1) = $$(shell $$(FIND) ./dicts/ -name "compound*$(1)*.txt" $$(FIND_OPTS) -print)
41
42## alle ohne "*-x*"
43WORDS_CAPMAIN_SMALL_$(1)	= $$(shell $$(FIND) ./dicts/ -name "*$(1)*.txt" ! -name "*-x*" ! -name "*compound*" $$(FIND_OPTS) -print)
44
45## alle "*-xx*"
46WORDS_CAPMAIN_PLUS_$(1)	= $$(shell $$(FIND) ./dicts/ -name "*$(1)*.txt" -name "*-xx*" ! -name "*compound*" $$(FIND_OPTS) -print)
47
48## alle "*-x*" ohne "*-xx*"
49WORDS_NOCAPMAIN_$(1)	= $$(shell $$(FIND) ./dicts/ -name "*$(1)*.txt" -name "*-x*" ! -name "*-xx*" ! -name "*compound*" $(FIND_OPTS) -print)
50
51WORDS_BLACKLISTS_$(1) = $$(shell $$(FIND) ./dicts/ -name "blacklist*$(1)*" $(FIND_OPTS) -print)
52
53endef
54$(foreach langcode,$(LANGS2),$(eval $(call WORDS_define_template,$(langcode))))
55
56ISPELLIBDIR = $$($(ISPELL) -vv |grep "LIBDIR" |$(SED) "s/.*\=//" |tr -d \")
57DESTDIR =
58# make might have to be GNU make,
59# please report problems with other make versions to me.
60MAKE = make
61FIND = find
62SORT = sort
63TAR = tar
64SED = sed
65NL = nl
66CP = cp
67# some incarnations of "wc -l" print out leading whitespace, let's use sed:
68WCL = $(SED) -n '$$='
69
70# the following is to remove temp files during build. Set it
71# to rm if disk space is an issue during build time:
72RM_OR_NOT = @\#
73#RM_OR_NOT = rm
74
75#ZIP = zip
76#ZIP_OPTS = -j -r -9 -X
77ZIP = 7z
78ZIP_OPTS = a -tzip -mx=9
79BUILDHASH = buildhash
80
81ISPELL = ispell
82HUNSPELL_BIN = hunspell
83# Hunspell starting with 1.1.9 (?) uses automatic charset transcoding,
84# we need to make sure we use latin1:
85HUNSPELL = $(HUNSPELL_BIN) `$(HUNSPELL_BIN) -h 2>&1 | grep -q "hunspell \\-i" && echo "-i latin1"`
86
87
88SQ = sq
89UNSQ = unsq
90#   if for some reason you don't have Ispell's unsq use my Perl sq/unsq
91#  and put it into a directory known by your PATH variable!
92#UNSQ = unsq.pl
93
94ASPELL = aspell
95
96# if you don't have ispell around, you may change this to aspell:
97AFFIX_EXPANDER = ispell
98
99ifeq ($(AFFIX_EXPANDER),ispell)
100AFFIX_EXPAND_PREREQ = ispell/$(1)_null.hash ispell/$(1)_null.aff
101AFFIX_EXPAND_COMMAND = $(ISPELL) -d./ispell/$(1)_null -e
102MUNCH_PFX = munch.
103else
104AFFIX_EXPAND_PREREQ = aspell/$(1).dat aspell/$(1)_affix.dat
105AFFIX_EXPAND_COMMAND = ( $(SED) -f ./bin/dic2iso | $(ASPELL) --encoding=iso8859-1 --lang=$(1) --local-data-dir=./aspell expand )
106MUNCH_PFX =
107endif
108
109vpath %.txt ./dicts  ./hunspell ./myspell
110.SUFFIXES: .txt .dic
111.PHONY: clean pack unpack sort help dist hunspell-all
112SUBDIRS = testdir
113
114# to let `sort' behave right: setting LC_ALL ist not enough, because
115# UTF-8 locales won't get overwritten by that, we also need to reset LANG!
116# That's strange and might have been a bug which is fixed in the meantime.
117# Otherwise locale depending sorting, grepping etc. which is slow as hell
118# (like for de_DE) would be used, we don't need that anyway. See
119# http://mail.nl.linux.org/linux-utf8/2003-11/msg00041.html
120
121LANG=C
122LC_ALL=C
123LC_COLLATE=C
124
125
126#$(addprefix dicts/,$(WORTE)): unpack
127#	echo x
128#	test -e $@ || (echo Wortliste $@ nicht vorhanden ; exit 1)
129
130
131
132###
133## Ispell stuff:
134###
135
136ispell/de_AT.aff ispell/de_DE.aff: ispell/de_DE.aff.in
137	$(CP) ispell/de_DE.aff.in $@
138
139ispell/de_CH.aff: ispell/de_DE.aff.in
140	$(SED) "/swiss-del/d" ispell/de_DE.aff.in |$(SED) "/swiss-convert/s/sS/SS/g" |$(SED) '/\#swiss-only/s/^\#//' |$(SED) '/stringchar/!s/sS//g' > $@
141
142
143define LANG_ispell_dict_template
144
145ispell/$(1).hash: ispell/$(1).aff all.words.munch.$(1).tmp
146	$(BUILDHASH) all.words.munch.$(1).tmp ./ispell/$(1).aff $$@
147
148all.words.$(1).tmp: $$(WORDS_$(1)) $$(WORDS_de_all) dicts/abkuerzpunkt.txt
149	$(SED) "s/qq//g;s/\.//;s/\-.*//" dicts/abkuerzpunkt.txt $$(WORDS_$(1)) $$(WORDS_de_all) \
150	| (test -e ./bin/conv_dict_$(1) && ./bin/conv_dict_$(1) || cat) \
151	| grep -v "\/.*d" | grep -v "##" | $(SED) "s/#.*//" | ./bin/myspellfixprefix.pl | $(SORT) -u > $$@
152
153all.words.munch.$(1).tmp: all.words.$(1).tmp ispell/$(1).aff
154	./bin/test-working-grep.sh
155	@# the munched way to overcome "Hash table overflowed by xxxx words" error:
156	munchlist -l ./ispell/$(1).aff all.words.$(1).tmp > $$@
157	@# the unmunched way:
158	@#$(CP) all.words.$(1).tmp $$@
159
160ispell/$(1)_null.hash: ispell/$(1)_null.aff
161	test -e all.words.placebo.tmp || echo a > all.words.placebo.tmp
162	$(BUILDHASH) all.words.placebo.tmp ispell/$(1)_null.aff $$@
163
164isowordlist-$(1): $(AFFIX_EXPAND_PREREQ) all.words.$(MUNCH_PFX)$(1).tmp
165	$(AFFIX_EXPAND_COMMAND) < all.words.$(MUNCH_PFX)$(1).tmp |tr ' ' '\n' |$(SED) -f ./bin/dic2iso | $(SORT) -u > $$@
166
167endef
168$(foreach langcode,$(LANGS),$(eval $(call LANG_ispell_dict_template,$(langcode))))
169
170
171
172
173###
174## old Aspell stuff, new aspell/ stuff support for aspell 0.60 later down...
175###
176#
177#help.hash: german.aff all.words2 .copyright
178#	$(BUILDHASH) all.words2 ./german.aff $@
179#
180#all.words2:
181#	cd dicts; sed s/qq//g $(WORTE) | $(SORT) -u > ../$@
182#
183#aspell: help.hash
184#	#cat all.words2 dicts/abkuerzpunkt.txt |$(ISPELL) -e -d./help |sed -f ./bin/dic2iso |sort -u |$(ASPELL) --lang=german create master ./german
185#	sed "s/\.//g" all.words2 dicts/abkuerzpunkt.txt |$(ISPELL) -e -d./help |sed -f ./bin/dic2iso | $(SORT) -u |$(ASPELL) --lang=german create master ./german
186#
187#swiss-aspell: swiss
188#	cat all.words.swiss |$(ISPELL) -e -d./swiss |sed -f ./bin/dic2iso | $(SORT) -u |$(ASPELL) --lang=swiss create master ./swiss
189#
190
191
192
193define LANG_myspell_template
194
195aspell/$(1)_affix.dat: myspell/$(1).aff
196	$(CP) myspell/$(1).aff $$@
197
198aspell/$(1).multi: aspell/de_all.multi.in
199	$(SED) "s/LANG_REPLACE/$(1)/g" < aspell/de_all.multi.in > $$@
200
201aspell/$(1).alias: aspell/de_all.alias.in
202	$(SED) "s/LANG_REPLACE/$(1)/g" < aspell/de_all.alias.in > $$@
203
204aspell/$(1).dat: aspell/de_all.dat.in
205	$(SED) "s/LANG_REPLACE/$(1)/g" < aspell/de_all.dat.in > $$@
206
207aspell/$(1).rws: myspell/$(1).dic aspell/$(1)_affix.dat aspell/$(1).multi aspell/$(1).dat aspell/$(1).alias
208	# the warnings about skipped words should be ignorable...
209	$(ASPELL) --lang=$(1) --dict-dir=./aspell/ --local-data-dir=./aspell/ create master $(1).rws < myspell/$(1).dic
210
211myspell/$(1).dic: $$(WORDS_$(1)) $$(WORDS_de_all) dicts/abkuerzpunkt.txt
212	./bin/test-working-grep.sh
213	cat $$(WORDS_$(1)) $$(WORDS_de_all) dicts/abkuerzpunkt.txt \
214		| (test -e ./bin/conv_dict_$(1) && ./bin/conv_dict_$(1) || cat) \
215		| ./bin/myspell-generic-process.sh  > $$@.tmp
216	$$(WCL) < $$@.tmp > $$@
217	cat myspell/de_all.dic.header | $(SED) "s/AFF_VERSION_REPLACE/$(VERSION_STRING)/;s/LANG_REPLACE/$(1)/" >> $$@
218	$(SED) -f ./bin/dic2iso < $$@.tmp >> $$@
219	$(RM_OR_NOT) $$@.tmp
220
221endef
222$(foreach langcode,$(LANGS) liglist,$(eval $(call LANG_myspell_template,$(langcode))))
223
224
225
226define LANG_aff_template
227
228myspell/$(1).aff: myspell/de_all.aff.in myspell/de_all.aff.header
229	cat myspell/de_all.aff.header myspell/de_all.aff.in | $(SED) "s/AFF_VERSION_REPLACE/$(VERSION_STRING)/;s/LANG_REPLACE/$(1)/" > $$@
230
231hunspell/$(1).aff: hunspell/de_all.aff.hunspell_additions myspell/de_all.aff.in hunspell/de_all.aff.header
232	cat hunspell/de_all.aff.header myspell/de_all.aff.in hunspell/de_all.aff.hunspell_additions | $(SED) "s/AFF_VERSION_REPLACE/$(VERSION_STRING)/;s/LANG_REPLACE/$(1)/" > $$@
233
234ispell/$(1)_null.aff: ispell/$(1).aff
235	$(CP) ispell/$(1).aff $$@
236
237endef
238$(foreach langcode,$(LANGS) liglist,$(eval $(call LANG_aff_template,$(langcode))))
239
240
241define LANGS2_hunspell_dicts_template
242
243HUNSPELL_DICTS_BASE_$(1) = hunspell-capmain-small_$(1).tmp hunspell-compdic_$(1).tmp hunspell-end-compdic_$(1).tmp hunspell-middle-compdic_$(1).tmp hunspell-end-compdic_$(1).tmp
244
245#HUNSPELL_DICTS_BASE_$(1) = hunspell-capmain-small_$(1).tmp hunspell-compdic_$(1).tmp hunspell-end-compdic_$(1).tmp hunspell-middle-compdic_$(1).tmp hunspell-end-compdic_$(1).tmp hunspell-capmain-small_de_all.tmp hunspell-compdic_de_all.tmp hunspell-end-compdic_de_all.tmp hunspell-middle-compdic_de_all.tmp hunspell-middle-compdic_de_all.tmp hunspell-end-compdic_de_all.tmp
246
247hunspell-capmain-small_$(1).tmp: $$(WORDS_CAPMAIN_SMALL_$(1))
248	# limited dictionary without any *-x* files used to sort out all known words from -xx files
249	rm -f $$@.tmp
250	echo $$(WORDS_CAPMAIN_SMALL_$(1)) | xargs cat >> $$@.tmp
251	./bin/hunspell-capmain $$@.tmp > $$@
252	$(RM_OR_NOT) $$@.tmp
253
254
255hunspell-nocapmain_$(1).tmp: $$(WORDS_NOCAPMAIN_$(1)) $$(WORDS_NOCAPMAIN_de_all)
256	# limited dictionary of all -x (but not -xx) files
257	rm -f $$@.tmp
258	#find dicts/ -name "*x*.txt" ! -name "*-xx*" -print | xargs cat >> $@.tmp
259	echo $$(WORDS_NOCAPMAIN_$(1)) $$(WORDS_NOCAPMAIN_de_all) | xargs cat >> $$@.tmp
260	###TODO??? ./bin/dic2iso < $$@.tmp > $$@
261	mv $$@.tmp $$@
262
263hunspell-middle-compdic_$(1).tmp: dicts/middle-compound.txt
264	# more TODO here ?
265	$(SED) "s:$$$$:/hkem:;s:/\(.*\)/:/\1:"	< dicts/middle-compound.txt	>  $$@
266
267hunspell-end-compdic_$(1).tmp: dicts/end-compound.txt
268	# more TODO here ?
269	$(SED) "s:$$$$:/oz:;s:/\(.*\)/:/\1:"		< dicts/end-compound.txt	>  $$@
270
271hunspell-compdic_$(1).tmp: $$(WORDS_COMP_$(1)) $$(WORDS_COMP_de_all)
272	# sed hack to add "/"to lines which don't have one yet:
273	# sed "/^[^\/]*$$/s/$$/\//"
274	echo DEBUG: WORDS_COMP_$(1) :: $$(WORDS_COMP_$(1)) :::
275	echo DEBUG: WORDS_COMP_de_all :: $$(WORDS_COMP_de_all) :::
276	echo $$(WORDS_COMP_$(1)) $$(WORDS_COMP_de_all) | xargs $(SED) "/^[^\/]*$$$$/s/$$$$/\// ; s/$$$$/hij/"	>  $$@
277	echo >> $$@
278	#	more TODO here ? (added myspellfixprefix...)
279	cat $$(WORDS_COMP_$(1)) $$(WORDS_COMP_de_all) \
280		| ./bin/myspellfixprefix.pl \
281		| ./bin/lcfirst.pl \
282		| $(SED) "/^[^\/]*$$$$/s/$$$$/\//;s/$$$$/hke/"			>> $$@
283	echo >> $$@
284
285endef
286$(foreach langcode,$(LANGS2),$(eval $(call LANGS2_hunspell_dicts_template,$(langcode))))
287
288define LANG_hunspell_template
289
290HUNSPELL_DICTS_ALL_$(1) = $$(HUNSPELL_DICTS_BASE_$(1)) hunspell-capmain-plus_$(1).tmp hunspell-nocapmain_$(1).tmp dicts/abkuerzpunkt.txt hunspell-blacklist_$(1).tmp \
291	$$(HUNSPELL_DICTS_BASE_de_all)
292
293hunspell-blacklist_$(1).tmp: $$(WORDS_BLACKLISTS_$(1)) $$(WORDS_BLACKLISTS_de_all)
294	# sed hack to merge /f/g to /fg : sed "s:/\(.*\)/:/\1:"
295	cat $$(WORDS_BLACKLISTS_$(1)) $$(WORDS_BLACKLISTS_de_all) >$$@
296
297hunspell-capmain-plus_$(1).tmp: $(AFFIX_EXPAND_PREREQ) hunspell/$(1)_small.dic hunspell/$(1)_small.aff $$(WORDS_CAPMAIN_PLUS_$(1)) $$(WORDS_CAPMAIN_PLUS_de_all)
298	echo DEBUG: WORDS_CAPMAIN_PLUS_$(1) :: $$(WORDS_CAPMAIN_PLUS_$(1)) :::
299	echo DEBUG: WORDS_CAPMAIN_PLUS_de_all :: $$(WORDS_CAPMAIN_PLUS_de_all) :::
300	# limited dictionary of *-xx* files containing compounds not generated by capmain-small
301	rm -f $$@.unfiltered-list0.tmp
302	#find dicts/ -name "*-xx*.txt" -print | xargs cat >> $$@.unfiltered-list.tmp
303	echo $$(WORDS_CAPMAIN_PLUS_$(1)) $$(WORDS_CAPMAIN_PLUS_de_all) | xargs cat >> $$@.unfiltered-list0.tmp
304	./bin/myspellfixprefix.pl < $$@.unfiltered-list0.tmp | (test -e ./bin/conv_dict_$(1) && ./bin/conv_dict_$(1) || cat) | grep -v '^$$$$' > $$@.unfiltered-list.tmp
305	cat $$@.unfiltered-list.tmp | $(AFFIX_EXPAND_COMMAND) > $$@.unfiltered-list-expanded.tmp
306	$(SED) -f ./bin/dic2iso < $$@.unfiltered-list-expanded.tmp |$(SED) "s/qq//g" | $(NL) | $(HUNSPELL) -d hunspell/$(1)_small -L > $$@.unknown.tmp
307	$(SED) "s/^ *\([0-9]*\)\t.*$$$$/\1/" $$@.unknown.tmp > $$@.list-unknown-lines.tmp
308	./bin/extractlines.pl $$@.list-unknown-lines.tmp $$@.unfiltered-list.tmp > $$@.tmp
309	./bin/hunspell-capmain $$@.tmp | $(SED) -f ./bin/iso2dic > $$@
310	$(RM_OR_NOT) $$@.unfiltered-list0.tmp $$@.unfiltered-list.tmp $$@.unfiltered-list-expanded.tmp $$@.unknown.tmp $$@.list-unknown-lines.tmp $$@.tmp
311
312
313hunspell/$(1)_small.dic: $$(HUNSPELL_DICTS_BASE_$(1)) $$(HUNSPELL_DICTS_BASE_de_all) myspell/de_all.dic.header
314	echo $$(HUNSPELL_DICTS_BASE_$(1))
315	echo $$(HUNSPELL_DICTS_BASE_de_all)
316	cat $$(HUNSPELL_DICTS_BASE_$(1)) $$(HUNSPELL_DICTS_BASE_de_all) \
317		| (test -e ./bin/conv_dict_$(1) && ./bin/conv_dict_$(1) || cat) \
318		| ./bin/hunspell-generic-process.sh \
319		> $$@.tmp
320	$$(WCL) < $$@.tmp > $$@
321	cat myspell/de_all.dic.header | \
322		$(SED) "s/AFF_VERSION_REPLACE/$(VERSION_STRING)/;s/LANG_REPLACE/$(1)/;s/Myspell/Hunspell/" >> $$@
323	$(SED) -f ./bin/dic2iso < $$@.tmp >> $$@
324	$(RM_OR_NOT) $$@.tmp
325
326hunspell/$(1)_small.aff: hunspell/$(1).aff
327	$(CP) hunspell/$(1).aff $$@
328
329hunspell/$(1).dic: $$(HUNSPELL_DICTS_ALL_$(1)) $$(HUNSPELL_DICTS_ALL_de_all) myspell/de_all.dic.header
330	./bin/test-working-grep.sh
331	echo a $$(HUNSPELL_DICTS_ALL_$(1))
332	echo b $$(HUNSPELL_DICTS_ALL_de_all)
333	cat $$(HUNSPELL_DICTS_ALL_$(1)) $$(HUNSPELL_DICTS_ALL_de_all) \
334		| (test -e ./bin/conv_dict_$(1) && ./bin/conv_dict_$(1) || cat) \
335		| ./bin/hunspell-generic-process.sh	\
336		| ./bin/hunspell-optimize-roothelper.pl	\
337		> $$@.tmp
338	$$(WCL) < $$@.tmp > $$@
339	cat myspell/de_all.dic.header | $(SED) "s/AFF_VERSION_REPLACE/$$(VERSION_STRING)/;s/LANG_REPLACE/$(1)/;s/Myspell/Hunspell/" >> $$@
340	$(SED) -f ./bin/dic2iso < $$@.tmp >> $$@
341	$(RM_OR_NOT) $$@.tmp
342
343
344
345endef
346$(foreach langcode,$(LANGS),$(eval $(call LANG_hunspell_template,$(langcode))))
347
348hunspell-all: hunspell/de_DE.aff hunspell/de_DE.dic hunspell/de_AT.aff hunspell/de_AT.dic hunspell/de_CH.aff hunspell/de_CH.dic
349
350# -x dictionaries should not be compounded via capmain
351# -xx dictionaries should be "cleaned up" before being compounded via capmain
352
353
354myspell-zip: myspell/de_DE.aff myspell/de_DE.dic myspell/de_AT.aff myspell/de_AT.dic myspell/de_CH.aff myspell/de_CH.dic
355	echo "$(VERSION_STRING)" > myspell/VERSION
356	VERSION=`cat VERSION` ; cd myspell; \
357	for lang in $(LANGS) ; do \
358		rm -f $$lang-$$VERSION.zip ; \
359		$(ZIP) $(ZIP_OPTS) $$lang-$$VERSION.zip -i@$$lang.zip.files ; \
360	done
361
362mozilla-xpi: hunspell-all mozilla/install.rdf.in
363	export VER=$(VERSION) ; \
364	rm -fr mozilla/*.tmp ; \
365	for lang in DE AT CH ; do \
366		mkdir mozilla/de-$$lang.tmp && mkdir mozilla/de-$$lang.tmp/dictionaries ; \
367		$(SED) "s/ADDON_LANG_REPLACE/$$lang/g;s/ADDON_VERSION_REPLACE/$$VER/g" mozilla/install.rdf.in > mozilla/de-$$lang.tmp/install.rdf ; \
368		$(CP) hunspell/de_$$lang.aff mozilla/de-$$lang.tmp/dictionaries/de-$$lang.aff ; \
369		$(CP) hunspell/de_$$lang.dic mozilla/de-$$lang.tmp/dictionaries/de-$$lang.dic ; \
370		rm -f mozilla/de-$$lang-$$VER.xpi ; \
371		(cd mozilla/de-$$lang.tmp ; $(ZIP) $(ZIP_OPTS) ../de-$$lang-$$VER.xpi . ); \
372	done
373
374hunspell-zip: hunspell-all
375	echo "$(VERSION_STRING)" > hunspell/VERSION
376	VERSION=`cat VERSION` ; cd hunspell; \
377	for lang in $(LANGS) ; do \
378		rm -f $$lang-$$VERSION.zip ; \
379		$(ZIP) $(ZIP_OPTS) $$lang-$$VERSION.zip -i@$$lang.zip.files ; \
380	done
381
382huntest: hunspell/hunspell-test.txt
383	# huntest fails with "BREAK -" but that is needed for US-Wirtschaft etc.
384	# so this is the lesser evil. No perfect solution found so far...
385	cat hunspell/hunspell-test.txt |$(HUNSPELL) -L -d hunspell/de_DE > $@.tmp 2>&1
386	@if `grep -q "^0 " $@.tmp`;then echo "Huntest NICHT bestanden:"; cat $@.tmp; exit 1;fi
387	@if ! test "`$$(WCL) < $@.tmp`" = "`tail -n 1 $@.tmp | cut -f1 -d:`";then echo "Huntest NICHT bestanden (Zu viele als korrekt erkannte W�rter):"; cat $@.tmp; exit 1;fi
388
389
390###
391## ligature stuff:
392###
393
394define liglist_template
395
396ispell/liglist.aff: ispell/de_DE.aff.in
397	$(SED) '/\#qqq/s/^\#//g;/\#nnn/d' ispell/de_DE.aff.in > $$@
398
399ispell/liglist_null.hash: ispell/liglist_null.aff
400	test -e all.words.placebo.tmp || echo a > all.words.placebo.tmp
401	$(BUILDHASH) all.words.placebo.tmp ispell/$(1)_null.aff $$@
402
403all.words.liglist.tmp: $(foreach langcode,$(LANGS2),$(WORDS_$(langcode)))
404	$(SED) "s/\.//" $(foreach langcode,$(LANGS2),$(WORDS_$(langcode))) | \
405	grep -v "\/.*d" | grep -v "##" | $(SED) "s/#.*//" | \
406	$(SORT) -u > $$@
407
408
409liglist.tmp: $(AFFIX_EXPAND_PREREQ) all.words.liglist.tmp
410	cat ligature/oldspell.liglist all.words.liglist.tmp \
411	| $(AFFIX_EXPAND_COMMAND)			\
412	| tr \  '\n'					\
413	| grep qq					\
414	| $(SORT) -u					\
415	| $(SED) 's/fqqf/f\|f/g;s/fqql/f\|l/g;s/fqqi/f\|i/g'	\
416	| grep \|					\
417	| $(SED) s/qq//g				\
418	| $(SED) -f ./bin/dic2iso			\
419	| tr A-Z a-z					\
420	| $(SORT) -u					\
421	> $$@
422
423ligature/rmligs: liglist.tmp ligature/rmligs.skel
424	cat ligature/rmligs.skel liglist.tmp > $$@
425	chmod 755 $$@
426
427endef
428$(eval $(call liglist_template,liglist))
429
430
431
432
433###
434## misc stuff:
435###
436
437clean:
438	rm -f all.words* igerman98*.tar.bz2 isowordlist* MD5sums SHA256sums
439	#sort liglist.aff  MD5sums myspell/*.dic de_DE.zip de_CH.zip myspell/VERSION *.tmp
440	rm -f ispell/*.aff ispell/*.hash
441	rm -f myspell/*.dic  myspell/*.aff  myspell/*.zip myspell/VERSION
442	rm -f hunspell/*.dic hunspell/*.aff hunspell/*.zip hunspell/VERSION
443	rm -f ligature/liglist.* ligature/rmligs
444	rm -f mozilla/*.xpi
445	$(FIND) aspell/ -type f ! -name "*.in" -print |xargs rm -fr
446	$(FIND) . -name "*tmp*" -print |xargs rm -fr
447
448sort:
449	@if grep [�������] dicts/*.txt ;then echo "!!! illegal ISO-8859-1 characters in dictionary files !!!";exit 1;fi
450	@if LC_ALL=de_DE.UTF-8 grep [`echo -n "�������"|iconv -f iso8859-1 -t utf-8`] dicts/*.txt ;then echo "!!! illegal UTF-8 characters in dictionary files !!!";exit 1;fi
451	@if grep -q -v "/.*d" dicts/blacklist* ; then echo "missing d in blacklist?" ; exit 1 ; fi
452	$(FIND) ./dicts/ -name "*.txt" -print -o -name "blacklist*" -print | while read i; do $(SORT) -u -o "$$i" "$$i"; done
453
454pack: sort
455	exit 1
456	rm -f unpack
457	cd dicts; $(FIND) . -name "*.txt" -print |while read i; do test -e $$i.sq && exit 1; $(SQ) < $$i > $$i.sq && rm $$i; done
458
459unpack:
460	exit 1
461	cd dicts; $(FIND) . -name "*.sq" -print | while read i; do test -e `basename $$i .sq` && exit 1; $(UNSQ) < $$i > `basename $$i .sq` && rm $$i; done
462	touch unpack
463
464dist: sort clean
465	echo $(DATE) > VERSION
466	$(FIND) . -xtype f ! -name ".*" -a ! -name grep -print | xargs sha256sum | gpg --clearsign > .SHA256sums
467	mv .SHA256sums SHA256sums
468	ls > .files
469	echo igerman98-`cat VERSION` > .name
470	mkdir `cat .name`
471	mv `cat .files` `cat .name`
472	$(TAR) cvf - --exclude "grep" * | bzip2 -9 > `cat .name`.tar.bz2
473	mv `cat .name`/* .
474	rmdir `cat .name`
475
476
477
478
479
480###########################
481### TEST TRASH follows: ###
482###########################
483
484help_test:
485	grep "^[[:alpha:]\-]*:"  Makefile | cut -d " " -f 1
486
487test0:
488	export BLA=FOO
489
490LIST_FOO = eins zwei drei
491
492eins:
493
494#zwei: $($(WORTE_NEU))
495# $(addprefix dicts/,$(WORTE))
496zwei: $(WORDS_GENERIC)
497	echo $(WORDS_GENERIC)
498	touch zwei
499
500drei:
501	echo $(WORDS_NOCAPMAIN)
502	$(RM_OR_NOT) bla
503
504test1: test0 $(LIST_FOO) testdir/de_DE.dic
505	echo $$BLA
506	echo $(LIST_FOO)
507
508#FOO_de_DE FOO_de_AT FOO_de_CH FOO_de_all: WORDS_$(subst FOO_,,$@)
509#FOO_de_DE FOO_de_AT FOO_de_CH FOO_de_all : MYLANG=$(subst FOO_,,$@)
510#FOO_de_DE FOO_de_AT FOO_de_CH FOO_de_all : MYLANG=$(shell echo $@ |sed s/.*_\(de_.*\)/\1/)
511#FOO_de_DE FOO_de_AT FOO_de_CH FOO_de_all : MYLANG=$(shell echo $@|sed "s/^.*_\(de_.*$$\)/\1/")
512#FOO_de_DE FOO_de_AT FOO_de_CH FOO_de_all: $(FOO_%: WORDS_%)
513FOO_de_DE FOO_de_AT FOO_de_CH FOO_de_all: $(WORDS_$(MYLANG)) $(HUNSPELL_DICTS_BASE_$(MYLANG))
514	#set MYLANG=$(subst FOO_,,$@)
515	echo target: $@
516	echo MYLANG: $(MYLANG)
517	#echo $(WORDS_$(subst FOO_,,$@))
518	echo $(WORDS_$(MYLANG))
519	echo $<
520
521WORDS_de_aa = $(WORDS_shell)
522WORDS_de_bb = $(WORDS_shell)
523
524SUB_de_aa SUB_de_bb: $(WORDS_$(MYLANG))
525	@echo SUB says WORDS is: $(MYLANG)
526	@echo SUB says lang is: $(lang)
527
528define MYDEF
529$(1): lang_def=hallo
530endef
531
532test2_de_aa test2_de_bb: lang=$(MYLANG)
533#test2_de_aa: SUB_
534#test2_de_aa test2_de_bb: $$(SUB_$(MYLANG))
535test2_de_aa test2_de_bb: $(eval $(call MYDEF,$(@)))
536	#$(subst LANG,$(lang),SUB_LANG)
537	@echo MYLANG: $(MYLANG)
538	@echo lang: $(lang)
539	@echo lang_def: $(lang_def)
540	@echo I think WORDS is: $(WORDS_$(MYLANG))
541
542TESTLANGS=de_aa de_bb de_DE
543
544define LANG_testtemplate
545$(1): $$($(1)_OBJS) $$($(1)_LIBS:%=-l%)
546	echo aa
547test3_$(1): SUB_$(1)
548	@echo MYLANG: $(MYLANG)
549	@echo I think WORDS is: $(WORDS_$(MYLANG))
550	@echo I think I am $$@
551
552ALL_OBJS   += $$($(1)_OBJS)
553endef
554
555$(foreach langcode,$(TESTLANGS),$(eval $(call LANG_testtemplate,$(langcode))))
556