# Generated automatically from Makefile.in by configure.
#=======================================================================
# Makefile for bibsort, a BibTeX bibliography file sort utility.
#
# Current target list:
#	all			make documentation files
#	bibsort.hlp		VAX (Open)VMS HELP file of manual pages
#	bibsort.html		HTML form of manual pages
#	bibsort.pdf		Portable Document Format form of manual
#				pages
#	bibsort.ps		PostScript file of typeset manual pages
#	bibsort.ser		spelling errors
#	bibsort.shar		UNIX shar bundle for e-mail distribution
#	bibsort.tar		UNIX tar archive bundle
#	bibsort.txt		ASCII text file of manual pages
#	bibsort.zip		Info-ZIP archive bundle
#	bibsort.zoo		Zoo archive bundle
#	check			run validation suite (currently a dummy)
#	clean			remove temporary files
#	clobber			remove all automatically recreatable files
#	distclean		same as clobber
#	install			install bibsort on system
#	install-exe		install bibsort executable on system
#	install-ftp		install bibsort on anonymous ftp directory
#	install-html		install bibsort HTML file on system
#	install-man		install bibsort manual pages on system
#	maintainer-clean	remove absolutely everything that "make" 
#				can rebuild at the maintainer's site (do 
#				NOT use this target!)
#	mostlyclean		same as clean
#	realclean		same as clobber
#	reconfigure		regenerate configure script and run it
#	spell			check spelling (with two spellers)
#	test-version		test extraction of version number
#	uninstall		remove installed executable and man pages
#	uninstall-exe		remove installed executable 
#	uninstall-ftp		remove files installed in anonymous ftp
#				directory
#	uninstall-html		remove installed HTML file
#	uninstall-man		remove installed man pages
# 
# [24-Sep-1999] -- update for version 0.13, and use of GNU autoconfigure
# [24-Nov-1997]
#=======================================================================

prefix          = /usr/local
exec_prefix     = $(prefix)

# Change these two directories to match local conventions if you
# wish to do "make install" and "make install-ftp":
BINDIR          = $(exec_prefix)/bin
CATDIR		= $(prefix)/man/cat1
MANDIR		= $(prefix)/man/man1
MANEXT		= 1
FTPDIR		= /usr/spool/ftp/pub/tex/bib
FTPDIR		= /u/ftp/pub/tex/bib
HTMLMANDIR	= /home/httpd/htdocs/computing/man
HTMLMANDIR	= $(prefix)/share/html/man/man1

AUTOCONF	= /usr/local/bin/autoconf

# Need new awk (nawk) or gawk here:
AWK		= /usr/local/bin/mawk

# This is either Robert Solovay's checksum program, or else cat, in which
# case the checksum in the file header of the installed executable will be
# incorrect.
CHECKSUM	= /usr/local/bin/checksum

CHMOD		= /usr/local/bin/chmod

COL		= /bin/col -b

# We prefer to retain file modification times on installed files, but
# not all cp implementations have the -p (preserve timestamp) switch.
# Fortunately, all rcp and scp implementations seem to support -p, so
# we use one of them instead.
CP		= scp -p

DIST-FILES      = CHANGELOG README README.AWK Makefile.in bibsort.hlp \
		  bibsort.html bibsort.man bibsort.pdf bibsort.ps bibsort.sh \
		  bibsort.sok bibsort.txt configure.in configure man2ps \
		  rofvms.awk save/configure save/Makefile

DISTILL		= /usr/local/bin/distill

GZIP		= /usr/local/bin/gzip

ISPELL		= /usr/local/bin/ispell

LN		= /usr/local/bin/ln

LS		= /usr/local/bin/ls

MAN2HTML	= /usr/local/bin/man2html

MAN2HTMLFLAGS	= -grammar-level 3.2

MAN2PS		= ./man2ps

# Not all mkdir commands support -p, but the install-html target
# will simply skip its installation work if the HTML directory
# is not available, perhaps because -p was unrecognized.
MKDIR		= /usr/local/bin/mkdir -p

NROFF		= /bin/nroff

RM		= /usr/local/bin/rm -f

SED		= /usr/local/bin/sed

SHELL		= /bin/ksh

SORT		= /usr/local/bin/sort

SPELL		= /bin/spell

TAR		= /usr/local/bin/tar

UNZIP		= /usr/local/bin/unzip

# NB: The version number of the FTP bibsort archive files is extracted
# from that of bibsort.sh.
VERSION		= `$(AWK) '/^\#\#\#[ \t]*version *= *"[0-9.]+", *$$/ \
		{ gsub(/[^0-9.]/,"",$$4); print $$4 }' bibsort.sh`

ZIP		= /usr/local/bin/zip

ZOO		= /usr/local/bin/zoo

#=======================================================================

all:	bibsort.txt bibsort.hlp

# VAX VMS help file format from bibsort.txt
bibsort.hlp:	bibsort.txt rofvms.awk
	$(AWK) -f rofvms.awk <bibsort.txt >bibsort.hlp

bibsort.html:	bibsort.man
	$(MAN2HTML) $(MAN2HTMLFLAGS) bibsort.man

bibsort.pdf:	bibsort.ps
	$(DISTILL) bibsort.ps

bibsort.ps:	bibsort.man
	$(MAN2PS) <bibsort.man >bibsort.ps

bibsort.shar:	$(DIST-FILES)
	$(SHAR) -b -c -v $(DIST-FILES) >bibsort.shar

bibsort.tar:	$(DIST-FILES)
	-$(RM) bibsort.tar bibsort.tar-lst
	$(TAR) chf bibsort.tar $(DIST-FILES)
	-$(MKDIR) bibsort-$(VERSION)
	cd bibsort-$(VERSION); $(TAR) xf ../bibsort.tar
	$(TAR) cf bibsort-$(VERSION).tar bibsort-$(VERSION)
	-$(RM) -r bibsort-$(VERSION)
	-$(RM) bibsort.tar
	$(LN) bibsort-$(VERSION).tar bibsort.tar

bibsort.txt:	bibsort.man
	$(NROFF) -man $? | $(COL) >$@

bibsort.zip:	$(DIST-FILES)
	-$(RM) bibsort*.zip
	-$(RM) bibsort*.zip-lst
	$(ZIP) bibsort-$(VERSION).zip $(DIST-FILES)
	$(UNZIP) -v bibsort-$(VERSION).zip >bibsort-$(VERSION).zip-lst
	$(LN) bibsort-$(VERSION).zip bibsort.zip

bibsort.zoo:	$(DIST-FILES)
	-$(RM) bibsort*.zoo
	-$(RM) bibsort*.zoo-lst
	$(ZOO) a bibsort-$(VERSION).zoo $(DIST-FILES)
	$(ZOO) v bibsort-$(VERSION).zoo >bibsort-$(VERSION).zoo-lst
	$(LN) bibsort-$(VERSION).zoo bibsort.zoo

check:	all
	@echo bibsort does not yet have a validation suite

clean mostlyclean:
	-$(RM) *.o
	-$(RM) *.shar
	-$(RM) *.tar
	-$(RM) *.tar-lst
	-$(RM) *.zip
	-$(RM) *.zip-lst
	-$(RM) *.zoo
	-$(RM) *.zoo-lst
	-$(RM) *~
	-$(RM) \#*
	-$(RM) core

clobber distclean realclean:	clean
	-$(RM) bibsort.hlp
	-$(RM) bibsort.txt
	-$(RM) bibsort.ps
	-$(RM) bibsort.ser
	-$(RM) Makefile
	-$(RM) config.cache config.log config.status

install:	install-exe install-html install-man

install-exe: uninstall-exe
	$(SED)	-e 's@#!/bin/sh@#!$(SHELL)@' \
		-e 's@^gawk@$(AWK)@' \
		bibsort.sh | \
		$(CHECKSUM) > $(BINDIR)/bibsort
	$(CHMOD) 755 $(BINDIR)/bibsort
	$(LN) $(BINDIR)/bibsort $(BINDIR)/bibsort-$(VERSION)
	$(LS) -l $(BINDIR)/bibsort $(BINDIR)/bibsort-$(VERSION)

install-html:	bibsort.html uninstall-html
	-if [ -d $(HTMLMANDIR) ] ; \
	then \
		true ; \
	else \
		$(MKDIR) $(HTMLMANDIR) 2>/dev/null ; \
	fi
	-if [ -d $(HTMLMANDIR) ] ; \
	then \
		$(RM) $(HTMLMANDIR)/bibsort.html ; \
		$(CP) bibsort.html $(HTMLMANDIR)/bibsort.html ; \
		$(CHMOD) 664 $(HTMLMANDIR)/bibsort.html ; \
		$(LS) -l $(HTMLMANDIR)/bibsort.html ; \
	else \
		echo "Skipping HTML file installation: $(HTMLMANDIR) does not exist" ; \
	fi

install-man:	uninstall-man
	$(CP) bibsort.man $(MANDIR)/bibsort.$(MANEXT)
	$(CHMOD) 664 $(MANDIR)/bibsort.$(MANEXT)
	$(LS) -l $(MANDIR)/bibsort.$(MANEXT)

install-ftp:	bibsort.tar bibsort.zip bibsort.zoo install-ftp
	$(TAR) tvf bibsort-$(VERSION).tar >$(FTPDIR)/bibsort-$(VERSION).tar-lst
	$(GZIP) <bibsort-$(VERSION).tar \
		>$(FTPDIR)/bibsort-$(VERSION).tar.gz
	$(CP) bibsort-$(VERSION).zip $(FTPDIR)
	$(CP) bibsort-$(VERSION).zip-lst $(FTPDIR)
	$(CP) bibsort-$(VERSION).zoo $(FTPDIR)
	$(CP) bibsort-$(VERSION).zoo-lst $(FTPDIR)
	$(LS) -l $(FTPDIR)/bibsort-$(VERSION).*

maintainer-clean:	distclean
	@echo "This command is intended for maintainers to use;"
	@echo "it deletes files that may require special tools to rebuild."
	-$(RM) bibsort.html
	-$(RM) configure

reconfigure:
	$(AUTOCONF)
	./configure

# Check the spelling in the bibsort script and manual pages, leaving
# exceptions in bibsort.ser.  Both spell and ispell are used.
SPELL-FILTER = cat bibsort.man bibsort.sh | $(SED) -e "s/[^a-zA-Z'-]/ /g"
spell bibsort.ser:
	-if [ ! -f bibsort.sok ] ; then touch bibsort.sok ; fi
	-$(SPELL-FILTER) | $(SPELL) +bibsort.sok >/tmp/bibsort.ser
	-$(SPELL-FILTER) | $(ISPELL) -l -p bibsort.sok >>/tmp/bibsort.ser
	-$(SORT) -u /tmp/bibsort.ser >bibsort.ser
	-if [ ! -s bibsort.ser ] ; then $(RM) bibsort.ser ; fi
	-$(RM) /tmp/bibsort.ser

test-version:
	@echo "Version number is ""'"$(VERSION)"'"

uninstall:	uninstall-exe uninstall-html uninstall-man

uninstall-exe:
	-$(RM) $(BINDIR)/bibsort $(BINDIR)/bibsort-$(VERSION)

uninstall-html:
	-$(RM) $(HTMLMANDIR)/bibsort.html

uninstall-man:
	-$(RM) $(MANDIR)/bibsort.$(MANEXT)
	-$(RM) $(CATDIR)/bibsort.$(MANEXT)

uninstall-ftp:
	-$(RM) $(FTPDIR)/bibsort-$(VERSION).tar.gz
	-$(RM) $(FTPDIR)/bibsort-$(VERSION).tar-lst
	-$(RM) $(FTPDIR)/bibsort-$(VERSION).zip
	-$(RM) $(FTPDIR)/bibsort-$(VERSION).zip-lst
	-$(RM) $(FTPDIR)/bibsort-$(VERSION).zoo
	-$(RM) $(FTPDIR)/bibsort-$(VERSION).zoo-lst
