Blame Makefile

Packit e20377
# Makefile for the dictionary igerman98
Packit e20377
#
Packit e20377
# Author: Bjoern Jacke <bjoern@j3e.de>
Packit e20377
#
Packit e20377
# Copyright: GNU GPLv2 and GPLv3
Packit e20377
Packit e20377
# we need want out own executables first:
Packit e20377
export PATH := .:bin:$(PATH)
Packit e20377
LANGS=de_DE de_AT de_CH
Packit e20377
LANGS2=$(LANGS) de_all
Packit e20377
DATE=`date +%Y%m%d`
Packit e20377
VERSION=`cat VERSION`
Packit e20377
VERSION_EXTRA=$(shell find . -name "VERSION.*" -print | while read i ; do echo -n "+"; head -1 "$$i" | tr -d "\n" ; done)
Packit e20377
# the build string makes the reproducible builds impossible. And builddate isn't really that much needed:
Packit e20377
# VERSION_STRING=$(VERSION)$(VERSION_EXTRA) (build $(DATE))
Packit e20377
VERSION_STRING=$(VERSION)$(VERSION_EXTRA)
Packit e20377
Packit e20377
all:
Packit e20377
	@echo "A default make target doesn't exist. You might want to use one of those:"
Packit e20377
	@echo "  make hunspell/de_DE.dic hunspell/de_DE.aff (or de_AT or de_CH)"
Packit e20377
	@echo "  make myspell/de_DE.dic myspell/de_DE.aff (or de_AT or de_CH)"
Packit e20377
	@echo "  make ispell/de_DE.aff ispell/de_DE.hash (or de_AT, de_CH ...)"
Packit e20377
	@echo "  make aspell/de_DE.rws (or de_AT, de_CH ...)"
Packit e20377
	@echo "  make ligature/rmligs"
Packit e20377
	@echo "  make isowordlist-de_DE (or de_AT, de_CH ...)"
Packit e20377
	@echo "Did I forget an important one ?-)"
Packit e20377
Packit e20377
Packit e20377
Packit e20377
#MYLANG = $(shell echo -n $@ | sed "s/^.*_\(de_.*$$\)/\1/")
Packit e20377
MYLANG = $(shell echo $@ | sed "s/^.*[_/]\(de_[a-zA-Z]*\).*/\1/")
Packit e20377
Packit e20377
# FIND_OPTS can be used to exclude directories from being used, like:
Packit e20377
# FIND_OPTS = ! -name "*-a-*"
Packit e20377
Packit e20377
define WORDS_define_template
Packit e20377
Packit e20377
WORDS_$(1) = $$(shell $$(FIND) ./dicts/ -name "*$(1)*.txt" ! -name "*compound*" $$(FIND_OPTS) -print)
Packit e20377
Packit e20377
WORDS_COMP_$(1) = $$(shell $$(FIND) ./dicts/ -name "compound*$(1)*.txt" $$(FIND_OPTS) -print)
Packit e20377
Packit e20377
## alle ohne "*-x*"
Packit e20377
WORDS_CAPMAIN_SMALL_$(1)	= $$(shell $$(FIND) ./dicts/ -name "*$(1)*.txt" ! -name "*-x*" ! -name "*compound*" $$(FIND_OPTS) -print)
Packit e20377
Packit e20377
## alle "*-xx*"
Packit e20377
WORDS_CAPMAIN_PLUS_$(1)	= $$(shell $$(FIND) ./dicts/ -name "*$(1)*.txt" -name "*-xx*" ! -name "*compound*" $$(FIND_OPTS) -print)
Packit e20377
Packit e20377
## alle "*-x*" ohne "*-xx*"
Packit e20377
WORDS_NOCAPMAIN_$(1)	= $$(shell $$(FIND) ./dicts/ -name "*$(1)*.txt" -name "*-x*" ! -name "*-xx*" ! -name "*compound*" $(FIND_OPTS) -print)
Packit e20377
Packit e20377
WORDS_BLACKLISTS_$(1) = $$(shell $$(FIND) ./dicts/ -name "blacklist*$(1)*" $(FIND_OPTS) -print)
Packit e20377
Packit e20377
endef
Packit e20377
$(foreach langcode,$(LANGS2),$(eval $(call WORDS_define_template,$(langcode))))
Packit e20377
Packit e20377
ISPELLIBDIR = $$($(ISPELL) -vv |grep "LIBDIR" |$(SED) "s/.*\=//" |tr -d \")
Packit e20377
DESTDIR =
Packit e20377
# make might have to be GNU make,
Packit e20377
# please report problems with other make versions to me.
Packit e20377
MAKE = make
Packit e20377
FIND = find
Packit e20377
SORT = sort
Packit e20377
TAR = tar
Packit e20377
SED = sed
Packit e20377
NL = nl
Packit e20377
CP = cp
Packit e20377
# some incarnations of "wc -l" print out leading whitespace, let's use sed:
Packit e20377
WCL = $(SED) -n '$$='
Packit e20377
Packit e20377
# the following is to remove temp files during build. Set it
Packit e20377
# to rm if disk space is an issue during build time:
Packit e20377
RM_OR_NOT = @\#
Packit e20377
#RM_OR_NOT = rm
Packit e20377
Packit e20377
#ZIP = zip
Packit e20377
#ZIP_OPTS = -j -r -9 -X
Packit e20377
ZIP = 7z
Packit e20377
ZIP_OPTS = a -tzip -mx=9
Packit e20377
BUILDHASH = buildhash
Packit e20377
Packit e20377
ISPELL = ispell
Packit e20377
HUNSPELL_BIN = hunspell
Packit e20377
# Hunspell starting with 1.1.9 (?) uses automatic charset transcoding,
Packit e20377
# we need to make sure we use latin1:
Packit e20377
HUNSPELL = $(HUNSPELL_BIN) `$(HUNSPELL_BIN) -h 2>&1 | grep -q "hunspell \\-i" && echo "-i latin1"`
Packit e20377
Packit e20377
Packit e20377
SQ = sq
Packit e20377
UNSQ = unsq
Packit e20377
#   if for some reason you don't have Ispell's unsq use my Perl sq/unsq
Packit e20377
#  and put it into a directory known by your PATH variable!
Packit e20377
#UNSQ = unsq.pl
Packit e20377
Packit e20377
ASPELL = aspell
Packit e20377
Packit e20377
# if you don't have ispell around, you may change this to aspell:
Packit Service 279987
AFFIX_EXPANDER = aspell
Packit e20377
Packit e20377
ifeq ($(AFFIX_EXPANDER),ispell)
Packit e20377
AFFIX_EXPAND_PREREQ = ispell/$(1)_null.hash ispell/$(1)_null.aff
Packit e20377
AFFIX_EXPAND_COMMAND = $(ISPELL) -d./ispell/$(1)_null -e
Packit e20377
MUNCH_PFX = munch.
Packit e20377
else
Packit e20377
AFFIX_EXPAND_PREREQ = aspell/$(1).dat aspell/$(1)_affix.dat
Packit e20377
AFFIX_EXPAND_COMMAND = ( $(SED) -f ./bin/dic2iso | $(ASPELL) --encoding=iso8859-1 --lang=$(1) --local-data-dir=./aspell expand )
Packit e20377
MUNCH_PFX =
Packit e20377
endif
Packit e20377
Packit e20377
vpath %.txt ./dicts  ./hunspell ./myspell
Packit e20377
.SUFFIXES: .txt .dic
Packit e20377
.PHONY: clean pack unpack sort help dist hunspell-all
Packit e20377
SUBDIRS = testdir
Packit e20377
Packit e20377
# to let `sort' behave right: setting LC_ALL ist not enough, because
Packit e20377
# UTF-8 locales won't get overwritten by that, we also need to reset LANG!
Packit e20377
# That's strange and might have been a bug which is fixed in the meantime.
Packit e20377
# Otherwise locale depending sorting, grepping etc. which is slow as hell
Packit e20377
# (like for de_DE) would be used, we don't need that anyway. See
Packit e20377
# http://mail.nl.linux.org/linux-utf8/2003-11/msg00041.html
Packit e20377
Packit e20377
LANG=C
Packit e20377
LC_ALL=C
Packit e20377
LC_COLLATE=C
Packit e20377
Packit e20377
Packit e20377
#$(addprefix dicts/,$(WORTE)): unpack
Packit e20377
#	echo x
Packit e20377
#	test -e $@ || (echo Wortliste $@ nicht vorhanden ; exit 1)
Packit e20377
Packit e20377
Packit e20377
Packit e20377
###
Packit e20377
## Ispell stuff:
Packit e20377
###
Packit e20377
Packit e20377
ispell/de_AT.aff ispell/de_DE.aff: ispell/de_DE.aff.in
Packit e20377
	$(CP) ispell/de_DE.aff.in $@
Packit e20377
Packit e20377
ispell/de_CH.aff: ispell/de_DE.aff.in
Packit e20377
	$(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' > $@
Packit e20377
Packit e20377
Packit e20377
define LANG_ispell_dict_template
Packit e20377
Packit e20377
ispell/$(1).hash: ispell/$(1).aff all.words.munch.$(1).tmp
Packit e20377
	$(BUILDHASH) all.words.munch.$(1).tmp ./ispell/$(1).aff $$@
Packit e20377
Packit e20377
all.words.$(1).tmp: $$(WORDS_$(1)) $$(WORDS_de_all) dicts/abkuerzpunkt.txt
Packit e20377
	$(SED) "s/qq//g;s/\.//;s/\-.*//" dicts/abkuerzpunkt.txt $$(WORDS_$(1)) $$(WORDS_de_all) \
Packit e20377
	| (test -e ./bin/conv_dict_$(1) && ./bin/conv_dict_$(1) || cat) \
Packit e20377
	| grep -v "\/.*d" | grep -v "##" | $(SED) "s/#.*//" | ./bin/myspellfixprefix.pl | $(SORT) -u > $$@
Packit e20377
Packit e20377
all.words.munch.$(1).tmp: all.words.$(1).tmp ispell/$(1).aff
Packit e20377
	./bin/test-working-grep.sh
Packit e20377
	@# the munched way to overcome "Hash table overflowed by xxxx words" error:
Packit e20377
	munchlist -l ./ispell/$(1).aff all.words.$(1).tmp > $$@
Packit e20377
	@# the unmunched way:
Packit e20377
	@#$(CP) all.words.$(1).tmp $$@
Packit e20377
Packit e20377
ispell/$(1)_null.hash: ispell/$(1)_null.aff
Packit e20377
	test -e all.words.placebo.tmp || echo a > all.words.placebo.tmp
Packit e20377
	$(BUILDHASH) all.words.placebo.tmp ispell/$(1)_null.aff $$@
Packit e20377
Packit e20377
isowordlist-$(1): $(AFFIX_EXPAND_PREREQ) all.words.$(MUNCH_PFX)$(1).tmp
Packit e20377
	$(AFFIX_EXPAND_COMMAND) < all.words.$(MUNCH_PFX)$(1).tmp |tr ' ' '\n' |$(SED) -f ./bin/dic2iso | $(SORT) -u > $$@
Packit e20377
Packit e20377
endef
Packit e20377
$(foreach langcode,$(LANGS),$(eval $(call LANG_ispell_dict_template,$(langcode))))
Packit e20377
Packit e20377
Packit e20377
Packit e20377
Packit e20377
###
Packit e20377
## old Aspell stuff, new aspell/ stuff support for aspell 0.60 later down...
Packit e20377
###
Packit e20377
#
Packit e20377
#help.hash: german.aff all.words2 .copyright
Packit e20377
#	$(BUILDHASH) all.words2 ./german.aff $@
Packit e20377
#
Packit e20377
#all.words2:
Packit e20377
#	cd dicts; sed s/qq//g $(WORTE) | $(SORT) -u > ../$@
Packit e20377
#
Packit e20377
#aspell: help.hash
Packit e20377
#	#cat all.words2 dicts/abkuerzpunkt.txt |$(ISPELL) -e -d./help |sed -f ./bin/dic2iso |sort -u |$(ASPELL) --lang=german create master ./german
Packit e20377
#	sed "s/\.//g" all.words2 dicts/abkuerzpunkt.txt |$(ISPELL) -e -d./help |sed -f ./bin/dic2iso | $(SORT) -u |$(ASPELL) --lang=german create master ./german
Packit e20377
#
Packit e20377
#swiss-aspell: swiss
Packit e20377
#	cat all.words.swiss |$(ISPELL) -e -d./swiss |sed -f ./bin/dic2iso | $(SORT) -u |$(ASPELL) --lang=swiss create master ./swiss
Packit e20377
#
Packit e20377
Packit e20377
Packit e20377
Packit e20377
define LANG_myspell_template
Packit e20377
Packit e20377
aspell/$(1)_affix.dat: myspell/$(1).aff
Packit e20377
	$(CP) myspell/$(1).aff $$@
Packit e20377
Packit e20377
aspell/$(1).multi: aspell/de_all.multi.in
Packit e20377
	$(SED) "s/LANG_REPLACE/$(1)/g" < aspell/de_all.multi.in > $$@
Packit e20377
Packit e20377
aspell/$(1).alias: aspell/de_all.alias.in
Packit e20377
	$(SED) "s/LANG_REPLACE/$(1)/g" < aspell/de_all.alias.in > $$@
Packit e20377
Packit e20377
aspell/$(1).dat: aspell/de_all.dat.in
Packit e20377
	$(SED) "s/LANG_REPLACE/$(1)/g" < aspell/de_all.dat.in > $$@
Packit e20377
Packit e20377
aspell/$(1).rws: myspell/$(1).dic aspell/$(1)_affix.dat aspell/$(1).multi aspell/$(1).dat aspell/$(1).alias
Packit e20377
	# the warnings about skipped words should be ignorable...
Packit e20377
	$(ASPELL) --lang=$(1) --dict-dir=./aspell/ --local-data-dir=./aspell/ create master $(1).rws < myspell/$(1).dic
Packit e20377
Packit e20377
myspell/$(1).dic: $$(WORDS_$(1)) $$(WORDS_de_all) dicts/abkuerzpunkt.txt
Packit e20377
	./bin/test-working-grep.sh
Packit e20377
	cat $$(WORDS_$(1)) $$(WORDS_de_all) dicts/abkuerzpunkt.txt \
Packit e20377
		| (test -e ./bin/conv_dict_$(1) && ./bin/conv_dict_$(1) || cat) \
Packit e20377
		| ./bin/myspell-generic-process.sh  > $$@.tmp
Packit e20377
	$$(WCL) < $$@.tmp > $$@
Packit e20377
	cat myspell/de_all.dic.header | $(SED) "s/AFF_VERSION_REPLACE/$(VERSION_STRING)/;s/LANG_REPLACE/$(1)/" >> $$@
Packit e20377
	$(SED) -f ./bin/dic2iso < $$@.tmp >> $$@
Packit e20377
	$(RM_OR_NOT) $$@.tmp
Packit e20377
Packit e20377
endef
Packit e20377
$(foreach langcode,$(LANGS) liglist,$(eval $(call LANG_myspell_template,$(langcode))))
Packit e20377
Packit e20377
Packit e20377
Packit e20377
define LANG_aff_template
Packit e20377
Packit e20377
myspell/$(1).aff: myspell/de_all.aff.in myspell/de_all.aff.header
Packit e20377
	cat myspell/de_all.aff.header myspell/de_all.aff.in | $(SED) "s/AFF_VERSION_REPLACE/$(VERSION_STRING)/;s/LANG_REPLACE/$(1)/" > $$@
Packit e20377
Packit e20377
hunspell/$(1).aff: hunspell/de_all.aff.hunspell_additions myspell/de_all.aff.in hunspell/de_all.aff.header
Packit e20377
	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)/" > $$@
Packit e20377
Packit e20377
ispell/$(1)_null.aff: ispell/$(1).aff
Packit e20377
	$(CP) ispell/$(1).aff $$@
Packit e20377
Packit e20377
endef
Packit e20377
$(foreach langcode,$(LANGS) liglist,$(eval $(call LANG_aff_template,$(langcode))))
Packit e20377
Packit e20377
Packit e20377
define LANGS2_hunspell_dicts_template
Packit e20377
Packit e20377
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
Packit e20377
Packit e20377
#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
Packit e20377
Packit e20377
hunspell-capmain-small_$(1).tmp: $$(WORDS_CAPMAIN_SMALL_$(1))
Packit e20377
	# limited dictionary without any *-x* files used to sort out all known words from -xx files
Packit e20377
	rm -f $$@.tmp
Packit e20377
	echo $$(WORDS_CAPMAIN_SMALL_$(1)) | xargs cat >> $$@.tmp
Packit e20377
	./bin/hunspell-capmain $$@.tmp > $$@
Packit e20377
	$(RM_OR_NOT) $$@.tmp
Packit e20377
Packit e20377
Packit e20377
hunspell-nocapmain_$(1).tmp: $$(WORDS_NOCAPMAIN_$(1)) $$(WORDS_NOCAPMAIN_de_all)
Packit e20377
	# limited dictionary of all -x (but not -xx) files
Packit e20377
	rm -f $$@.tmp
Packit e20377
	#find dicts/ -name "*x*.txt" ! -name "*-xx*" -print | xargs cat >> $@.tmp
Packit e20377
	echo $$(WORDS_NOCAPMAIN_$(1)) $$(WORDS_NOCAPMAIN_de_all) | xargs cat >> $$@.tmp
Packit e20377
	###TODO??? ./bin/dic2iso < $$@.tmp > $$@
Packit e20377
	mv $$@.tmp $$@
Packit e20377
Packit e20377
hunspell-middle-compdic_$(1).tmp: dicts/middle-compound.txt
Packit e20377
	# more TODO here ?
Packit e20377
	$(SED) "s:$$$$:/hkem:;s:/\(.*\)/:/\1:"	< dicts/middle-compound.txt	>  $$@
Packit e20377
Packit e20377
hunspell-end-compdic_$(1).tmp: dicts/end-compound.txt
Packit e20377
	# more TODO here ?
Packit e20377
	$(SED) "s:$$$$:/oz:;s:/\(.*\)/:/\1:"		< dicts/end-compound.txt	>  $$@
Packit e20377
Packit e20377
hunspell-compdic_$(1).tmp: $$(WORDS_COMP_$(1)) $$(WORDS_COMP_de_all)
Packit e20377
	# sed hack to add "/"to lines which don't have one yet:
Packit e20377
	# sed "/^[^\/]*$$/s/$$/\//"
Packit e20377
	echo DEBUG: WORDS_COMP_$(1) :: $$(WORDS_COMP_$(1)) :::
Packit e20377
	echo DEBUG: WORDS_COMP_de_all :: $$(WORDS_COMP_de_all) :::
Packit e20377
	echo $$(WORDS_COMP_$(1)) $$(WORDS_COMP_de_all) | xargs $(SED) "/^[^\/]*$$$$/s/$$$$/\// ; s/$$$$/hij/"	>  $$@
Packit e20377
	echo >> $$@
Packit e20377
	#	more TODO here ? (added myspellfixprefix...)
Packit e20377
	cat $$(WORDS_COMP_$(1)) $$(WORDS_COMP_de_all) \
Packit e20377
		| ./bin/myspellfixprefix.pl \
Packit e20377
		| ./bin/lcfirst.pl \
Packit e20377
		| $(SED) "/^[^\/]*$$$$/s/$$$$/\//;s/$$$$/hke/"			>> $$@
Packit e20377
	echo >> $$@
Packit e20377
Packit e20377
endef
Packit e20377
$(foreach langcode,$(LANGS2),$(eval $(call LANGS2_hunspell_dicts_template,$(langcode))))
Packit e20377
Packit e20377
define LANG_hunspell_template
Packit e20377
Packit e20377
HUNSPELL_DICTS_ALL_$(1) = $$(HUNSPELL_DICTS_BASE_$(1)) hunspell-capmain-plus_$(1).tmp hunspell-nocapmain_$(1).tmp dicts/abkuerzpunkt.txt hunspell-blacklist_$(1).tmp \
Packit e20377
	$$(HUNSPELL_DICTS_BASE_de_all)
Packit e20377
Packit e20377
hunspell-blacklist_$(1).tmp: $$(WORDS_BLACKLISTS_$(1)) $$(WORDS_BLACKLISTS_de_all)
Packit e20377
	# sed hack to merge /f/g to /fg : sed "s:/\(.*\)/:/\1:"
Packit e20377
	cat $$(WORDS_BLACKLISTS_$(1)) $$(WORDS_BLACKLISTS_de_all) >$$@
Packit e20377
Packit e20377
hunspell-capmain-plus_$(1).tmp: $(AFFIX_EXPAND_PREREQ) hunspell/$(1)_small.dic hunspell/$(1)_small.aff $$(WORDS_CAPMAIN_PLUS_$(1)) $$(WORDS_CAPMAIN_PLUS_de_all)
Packit e20377
	echo DEBUG: WORDS_CAPMAIN_PLUS_$(1) :: $$(WORDS_CAPMAIN_PLUS_$(1)) :::
Packit e20377
	echo DEBUG: WORDS_CAPMAIN_PLUS_de_all :: $$(WORDS_CAPMAIN_PLUS_de_all) :::
Packit e20377
	# limited dictionary of *-xx* files containing compounds not generated by capmain-small
Packit e20377
	rm -f $$@.unfiltered-list0.tmp
Packit e20377
	#find dicts/ -name "*-xx*.txt" -print | xargs cat >> $$@.unfiltered-list.tmp
Packit e20377
	echo $$(WORDS_CAPMAIN_PLUS_$(1)) $$(WORDS_CAPMAIN_PLUS_de_all) | xargs cat >> $$@.unfiltered-list0.tmp
Packit e20377
	./bin/myspellfixprefix.pl < $$@.unfiltered-list0.tmp | (test -e ./bin/conv_dict_$(1) && ./bin/conv_dict_$(1) || cat) | grep -v '^$$$$' > $$@.unfiltered-list.tmp
Packit e20377
	cat $$@.unfiltered-list.tmp | $(AFFIX_EXPAND_COMMAND) > $$@.unfiltered-list-expanded.tmp
Packit e20377
	$(SED) -f ./bin/dic2iso < $$@.unfiltered-list-expanded.tmp |$(SED) "s/qq//g" | $(NL) | $(HUNSPELL) -d hunspell/$(1)_small -L > $$@.unknown.tmp
Packit e20377
	$(SED) "s/^ *\([0-9]*\)\t.*$$$$/\1/" $$@.unknown.tmp > $$@.list-unknown-lines.tmp
Packit e20377
	./bin/extractlines.pl $$@.list-unknown-lines.tmp $$@.unfiltered-list.tmp > $$@.tmp
Packit e20377
	./bin/hunspell-capmain $$@.tmp | $(SED) -f ./bin/iso2dic > $$@
Packit e20377
	$(RM_OR_NOT) $$@.unfiltered-list0.tmp $$@.unfiltered-list.tmp $$@.unfiltered-list-expanded.tmp $$@.unknown.tmp $$@.list-unknown-lines.tmp $$@.tmp
Packit e20377
Packit e20377
Packit e20377
hunspell/$(1)_small.dic: $$(HUNSPELL_DICTS_BASE_$(1)) $$(HUNSPELL_DICTS_BASE_de_all) myspell/de_all.dic.header
Packit e20377
	echo $$(HUNSPELL_DICTS_BASE_$(1))
Packit e20377
	echo $$(HUNSPELL_DICTS_BASE_de_all)
Packit e20377
	cat $$(HUNSPELL_DICTS_BASE_$(1)) $$(HUNSPELL_DICTS_BASE_de_all) \
Packit e20377
		| (test -e ./bin/conv_dict_$(1) && ./bin/conv_dict_$(1) || cat) \
Packit e20377
		| ./bin/hunspell-generic-process.sh \
Packit e20377
		> $$@.tmp
Packit e20377
	$$(WCL) < $$@.tmp > $$@
Packit e20377
	cat myspell/de_all.dic.header | \
Packit e20377
		$(SED) "s/AFF_VERSION_REPLACE/$(VERSION_STRING)/;s/LANG_REPLACE/$(1)/;s/Myspell/Hunspell/" >> $$@
Packit e20377
	$(SED) -f ./bin/dic2iso < $$@.tmp >> $$@
Packit e20377
	$(RM_OR_NOT) $$@.tmp
Packit e20377
Packit e20377
hunspell/$(1)_small.aff: hunspell/$(1).aff
Packit e20377
	$(CP) hunspell/$(1).aff $$@
Packit e20377
Packit e20377
hunspell/$(1).dic: $$(HUNSPELL_DICTS_ALL_$(1)) $$(HUNSPELL_DICTS_ALL_de_all) myspell/de_all.dic.header
Packit e20377
	./bin/test-working-grep.sh
Packit e20377
	echo a $$(HUNSPELL_DICTS_ALL_$(1))
Packit e20377
	echo b $$(HUNSPELL_DICTS_ALL_de_all)
Packit e20377
	cat $$(HUNSPELL_DICTS_ALL_$(1)) $$(HUNSPELL_DICTS_ALL_de_all) \
Packit e20377
		| (test -e ./bin/conv_dict_$(1) && ./bin/conv_dict_$(1) || cat) \
Packit e20377
		| ./bin/hunspell-generic-process.sh	\
Packit e20377
		| ./bin/hunspell-optimize-roothelper.pl	\
Packit e20377
		> $$@.tmp
Packit e20377
	$$(WCL) < $$@.tmp > $$@
Packit e20377
	cat myspell/de_all.dic.header | $(SED) "s/AFF_VERSION_REPLACE/$$(VERSION_STRING)/;s/LANG_REPLACE/$(1)/;s/Myspell/Hunspell/" >> $$@
Packit e20377
	$(SED) -f ./bin/dic2iso < $$@.tmp >> $$@
Packit e20377
	$(RM_OR_NOT) $$@.tmp
Packit e20377
Packit e20377
Packit e20377
Packit e20377
endef
Packit e20377
$(foreach langcode,$(LANGS),$(eval $(call LANG_hunspell_template,$(langcode))))
Packit e20377
Packit e20377
hunspell-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
Packit e20377
Packit e20377
# -x dictionaries should not be compounded via capmain
Packit e20377
# -xx dictionaries should be "cleaned up" before being compounded via capmain
Packit e20377
Packit e20377
Packit e20377
myspell-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
Packit e20377
	echo "$(VERSION_STRING)" > myspell/VERSION
Packit e20377
	VERSION=`cat VERSION` ; cd myspell; \
Packit e20377
	for lang in $(LANGS) ; do \
Packit e20377
		rm -f $$lang-$$VERSION.zip ; \
Packit e20377
		$(ZIP) $(ZIP_OPTS) $$lang-$$VERSION.zip -i@$$lang.zip.files ; \
Packit e20377
	done
Packit e20377
Packit e20377
mozilla-xpi: hunspell-all mozilla/install.rdf.in
Packit e20377
	export VER=$(VERSION) ; \
Packit e20377
	rm -fr mozilla/*.tmp ; \
Packit e20377
	for lang in DE AT CH ; do \
Packit e20377
		mkdir mozilla/de-$$lang.tmp && mkdir mozilla/de-$$lang.tmp/dictionaries ; \
Packit e20377
		$(SED) "s/ADDON_LANG_REPLACE/$$lang/g;s/ADDON_VERSION_REPLACE/$$VER/g" mozilla/install.rdf.in > mozilla/de-$$lang.tmp/install.rdf ; \
Packit e20377
		$(CP) hunspell/de_$$lang.aff mozilla/de-$$lang.tmp/dictionaries/de-$$lang.aff ; \
Packit e20377
		$(CP) hunspell/de_$$lang.dic mozilla/de-$$lang.tmp/dictionaries/de-$$lang.dic ; \
Packit e20377
		rm -f mozilla/de-$$lang-$$VER.xpi ; \
Packit e20377
		(cd mozilla/de-$$lang.tmp ; $(ZIP) $(ZIP_OPTS) ../de-$$lang-$$VER.xpi . ); \
Packit e20377
	done
Packit e20377
Packit e20377
hunspell-zip: hunspell-all
Packit e20377
	echo "$(VERSION_STRING)" > hunspell/VERSION
Packit e20377
	VERSION=`cat VERSION` ; cd hunspell; \
Packit e20377
	for lang in $(LANGS) ; do \
Packit e20377
		rm -f $$lang-$$VERSION.zip ; \
Packit e20377
		$(ZIP) $(ZIP_OPTS) $$lang-$$VERSION.zip -i@$$lang.zip.files ; \
Packit e20377
	done
Packit e20377
Packit e20377
huntest: hunspell/hunspell-test.txt
Packit e20377
	# huntest fails with "BREAK -" but that is needed for US-Wirtschaft etc.
Packit e20377
	# so this is the lesser evil. No perfect solution found so far...
Packit e20377
	cat hunspell/hunspell-test.txt |$(HUNSPELL) -L -d hunspell/de_DE > $@.tmp 2>&1
Packit e20377
	@if `grep -q "^0 " $@.tmp`;then echo "Huntest NICHT bestanden:"; cat $@.tmp; exit 1;fi
Packit e20377
	@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
Packit e20377
Packit e20377
Packit e20377
###
Packit e20377
## ligature stuff:
Packit e20377
###
Packit e20377
Packit e20377
define liglist_template
Packit e20377
Packit e20377
ispell/liglist.aff: ispell/de_DE.aff.in
Packit e20377
	$(SED) '/\#qqq/s/^\#//g;/\#nnn/d' ispell/de_DE.aff.in > $$@
Packit e20377
Packit e20377
ispell/liglist_null.hash: ispell/liglist_null.aff
Packit e20377
	test -e all.words.placebo.tmp || echo a > all.words.placebo.tmp
Packit e20377
	$(BUILDHASH) all.words.placebo.tmp ispell/$(1)_null.aff $$@
Packit e20377
Packit e20377
all.words.liglist.tmp: $(foreach langcode,$(LANGS2),$(WORDS_$(langcode)))
Packit e20377
	$(SED) "s/\.//" $(foreach langcode,$(LANGS2),$(WORDS_$(langcode))) | \
Packit e20377
	grep -v "\/.*d" | grep -v "##" | $(SED) "s/#.*//" | \
Packit e20377
	$(SORT) -u > $$@
Packit e20377
Packit e20377
Packit e20377
liglist.tmp: $(AFFIX_EXPAND_PREREQ) all.words.liglist.tmp
Packit e20377
	cat ligature/oldspell.liglist all.words.liglist.tmp \
Packit e20377
	| $(AFFIX_EXPAND_COMMAND)			\
Packit e20377
	| tr \  '\n'					\
Packit e20377
	| grep qq					\
Packit e20377
	| $(SORT) -u					\
Packit e20377
	| $(SED) 's/fqqf/f\|f/g;s/fqql/f\|l/g;s/fqqi/f\|i/g'	\
Packit e20377
	| grep \|					\
Packit e20377
	| $(SED) s/qq//g				\
Packit e20377
	| $(SED) -f ./bin/dic2iso			\
Packit e20377
	| tr A-Z a-z					\
Packit e20377
	| $(SORT) -u					\
Packit e20377
	> $$@
Packit e20377
Packit e20377
ligature/rmligs: liglist.tmp ligature/rmligs.skel
Packit e20377
	cat ligature/rmligs.skel liglist.tmp > $$@
Packit e20377
	chmod 755 $$@
Packit e20377
Packit e20377
endef
Packit e20377
$(eval $(call liglist_template,liglist))
Packit e20377
Packit e20377
Packit e20377
Packit e20377
Packit e20377
###
Packit e20377
## misc stuff:
Packit e20377
###
Packit e20377
Packit e20377
clean:
Packit e20377
	rm -f all.words* igerman98*.tar.bz2 isowordlist* MD5sums SHA256sums
Packit e20377
	#sort liglist.aff  MD5sums myspell/*.dic de_DE.zip de_CH.zip myspell/VERSION *.tmp
Packit e20377
	rm -f ispell/*.aff ispell/*.hash
Packit e20377
	rm -f myspell/*.dic  myspell/*.aff  myspell/*.zip myspell/VERSION
Packit e20377
	rm -f hunspell/*.dic hunspell/*.aff hunspell/*.zip hunspell/VERSION
Packit e20377
	rm -f ligature/liglist.* ligature/rmligs
Packit e20377
	rm -f mozilla/*.xpi
Packit e20377
	$(FIND) aspell/ -type f ! -name "*.in" -print |xargs rm -fr
Packit e20377
	$(FIND) . -name "*tmp*" -print |xargs rm -fr
Packit e20377
Packit e20377
sort:
Packit e20377
	@if grep [äöüÄÖÜß] dicts/*.txt ;then echo "!!! illegal ISO-8859-1 characters in dictionary files !!!";exit 1;fi
Packit e20377
	@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
Packit e20377
	@if grep -q -v "/.*d" dicts/blacklist* ; then echo "missing d in blacklist?" ; exit 1 ; fi
Packit e20377
	$(FIND) ./dicts/ -name "*.txt" -print -o -name "blacklist*" -print | while read i; do $(SORT) -u -o "$$i" "$$i"; done
Packit e20377
Packit e20377
pack: sort
Packit e20377
	exit 1
Packit e20377
	rm -f unpack
Packit e20377
	cd dicts; $(FIND) . -name "*.txt" -print |while read i; do test -e $$i.sq && exit 1; $(SQ) < $$i > $$i.sq && rm $$i; done
Packit e20377
Packit e20377
unpack:
Packit e20377
	exit 1
Packit e20377
	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
Packit e20377
	touch unpack
Packit e20377
Packit e20377
dist: sort clean
Packit e20377
	echo $(DATE) > VERSION
Packit e20377
	$(FIND) . -xtype f ! -name ".*" -a ! -name grep -print | xargs sha256sum | gpg --clearsign > .SHA256sums
Packit e20377
	mv .SHA256sums SHA256sums
Packit e20377
	ls > .files
Packit e20377
	echo igerman98-`cat VERSION` > .name
Packit e20377
	mkdir `cat .name`
Packit e20377
	mv `cat .files` `cat .name`
Packit e20377
	$(TAR) cvf - --exclude "grep" * | bzip2 -9 > `cat .name`.tar.bz2
Packit e20377
	mv `cat .name`/* .
Packit e20377
	rmdir `cat .name`
Packit e20377
Packit e20377
Packit e20377
Packit e20377
Packit e20377
Packit e20377
###########################
Packit e20377
### TEST TRASH follows: ###
Packit e20377
###########################
Packit e20377
Packit e20377
help_test:
Packit e20377
	grep "^[[:alpha:]\-]*:"  Makefile | cut -d " " -f 1
Packit e20377
Packit e20377
test0:
Packit e20377
	export BLA=FOO
Packit e20377
Packit e20377
LIST_FOO = eins zwei drei
Packit e20377
Packit e20377
eins:
Packit e20377
Packit e20377
#zwei: $($(WORTE_NEU))
Packit e20377
# $(addprefix dicts/,$(WORTE))
Packit e20377
zwei: $(WORDS_GENERIC)
Packit e20377
	echo $(WORDS_GENERIC)
Packit e20377
	touch zwei
Packit e20377
Packit e20377
drei:
Packit e20377
	echo $(WORDS_NOCAPMAIN)
Packit e20377
	$(RM_OR_NOT) bla
Packit e20377
Packit e20377
test1: test0 $(LIST_FOO) testdir/de_DE.dic
Packit e20377
	echo $$BLA
Packit e20377
	echo $(LIST_FOO)
Packit e20377
Packit e20377
#FOO_de_DE FOO_de_AT FOO_de_CH FOO_de_all: WORDS_$(subst FOO_,,$@)
Packit e20377
#FOO_de_DE FOO_de_AT FOO_de_CH FOO_de_all : MYLANG=$(subst FOO_,,$@)
Packit e20377
#FOO_de_DE FOO_de_AT FOO_de_CH FOO_de_all : MYLANG=$(shell echo $@ |sed s/.*_\(de_.*\)/\1/)
Packit e20377
#FOO_de_DE FOO_de_AT FOO_de_CH FOO_de_all : MYLANG=$(shell echo $@|sed "s/^.*_\(de_.*$$\)/\1/")
Packit e20377
#FOO_de_DE FOO_de_AT FOO_de_CH FOO_de_all: $(FOO_%: WORDS_%)
Packit e20377
FOO_de_DE FOO_de_AT FOO_de_CH FOO_de_all: $(WORDS_$(MYLANG)) $(HUNSPELL_DICTS_BASE_$(MYLANG))
Packit e20377
	#set MYLANG=$(subst FOO_,,$@)
Packit e20377
	echo target: $@
Packit e20377
	echo MYLANG: $(MYLANG)
Packit e20377
	#echo $(WORDS_$(subst FOO_,,$@))
Packit e20377
	echo $(WORDS_$(MYLANG))
Packit e20377
	echo $<
Packit e20377
Packit e20377
WORDS_de_aa = $(WORDS_shell)
Packit e20377
WORDS_de_bb = $(WORDS_shell)
Packit e20377
Packit e20377
SUB_de_aa SUB_de_bb: $(WORDS_$(MYLANG))
Packit e20377
	@echo SUB says WORDS is: $(MYLANG)
Packit e20377
	@echo SUB says lang is: $(lang)
Packit e20377
Packit e20377
define MYDEF
Packit e20377
$(1): lang_def=hallo
Packit e20377
endef
Packit e20377
Packit e20377
test2_de_aa test2_de_bb: lang=$(MYLANG)
Packit e20377
#test2_de_aa: SUB_
Packit e20377
#test2_de_aa test2_de_bb: $$(SUB_$(MYLANG))
Packit e20377
test2_de_aa test2_de_bb: $(eval $(call MYDEF,$(@)))
Packit e20377
	#$(subst LANG,$(lang),SUB_LANG)
Packit e20377
	@echo MYLANG: $(MYLANG)
Packit e20377
	@echo lang: $(lang)
Packit e20377
	@echo lang_def: $(lang_def)
Packit e20377
	@echo I think WORDS is: $(WORDS_$(MYLANG))
Packit e20377
Packit e20377
TESTLANGS=de_aa de_bb de_DE
Packit e20377
Packit e20377
define LANG_testtemplate
Packit e20377
$(1): $$($(1)_OBJS) $$($(1)_LIBS:%=-l%)
Packit e20377
	echo aa
Packit e20377
test3_$(1): SUB_$(1)
Packit e20377
	@echo MYLANG: $(MYLANG)
Packit e20377
	@echo I think WORDS is: $(WORDS_$(MYLANG))
Packit e20377
	@echo I think I am $$@
Packit e20377
Packit e20377
ALL_OBJS   += $$($(1)_OBJS)
Packit e20377
endef
Packit e20377
Packit e20377
$(foreach langcode,$(TESTLANGS),$(eval $(call LANG_testtemplate,$(langcode))))