N=whichPT

all:
	@ echo
	@ echo ' whichPT '
	@ echo '------------------------------'
	@ echo
	@ echo ' NOTE: to install and build whichPT you need a recent'
	@ echo '       jspell release (1.1.3 or later) '
	@ echo
	@ echo ' make install - installs whichPT '
	@ echo ' make build - creates all the needed files, but do not '
	@ echo '              install '
	@ echo ' make uninstall - removes whichPT and documentation '
	@ echo
	@ echo

build: $N

$N: $N.skel pt br makefile 
	cat $N.skel > $N
	echo "__DATA__\n" >> $N 
	iconv -f latin1 -t utf8 pt >> $N
	iconv -f latin1 -t utf8 br >> $N
	
	chmod 755 $N

pt br: regras2listas
	perl regras2listas regras.pt-br

clean: 
	rm -f $N $N.tar.gz pt br
uninstall:
	rm /usr/local/bin/$N /usr/share/man/man1/$N.1
install: $N build
	cp $N /usr/local/bin/
	chmod 755 /usr/local/bin/$N
	pod2man $N > /usr/share/man/man1/$N.1
package: $N.skel COPYING README makefile regras2listas regras.pt-br
	mkdir -p _tmp/$N
	cp $N.skel makefile COPYING README regras2listas regras.pt-br _tmp/$N
	(cd _tmp; tar czvf $N.tgz $N )
	cp _tmp/$N.tgz .
	rm -rf _tmp
