# Makefile for igaelic
# igaelic -- Ispell dictionary list for Scots Gaelic (gaidhlig)
#
# Copyright (C) Alastair McKinstry, 1997,1998
# Released under the GNU Public License
#
# $Id: Makefile,v 1.1.1.1 1999/01/30 19:14:49 alastair Exp $

ISPELL=`rpm -q ispell`
VERSION=`cat version`

ifndef PREFIX
PREFIX=${DESTDIR}/usr
endif

# Edit WORDLISTS to change list of words that are included.

RPM_ROOT_DIR=/usr/src/redhat
WORDLISTS= words unchecked-words
ALLFILES= $(WORDLISTS) Makefile ispell-gd.spec.sed ChangeLog README COPYING \
	gaelic.4 gaelic.aff

TARFILE=igaelic-$(VERSION).tar


gaelic.words: $(WORDLISTS)
	cat $(WORDLISTS) > gaelic.words

gaelic.hash: gaelic.words gaelic.aff
	buildhash gaelic.words gaelic.aff gaelic.hash

gd_GB.dic: gaelic.words
	wc -l gaelic.words > gd_GB.dic
	cat gaelic.words >> gd_GB.dic

clean:
	rm -f *.cnt *.stat  gaelic.words *~ *.bak gd_GB.dic

reallyclean:
	make clean
	rm -rf *.hash

check: gaelic.hash
	$(MAKE) -C tests

munch:
	for d in $(WORDLISTS) incorrect-words ; do munchlist -l  gaelic.aff $$d > tmp ; mv tmp $$d ; done

tarfile: 
	make munch clean
	rm -f gaidhlig.hash ../ispell-gd-*
	ln -s ispell-gd ../ispell-gd-$(VERSION)
	tar  cvf ../$(TARFILE) -C .. -h  ispell-gd-$(VERSION)
	gzip ../$(TARFILE)
	rm ../ispell-gd-$(VERSION)
	ln -s ../$(TARFILE).gz ../ispell-gd-latest.tgz

../ispell-gd-latest.tgz:
	make tarfile

rpm: 	../ispell-gd-latest.tgz
	mv ../$(TARFILE).gz $(RPM_ROOT_DIR)/SOURCES
	sed s/DATESTAMP/$(DATE)/ < ispell-gd.spec.sed > $(RPM_ROOT_DIR)/SPECS/ispell-gd-$(VERSION).spec	
	(cd $(RPM_ROOT_DIR)/SPECS;	rpm -ba -vv --sign ispell-gd-$(VERSION).spec)


install: gaelic.hash 
	mkdir -p ${PREFIX}/lib/ispell
	cp gaelic.hash gaelic.aff ${PREFIX}/lib/ispell

install-words: gaelic.words
	mkdir -p ${PREFIX}/share/dict
	cp gaelic.words ${PREFIX}/share/dict/gaelic

install-myspell: gd_GB.dic
	mkdir -p ${PREFIX}/share/myspell/dicts
	mkdir -p ${PREFIX}/share/myspell/infos/ooo
	cp gd_GB.aff gd_GB.dic ${PREFIX}/share/myspell/dicts
	cp debian/myspell.info ${PREFIX}/share/myspell/infos/ooo/myspell-gd
