### ====================================================================
### Makefile for BibTeX .bib file prettyprinter
###
### Current target list: (these include all GNU Project standard
### targets)
###
###	all			build bibclean
###	bibclean		executable for bibclean
###	bibclean.h		documentation strings for help()
###				function
###	bibclean.hlp		VAX VMS help file (automatically
###				converted from bibclean.txt)
###	bibclean.html		HTML version of formatted manual pages
###	bibclean.i		C preprocessor output from bibclean.c
###	bibclean.jar		Java Jar distribution archive
###	bibclean.pdf		Adobe Portable Document Format version
###				of bibclean.man
###	bibclean.ps		PostScript version of bibclean.man
###	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		remove everything make can rebuild at
###				remote site
###	docs			make bibclean.txt, bibclean.hlp, and
###				bibclean.ps
###	install			install executable and man pages
###	install.time		internal target for install
###	install-exe		install executable
###	install-man		install man pages
###	install-ftp		install .tar, .zip, and .zoo files in
###				ftp tree
###	install-ftp.time	internal target for install-ftp
###	lint			check for code problems
###	mostlyclean		same as clean
###	maintainer-clean	for program author only: remove
###				everything make can rebuild at
###				author's site
###	romtol			build and run test program for romtol()
###	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
###
### [28-Feb-2016] -- major update for bibclean 3.00 and later
### [28-Aug-2001] -- major update for bibclean 2.12 and later
### [01-Jul-1996] -- add targets bibclean.pdf and DISTILL macro, and
###		     update DIST-FILES list
### [03-May-1996] -- add targets match, romtol, test-match, and
###		     and test-romtol, and update DIST-FILES list for
###		     version 2.11.3 release
### [25-Apr-1996] -- add target for bibclean.html, with associated
###		     support Makefile variables
### [20-Sep-1995] -- revise to use GNU autoconf and configure
### [08-Mar-1995] -- Change TARGET to TARGETS to avoid conflict with
###		     built-in macro on Cray systems. Add -D_POSIX_SOURCE
###		     to dec-alpha-osf1-c++ CC definition to work around
###		     bug in C++ signal.h header file on OSF/1 3.x.
### [21-Nov-1994] -- add cray-el94 target
### [11-Nov-1994] -- add sun-sparc-solaris2-lcc and sun-sparc-sunos5-lcc
###		     targets
### [18-Oct-1994] -- add isbn.[co] to file lists
### [16-Oct-1994] -- add strist.[co] to file lists
### [04-Jun-1994] -- update for version 2.10
###		     add lint target
### [31-Dec-1993] -- final polishing of Makefile for public release
###		     after TUGboat publication
### [24-Sep-1993] -- original version
### ====================================================================

### --------------------------------------------------------------------
### Start of system configuration section.

BIBCLEANNAME	= bibclean

prefix		= /usr/uumath
exec_prefix     = ${prefix}

bindir          = ${exec_prefix}/bin
srcdir          = .

datarootdir	= ${prefix}/share
datadir		= ${datarootdir}
bibcleandir	= ${datadir}/${BIBCLEANNAME}
initdir		= ${bibcleandir}/${VERSION}

### This is needed only at the developer's site:
FTPDIR		= /u/ftp/pub/tex/bib

CC              = gcc
CFLAGS          =  -I${prefix}/include ${OPT}
CPPFLAGS	=  -I${prefix}/include

DEFS            = -DINITDIR='"${initdir}"' ${XDEFS} -DHAVE_CONFIG_H

LDFLAGS         = -L/usr/uumath/lib64 -Wl,-rpath,/usr/uumath/lib64 ${OPT}
LIBOBJS		= 
LIBS            = 

OPT		=



### Where to install the manual pages.
mandir          = ${prefix}/man/man1
### Extension (not including `.') for the installed manual page filenames.
manext          = 1

### End of system configuration section.
### --------------------------------------------------------------------

AUTOCONF	= autoconf

AUTOHEADER	= autoheader

AWK		= mawk

BIBCLEAN	= bibclean${EXEEXT}

### This option is normally empty, but is used by the developer
### to test whether new options affect output.
BIBCLEANFLAGS	=

BIBISBN		= bibisbn${EXEEXT}

CHECK-BIBISBN	= bibisbn1 bibisbn2 bibisbn3 bibisbn4 bibisbn5 bibisbn6 bibisbn7

BIBTEX		= bibtex

CAT		= cat

### The topt1* tests try all recognized options with a single leading dash, and
### the topt3* tests are their companions with two leading dashes.  However, we
### intentionally EXCLUDE topt163 and topt363 because they hold -print-patterns
### options whose output is site-dependent.  We have no tests for
### -trace-file-opening because that too is site-dependent, and also
### user-dependent.

CHECK-BIBTEX    = testbib1 testbib2 testbib3 testbib4 testbib5 testbib6		\
		  testbib7 testbib8 testcodn testisxn testopt1 testopt2		\
		  testopt3 testopt4 testopt5 testopt6 testopt7 testopt8		\
		  testopt9 testopta testoptb testoptc testoptd testopte		\
		  testoptf testoptg testopth testopti testoptj testoptk		\
		  testoptl testoptm testoptn testopto testoptp testoptq		\
		  testoptr testopts testoptt testoptu testoptv testoptw		\
		  topt101 topt102 topt103 topt104 topt105 topt106 topt107	\
		  topt108 topt109 topt110 topt111 topt112 topt113 topt114	\
		  topt115 topt116 topt117 topt118 topt119 topt120 topt121	\
		  topt122 topt123 topt124 topt125 topt126 topt127 topt128	\
		  topt129 topt130 topt131 topt132 topt133 topt134 topt135	\
		  topt136 topt137 topt138 topt139 topt140 topt141 topt142	\
		  topt143 topt144 topt145 topt146 topt147 topt148 topt149	\
		  topt150 topt151 topt152 topt153 topt154 topt155 topt156	\
		  topt157 topt158 topt159 topt160 topt161 topt162 topt164	\
		  topt165 topt166 topt167 topt168 topt169 topt170 topt171	\
		  topt301 topt302 topt303 topt304 topt305 topt306 topt307	\
		  topt308 topt309 topt310 topt311 topt312 topt313 topt314	\
		  topt315 topt316 topt317 topt318 topt319 topt320 topt321	\
		  topt322 topt323 topt324 topt325 topt326 topt327 topt328	\
		  topt329 topt330 topt331 topt332 topt333 topt334 topt335	\
		  topt336 topt337 topt338 topt339 topt340 topt341 topt342	\
		  topt343 topt344 topt345 topt346 topt347 topt348 topt349	\
		  topt350 topt351 topt352 topt353 topt354 topt355 topt356	\
		  topt357 topt358 topt359 topt360 topt361 topt362 topt364	\
		  topt365 topt366 topt367 topt368 topt369 topt370 topt371	\
		  topt372

CHECK-LATEX	= testltx1.ltx

CHECK-MATCH	= match.in

CHECK-ROMTOL	= romtol.in

CHECK-SCRIBE	= testscr1.bib testscr2.bib testscr3.bib testscr4.bib

### This program is freely available at ftp://ftp.math.utah.edu/pub/checksum/
CHECKSUM	= checksum

CHMOD		= chmod

CMP		= cmp

CP		= scp -p
CPFLAGS		= -p

CUT		= cut

DATE		= date

DIFF		= diff

DIST-FILES      = ChangeLog COPYING README Makefile.in bibclean.c bibclean.h	\
		  bibclean.hlp bibclean.html bibclean.ini bibclean.isbn		\
		  bibclean.key bibclean.man bibclean.pdf bibclean.ps		\
		  bibclean.reg bibclean.txt build-all.sh ch.h chek.c		\
		  config.hin configure configure.ac configure.sed custom.h	\
		  delete.h do.c dbx-test.run fix.c fndfil.c isbn.c isbn.h	\
		  isbn.tbl isbn-el-to-bibclean-isbn.awk keybrd.c keybrd.h	\
		  match.c match.dat match.h option.c pattern.h rofvms.awk	\
		  romtol.c romtol.dat strist.c strtol.c token.h toklst.h	\
		  tstctype.c typedefs.h vaxvms.c vmswild.c xctype.h xerrno.h	\
		  xlimits.h xpwd.h xstat.h xstdbool.h xstdio.h xstdlib.h	\
		  xstring.h xtypes.h xunistd.h yesorno.h testscr2.bo2		\
		  testscr2.eo2 ${FILES-DOC} ${FILES-IBMPC} ${FILES-SAVE}	\
		  ${FILES-TEST} test/plain.bst ${FILES-VMS} ${FILES-WINDOWS}

DISTILL		= ps2pdf

DITROFF		= groff

ETAGS		= etags

EXEEXT		= 

EXPR		= expr

### On UNIX systems, the FILES-xxx lists could be generated by `find xxx
### -type f | sort`, but explicit enumeration eases portability to other
### operating systems, and ensures that we do not accidentally include
### unwanted temporary files that might be present.
FILES-DOC       = doc/Makefile doc/bibclean.aux doc/bibclean.bbl	\
		  doc/bibclean.bib doc/bibclean.blg doc/bibclean.dvi	\
		  doc/bibclean.idw doc/bibclean.idx doc/bibclean.ilg	\
		  doc/bibclean.ind doc/bibclean.log doc/bibclean.lot	\
		  doc/bibclean.ltx doc/bibclean.pdf doc/bibclean.ps	\
		  doc/bibclean.sok doc/bibclean.sty doc/bibclean.toc	\
		  doc/is-plain.bst doc/ltugboat.sty doc/path.sty	\
		  doc/texnames.sty doc/tugboat.cmn

FILES-IBMPC	= ibmpc/dos/README ibmpc/dos/msc5p1/bibclean.exe		\
		  ibmpc/dos/msc5p1/config.h ibmpc/dos/msc5p1/ibmclean.bat	\
		  ibmpc/dos/msc5p1/ibmtest.bat ibmpc/dos/msc5p1/msc51bld.bat	\
		  ibmpc/dos/msc5p1/msc51pth.bat ibmpc/dos/msc6p0/bibclean.exe	\
		  ibmpc/dos/msc6p0/bibclean.map ibmpc/dos/msc6p0/config.h	\
		  ibmpc/dos/msc6p0/ibmclean.bat ibmpc/dos/msc6p0/ibmtest.bat	\
		  ibmpc/dos/msc6p0/msc60bld.bat ibmpc/dos/msc6p0/msc60pth.bat	\
		  ibmpc/dos/msc7p0/config.h ibmpc/dos/msc7p0/ibmclean.bat	\
		  ibmpc/dos/msc7p0/ibmtest.bat ibmpc/dos/msc7p0/msc70bld.bat	\
		  ibmpc/dos/msc7p0/msc70pth.bat ibmpc/dos/tcc2p0/bibclean.exe	\
		  ibmpc/dos/tcc2p0/config.h ibmpc/dos/tcc2p0/ibmclean.bat	\
		  ibmpc/dos/tcc2p0/ibmtest.bat ibmpc/dos/tcc2p0/tcc20bld.bat	\
		  ibmpc/dos/tcc2p0/tcc20pth.bat ibmpc/dos/tcc3p0/bibclean.exe	\
		  ibmpc/dos/tcc3p0/config.h ibmpc/dos/tcc3p0/ibmclean.bat	\
		  ibmpc/dos/tcc3p0/ibmtest.bat ibmpc/dos/tcc3p0/tcc30bld.bat	\
		  ibmpc/dos/tcc3p0/tcc30pth.bat ibmpc/dos/tpp3p0/bibclean.exe	\
		  ibmpc/dos/tpp3p0/config.h ibmpc/dos/tpp3p0/ibmclean.bat	\
		  ibmpc/dos/tpp3p0/ibmtest.bat ibmpc/dos/tpp3p0/tcc30pth.bat	\
		  ibmpc/dos/tpp3p0/tpp30bld.bat					\
		  ibmpc/dos/wat10/wcc/bibclean.exe				\
		  ibmpc/dos/wat10/wcc/bibclean.map				\
		  ibmpc/dos/wat10/wcc/config.h					\
		  ibmpc/dos/wat10/wcc/ibmclean.bat				\
		  ibmpc/dos/wat10/wcc/ibmtest.bat				\
		  ibmpc/dos/wat10/wcc/watcpp.bat				\
		  ibmpc/dos/wat10/wcc/watpath.bat				\
		  ibmpc/dos/wat10/wcc/watwcc.bat				\
		  ibmpc/dos/wat10/wcc386/bibclean.exe				\
		  ibmpc/dos/wat10/wcc386/config.h				\
		  ibmpc/dos/wat10/wcc386/dos4gw.doc				\
		  ibmpc/dos/wat10/wcc386/dos4gw.exe				\
		  ibmpc/dos/wat10/wcc386/ibmclean.bat				\
		  ibmpc/dos/wat10/wcc386/ibmtest.bat				\
		  ibmpc/dos/wat10/wcc386/wat10bld.bat				\
		  ibmpc/dos/wat10/wcc386/watpath.bat				\
		  ibmpc/dos/wat10/wpp386/bibclean.exe				\
		  ibmpc/dos/wat10/wpp386/config.h				\
		  ibmpc/dos/wat10/wpp386/dos4gw.doc				\
		  ibmpc/dos/wat10/wpp386/dos4gw.exe				\
		  ibmpc/dos/wat10/wpp386/ibmclean.bat				\
		  ibmpc/dos/wat10/wpp386/ibmtest.bat				\
		  ibmpc/dos/wat10/wpp386/w386cpp.bat				\
		  ibmpc/dos/wat10/wpp386/watpath.bat ibmpc/linux/bibclean

FILES-SAVE	= save/Makefile save/config.h save/config.hin save/configure	\
		  save/custom.h

FILES-TEST      = test/match.in test/okay/match.err test/okay/match.out		\
		  test/okay/romtol.err test/okay/romtol.out			\
		  test/okay/testbib1.err test/okay/testbib1.out			\
		  test/okay/testbib2.err test/okay/testbib2.out			\
		  test/okay/testbib3.err test/okay/testbib3.out			\
		  test/okay/testbib4.err test/okay/testbib4.out			\
		  test/okay/testbib5.err test/okay/testbib5.out			\
		  test/okay/testbib6.err test/okay/testbib6.out			\
		  test/okay/testbib7.err test/okay/testbib7.out			\
		  test/okay/testbib8.err test/okay/testbib8.out			\
		  test/okay/testcodn.err test/okay/testcodn.out			\
		  test/okay/testisxn.err test/okay/testisxn.out			\
		  test/okay/testltx1.bbl test/okay/testltx1.blg			\
		  test/okay/testltx1.err test/okay/testltx1.out			\
		  test/okay/testopt1.err test/okay/testopt1.out			\
		  test/okay/testopt2.err test/okay/testopt2.out			\
		  test/okay/testopt3.err test/okay/testopt3.out			\
		  test/okay/testopt4.err test/okay/testopt4.out			\
		  test/okay/testopt5.err test/okay/testopt5.out			\
		  test/okay/testopt6.err test/okay/testopt6.out			\
		  test/okay/testopt7.err test/okay/testopt7.out			\
		  test/okay/testopt8.err test/okay/testopt8.out			\
		  test/okay/testopt9.err test/okay/testopt9.out			\
		  test/okay/testopta.err test/okay/testopta.out			\
		  test/okay/testoptb.err test/okay/testoptb.out			\
		  test/okay/testoptc.err test/okay/testoptc.out			\
		  test/okay/testoptd.err test/okay/testoptd.out			\
		  test/okay/testopte.err test/okay/testopte.out			\
		  test/okay/testoptf.err test/okay/testoptf.out			\
		  test/okay/testoptg.err test/okay/testoptg.out			\
		  test/okay/testopth.err test/okay/testopth.out			\
		  test/okay/testopti.err test/okay/testopti.out			\
		  test/okay/testoptj.err test/okay/testoptj.out			\
		  test/okay/testoptk.err test/okay/testoptk.out			\
		  test/okay/testoptl.err test/okay/testoptl.out			\
		  test/okay/testoptm.err test/okay/testoptm.out			\
		  test/okay/testoptn.err test/okay/testoptn.out			\
		  test/okay/testopto.err test/okay/testopto.out			\
		  test/okay/testoptp.err test/okay/testoptp.out			\
		  test/okay/testoptq.err test/okay/testoptq.out			\
		  test/okay/testoptr.err test/okay/testoptr.out			\
		  test/okay/testopts.err test/okay/testopts.out			\
		  test/okay/testoptt.err test/okay/testoptt.out			\
		  test/okay/testoptu.err test/okay/testoptu.out			\
		  test/okay/testoptu.win test/okay/testoptv.err			\
		  test/okay/testoptv.out test/okay/testoptw.err			\
		  test/okay/testoptw.out test/okay/testoptx.err			\
		  test/okay/testoptx.out test/okay/testscr1.bbl			\
		  test/okay/testscr1.blg test/okay/testscr1.err			\
		  test/okay/testscr1.out test/okay/testscr2.bbl			\
		  test/okay/testscr2.blg test/okay/testscr2.err			\
		  test/okay/testscr2.out test/okay/testscr3.bbl			\
		  test/okay/testscr3.blg test/okay/testscr3.err			\
		  test/okay/testscr3.out test/okay/testscr4.bbl			\
		  test/okay/testscr4.blg test/okay/testscr4.err			\
		  test/okay/testscr4.out test/okay/topt101.err			\
		  test/okay/topt101.out test/okay/topt102.err			\
		  test/okay/topt102.out test/okay/topt103.err			\
		  test/okay/topt103.out test/okay/topt104.err			\
		  test/okay/topt104.out test/okay/topt105.err			\
		  test/okay/topt105.out test/okay/topt106.err			\
		  test/okay/topt106.out test/okay/topt107.err			\
		  test/okay/topt107.out test/okay/topt108.err			\
		  test/okay/topt108.out test/okay/topt109.err			\
		  test/okay/topt109.out test/okay/topt110.err			\
		  test/okay/topt110.out test/okay/topt111.err			\
		  test/okay/topt111.out test/okay/topt112.err			\
		  test/okay/topt112.out test/okay/topt113.err			\
		  test/okay/topt113.out test/okay/topt114.err			\
		  test/okay/topt114.out test/okay/topt115.err			\
		  test/okay/topt115.out test/okay/topt116.err			\
		  test/okay/topt116.out test/okay/topt117.err			\
		  test/okay/topt117.out test/okay/topt118.err			\
		  test/okay/topt118.out test/okay/topt119.err			\
		  test/okay/topt119.out test/okay/topt120.err			\
		  test/okay/topt120.out test/okay/topt121.err			\
		  test/okay/topt121.out test/okay/topt122.err			\
		  test/okay/topt122.out test/okay/topt123.err			\
		  test/okay/topt123.out test/okay/topt124.err			\
		  test/okay/topt124.out test/okay/topt125.err			\
		  test/okay/topt125.out test/okay/topt126.err			\
		  test/okay/topt126.out test/okay/topt127.err			\
		  test/okay/topt127.out test/okay/topt128.err			\
		  test/okay/topt128.out test/okay/topt129.err			\
		  test/okay/topt129.out test/okay/topt130.err			\
		  test/okay/topt130.out test/okay/topt131.err			\
		  test/okay/topt131.out test/okay/topt132.err			\
		  test/okay/topt132.out test/okay/topt133.err			\
		  test/okay/topt133.out test/okay/topt134.err			\
		  test/okay/topt134.out test/okay/topt135.err			\
		  test/okay/topt135.out test/okay/topt136.err			\
		  test/okay/topt136.out test/okay/topt137.err			\
		  test/okay/topt137.out test/okay/topt138.err			\
		  test/okay/topt138.out test/okay/topt139.err			\
		  test/okay/topt139.out test/okay/topt140.err			\
		  test/okay/topt140.out test/okay/topt141.err			\
		  test/okay/topt141.out test/okay/topt142.err			\
		  test/okay/topt142.out test/okay/topt143.err			\
		  test/okay/topt143.out test/okay/topt144.err			\
		  test/okay/topt144.out test/okay/topt145.err			\
		  test/okay/topt145.out test/okay/topt146.err			\
		  test/okay/topt146.out test/okay/topt147.err			\
		  test/okay/topt147.out test/okay/topt148.err			\
		  test/okay/topt148.out test/okay/topt149.err			\
		  test/okay/topt149.out test/okay/topt150.err			\
		  test/okay/topt150.out test/okay/topt151.err			\
		  test/okay/topt151.out test/okay/topt152.err			\
		  test/okay/topt152.out test/okay/topt153.err			\
		  test/okay/topt153.out test/okay/topt154.err			\
		  test/okay/topt154.out test/okay/topt155.err			\
		  test/okay/topt155.out test/okay/topt156.err			\
		  test/okay/topt156.out test/okay/topt157.err			\
		  test/okay/topt157.out test/okay/topt158.err			\
		  test/okay/topt158.out test/okay/topt159.err			\
		  test/okay/topt159.out test/okay/topt160.err			\
		  test/okay/topt160.out test/okay/topt161.err			\
		  test/okay/topt161.out test/okay/topt162.err			\
		  test/okay/topt162.out test/okay/topt163.err			\
		  test/okay/topt163.out test/okay/topt164.err			\
		  test/okay/topt164.out test/okay/topt165.err			\
		  test/okay/topt165.out test/okay/topt166.err			\
		  test/okay/topt166.out test/okay/topt167.err			\
		  test/okay/topt167.out test/okay/topt168.err			\
		  test/okay/topt168.out test/okay/topt169.err			\
		  test/okay/topt169.out test/okay/topt170.err			\
		  test/okay/topt170.out test/okay/topt171.err			\
		  test/okay/topt171.out test/okay/topt301.err			\
		  test/okay/topt301.out test/okay/topt302.err			\
		  test/okay/topt302.out test/okay/topt303.err			\
		  test/okay/topt303.out test/okay/topt304.err			\
		  test/okay/topt304.out test/okay/topt305.err			\
		  test/okay/topt305.out test/okay/topt306.err			\
		  test/okay/topt306.out test/okay/topt307.err			\
		  test/okay/topt307.out test/okay/topt308.err			\
		  test/okay/topt308.out test/okay/topt309.err			\
		  test/okay/topt309.out test/okay/topt310.err			\
		  test/okay/topt310.out test/okay/topt311.err			\
		  test/okay/topt311.out test/okay/topt312.err			\
		  test/okay/topt312.out test/okay/topt313.err			\
		  test/okay/topt313.out test/okay/topt314.err			\
		  test/okay/topt314.out test/okay/topt315.err			\
		  test/okay/topt315.out test/okay/topt316.err			\
		  test/okay/topt316.out test/okay/topt317.err			\
		  test/okay/topt317.out test/okay/topt318.err			\
		  test/okay/topt318.out test/okay/topt319.err			\
		  test/okay/topt319.out test/okay/topt320.err			\
		  test/okay/topt320.out test/okay/topt321.err			\
		  test/okay/topt321.out test/okay/topt322.err			\
		  test/okay/topt322.out test/okay/topt323.err			\
		  test/okay/topt323.out test/okay/topt324.err			\
		  test/okay/topt324.out test/okay/topt325.err			\
		  test/okay/topt325.out test/okay/topt326.err			\
		  test/okay/topt326.out test/okay/topt327.err			\
		  test/okay/topt327.out test/okay/topt328.err			\
		  test/okay/topt328.out test/okay/topt329.err			\
		  test/okay/topt329.out test/okay/topt330.err			\
		  test/okay/topt330.out test/okay/topt331.err			\
		  test/okay/topt331.out test/okay/topt332.err			\
		  test/okay/topt332.out test/okay/topt333.err			\
		  test/okay/topt333.out test/okay/topt334.err			\
		  test/okay/topt334.out test/okay/topt335.err			\
		  test/okay/topt335.out test/okay/topt336.err			\
		  test/okay/topt336.out test/okay/topt337.err			\
		  test/okay/topt337.out test/okay/topt338.err			\
		  test/okay/topt338.out test/okay/topt339.err			\
		  test/okay/topt339.out test/okay/topt340.err			\
		  test/okay/topt340.out test/okay/topt341.err			\
		  test/okay/topt341.out test/okay/topt342.err			\
		  test/okay/topt342.out test/okay/topt343.err			\
		  test/okay/topt343.out test/okay/topt344.err			\
		  test/okay/topt344.out test/okay/topt345.err			\
		  test/okay/topt345.out test/okay/topt346.err			\
		  test/okay/topt346.out test/okay/topt347.err			\
		  test/okay/topt347.out test/okay/topt348.err			\
		  test/okay/topt348.out test/okay/topt349.err			\
		  test/okay/topt349.out test/okay/topt350.err			\
		  test/okay/topt350.out test/okay/topt351.err			\
		  test/okay/topt351.out test/okay/topt352.err			\
		  test/okay/topt352.out test/okay/topt353.err			\
		  test/okay/topt353.out test/okay/topt354.err			\
		  test/okay/topt354.out test/okay/topt355.err			\
		  test/okay/topt355.out test/okay/topt356.err			\
		  test/okay/topt356.out test/okay/topt357.err			\
		  test/okay/topt357.out test/okay/topt358.err			\
		  test/okay/topt358.out test/okay/topt359.err			\
		  test/okay/topt359.out test/okay/topt360.err			\
		  test/okay/topt360.out test/okay/topt361.err			\
		  test/okay/topt361.out test/okay/topt362.err			\
		  test/okay/topt362.out test/okay/topt363.err			\
		  test/okay/topt363.out test/okay/topt364.err			\
		  test/okay/topt364.out test/okay/topt365.err			\
		  test/okay/topt365.out test/okay/topt366.err			\
		  test/okay/topt366.out test/okay/topt367.err			\
		  test/okay/topt367.out test/okay/topt368.err			\
		  test/okay/topt368.out test/okay/topt369.err			\
		  test/okay/topt369.out test/okay/topt370.err			\
		  test/okay/topt370.out test/okay/topt371.err			\
		  test/okay/topt371.out test/okay/tstctype.out test/romtol.in	\
		  test/testbib1.bib test/testbib1.opt test/testbib2.bib		\
		  test/testbib2.opt test/testbib3.bib test/testbib3.opt		\
		  test/testbib4.bib test/testbib4.opt test/testbib5.bib		\
		  test/testbib5.opt test/testbib6.bib test/testbib6.opt		\
		  test/testbib7.bib test/testbib7.opt test/testbib8.bib		\
		  test/testbib8.opt test/testcodn.bib test/testcodn.opt		\
		  test/testisxn.bib test/testisxn.opt test/testltx1.bin		\
		  test/testltx1.ltx test/testltx1.opt test/testopt1.bib		\
		  test/testopt1.opt test/testopt2.bib test/testopt2.opt		\
		  test/testopt3.bib test/testopt3.opt test/testopt4.bib		\
		  test/testopt4.opt test/testopt5.bib test/testopt5.opt		\
		  test/testopt6.bib test/testopt6.opt test/testopt7.bib		\
		  test/testopt7.opt test/testopt8.bib test/testopt8.opt		\
		  test/testopt9.bib test/testopt9.opt test/testopta.bib		\
		  test/testopta.opt test/testoptb.bib test/testoptb.opt		\
		  test/testoptc.bib test/testoptc.opt test/testoptd.bib		\
		  test/testoptd.opt test/testopte.bib test/testopte.opt		\
		  test/testoptf.bib test/testoptf.opt test/testoptg.bib		\
		  test/testoptg.opt test/testopth.bib test/testopth.opt		\
		  test/testopti.bib test/testopti.opt test/testoptj.bib		\
		  test/testoptj.opt test/testoptk.bib test/testoptk.opt		\
		  test/testoptl.bib test/testoptl.opt test/testoptm.bib		\
		  test/testoptm.opt test/testoptn.bib test/testoptn.opt		\
		  test/testopto.bib test/testopto.opt test/testoptp.bib		\
		  test/testoptp.opt test/testoptq.bib test/testoptq.opt		\
		  test/testoptr.bib test/testoptr.opt test/testopts.bib		\
		  test/testopts.opt test/testoptt.bib test/testoptt.opt		\
		  test/testoptu.bib test/testoptu.opt test/testoptv.bib		\
		  test/testoptv.opt test/testoptw.bib test/testoptw.opt		\
		  test/testoptx.in test/testoptx.opt test/testscr1.bib		\
		  test/testscr1.opt test/testscr2.bib test/testscr2.opt		\
		  test/testscr3.bib test/testscr3.opt test/testscr4.bib		\
		  test/testscr4.opt test/topt101.bib test/topt101.opt		\
		  test/topt102.bib test/topt102.opt test/topt103.bib		\
		  test/topt103.opt test/topt104.bib test/topt104.opt		\
		  test/topt105.bib test/topt105.opt test/topt106.bib		\
		  test/topt106.opt test/topt107.bib test/topt107.opt		\
		  test/topt108.bib test/topt108.opt test/topt109.bib		\
		  test/topt109.opt test/topt110.bib test/topt110.opt		\
		  test/topt111.bib test/topt111.opt test/topt112.bib		\
		  test/topt112.opt test/topt113.bib test/topt113.opt		\
		  test/topt114.bib test/topt114.opt test/topt115.bib		\
		  test/topt115.opt test/topt116.bib test/topt116.opt		\
		  test/topt117.bib test/topt117.opt test/topt118.bib		\
		  test/topt118.opt test/topt119.bib test/topt119.opt		\
		  test/topt120.bib test/topt120.opt test/topt121.bib		\
		  test/topt121.opt test/topt122.bib test/topt122.opt		\
		  test/topt123.bib test/topt123.opt test/topt124.bib		\
		  test/topt124.opt test/topt125.bib test/topt125.opt		\
		  test/topt126.bib test/topt126.opt test/topt127.bib		\
		  test/topt127.opt test/topt128.bib test/topt128.opt		\
		  test/topt129.bib test/topt129.opt test/topt130.bib		\
		  test/topt130.opt test/topt131.bib test/topt131.opt		\
		  test/topt132.bib test/topt132.opt test/topt133.bib		\
		  test/topt133.opt test/topt134.bib test/topt134.opt		\
		  test/topt135.bib test/topt135.opt test/topt136.bib		\
		  test/topt136.opt test/topt137.bib test/topt137.opt		\
		  test/topt138.bib test/topt138.opt test/topt139.bib		\
		  test/topt139.opt test/topt140.bib test/topt140.opt		\
		  test/topt141.bib test/topt141.opt test/topt142.bib		\
		  test/topt142.opt test/topt143.bib test/topt143.opt		\
		  test/topt144.bib test/topt144.opt test/topt145.bib		\
		  test/topt145.opt test/topt146.bib test/topt146.opt		\
		  test/topt147.bib test/topt147.opt test/topt148.bib		\
		  test/topt148.opt test/topt149.bib test/topt149.opt		\
		  test/topt150.bib test/topt150.opt test/topt151.bib		\
		  test/topt151.opt test/topt152.bib test/topt152.opt		\
		  test/topt153.bib test/topt153.opt test/topt154.bib		\
		  test/topt154.opt test/topt155.bib test/topt155.opt		\
		  test/topt156.bib test/topt156.opt test/topt157.bib		\
		  test/topt157.opt test/topt158.bib test/topt158.opt		\
		  test/topt159.bib test/topt159.opt test/topt160.bib		\
		  test/topt160.opt test/topt161.bib test/topt161.opt		\
		  test/topt162.bib test/topt162.opt test/topt163.bib		\
		  test/topt163.opt test/topt164.bib test/topt164.opt		\
		  test/topt165.bib test/topt165.opt test/topt166.bib		\
		  test/topt166.opt test/topt167.bib test/topt167.opt		\
		  test/topt168.bib test/topt168.opt test/topt169.bib		\
		  test/topt169.opt test/topt170.bib test/topt170.opt		\
		  test/topt171.bib test/topt171.opt test/topt301.bib		\
		  test/topt301.opt test/topt302.bib test/topt302.opt		\
		  test/topt303.bib test/topt303.opt test/topt304.bib		\
		  test/topt304.opt test/topt305.bib test/topt305.opt		\
		  test/topt306.bib test/topt306.opt test/topt307.bib		\
		  test/topt307.opt test/topt308.bib test/topt308.opt		\
		  test/topt309.bib test/topt309.opt test/topt310.bib		\
		  test/topt310.opt test/topt311.bib test/topt311.opt		\
		  test/topt312.bib test/topt312.opt test/topt313.bib		\
		  test/topt313.opt test/topt314.bib test/topt314.opt		\
		  test/topt315.bib test/topt315.opt test/topt316.bib		\
		  test/topt316.opt test/topt317.bib test/topt317.opt		\
		  test/topt318.bib test/topt318.opt test/topt319.bib		\
		  test/topt319.opt test/topt320.bib test/topt320.opt		\
		  test/topt321.bib test/topt321.opt test/topt322.bib		\
		  test/topt322.opt test/topt323.bib test/topt323.opt		\
		  test/topt324.bib test/topt324.opt test/topt325.bib		\
		  test/topt325.opt test/topt326.bib test/topt326.opt		\
		  test/topt327.bib test/topt327.opt test/topt328.bib		\
		  test/topt328.opt test/topt329.bib test/topt329.opt		\
		  test/topt330.bib test/topt330.opt test/topt331.bib		\
		  test/topt331.opt test/topt332.bib test/topt332.opt		\
		  test/topt333.bib test/topt333.opt test/topt334.bib		\
		  test/topt334.opt test/topt335.bib test/topt335.opt		\
		  test/topt336.bib test/topt336.opt test/topt337.bib		\
		  test/topt337.opt test/topt338.bib test/topt338.opt		\
		  test/topt339.bib test/topt339.opt test/topt340.bib		\
		  test/topt340.opt test/topt341.bib test/topt341.opt		\
		  test/topt342.bib test/topt342.opt test/topt343.bib		\
		  test/topt343.opt test/topt344.bib test/topt344.opt		\
		  test/topt345.bib test/topt345.opt test/topt346.bib		\
		  test/topt346.opt test/topt347.bib test/topt347.opt		\
		  test/topt348.bib test/topt348.opt test/topt349.bib		\
		  test/topt349.opt test/topt350.bib test/topt350.opt		\
		  test/topt351.bib test/topt351.opt test/topt352.bib		\
		  test/topt352.opt test/topt353.bib test/topt353.opt		\
		  test/topt354.bib test/topt354.opt test/topt355.bib		\
		  test/topt355.opt test/topt356.bib test/topt356.opt		\
		  test/topt357.bib test/topt357.opt test/topt358.bib		\
		  test/topt358.opt test/topt359.bib test/topt359.opt		\
		  test/topt360.bib test/topt360.opt test/topt361.bib		\
		  test/topt361.opt test/topt362.bib test/topt362.opt		\
		  test/topt363.bib test/topt363.opt test/topt364.bib		\
		  test/topt364.opt test/topt365.bib test/topt365.opt		\
		  test/topt366.bib test/topt366.opt test/topt367.bib		\
		  test/topt367.opt test/topt368.bib test/topt368.opt		\
		  test/topt369.bib test/topt369.opt test/topt370.bib		\
		  test/topt370.opt test/topt371.bib test/topt371.opt

FILES-VMS       = vms/config.h vms/alpha/bibclean.exe vms/alpha/recomp.com	\
		  vms/alpha/vmsclean.com vms/alpha/vmsmake.com			\
		  vms/alpha/vmstest.com vms/vax/README vms/vax/bibclean.exe	\
		  vms/vax/bibclean.obj vms/vax/chek.obj vms/vax/config.h	\
		  vms/vax/do.obj vms/vax/fix.obj vms/vax/fndfil.obj		\
		  vms/vax/getoneheader.com vms/vax/getvmsheaders.com		\
		  vms/vax/isbn.obj vms/vax/keybrd.obj vms/vax/match.obj		\
		  vms/vax/option.obj vms/vax/recomp.com vms/vax/romtol.obj	\
		  vms/vax/strist.obj vms/vax/vaxvms.obj vms/vax/vmsclean.com	\
		  vms/vax/vmsmake.com vms/vax/vmstest.com vms/vax/vmswild.obj

FILES-WINDOWS	= win32/bibclean.exe

FIXBLG		= ${SED} -e "/^You've used/,/^write/d" -e "/^This is BibTeX/,/^Database file/d"

GREP		= egrep

GZIP		= gzip

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

### This program is freely available at ftp://ftp.math.utah.edu/pub/sgml/sp-*
HTMLNCHECK	= echo

### This program is freely available at ftp://ftp.math.utah.edu/pub/sgml/htmlpty-x.y.*
HTMLPRETTY	= html-pretty

JAR		= jar

LATEX		= latex

LN		= ln

LS		= ls

MAN2HTML	= man2html

MATCH		= match${EXEEXT}

MKDIR		= mkdir -p

MV		= mv

NROFF		= nroff

PROGRAMS	= ${BIBCLEAN} ${BIBISBN} ${MATCH} ${ROMTOL} ${TSTCTYPE}

RM		= rm -f

ROMTOL		= romtol${EXEEXT}

SED		= sed

SHELL		= /bin/bash

SRC             = bibclean.c chek.c do.c fix.c fndfil.c isbn.c		\
		  keybrd.c match.c option.c romtol.c strist.c strtol.c

STRIP		= strip

### Only the subdirectories with Makefiles are listed here
SUBDIRS		= doc

TAR		= gtar

TAGS-FILES      = bibclean.c bibclean.h ch.h chek.c config.h custom.h		\
		  delete.h do.c fix.c fndfil.c isbn.c isbn.h keybrd.c		\
		  keybrd.h match.c match.h option.c pattern.h romtol.c		\
		  strist.c strtol.c token.h toklst.h vaxvms.c vmswild.c		\
		  xctype.h xerrno.h xlimits.h xpwd.h xstat.h xstdbool.h		\
		  xstdio.h xstdlib.h xstring.h xtypes.h xunistd.h yesorno.h

TEST		= test

TESTBIBCLEAN	= ${VM} ../${BIBCLEAN}

### For testing purposes, make sure we always have the same
### initialization files:
TESTBIBCLEANFLAGS = -init-file ../bibclean.ini		\
		    -ISBN-file ../bibclean.isbn		\
		    -keyword-file ../bibclean.key

TESTFLAGS	= ${DEFS} ${CPPFLAGS} ${CFLAGS} -DTEST

TESTMATCH	= ${VM} ../${MATCH}

TESTROMTOL	= ${VM} ../${ROMTOL}

TESTTSTCTYPE	= ${VM} ../${TSTCTYPE}

TMPDIR		= /tmp
TMPDIR		= /var/tmp

TOUCH		= touch

TR		= tr

TSTCTYPE	= tstctype${EXEEXT}

UNZIP		= unzip

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

WINE		= 

### Use the make-time option
###
###	XDEFS="-Dname1=value1 -Dname2=value2 ..."
###
### to alter table sizes in bibclean from their defaults of:
###
###	-DMAXPATHLEN=<system dependent: typically 1024 to 4096>	# longest "/path/to/some/file.ext" or "c:\path\to\some\file.ext"
###	-DMAX_BUFFER=8192			# maximum length of output buffer (does NOT limit lengths of input lines)
###	-DMAX_FIELD_LENGTH=12			# maximum field name length
###	-DMAX_ISBN_RANGE=2560			# maximum number of ISBN ranges
###	-DMAX_KEYWORD=200			# maximum number of field names subject to lettercase change
###	-DMAX_LINE=10240			# maximum line length in initialization file
###	-DMAX_PATTERN_NAMES=100			# maximum different pattern names
###	-DMAX_TOKEN=32760			# maximum field value length
###	-DMAX_WIDTH=72				# maximum output line length
###	-DSTD_MAX_TOKEN=1000			# original BibTeX maximum field value length
###	-DSTD_MAX_TOKEN=5000			# for TeX Live 2003--2011
###	-DSTD_MAX_TOKEN=20000			# for TeX Live 2012--2019
###
### Possible local customizations:
###
###	-DDOI_RAW_VALID				# accept DOI = "10.xxxx" values
###	-DBIBCLEAN_INI=\"BIBCLEANINI\"		# environment variable name
###	-DBIBCLEAN_ISBN=\"BIBCLEANISBN\"	# environment variable name
###	-DBIBCLEAN_KEY=\"BIBCLEANKEY\"		# environment variable name
###	-DINITDIR='"${initdir}"' ${XDEFS} -DHAVE_CONFIG_H

XDEFS		=

XSPLINTFLAGS	=

ZIP		= zip

ZOO		= zoo

#=======================================================================
# Syntax and security checker settings

ANTIC		= antic
ANTICFLAGS	=

CPPCHECK	= cppcheck
CPPCHECKFLAGS	= -I. --enable=all --force --verbose

FLAWFINDER	= flawfinder
FLAWFINDERFLAGS	=

ITS4		= its4
ITS4FLAGS	=

LINT		= 
LINTFLAGS	= -I. -b -c -h -x
LINTFLAGS	= -I. -errchk -h -x

RATS		= rats
RATSFLAGS	=

SPLINT		= splint
SPLINTFLAGS	= -I.				\
		  -booltype _Bool		\
		  -booltrue __true		\
		  -boolfalse __false		\
		  -bounds			\
		  -initallelements		\
		  +posixlib			\
		  ${XSPLINTFLAGS}

UNO		= uno
UNOFLAGS	= -I. -w -D_Bool=int

## Set VM=wine for testing Windows build with CC=i686-pc-mingw32-gcc
VM		= wine
VM		= 

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

.SUFFIXES:

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

.bib.bib-new:
	-${TESTBIBCLEAN} ${TESTBIBCLEANFLAGS} ${BIBCLEANFLAGS} <$< >$@

.c.i:
	${CC} -E -I. -I${srcdir} ${DEFS} ${CPPFLAGS} ${CFLAGS} $< 2>&1 | \
		grep -v '^[ 	]*$$' >$@

.c.o:
	${CC} -c -I. -I${srcdir} ${DEFS} ${CPPFLAGS} ${CFLAGS} $<

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

all: 	${PROGRAMS}

BIBCLEAN-OBJS   = bibclean.o chek.o do.o fix.o fndfil.o isbn.o	\
		  keybrd.o match.o option.o romtol.o strist.o	\
		  ${LIBOBJS}

${BIBCLEAN}:         ${BIBCLEAN-OBJS}
	${CC} -o $@ ${CFLAGS} ${BIBCLEAN-OBJS} ${LDFLAGS} ${LIBS}

bibclean.dvi: bibclean.texi
	cd ${srcdir}; texi2dvi bibclean.texi

### 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
	-test -f $@ && ${CHMOD} u+w $@
	-${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' |		\
		${SED} -e 's/\\n/|n/g' -e 's/\\"/|"/g'				\
			-e 's/\\/\\\\/g' -e 's/|n/\\n/g' -e 's/|"/\\"/g' |	\
		${AWK} '/^OPTION/,/^ERROR/ {if ($$0 !~ /^[A-Z]/)		\
			printf("\t\"%s\\n\",\n",substr($$0,6))}' >>$@
	echo '	(const char*)NULL,' >>$@
	${CHMOD} a-w $@

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

bibclean.html:	bibclean.man
	-${CHMOD} u+w $@
	${MAN2HTML} $<
	${HTMLPRETTY} bibclean.html | ${CHECKSUM} >$@.tmp
	${MV} $@.tmp $@
	${CHMOD} a-w $@
	${HTMLNCHECK} $@

bibclean.info: bibclean.texi
	cd ${srcdir}; makeinfo bibclean.texi

bibclean.i:	bibclean.c ch.h config.h custom.h delete.h isbn.h keybrd.h	\
		match.h pattern.h token.h toklst.h typedefs.h xctype.h		\
		xlimits.h xstdbool.h xstdio.h xstdlib.h xstring.h xtypes.h	\
		xunistd.h yesorno.h Makefile

bibclean.jar:	subdist ${DIST-FILES}
	-${RM} bibclean.jar bibclean.jar-lst
	${JAR} cf bibclean.jar ${DIST-FILES}
	-${MKDIR} bibclean-${VERSION}
	cd bibclean-${VERSION}; ${JAR} xf ../bibclean.jar
	${JAR} cf bibclean-${VERSION}.jar bibclean-${VERSION}
	-${RM} -rf bibclean-${VERSION}
	-${RM} bibclean.jar
	${LN} bibclean-${VERSION}.jar bibclean.jar || \
	${CP} ${CPFLAGS} bibclean-${VERSION}.jar bibclean.jar

bibclean.o:	bibclean.c ch.h config.h custom.h delete.h isbn.h keybrd.h	\
		match.h pattern.h token.h toklst.h typedefs.h xctype.h		\
		xlimits.h xstdbool.h xstdio.h xstdlib.h xstring.h xtypes.h	\
		xunistd.h yesorno.h

bibclean.pdf:	bibclean.ps
	${DISTILL} bibclean.ps

bibclean.ps:	bibclean.man
	${DITROFF} -Tps -man $? >$@

bibclean.tar:	subdist ${DIST-FILES}
	-${RM} bibclean.tar bibclean.tar-lst
	${TAR} chf bibclean.tar ${DIST-FILES}
	-${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 || \
		${CP} ${CPFLAGS} bibclean-${VERSION}.tar bibclean.tar

bibclean.txt:	bibclean.man
	${NROFF} -man bibclean.man | col -b | expand >$@

bibclean.zip:	subdist ${DIST-FILES}
	-${RM} bibclean*.zip
	-${RM} bibclean*.zip-lst
	${ZIP} bibclean-${VERSION}.zip ${DIST-FILES}
	${UNZIP} -v bibclean-${VERSION}.zip >bibclean-${VERSION}.zip-lst
	${LN} bibclean-${VERSION}.zip bibclean.zip || \
		${CP} ${CPFLAGS} bibclean-${VERSION}.zip bibclean.zip

bibclean.zoo:	subdist ${DIST-FILES}
	-${RM} bibclean*.zoo
	-${RM} bibclean*.zoo-lst
	${ZOO} a bibclean-${VERSION}.zoo ${DIST-FILES}
	${ZOO} v bibclean-${VERSION}.zoo >bibclean-${VERSION}.zoo-lst
	${LN} bibclean-${VERSION}.zoo bibclean.zoo || \
		${CP} ${CPFLAGS} bibclean-${VERSION}.zoo bibclean.zoo

${BIBISBN}:         isbn.c
	${CC} -DTEST -I. ${CFLAGS} isbn.c ${LDFLAGS} ${LIBS} -o $@

check:	check-setup check-ctype check-match check-romtol check-bibisbn check-bibtex \
	check-latex check-scribe

check-antic:
	-${TEST} -n "${ANTIC}" && for f in ${SRC} ; do ${ANTIC} ${ANTICFLAGS} $$f ; done

check-bibisbn: ${BIBISBN}
	@echo "==================== begin ${BIBISBN} test ====================" ;		\
	cd test ;										\
	nfail=0 ;										\
	npass=0 ;										\
	ntest=0 ;										\
	ntotal=`echo ${CHECK-BIBISBN} | wc -w` ;						\
	ntotal=`expr $$ntotal + $$ntotal` ;							\
	echo ;											\
	echo "These checks should produce no output other than their numbers and names," ;	\
	echo "followed by a test summary: no failures are expected anywhere." ;			\
	echo ;											\
	for f in ${CHECK-BIBISBN} ;								\
	do											\
	    ntest=`${EXPR} $$ntest + 2` ;							\
	    printf "[%2d / %d] %s " $$ntest $$ntotal $$f ;					\
	    test -f $$f.in  && ../${BIBISBN}                  < $$f.in > $$f.out 2> $$f.err ;	\
	    test -f $$f.opt && ../${BIBISBN} `cat $$f.opt` < /dev/null > $$f.out 2> $$f.err ;	\
	    ${CMP} -s okay/$$f.out $$f.out && ${RM} $$f.out ;					\
	    ${CMP} -s okay/$$f.err $$f.err && ${RM} $$f.err ;					\
	    test   -f $$f.out && printf "    FAIL "  && nfail=`expr $$nfail + 1` ;		\
	    test ! -f $$f.out && printf "PASS "      && npass=`expr $$npass + 1` ;		\
	    test   -f $$f.err && printf "    FAIL"   && nfail=`expr $$nfail + 1` ;		\
	    test ! -f $$f.err && printf "PASS"       && npass=`expr $$npass + 1` ;		\
	    echo ;										\
	done ;											\
	echo ;											\
	echo PASS: $$npass of $$ntest tests ;							\
	test $$nfail -ne 0 && echo FAIL: $$nfail of $$ntest tests ;				\
	echo ;											\
	test $$nfail -eq 0 && echo ALL TESTS PASSED! ;						\
	echo ;											\
	echo "===================== end ${BIBISBN} test =====================" ;		\
	echo

check-bibtex:	${BIBCLEAN}
	@echo
	@echo "===================== begin BibTeX test ======================"
	@echo
	@echo This test takes from 25 to 250 seconds on current and vintage machines.
	@echo Test times that are much longer indicate a SERIOUS problem.
	@echo
	@-cd test ;										\
	echo ${CHECK-BIBTEX} | wc -w > total.dat ;						\
	echo "These checks should produce no output other than their numbers and names," ;	\
	echo "followed by a test summary: no failures are expected anywhere." ;			\
	echo ;															\
	nfail=0 ;														\
	npass=0 ;														\
	ntest=0 ;														\
	ntotal=`echo ${CHECK-BIBTEX} | wc -w` ;											\
	for b in ${CHECK-BIBTEX} ;												\
	do															\
		ntest=`${EXPR} $$ntest + 1` ;											\
		bibfile=$$b.bib ;												\
		optfile=$$b.opt ;												\
		options=`${CAT} $$optfile` ;											\
		printf "[%2d / %d] " $$ntest $$ntotal ;										\
		echo $$b `echo $$options | ${CUT} -c -70 ` ;									\
		${TESTBIBCLEAN} ${TESTBIBCLEANFLAGS} ${BIBCLEANFLAGS} `${CAT} $$optfile` $$bibfile >$$b.out 2> $$b.ert ;	\
		${SED} -e ` printf 's/\015$$//' ` $$b.ert > ${TMPDIR}/$$b.ert.$$$$ ;						\
		${MV} ${TMPDIR}/$$b.ert.$$$$ $$b.ert ;										\
		${SED} -e ` printf 's/\015$$//' ` $$b.out > ${TMPDIR}/$$b.out.$$$$ ;						\
		${MV} ${TMPDIR}/$$b.out.$$$$ $$b.out ;										\
		${GREP} -v '^Compiled by' < $$b.ert >$$b.err ;									\
		${RM} $$b.ert ;													\
		${DIFF} okay/$$b.err $$b.err ;											\
		${CMP} -s okay/$$b.err $$b.err 2>/dev/null && ${RM} $$b.err ;							\
		${DIFF} okay/$$b.out $$b.out ;											\
		${CMP} -s okay/$$b.out $$b.out 2>/dev/null && ${RM} $$b.out ;							\
		if test -f $$b.err -o -f $$b.out ;										\
		then														\
		    nfail=`${EXPR} $$nfail + 1` ;										\
		else														\
		    npass=`${EXPR} $$npass + 1` ;										\
		fi ;														\
	done ;															\
	echo ;															\
	echo PASS: $$npass of $$ntest tests ;											\
	test $$nfail -ne 0 && echo FAIL: $$nfail of $$ntest tests ;								\
	echo ;															\
	test $$nfail -eq 0 && echo ALL TESTS PASSED! ;										\
	echo ;															\
	${RM} fail.dat pass.dat total.dat
	@echo
	@echo "====================== end BibTeX test ========================"
	@echo

check-cppcheck:
	-${TEST} -n "${CPPCHECK}" && for f in ${SRC} ; do ${CPPCHECK} ${CPPCHECKFLAGS} $$f ; done

check-ctype:	${TSTCTYPE}
	@echo
	@echo "===================== begin ctype test ======================"
	@echo
	-@cd test ;										\
	echo "NB: A failure of this test is SERIOUS.  It indicates that the C library" ;	\
	echo "<ctype.h> isxxx() and toxxx() functions are behaving unconventionally," ;		\
	echo "and the result will likely be later failure of the BibTeX testbib1 test." ;	\
	echo "Among systems tested for this release, OpenBSD 3.2 is known to fail here." ;	\
	echo ;											\
	echo "The following checks should produce no output other than their names." ;		\
	echo ;											\
	echo tstctype ;										\
	LANG=C ${TESTTSTCTYPE} | ${SED} -e ` printf 's/\015$$//' ` > tstctype.out ;		\
	${DIFF} okay/tstctype.out tstctype.out ;						\
	${CMP} -s okay/tstctype.out tstctype.out 2>/dev/null && ${RM} tstctype.out
	@echo
	@echo "====================== end ctype test ========================"
	@echo

check-flawfinder:
	-${TEST} -n "${FLAWFINDER}" && for f in ${SRC} ; do ${FLAWFINDER} ${FLAWFINDERFLAGS} $$f ; done

check-its4:
	-${TEST} -n "${ITS4}" && for f in ${SRC} ; do ${ITS4} ${ITS4FLAGS} $$f ; done

check-latex:
	@echo
	@echo "===================== begin LaTeX test ======================="
	@echo
	@if test \( "xx${LATEX}" = "xx" \) -o \( "xx${BIBTEX}" = "xx" \) ;				\
	then												\
		echo "$@ skipped: missing LaTeX and/or BibTeX" ;					\
	else												\
		cd test ;										\
		echo "The following checks should produce no output other than their names." ;		\
		echo ;											\
		for f in ${CHECK-LATEX} ;								\
		do											\
			b=`basename $$f .ltx` ;								\
			optfile=$$b.opt ;								\
			echo $$b `${CAT} $$optfile` ;							\
			${TESTBIBCLEAN} ${TESTBIBCLEANFLAGS} ${BIBCLEANFLAGS} 				\
				`${CAT} $$optfile` $$b.bin > $$b.out 2> $$b.err ;			\
			${SED} -e ` printf 's/\015$$//' ` $$b.err > ${TMPDIR}/$$b.err.$$$$ ;		\
			${MV} ${TMPDIR}/$$b.err.$$$$ $$b.err ;						\
			${SED} -e ` printf 's/\015$$//' ` $$b.out > ${TMPDIR}/$$b.out.$$$$ ;		\
			${MV} ${TMPDIR}/$$b.out.$$$$ $$b.out ;						\
			${CP} ${CPFLAGS} $$b.out $$b.bib ;						\
			${LATEX} $$b.ltx >/dev/null 2>/dev/null ;					\
			${BIBTEX} $$b 1>/dev/null ;							\
			${TEST} -f $$b.blg && ${FIXBLG} $$b.blg > $$b.tmp && ${MV} $$b.tmp $$b.blg ;	\
			${RM} $$b.aux $$b.bib $$b.log ;							\
			${DIFF} okay/$$b.bbl $$b.bbl ;							\
			${CMP} -s okay/$$b.bbl $$b.bbl 2>/dev/null && ${RM} $$b.bbl ;			\
			${DIFF} okay/$$b.blg $$b.blg ;							\
			${CMP} -s okay/$$b.blg $$b.blg 2>/dev/null && ${RM} $$b.blg ;			\
			${DIFF} okay/$$b.err $$b.err ;							\
			${CMP} -s okay/$$b.err $$b.err 2>/dev/null && ${RM} $$b.err ;			\
			${DIFF} okay/$$b.out $$b.out ;							\
			${CMP} -s okay/$$b.out $$b.out 2>/dev/null && ${RM} $$b.out ;			\
		done ; \
	fi
	@echo
	@echo "====================== end LaTeX test ========================"
	@echo

check-lint:
	-${TEST} -n "${LINT}" && for f in ${SRC} ; do ${LINT} ${LINTFLAGS} $$f ; done

check-match:	${MATCH}
	@echo
	@echo "===================== begin match test ======================="
	@echo
	@cd test ;									\
	echo "The following checks should produce no output other than their names." ;	\
	echo ;										\
	for f in ${CHECK-MATCH} ;							\
	do										\
		b=`basename $$f .in` ;							\
		echo $$b ;								\
		${TESTMATCH} < $$f >$$b.out 2>$$b.err ;					\
		${SED} -e ` printf 's/\015$$//' ` $$b.err > ${TMPDIR}/$$b.err.$$$$ ;	\
		${MV} ${TMPDIR}/$$b.err.$$$$ $$b.err ;					\
		${SED} -e ` printf 's/\015$$//' ` $$b.out > ${TMPDIR}/$$b.out.$$$$ ;	\
		${MV} ${TMPDIR}/$$b.out.$$$$ $$b.out ;					\
		${DIFF} okay/$$b.err $$b.err ;						\
		${CMP} -s okay/$$b.err $$b.err 2>/dev/null && ${RM} $$b.err ;		\
		${DIFF} okay/$$b.out $$b.out ;						\
		${CMP} -s okay/$$b.out $$b.out 2>/dev/null && ${RM} $$b.out ;		\
	done
	@echo
	@echo "====================== end match test ========================"
	@echo

check-rats:
	-${TEST} -n "${RATS}" && for f in ${SRC} ; do ${RATS} ${RATSFLAGS} $$f ; done

check-romtol:	${ROMTOL}
	@echo
	@echo "===================== begin romtol test ======================"
	@echo
	@cd test ;									\
	echo "The following checks should produce no output other than their names." ;	\
	echo ;										\
	for f in ${CHECK-ROMTOL} ;							\
	do										\
		b=`basename $$f .in` ;							\
		echo $$b ;								\
		${TESTROMTOL} < $$f >$$b.out 2>$$b.err ;				\
		${SED} -e ` printf 's/\015$$//' ` $$b.err > ${TMPDIR}/$$b.err.$$$$ ;	\
		${MV} ${TMPDIR}/$$b.err.$$$$ $$b.err ;					\
		${SED} -e ` printf 's/\015$$//' ` $$b.out > ${TMPDIR}/$$b.out.$$$$ ;	\
		${MV} ${TMPDIR}/$$b.out.$$$$ $$b.out ;					\
		${DIFF} okay/$$b.err $$b.err ;						\
		${CMP} -s okay/$$b.err $$b.err 2>/dev/null && ${RM} $$b.err ;		\
		${DIFF} okay/$$b.out $$b.out ;						\
		${CMP} -s okay/$$b.out $$b.out 2>/dev/null && ${RM} $$b.out ;		\
	done
	@echo
	@echo "====================== end romtol test ======================="
	@echo

### 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 IBM AIX
### INFO system hypertext node on bsh/rsh says:
###     All characters, except the enclosing single quotation marks, are
###     taken literally, with any special meaning removed.
###
check-scribe:	${BIBCLEAN}
	@echo
	@echo "===================== begin Scribe test ======================"
	@echo
	@if test "xx${BIBTEX}" = "xx" ;									\
	then												\
		echo "$@ skipped: missing BibTeX" ;							\
	else												\
		cd test ;										\
		echo "The following checks should produce no output other than their names." ;		\
		echo ;											\
		for f in ${CHECK-SCRIBE} ;								\
		do											\
			b=`basename $$f .bib` ;								\
			optfile=$$b.opt ;								\
			echo $$b `${CAT} $$optfile` ;							\
			${TESTBIBCLEAN} ${TESTBIBCLEANFLAGS} ${BIBCLEANFLAGS} `${CAT} $$optfile` $$f >$$b.out 2>$$b.err ; \
			${SED} -e ` printf 's/\015$$//' ` $$b.err > ${TMPDIR}/$$b.err.$$$$ ;		\
			${MV} ${TMPDIR}/$$b.err.$$$$ $$b.err ;						\
			${SED} -e ` printf 's/\015$$//' ` $$b.out > ${TMPDIR}/$$b.out.$$$$ ;		\
			${MV} ${TMPDIR}/$$b.out.$$$$ $$b.out ;						\
			echo 'Bbibstyle{plain}NBcitation{*}NBbibdata{'$$b'}' |				\
				${TR} BN '\134\012' >$$b.aux ;						\
			${BIBTEX} $$b 1>/dev/null ;							\
			${TEST} -f $$b.blg && ${FIXBLG} $$b.blg > $$b.tmp && ${MV} $$b.tmp $$b.blg ;	\
			${RM} $$b.aux ;									\
			${DIFF} okay/$$b.bbl $$b.bbl ;							\
			${CMP} -s okay/$$b.bbl $$b.bbl 2>/dev/null && ${RM} $$b.bbl ;			\
			${DIFF} okay/$$b.blg $$b.blg ;							\
			${CMP} -s okay/$$b.blg $$b.blg 2>/dev/null && ${RM} $$b.blg ;			\
			${DIFF} okay/$$b.err $$b.err ;							\
			${CMP} -s okay/$$b.err $$b.err 2>/dev/null && ${RM} $$b.err ;			\
			${DIFF} okay/$$b.out $$b.out ;							\
			${CMP} -s okay/$$b.out $$b.out 2>/dev/null && ${RM} $$b.out ;			\
		done ;											\
	fi
	@echo
	@echo "====================== end Scribe test ========================"
	@echo

check-setup:	${BIBCLEAN} ${MATCH} ${ROMTOL} ${TSTCTYPE}

check-splint:
	-${TEST} -n "${SPLINT}" && for f in ${SRC} ; do ${SPLINT} ${SPLINTFLAGS} $$f ; done

check-syntax: check-antic check-cppcheck check-flawfinder check-its4 \
	check-lint check-rats check-splint check-uno

check-uno:
	-${TEST} -n "${UNO}" && ${UNO} ${UNOFLAGS} ${SRC}

check-version:	Makefile
	@echo "Version number is ""'"${VERSION}"'"

clean:	clean-test clean-dist
	-${RM} *.aux
	-${RM} *.bbl
	-${RM} *.blg
	-${RM} *.dvi
	-${RM} *.err
	-${RM} *.i
	-${RM} *.log
	-${RM} *.o
	-${RM} *~
	-${RM} \#*
	-${RM} configure.tmp
	-${RM} core test/core
	-${RM} ${MATCH} match.lst
	-${RM} ${ROMTOL} romtol.lst
	-${RM} testcodn.bib
	-${RM} testisxn.bib
	-${RM} testscr2.bi2 testscr2.er2
	-${RM} ${TSTCTYPE}
	# [08-Nov-1999] Suppress subdir make to preserve distribution files
	# -for d in ${SUBDIRS} ; do (cd $$d ; ${MAKE} clean ) ; done

clean-dist:
	-${RM} bibclean.jar bibclean-?.??.jar
	-${RM} bibclean.jar-lst
	-${RM} bibclean.tar bibclean-?.??.tar
	-${RM} bibclean.tar-lst
	-${RM} bibclean-${VERSION}.tar
	-${RM} bibclean.zip bibclean-?.??.zip
	-${RM} bibclean.zip-lst bibclean-?.??.zip-lst
	-${RM} bibclean.zoo bibclean-?.??.zoo
	-${RM} bibclean.zoo-lst bibclean-?.??.zoo-lst

clean-test:
	-${RM} test/*.aux test/*.bbl test/*.blg test/*.err test/*.ert \
		test/*.log test/*.out test/*.tmp

clobber:	clean
	-${RM} ${PROGRAMS}
	-${RM} bibclean.hlp
	-${RM} bibclean.ps
	-${RM} bibclean.txt
	-${RM} install.time install-ftp.time
	# [08-Nov-1999] Suppress subdir make to preserve distribution files
	# -for d in ${SUBDIRS} ; do (cd $$d ; ${MAKE} clobber ) ; done

dist:	bibclean.jar bibclean.tar bibclean.zip bibclean.zoo

distclean: clobber
	-${RM} config.cache config.h config.log config.status
	-${RM} -r autom4te.cache
	-${RM} bibclean*.jar-lst bibclean*.tar-lst bibclean*.zip-lst \
		bibclean*.zoo-lst
	# [08-Nov-1999] Suppress subdir make to preserve distribution files
	# -for d in ${SUBDIRS} ; do (cd $$d ; ${MAKE} distclean ) ; done
	-${RM} Makefile

docs:	bibclean.txt bibclean.hlp bibclean.html bibclean.ps bibclean.pdf

chek.i:		chek.c config.h custom.h match.h token.h typedefs.h xctype.h	\
		xstat.h xstdio.h xstring.h yesorno.h Makefile

chek.o:		chek.c config.h custom.h match.h token.h typedefs.h xctype.h	\
		xstat.h xstdio.h xstring.h yesorno.h

do.i:           do.c ch.h config.h custom.h delete.h keybrd.h match.h		\
		pattern.h token.h toklst.h typedefs.h xctype.h xstdbool.h	\
		xstdio.h xstdlib.h xstring.h xunistd.h yesorno.h Makefile

do.o:           do.c ch.h config.h custom.h delete.h keybrd.h match.h		\
		pattern.h token.h toklst.h typedefs.h xctype.h xstdbool.h	\
		xstdio.h xstdlib.h xstring.h xunistd.h yesorno.h

fix.i:		fix.c config.h custom.h match.h token.h typedefs.h xctype.h	\
		xstring.h yesorno.h Makefile

fix.o:		fix.c config.h custom.h match.h token.h typedefs.h xctype.h	\
		xstring.h yesorno.h

fndfil.i:       fndfil.c config.h custom.h typedefs.h xctype.h xpwd.h		\
		xstdbool.h xstdio.h xstdlib.h xstring.h xunistd.h Makefile

fndfil.o:       fndfil.c config.h custom.h typedefs.h xctype.h xpwd.h		\
		xstdbool.h xstdio.h xstdlib.h xstring.h xunistd.h

isbn.i:         isbn.c ch.h config.h custom.h isbn.h isbn.tbl xctype.h		\
		xstdbool.h xstdio.h xstdlib.h xstring.h yesorno.h Makefile

isbn.o:         isbn.c ch.h config.h custom.h isbn.h isbn.tbl xctype.h		\
		xstdbool.h xstdio.h xstdlib.h xstring.h yesorno.h

keybrd.i:	ch.h config.h custom.h xstdio.h xstring.h xunistd.h		\
		yesorno.h Makefile

keybrd.o:	keybrd.c ch.h config.h custom.h xctype.h xstdio.h xstring.h	\
		xunistd.h yesorno.h

### Build a test program for match()
${MATCH}:	match.c romtol.o
	-${RM} matchx.o
	${CC} -I. -I${srcdir} ${TESTFLAGS} -o matchx.o -c match.c
	${CC} -I. -I${srcdir} ${TESTFLAGS} -o $@ matchx.o romtol.o ${LDFLAGS} ${LIBS}
	-${RM} matchx.o

match.i:        match.c config.h custom.h match.h xctype.h xstdbool.h		\
		xstdio.h xstdlib.h xstring.h yesorno.h Makefile

match.o:        match.c config.h custom.h match.h xctype.h xstdbool.h		\
		xstdio.h xstdlib.h xstring.h yesorno.h

mostlyclean:	clean
	# [08-Nov-1999] Suppress subdir make to preserve distribution files
	# -for d in ${SUBDIRS} ; do (cd $$d ; ${MAKE} mostlyclean ) ; done

option.i:       option.c bibclean.h ch.h config.h custom.h isbn.h match.h	\
		typedefs.h xstdbool.h xstdio.h xstdlib.h xstring.h yesorno.h	\
		Makefile

### When HOST, USER, __DATE__, and __TIME__ are available,
### bibclean preserves them for its version output
option.o:       option.c bibclean.h ch.h config.h custom.h isbn.h match.h	\
		typedefs.h xstdbool.h xstdio.h xstdlib.h xstring.h yesorno.h
	${CC} -I. -I${srcdir} ${CFLAGS} -c -DHOST=\"${HOST}\" -DUSER=\"${USER}\" option.c

### Build a test program for romtol()
${ROMTOL}:	romtol.c
	-${RM} romtolx.o
	${CC} -I. -I${srcdir} ${TESTFLAGS} -o romtolx.o -c romtol.c
	${CC} -I. -I${srcdir} ${TESTFLAGS} -o $@ romtolx.o ${LDFLAGS} ${LIBS}
	-${RM} romtolx.o

romtol.i:       romtol.c config.h custom.h xctype.h xstring.h xstdbool.h	\
		xstdio.h xstdlib.h Makefile

romtol.o:       romtol.c config.h custom.h xctype.h xstring.h xstdbool.h	\
		xstdio.h xstdlib.h

splint:		splint.log

splint.log:	${SRC} *.h Makefile
	-${SPLINT} ${SPLINTFLAGS} ${SRC} > $@

strist.i:	strist.c config.h custom.h xctype.h xstdio.h xstring.h Makefile

strist.o:	strist.c config.h custom.h xctype.h xstdio.h xstring.h

strtol.i:       strtol.c config.h custom.h xctype.h xstdbool.h xstdio.h		\
		xstdlib.h xstring.h Makefile

strtol.o:       strtol.c config.h custom.h xctype.h xstdbool.h xstdio.h		\
		xstdlib.h xstring.h

### Subdirectory makes needed for distribution file creation
subdist:
	-for d in ${SUBDIRS} ; do (cd $$d ; ${MAKE} ) ; done

${TSTCTYPE}:	tstctype.c
	${CC} ${CFLAGS} -o $@ $? ${LDFLAGS} ${LIBS}

### ====================================================================
### Additional targets required by GNU Coding standards

Makefile: Makefile.in config.status
	./config.status

config.status: configure
	${srcdir}/configure --srcdir=${srcdir} --no-create --config-cache

configure reconfigure: configure.ac configure.sed
	cd ${srcdir}; ${AUTOCONF} ; ${AUTOHEADER}
### Apply needed fixup for C++ with configure
	${MV} configure configure.tmp
	${SED} -f configure.sed <configure.tmp >configure
	-${RM} configure.tmp
	${CHMOD} +x configure

maintainer-clean: distclean
	@echo "This command is intended for maintainers to use;"
	@echo "it deletes files that may require special tools to rebuild."
	-${CHMOD} u+w bibclean.html
	-${RM} bibclean.html
	-${RM} bibclean.pdf
	-${RM} TAGS
	-${RM} configure config.hin
	# [08-Nov-1999] Suppress subdir make to preserve distribution files
	# -for d in ${SUBDIRS} ; do (cd $$d ; ${MAKE} maintainer-clean ) ; done

TAGS:	Makefile ${TAGS-FILES}
	cd ${srcdir}; ${ETAGS} ${TAGS-FILES}

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

install:	install.time

install.time:	install-exe install-ini install-man
	${TOUCH} install.time

install-exe:	uninstall-exe install-bibclean install-bibisbn

install-bibclean:	${BIBCLEAN}
	test -d ${DESTDIR}${bindir} || ${MKDIR} ${DESTDIR}${bindir}
	if ${TEST} -f ${DESTDIR}${bindir}/${BIBCLEAN} ;		\
	then							\
		${MV} ${DESTDIR}${bindir}/${BIBCLEAN}		\
		      ${DESTDIR}${bindir}/${BIBCLEAN}.old ;	\
	fi
	-${RM} ${DESTDIR}${bindir}/bibclean-${VERSION}
	${CP} ${CPFLAGS} ${BIBCLEAN} ${DESTDIR}${bindir}/${BIBCLEAN}
	-${STRIP} ${DESTDIR}${bindir}/${BIBCLEAN}
	${LN} ${DESTDIR}${bindir}/${BIBCLEAN} ${DESTDIR}${bindir}/bibclean-${VERSION}${EXEEXT} || \
		${CP} ${CPFLAGS} ${DESTDIR}${bindir}/${BIBCLEAN} ${DESTDIR}${bindir}/bibclean-${VERSION}${EXEEXT}
	${CHMOD} 775 ${DESTDIR}${bindir}/${BIBCLEAN}
	$(MAKE)

install-bibisbn:	${BIBISBN}
	test -d ${DESTDIR}${bindir} || ${MKDIR} ${DESTDIR}${bindir}
	if ${TEST} -f ${DESTDIR}${bindir}/${BIBISBN} ;		\
	then							\
		${MV} ${DESTDIR}${bindir}/${BIBISBN}		\
		      ${DESTDIR}${bindir}/${BIBISBN}.old ;	\
	fi
	-${RM} ${DESTDIR}${bindir}/bibisbn-${VERSION}
	${CP} ${CPFLAGS} ${BIBISBN} ${DESTDIR}${bindir}/${BIBISBN}
	-${STRIP} ${DESTDIR}${bindir}/${BIBISBN}
	${LN} ${DESTDIR}${bindir}/${BIBISBN} ${DESTDIR}${bindir}/bibisbn-${VERSION}${EXEEXT} || \
		${CP} ${CPFLAGS} ${DESTDIR}${bindir}/${BIBISBN} ${DESTDIR}${bindir}/bibisbn-${VERSION}${EXEEXT}
	${CHMOD} 775 ${DESTDIR}${bindir}/${BIBISBN}

### Although it is generally considered bad form to install
### initialization files in the same location as executable files
### (mostly because they confuse directory listings), we make an
### exception for bibclean because (a) the files are, on UNIX, `hidden'
### (by their leading dot), (b) doing so avoids the need for yet
### another hard-coded configuration directory, or else another search path,
### and (c) search paths are more flexible than fixed configuration-file
### directories.

install-ini:	 uninstall-ini
# OLD:	${CP} bibclean.ini ${DESTDIR}${bindir}/.bibcleanrc
# OLD:	${CHMOD} 664 ${DESTDIR}${bindir}/.bibcleanrc
# OLD:	${CP} bibclean.key ${DESTDIR}${bindir}/.bibclean.key
# OLD:	${CHMOD} 664 ${DESTDIR}${bindir}/.bibclean.key
# OLD:	${CP} bibclean.isbn ${DESTDIR}${bindir}/.bibclean.isbn
# OLD:	${CHMOD} 664 ${DESTDIR}${bindir}/.bibclean.isbn
	-${TEST} -d ${DESTDIR}${bibcleandir} || ${MKDIR} ${DESTDIR}${bibcleandir}
	-${TEST} -d ${DESTDIR}${initdir}     || ${MKDIR} ${DESTDIR}${initdir}
	-${TEST} ! -d ${DESTDIR}${initdir} && echo ERROR: cannot create ${DESTDIR}${initdir} && exit 1
	${CP} ${CPFLAGS} bibclean.ini bibclean.key bibclean.isbn ${DESTDIR}${initdir}/
	${CHMOD} 664 ${DESTDIR}${initdir}/bibclean.*

install-man:	bibclean.man uninstall-man
	test -d ${DESTDIR}${mandir} || ${MKDIR} ${DESTDIR}${mandir}
	if ${TEST} -f ${DESTDIR}${mandir}/bibclean.${manext} ;		\
	then								\
		${MV} ${DESTDIR}${mandir}/bibclean.${manext}		\
		      ${DESTDIR}${mandir}/bibclean.old.${manext} ;	\
	fi
	${CP} ${CPFLAGS} bibclean.man ${DESTDIR}${mandir}/bibclean.${manext}
	-${RM} ${DESTDIR}${mandir}/../cat${manext}/bibclean.${manext}
	-${RM} ${DESTDIR}${mandir}/bibclean-${VERSION}.${manext}
	${LN} ${DESTDIR}${mandir}/bibclean.${manext} ${DESTDIR}${mandir}/bibclean-${VERSION}.${manext} || \
		${CP} ${CPFLAGS} ${DESTDIR}${mandir}/bibclean.${manext} ${DESTDIR}${mandir}/bibclean-${VERSION}.${manext}
	${CHMOD} 664 ${DESTDIR}${mandir}/bibclean.${manext}

install-ftp:	uninstall-ftp install-ftp.time

install-ftp.time:	dist
	${TAR} tvf bibclean-${VERSION}.tar >${FTPDIR}/bibclean-${VERSION}.tar-lst
	${GZIP} <bibclean-${VERSION}.tar		\
		>${FTPDIR}/bibclean-${VERSION}.tar.gz
	${CP} ${CPFLAGS} bibclean-${VERSION}.jar ${FTPDIR}
	${JAR} tvf bibclean-${VERSION}.jar		\
		2>${FTPDIR}/bibclean-${VERSION}.jar-lst
	${CP} ${CPFLAGS} bibclean-${VERSION}.zip ${FTPDIR}
	${CP} ${CPFLAGS} bibclean-${VERSION}.zip-lst ${FTPDIR}
	${CP} ${CPFLAGS} bibclean-${VERSION}.zoo ${FTPDIR}
	${CP} ${CPFLAGS} bibclean-${VERSION}.zoo-lst ${FTPDIR}
	${LS} -l ${FTPDIR}/bibclean*
	${DATE} >install-ftp.time

lint:
	${LINT} ${LINTFLAGS} ${SRC}

uninstall:	uninstall-exe uninstall-ini uninstall-man
	-${RM} install.time

uninstall-exe:
	-${RM} ${DESTDIR}${bindir}/${BIBCLEAN} ${DESTDIR}${bindir}/bibclean-${VERSION}${EXEEXT}
	-${RM} ${DESTDIR}${bindir}/${BIBISBN}  ${DESTDIR}${bindir}/bibisbn-${VERSION}${EXEEXT}

uninstall-ini:
	-${RM}  ${DESTDIR}${initdir}/bibclean.ini	\
		${DESTDIR}${initdir}/bibclean.isbn	\
		${DESTDIR}${initdir}/bibclean.key

uninstall-man:
	-${RM}  ${DESTDIR}${mandir}/bibclean.${manext}					\
		${DESTDIR}${mandir}/bibclean-${VERSION}.${manext}			\
		${DESTDIR}${mandir}/../cat${manext}/bibclean.${manext}			\
		${DESTDIR}${mandir}/../cat${manext}/bibclean-${VERSION}.${manext}

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

### Prevent GNU make v3 from overflowing arg limit on SysV.
.NOEXPORT:
