#=======================================================================
# Makefile for BibTeX .bib file prettyprinter
#
# Current target list: (these include all GNU Project standard targets)
#	all			build bibclean
#	bclproto		obsolete; build an early prototype of bibclean
#	bibclean		executable for bibclean
#	bibclean.h		documentation strings for help() function
#	bibclean.hlp		VAX VMS help file (automatically converted
#				from bibclean.txt)
#	bibclean.i		C preprocessor output from bibclean.c
#	bibclean.ps		PostScript version of bibclean.man
#	bibclean.shr		shar bundle for email distribution
#	bibclean.tar		tar archive file for ftp distribution
#	bibclean.txt		nroff'ed bibclean.man manual page file
#	bibclean.zip		Info-zip archive file for ftp distribution
#	bibclean.zoo		zoo archive file for ftp distribution
#	check			same as test (see below)
#	clean			clean up all but executables and time stamps
#	clobber			clean up everything
#	distclean		same as clobber
#	docs			make bibclean.txt, bibclean.hlp, and bibclean.ps
#	install			install executable and man pages
#	install.time		internal target for install
#	install-ftp		install .tar, .zip, and .zoo files in ftp tree
#	install-ftp.time	internal target for install-ftp
#	mostlyclean		same as clean
#	realclean		bad grammar for reallyclean
#	reallyclean		clobber, and remove TAGS file
#	TAGS			GNU Emacs tags file
#	test			test bibclean on BibTeX and Scribe
#				bibliographies
#	test-bibtex		test 1,2,3 bibclean on BibTeX bibliographies
#	test-bibtex-1		test 1 bibclean on BibTeX bibliographies
#	test-bibtex-2		test 2 bibclean on BibTeX bibliographies
#	test-bibtex-3		test 3 ISBN and ISSN verification
#	test-scribe		test 1,2,3 bibclean on Scribe bibliographies
#	test-scribe-1		test 1 bibclean on Scribe bibliographies
#	test-scribe-2		test 2 bibclean on Scribe bibliographies
#	test-scribe-3		test 3 bibclean on Scribe bibliographies
#	test-version		test extraction of version number
#	uninstall		remove files installed by "make install"
#	uninstall-ftp		remove installed files in anonymous ftp
#				directory
#	vaxvms/bibclean.uue	uuencoded version of VAX VMS bibclean.exe
#				for portable distribution
#
# [24-Nov-1992]
#=======================================================================

# Change these two directories to match local conventions:
BINDIR		= /usr/local/bin
MANDIR		= /usr/local/man/man1
MANEXT		= 1
FTPDIR		= /usr/spool/ftp/pub/tex/bib

# Need new awk (nawk) or gawk here:
AWK		= nawk

# For testing purposes, make sure we always have the same
# initialization file
BIBCLEAN	= ./bibclean -init-file bibclean.ini

BIBTEX		= bibtex

BIBTEX-TESTS	= testbib1.org testbib2.org testisxn.org

# Use lcc or gcc with extra flags for extensive error checking, or use
# C++ compiler (g++ or CC).  DO NOT CHANGE ANY OF THESE VALUES:
# instead, copy one of these to the end of the CC list to select your
# compiler.  You may also set the DEFINES value below too, though that
# is rarely necessary.

CC	= CC			## C++ for BSD 4.3 UNIX on HP 370
CC	= CC +a1 -xansi +w	## C++ for SGI IRIX 4.0 (see LOADLIBES below)
CC	= cc -ansiposix -fullwarn -woff 22,24,183,205,262,269,302,303
                                ## C for SGI IRIX 4.0
CC	= CC +a1 +p +w -D_POSIX_SOURCE -Hansi -D__STDC__ -D_BSD -D_AIX -Dps2 \
	  -DHAVE_TERMIO_H
                                ## C++ on AIX 370 and PS/2: +a1 (ANSI
                                ## declarations), +p (no anachronisms), +w
                                ## (warnings) -D-BSD (to get toupper() and
                                ## tolower() declared in ctype.h).
                                ## Need -DHAVE_TERMIO_H because termios.h
                                ## has wrong prototypes for C++
CC	= CC +a1 +p +w -D_POSIX_SOURCE -Hansi -D__STDC__ -D_BSD -D_AIX -D_AIX370
                                ## C++ on AIX 370
CC	= /usr/CC/sun4/CC -I/usr/CC/incl -D__SUNCC__ ## C++ on SunOS 4.1.1
CC	= acc -Xc -vc -strconst -D__ACC__ -D_POSIX_SOURCE -DHAVE_TERMIOS_H
                                ## SunOS Standard C compiler (neither
                                ## -DHAVE_SGTTY_H nor -DHAVE_TERMIO_H gives
                                ## char-at-a-time input, sigh...; they work
                                ## fine on other systems).
CC	= c89 -D_POSIX_SOURCE -D_ALL_SOURCE	## IBM RS/6000
CC	= c89 -D_HPUX_SOURCE	## HP 9000/8xx HP-UX A.08
CC	= cc			## most systems
CC	= cc			## Stardent (NB: remove -g in OPT below)
CC	= cc -systype bsd43 -D__CC__	## MIPS RCxxxx RISCos 4.52 and 5.2:
CC	= cc $(GCCFLAGS)	## NeXT (cc is really GNU C compiler)
CC	= g++ $(GCCFLAGS)	## GNU C++
CC	= lcc -A -A -n		## Princeton/AT&T Standard C compiler
CC	= gcc $(GCCFLAGS)	## GNU C

# Compiler for this site:
CC	= g++ $(GCCFLAGS)	## GNU C++

# When HOST, USER, __DATE__, and __TIME__ are available,
# bibclean preserves them for its version output
CFLAGS		= $(OPT) $(DEFINES) -DHOST=\"$(HOST)\" -DUSER=\"$(USER)\"

CHMOD		= chmod

COMPRESS	= compress

# Use the -p flag where available to preserve file time stamps
CP		= /bin/cp -p
CP		= /bin/cp

# To select the value checking algorithms, you can define one of:
#
# HAVE_RECOMP		when re_comp() and re_exec() are available.
# HAVE_REGEXP		when compile() and step() are available.
# HAVE_PATTERNS		for internal pattern matching code (default)
# HAVE_OLDCODE		for old hard-wired value checking
#
# If you experience problems with compiling the terminal handling code,
# used for a `more' display of help, define one of:
#
# HAVE_SGTTY_H		for Berkeley style
# HAVE_TERMIO_H		for SVID2 and XPG2 style
# HAVE_TERMIOS_H	for XPG3, POSIX.1, FIPS 151-1 style
# SCREEN_LINES=0	to suppress all terminal handling
#
# Finally, you can customize file names and search paths:
# INITFILE=xxx		to change the name of the initialization file
#			from .bibcleanrc.
# SYSPATH=xxx		to change the system search path name from PATH
# USERPATH=xxx		to change the user search path name from BIBINPUTS
#
# For most machines, the internal settings of these values are
# adequate, and they need not be set here.  See however the setting of
# HAVE_TERMIO_H for the IBM 3090 above.  On Sun systems, all 3 terminal
# handling mechanisms are supported.  However, on SunOS 4.1.2 at
# least, termios.h has incorrect function prototypes that prevent
# successful compilation with C++ compilers; gcc will work in such a case.

DEFINES		= -DHAVE_REGEXP		## SGI Irix 4.0, HP-UX

DEFINES		= -DHAVE_RECOMP		## IBM AIX PS/2, IBM AIX 370,
                                        ## NeXT, SunOS, ULTRIX

DEFINES		= -DHAVE_PATTERNS	## generic solution for all systems

DIST-FILES	= README Makefile bibclean.c bibclean.h bibclean.hlp  \
		bibclean.ini bibclean.man bibclean.ps bibclean.reg \
		bibclean.txt fndfil.c machdefs.h match.c match.h os.h \
		osatari.h ospcdos.h osprimos.h osrmx.h ostops20.h \
		osunix.h osvaxvms.h osvmcms.h rofvms.awk strtol.c \
		unixlib.h vaxvms.c vmswild.c xctype.h xerrno.h xpwd.h \
		xstat.h xstddef.h xstdlib.h xstring.h xtypes.h \
		$(BIBTEX-TESTS) \
		$(BIBTEX-TESTS:.org=.bok) \
		$(BIBTEX-TESTS:.org=.eok) \
		testbib2.ltx \
		$(SCRIBE-TESTS) \
		$(SCRIBE-TESTS:.org=.bok) \
		$(SCRIBE-TESTS:.org=.eok) \
		testscr2.bo2 testscr2.eo2 \
		ibmpc/bibclean.uue ibmpc/ibmtest.bat \
		ibmpc/makefile.msc ibmpc/makefile.tcc \
		ibmpc/msc51bld.bat ibmpc/msc51pth.bat \
		ibmpc/msc60bld.bat ibmpc/msc60pth.bat \
		ibmpc/msc70bld.bat ibmpc/msc70pth.bat \
		ibmpc/tcc20bld.bat ibmpc/tcc20pth.bat \
		ibmpc/tcc30bld.bat ibmpc/tcc30pth.bat \
		vaxvms/bibclean.uue vaxvms/recomp.com \
		vaxvms/vmsclean.com vaxvms/vmsmake.com \
		vaxvms/vmstest.com

DIST-FILES-BIN	= ibmpc/bibclean.exe vaxvms/bibclean.exe

DITROFF		= ditroff	## AT&T
DITROFF		= groff		## GNU

# Extra flags for gcc and g++ to get maximal checking
GCCFLAGS	= -Wall -Wshadow -Wcast-qual -Wpointer-arith \
		  -Wwrite-strings

# Some systems define HOST or HOSTNAME, but others don't, so we
# generate it at compile time with the hostname utility.
HOST		= `hostname`

LATEX		= latex

LN		= ln -s

# Define this symbol for additional link libraries
LOADLIBES	= -lC -lc_s		## SGI IRIX 4.0 for shared libraries
LOADLIBES	=

NROFF		= nroff

OPT		= -g

RM		= /bin/rm -f

SCRIBE-TESTS-1	= testscr1.org testscr2.org

# Do NOT use SCRIBE-TESTS-1 in this list, because MIPS 6280 RISCos 5.0
# make then fails to correctly expand $(SCRIBE-TESTS:.org=.xyz).
SCRIBE-TESTS	= testscr1.org testscr2.org testscr3.org

SED		= /bin/sed

SHELL		= /bin/sh

STRIP		= strip

TAGS-FILES	= bibclean.c match.c match.h

UNZIP		= unzip

VERSION		= `$(AWK) '/^[ \t]*version *= *"[0-9.]+", *$$/ \
		{ gsub(/[^0-9.]/,"",$$3); print $$3 }' bibclean.c`

ZIP		= zip

ZOO		= zoo

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

.SUFFIXES:

.SUFFIXES: .o .i .c .bib-new .bib-old .bib

.bib.bib-new:
	-$(BIBCLEAN) <$< >$@

.bib.bib-old:
	./bclproto <$< >$@

.c.i:
	$(CC) $(CFLAGS) -E $< 2>&1 | grep -v '^[ 	]*$$' >$@

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

all:	bibclean test docs

# Original (and now very obsolete) ad hoc prototype
bclproto:	bclproto.o
	$(CC) $(CFLAGS) -o bclproto bclproto.o

bclproto.o:	bclproto.c os.h xerrno.h xstddef.h xstdlib.h xstring.h \
		xtypes.h

# New grammar-based program.  Although strtol() is a Standard C
# function, it is missing in older systems, including BSD 4.3,
# so we simply use our own version.
bibclean:	bibclean.o fndfil.o match.o strtol.o
	$(CC) $(CFLAGS) -o bibclean bibclean.o fndfil.o match.o \
		strtol.o $(LOADLIBES)

# This target converts the option descriptions from the manual pages
# to C code for inclusion in bibclean.c.  The first awk command
# augments the bibclean.man file in a pipe with some small changes
# after the .TH line (which sets page dimensions) to get longer
# unhyphenated ragged-right lines without page headers, and reduces
# the option description indentation.
#
# Here are the magic nroff incantations:
#
# .pl 100i	set page length to 100in
# .nr LL 7.2i	set LL register (page width) to 7.2in
# .nh		no hyphenation
# .na		no right-adjusting
#
# That output feeds into nroff for formatting, col for removal of
# underlining and escape sequences, expand for tab removal, sed to
# backslash all quotes, and a final awk step to select the lines
# between OPTIONS and ERROR headers for conversion to C code.

bibclean.h:	bibclean.man
	-$(RM) $@
	echo '/* WARNING: Do NOT edit this file.  It was created automatically'\
		>$@
	echo '   with the command "make bibclean.h" by '$$USER@`hostname` \
		>>$@
	echo '   in '$$PWD' on '`date`' */' >>$@
	echo >>$@
	$(AWK) '{ if ($$0 ~ /^.TH/) \
		printf("%s\n.pl 100i\n.nr LL 7.2i\n.nh\n.na",$$0); \
	    else if ($$0 ~ /^.TP .*remove-OPT-prefixes.*/) \
		print ".TP 1in"; \
	    else \
			print $$0}' <bibclean.man | \
	$(NROFF) -man | col -b | expand | $(SED) -e 's/"/\\"/g' | $(AWK) \
		'/^OPTION/,/^ERROR/ {if ($$0 !~ /^[A-Z]/) \
			printf("\t\"%s\\n\",\n",substr($$0,6))}' >>$@
	echo '	(const char*)NULL,' >>$@

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

bibclean.i:	bibclean.c bibclean.h match.h os.h unixlib.h \
		xctype.h xerrno.h xstddef.h xstdlib.h xstring.h \
		xtypes.h Makefile

bibclean.o:	bibclean.c bibclean.h match.h os.h unixlib.h \
		xctype.h xerrno.h xstat.h xstddef.h xstdlib.h \
		xstring.h xtypes.h

bibclean.ps:	bibclean.man
	$(DITROFF) -Tps -man $? >$@

bibclean.shr:	$(DIST-FILES)
	shar -b -c -v $(DIST-FILES) >bibclean.shr

bibclean.tar:	$(DIST-FILES) $(DIST-FILES-BIN)
	-$(RM) bibclean.tar bibclean.tar-lst
	tar chf bibclean.tar $(DIST-FILES) $(DIST-FILES-BIN)
	-mkdir bibclean-$(VERSION)
	cd bibclean-$(VERSION); tar xf ../bibclean.tar
	tar cf bibclean-$(VERSION).tar bibclean-$(VERSION)
	-$(RM) -r bibclean-$(VERSION)
	-$(RM) bibclean.tar
	$(LN) bibclean-$(VERSION).tar bibclean.tar

bibclean.txt:	bibclean.man
	$(NROFF) -man bibclean.man | col -b | expand >$@

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

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

clean mostlyclean:
	-$(RM) $(BIBTEX-TESTS:.org=.bib)
	-$(RM) $(SCRIBE-TESTS:.org=.bib)
	-$(RM) *.aux
	-$(RM) *.bbl
	-$(RM) *.blg
	-$(RM) *.dvi
	-$(RM) *.err
	-$(RM) *.i
	-$(RM) *.log
	-$(RM) *.o
	-$(RM) *~
	-$(RM) \#*
	-$(RM) bibclean.shr
	-$(RM) bibclean.tar bibclean-?.??.tar
	-$(RM) bibclean.tar-lst
	-$(RM) bibclean.zip
	-$(RM) bibclean.zip-lst
	-$(RM) bibclean.zoo
	-$(RM) bibclean.zoo-lst
	-$(RM) core
	-$(RM) testisxn.bib
	-$(RM) testscr2.bi2 testscr2.er2

clobber distclean:	clean
	-$(RM) bclproto bibclean
	-$(RM) bibclean.hlp
	-$(RM) bibclean.ps
	-$(RM) bibclean.txt
	-$(RM) install.time install-ftp.time

docs:	bibclean.txt bibclean.hlp bibclean.ps

fndfil.i:	fndfil.c machdefs.h os.h ospcdos.h osrmx.h osunix.h \
		osvmcms.h osatari.h osprimos.h ostops20.h osvaxvms.h \
		unixlib.h xctype.h xpwd.h xstdlib.h xstring.h Makefile

fndfil.o:	fndfil.c machdefs.h os.h ospcdos.h osrmx.h osunix.h \
		osvmcms.h osatari.h osprimos.h ostops20.h osvaxvms.h \
		unixlib.h xctype.h xpwd.h xstdlib.h xstring.h

install:	install.time

install.time:	bibclean bibclean.man
	$(CP) bibclean $(BINDIR)/bibclean
	-$(STRIP) $(BINDIR)/bibclean
	$(CHMOD) 755 $(BINDIR)/bibclean
	$(CP) bibclean.ini $(BINDIR)/.bibcleanrc
	$(CP) bibclean.man $(MANDIR)/bibclean.$(MANEXT)
	-$(RM) $(MANDIR)/../cat$(MANEXT)/bibclean.$(MANEXT)
	$(CHMOD) 644 $(MANDIR)/bibclean.$(MANEXT)
	touch install.time

install-ftp:	install-ftp.time

install-ftp.time:	bibclean.tar bibclean.zip bibclean.zoo
	tar tvf bibclean-$(VERSION).tar >$(FTPDIR)/bibclean-$(VERSION).tar-lst
	$(COMPRESS) <bibclean-$(VERSION).tar \
		>$(FTPDIR)/bibclean-$(VERSION).tar.z
	$(CP) bibclean-$(VERSION).zip $(FTPDIR)
	$(CP) bibclean-$(VERSION).zip-lst $(FTPDIR)
	$(CP) bibclean-$(VERSION).zoo $(FTPDIR)
	$(CP) bibclean-$(VERSION).zoo-lst $(FTPDIR)
	ls -l $(FTPDIR)/bibclean*
	date >install-ftp.time

match.i:	match.c match.h os.h xctype.h xstdlib.h xstring.h Makefile

match.o:	match.c match.h os.h xctype.h xstdlib.h xstring.h

reallyclean realclean:	distclean
	-$(RM) TAGS

TAGS:	Makefile $(TAGS-FILES)
	etags $(TAGS-FILES)

test check:	test-bibtex test-scribe

# Test bibclean on Part 1 of the Reduce bibliography, testbib2.org.  The
# output file, testbib2.bib, is compared against a correct output file,
# testbib2.bok, from the author's site, and then the bibliography is
# additionally tested by LaTeX and BibTeX.

test-bibtex:	bibclean test-bibtex-1 test-bibtex-2 test-bibtex-3

test-bibtex-1:	bibclean testbib1.org
	@echo
	@echo "==================== begin BibTeX test 1 ====================="
	@echo
	-@$(RM) testbib1.err testbib1.bib
	@echo
	-$(BIBCLEAN) testbib1.org >testbib1.bib 2>testbib1.err
	@echo
	@echo "There should be no differences found:"
	@echo "diff testbib1.bok testbib1.bib"
	-@if diff testbib1.bok testbib1.bib ; then $(RM) testbib1.bib ; fi
	@echo
	@echo "There should be no differences found:"
	@echo "diff testbib1.eok testbib1.err"
	-@if diff testbib1.eok testbib1.err ; then $(RM) testbib1.err ; fi
	@echo
	@echo "===================== end BibTeX test 1 ======================"
	@echo

test-bibtex-2:	bibclean testbib2.org
	@echo
	@echo "==================== begin BibTeX test 2 ====================="
	@echo
	@-$(RM) testbib2.aux testbib2.bbl testbib2.bib testbib2.blg \
		testbib2.dvi testbib2.log
	@echo
	-$(BIBCLEAN) -no-check-values testbib2.org >testbib2.bib 2>testbib2.err
	@echo
	@echo "There should be no differences found:"
	-diff testbib2.bok testbib2.bib
	@echo
	@echo "There should be no differences found:"
	@echo "diff testbib2.eok testbib2.err"
	-@if diff testbib2.eok testbib2.err ; then $(RM) testbib2.err ; fi
	@echo
	$(LATEX) testbib2.ltx >/dev/null
	@echo
	@echo "Expect 6 BibTeX warnings:"
	-$(BIBTEX) testbib2
	@if cmp testbib2.bok testbib2.bib 2>/dev/null ; \
		then $(RM) testbib2.bib ; fi
	@echo
	$(LATEX) testbib2.ltx >/dev/null
	@echo
	$(LATEX) testbib2.ltx
	@echo
	@echo "===================== end BibTeX test 2 ======================"
	@echo

# Test bibclean verification of ISBN and ISSN values.  The test file,
# testisxn.org, contains several hundred correct values, and also
# several hundred erroneous values.  We therefore discard error and
# warning messages, we ignore the return code, and we don't try to use
# the output with LaTeX or BibTeX.
test-bibtex-3:	bibclean testisxn.org
	@echo
	@echo "==================== begin BibTeX test 3 ====================="
	@echo
	-$(BIBCLEAN) testisxn.org >testisxn.bib 2>testisxn.err
	@echo
	@echo "There should be no differences found:"
	@echo "diff testisxn.bok testisxn.bib"
	-@if diff testisxn.bok testisxn.bib ; then $(RM) testisxn.bib ; fi
	@echo
	@echo "There should be no differences found:"
	@echo "diff testisxn.eok testisxn.err"
	-@if diff testisxn.eok testisxn.err ; then $(RM) testisxn.err ; fi
	@echo
	@echo "===================== end BibTeX test 3 ======================"
	@echo

# Test bibclean on a collection of Scribe bibliographies containing
# test cases to exhibit variations in Scribe bibliography syntax.

test-scribe:	bibclean test-scribe-1 test-scribe-2 test-scribe-3

# The peculiar step using tr to prepare the .aux files is needed to
# overcome inconsistencies in the handling of backslashes by the IBM
# RS/6000 shell.  The documented behavior in the SunOS 4.1.1 manual
# pages is (emphasis mine):
#     All characters enclosed between a pair of single quote marks
#     (''), except a single quote, are quoted by the shell.  BACKSLASH
#     HAS NO SPECIAL MEANING INSIDE A PAIR OF SINGLE QUOTES.  A single
#     quote may be quoted inside a pair of double quote marks (for
#     example, "'").
# On SunOS, HP UX, IBM 3090 AIX, NeXT Mach, and SGI IRIX, the shells
# csh, sh, bash, and ksh agree with this.  However, on IBM RS/6000
# AIX 3.2, backslashes in single quotes are untouched by csh, but
# expanded by sh and ksh.  This is clearly a bug, because the INFO
# hypertext node on bsh/rsh says:
#     All characters, except the enclosing single quotation marks, are
#     taken literally, with any special meaning removed.
#
test-scribe-1:	bibclean $(SCRIBE-TESTS-1)
	@echo
	@echo "==================== begin Scribe test 1 ====================="
	@echo
	-@for f in $(SCRIBE-TESTS-1) ; \
	do \
		BASENAME=`basename $$f .org` ; \
		echo ; \
		echo "----------------------------------------------------" ; \
		echo ; \
		echo "$(BIBCLEAN) -scribe -no-check $$f >$$BASENAME.bib" ; \
		$(BIBCLEAN) -scribe -no-check $$f >$$BASENAME.bib \
			2>$$BASENAME.err; \
		echo ; \
		echo "There should be no differences found:" ; \
		echo "diff $$BASENAME.bok $$BASENAME.bib" ; \
		diff $$BASENAME.bok $$BASENAME.bib ; \
		echo ; \
		echo "There should be no differences found:" ; \
		echo "diff $$BASENAME.eok $$BASENAME.err" ; \
		if diff $$BASENAME.eok $$BASENAME.err ; \
			then $(RM) $$BASENAME.err ; fi ; \
		echo ; \
		echo 'Bbibstyle{plain}NBcitation{*}NBbibdata{'$$BASENAME'}' | \
			tr BN '\134\012' >$$BASENAME.aux ; \
		if [ "$$BASENAME" = "testscr1" ] ; \
			then echo "Expect 5 BibTeX warnings" ; fi ; \
		if [ "$$BASENAME" = "testscr2" ] ; \
			then echo "There should be no BibTeX warnings:" ; fi ; \
		echo "$(BIBTEX) $$BASENAME" ; \
		$(BIBTEX) $$BASENAME; \
		if cmp $$BASENAME.bok $$BASENAME.bib 2>/dev/null ; \
			then $(RM) $$BASENAME.bib ; fi ; \
	done
	@echo "===================== end Scribe test 1 ======================"
	@echo

test-scribe-2:	bibclean testscr2.org
	@echo
	@echo "==================== begin Scribe test 2 ====================="
	@echo
	-$(BIBCLEAN) -scribe -file -no-check -no-par testscr2.org \
		>testscr2.bi2 2>testscr2.er2
	@echo
	@echo "There should be no differences found:"
	@echo "diff testscr2.bo2 testscr2.bi2"
	-@if diff testscr2.bo2 testscr2.bi2 ; then $(RM) testscr2.bi2 ; fi
	@echo
	@echo "There should be no differences found:"
	@echo "diff testscr2.eo2 testscr2.er2"
	-@if diff testscr2.eo2 testscr2.er2 ; then $(RM) testscr2.er2 ; fi
	@echo
	@echo "===================== end Scribe test 2 ======================"
	@echo

test-scribe-3:	bibclean testscr3.org
	@echo
	@echo "==================== begin Scribe test 3 ====================="
	@echo
	-$(BIBCLEAN) -scribe -no-check testscr3.org >testscr3.bib 2>testscr3.err
	@echo
	@echo "There should be no differences found:"
	@echo "diff testscr3.bok testscr3.bib"
	-@if diff testscr3.bok testscr3.bib ; then $(RM) testscr3.bib ; fi
	@echo
	@echo "There should be no differences found:"
	@echo "diff testscr3.eok testscr3.err"
	-@if diff testscr3.eok testscr3.err ; then $(RM) testscr3.err ; fi
	@echo
	@echo "===================== end Scribe test 3 ======================"
	@echo

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

uninstall:
	-$(RM) $(BINDIR)/bibclean $(BINDIR)/.bibcleanrc \
		$(MANDIR)/bibclean.$(MANEXT) \
		$(MANDIR)/../cat$(MANEXT)/bibclean.$(MANEXT)
	-$(RM) install.time

uninstall-ftp:
	-$(RM) $(FTPDIR)/bibclean-$(VERSION).tar
	-$(RM) $(FTPDIR)/bibclean-$(VERSION).tar-lst
	-$(RM) $(FTPDIR)/bibclean-$(VERSION).zip
	-$(RM) $(FTPDIR)/bibclean-$(VERSION).zip-lst
	-$(RM) $(FTPDIR)/bibclean-$(VERSION).zoo
	-$(RM) $(FTPDIR)/bibclean-$(VERSION).zoo-lst
	-$(RM) install-ftp.time

vaxvms/bibclean.uue:	vaxvms/bibclean.exe
	uuencode vaxvms/bibclean.exe bibclean.exe >vaxvms/bibclean.uue
