A2PS = a2ps

PERL = /usr/local/bin/perl
#PERL = /usr/bin/perl

BINDIR = /usr/local/bin
#BINDIR = /usr/bin

#MANDIR = /usr/local/share/man/man1
MANDIR = /usr/local/man/man1
#MANDIR = /usr/share/man/man1
#MANDIR = /usr/man/man1

all:
	( \
		cp a2ps $(A2PS).$$$$ ; \
		sed -e "1s@#\!.*@#\!$(PERL)@" -e "s/a2ps/$(A2PS)/g" \
			< $(A2PS).$$$$ > $(A2PS) ; \
		rm -f $(A2PS).$$$$ ; \
		chmod a+x $(A2PS) ; \
		cp a2ps.1 $(A2PS).1.$$$$ ; \
		sed -e "s/a2ps/$(A2PS)/g" < $(A2PS).1.$$$$ > $(A2PS).1 ; \
		rm -f $(A2PS).1.$$$$ \
	)

install:
	install $(A2PS) $(BINDIR)
	install $(A2PS).1 $(MANDIR)
