#
# lookbibtex makefile
# very simple, right?
# Actually, it was simple, once.
#

#
# The following parameters you may wish to change.
#

BINDIR=/usr/dist/bin
BINOWN=johnh
BINMOD=755

MANEXT=1
MANDIR=/usr/dist/share/man/man$(MANEXT)
MANOWN=johnh
MANMOD=644

# perl path in scripts.dist
OLDPERLPATH=/usr/dist/bin/perl
# perl path on your system
NEWPERLPATH=/usr/dist/bin/perl

#
# End of stuff to localize
#



PROGRAMS=lookbibtex bibdestringify


default: $(PROGRAMS)
	@echo "bibtex tools are up-to-date."

lookbibtex: lookbibtex.dist
	sed s:#!$(OLDPERLPATH):#!$(NEWPERLPATH):p <lookbibtex.dist >lookbibtex

bibdestringify: bibdestringify.dist
	sed s:#!$(OLDPERLPATH):#!$(NEWPERLPATH):p <bibdestringify.dist >bibdestringify



# install things in the right place
install:  $(PROGRAMS)
	cp lookbibtex.1 $(MANDIR)/lookbibtex.$(MANEXT)
	chmod $(MANMOD) $(MANDIR)/lookbibtex.$(MANEXT)
	chown $(MANOWN) $(MANDIR)/lookbibtex.$(MANEXT)
	cp bibdestringify.1 $(MANDIR)/bibdestringify.$(MANEXT)
	chmod $(MANMOD) $(MANDIR)/bibdestringify.$(MANEXT)
	chown $(MANOWN) $(MANDIR)/bibdestringify.$(MANEXT)
	cp lookbibtex $(BINDIR)
	chmod $(BINMOD) $(BINDIR)/lookbibtex
	chown $(BINOWN) $(BINDIR)/lookbibtex
	cp bibdestringify $(BINDIR)
	chmod $(BINMOD) $(BINDIR)/bibdestringify
	chown $(BINOWN) $(BINDIR)/bibdestringify


# package up a shar for distribution
shar:
	shar README lookbibtex.1 lookbibtex.dist \
		bibdestringify.1 bibdestringify.dist release \
		Makefile>lookbibtex.`cat release`.shar
	compress <lookbibtex.`cat release`.shar >lookbibtex.`cat release`.shar.Z