%.1: %.pod
	pod2man -c '' $< $@
bin/fig2pdf:
	cd bin;ln -s fig2ps fig2pdf; cd ..;
doc/fig2pdf.1:
	cd doc;ln -s fig2ps.1 fig2pdf.1; cd ..;

build: doc/fig2ps.1 check

check:
	perl -c -w bin/fig2ps

install: build
	cp bin/fig2ps $(DESTDIR)/usr/bin/fig2ps
	cp fig2ps.rc $(DESTDIR)/etc/fig2ps/fig2ps.rc
	gzip --best -c doc/fig2ps.1 > $(DESTDIR)/usr/share/man/man1/fig2ps.1.gz

install-home: build
	if test -d $(HOME)/bin ;\
	then cp bin/fig2ps $(HOME)/bin;\
	ln -s  $(HOME)/bin/fig2ps  $(HOME)/bin/fig2pdf;\
	ln -s  $(HOME)/bin/fig2ps  $(HOME)/bin/fig2eps;\
	cp fig2ps.rc $(HOME)/.fig2ps.rc;\
	else echo "You should have a $(HOME)/bin directory";\
	fi;

clean:
	rm -f `find . -name "*~"`;
	rm doc/fig2ps.1;

