1### ====================================================================
2### Makefile for BibTeX .bib file prettyprinter
3###
4### Current target list: (these include all GNU Project standard
5### targets)
6###
7###	all			build bibclean
8###	bibclean		executable for bibclean
9###	bibclean.h		documentation strings for help()
10###				function
11###	bibclean.hlp		VAX VMS help file (automatically
12###				converted from bibclean.txt)
13###	bibclean.html		HTML version of formatted manual pages
14###	bibclean.i		C preprocessor output from bibclean.c
15###	bibclean.jar		Java Jar distribution archive
16###	bibclean.pdf		Adobe Portable Document Format version
17###				of bibclean.man
18###	bibclean.ps		PostScript version of bibclean.man
19###	bibclean.tar		tar archive file for ftp distribution
20###	bibclean.txt		nroff'ed bibclean.man manual page file
21###	bibclean.zip		Info-zip archive file for ftp
22###				distribution
23###	bibclean.zoo		zoo archive file for ftp distribution
24###	check			same as test (see below)
25###	clean			clean up all but executables and time
26###				stamps
27###	clobber			clean up everything
28###	distclean		remove everything make can rebuild at
29###				remote site
30###	docs			make bibclean.txt, bibclean.hlp, and
31###				bibclean.ps
32###	install			install executable and man pages
33###	install.time		internal target for install
34###	install-exe		install executable
35###	install-man		install man pages
36###	install-ftp		install .tar, .zip, and .zoo files in
37###				ftp tree
38###	install-ftp.time	internal target for install-ftp
39###	lint			check for code problems
40###	mostlyclean		same as clean
41###	maintainer-clean	for program author only: remove
42###				everything make can rebuild at
43###				author's site
44###	romtol			build and run test program for romtol()
45###	TAGS			GNU Emacs tags file
46###	test			test bibclean on BibTeX and Scribe
47###				bibliographies
48###	test-bibtex		test 1,2,3 bibclean on BibTeX
49###				bibliographies
50###	test-bibtex-1		test 1 bibclean on BibTeX bibliographies
51###	test-bibtex-2		test 2 bibclean on BibTeX bibliographies
52###	test-bibtex-3		test 3 ISBN and ISSN verification
53###	test-scribe		test 1,2,3 bibclean on Scribe
54###				bibliographies
55###	test-scribe-1		test 1 bibclean on Scribe bibliographies
56###	test-scribe-2		test 2 bibclean on Scribe bibliographies
57###	test-scribe-3		test 3 bibclean on Scribe bibliographies
58###	test-version		test extraction of version number
59###	uninstall		remove files installed by "make install"
60###	uninstall-ftp		remove installed files in anonymous ftp
61###				directory
62###
63### [28-Feb-2016] -- major update for bibclean 3.00 and later
64### [28-Aug-2001] -- major update for bibclean 2.12 and later
65### [01-Jul-1996] -- add targets bibclean.pdf and DISTILL macro, and
66###		     update DIST-FILES list
67### [03-May-1996] -- add targets match, romtol, test-match, and
68###		     and test-romtol, and update DIST-FILES list for
69###		     version 2.11.3 release
70### [25-Apr-1996] -- add target for bibclean.html, with associated
71###		     support Makefile variables
72### [20-Sep-1995] -- revise to use GNU autoconf and configure
73### [08-Mar-1995] -- Change TARGET to TARGETS to avoid conflict with
74###		     built-in macro on Cray systems. Add -D_POSIX_SOURCE
75###		     to dec-alpha-osf1-c++ CC definition to work around
76###		     bug in C++ signal.h header file on OSF/1 3.x.
77### [21-Nov-1994] -- add cray-el94 target
78### [11-Nov-1994] -- add sun-sparc-solaris2-lcc and sun-sparc-sunos5-lcc
79###		     targets
80### [18-Oct-1994] -- add isbn.[co] to file lists
81### [16-Oct-1994] -- add strist.[co] to file lists
82### [04-Jun-1994] -- update for version 2.10
83###		     add lint target
84### [31-Dec-1993] -- final polishing of Makefile for public release
85###		     after TUGboat publication
86### [24-Sep-1993] -- original version
87### ====================================================================
88
89### --------------------------------------------------------------------
90### Start of system configuration section.
91
92BIBCLEANNAME	= bibclean
93
94prefix		= /usr/uumath
95exec_prefix     = ${prefix}
96
97bindir          = ${exec_prefix}/bin
98srcdir          = .
99
100datarootdir	= ${prefix}/share
101datadir		= ${datarootdir}
102bibcleandir	= ${datadir}/${BIBCLEANNAME}
103initdir		= ${bibcleandir}/${VERSION}
104
105### This is needed only at the developer's site:
106FTPDIR		= /u/ftp/pub/tex/bib
107
108CC              = gcc -std=gnu11
109CFLAGS          =  -I${prefix}/include ${OPT}
110CPPFLAGS	=  -I${prefix}/include
111
112DEFS            = -DINITDIR='"${initdir}"' ${XDEFS} -DHAVE_CONFIG_H
113
114LDFLAGS         = -L/usr/uumath/lib64 -Wl,-rpath,/usr/uumath/lib64 ${OPT}
115LIBOBJS		=
116LIBS            =
117
118OPT		=
119
120
121
122### Where to install the manual pages.
123mandir          = ${prefix}/man/man1
124### Extension (not including `.') for the installed manual page filenames.
125manext          = 1
126
127### End of system configuration section.
128### --------------------------------------------------------------------
129
130AUTOCONF	= autoconf
131
132AUTOHEADER	= autoheader
133
134AWK		= mawk
135
136BIBCLEAN	= bibclean${EXEEXT}
137
138### This option is normally empty, but is used by the developer
139### to test whether new options affect output.
140BIBCLEANFLAGS	=
141
142BIBISBN		= bibisbn${EXEEXT}
143
144CHECK-BIBISBN	= bibisbn1 bibisbn2 bibisbn3 bibisbn4 bibisbn5 bibisbn6 bibisbn7
145
146BIBTEX		= bibtex
147
148CAT		= cat
149
150### The topt1* tests try all recognized options with a single leading dash, and
151### the topt3* tests are their companions with two leading dashes.  However, we
152### intentionally EXCLUDE topt163 and topt363 because they hold -print-patterns
153### options whose output is site-dependent.  We have no tests for
154### -trace-file-opening because that too is site-dependent, and also
155### user-dependent.
156
157CHECK-BIBTEX    = testbib1 testbib2 testbib3 testbib4 testbib5 testbib6		\
158		  testbib7 testbib8 testcodn testisxn testopt1 testopt2		\
159		  testopt3 testopt4 testopt5 testopt6 testopt7 testopt8		\
160		  testopt9 testopta testoptb testoptc testoptd testopte		\
161		  testoptf testoptg testopth testopti testoptj testoptk		\
162		  testoptl testoptm testoptn testopto testoptp testoptq		\
163		  testoptr testopts testoptt testoptu testoptv testoptw		\
164		  topt101 topt102 topt103 topt104 topt105 topt106 topt107	\
165		  topt108 topt109 topt110 topt111 topt112 topt113 topt114	\
166		  topt115 topt116 topt117 topt118 topt119 topt120 topt121	\
167		  topt122 topt123 topt124 topt125 topt126 topt127 topt128	\
168		  topt129 topt130 topt131 topt132 topt133 topt134 topt135	\
169		  topt136 topt137 topt138 topt139 topt140 topt141 topt142	\
170		  topt143 topt144 topt145 topt146 topt147 topt148 topt149	\
171		  topt150 topt151 topt152 topt153 topt154 topt155 topt156	\
172		  topt157 topt158 topt159 topt160 topt161 topt162 topt164	\
173		  topt165 topt166 topt167 topt168 topt169 topt170 topt171	\
174		  topt301 topt302 topt303 topt304 topt305 topt306 topt307	\
175		  topt308 topt309 topt310 topt311 topt312 topt313 topt314	\
176		  topt315 topt316 topt317 topt318 topt319 topt320 topt321	\
177		  topt322 topt323 topt324 topt325 topt326 topt327 topt328	\
178		  topt329 topt330 topt331 topt332 topt333 topt334 topt335	\
179		  topt336 topt337 topt338 topt339 topt340 topt341 topt342	\
180		  topt343 topt344 topt345 topt346 topt347 topt348 topt349	\
181		  topt350 topt351 topt352 topt353 topt354 topt355 topt356	\
182		  topt357 topt358 topt359 topt360 topt361 topt362 topt364	\
183		  topt365 topt366 topt367 topt368 topt369 topt370 topt371
184
185CHECK-LATEX	= testltx1.ltx
186
187CHECK-MATCH	= match.in
188
189CHECK-ROMTOL	= romtol.in
190
191CHECK-SCRIBE	= testscr1.bib testscr2.bib testscr3.bib testscr4.bib
192
193### This program is freely available at ftp://ftp.math.utah.edu/pub/checksum/
194CHECKSUM	= checksum
195
196CHMOD		= chmod
197
198CMP		= cmp
199
200CP		= scp -p
201CPFLAGS		= -p
202
203CUT		= cut
204
205DATE		= date
206
207DIFF		= diff
208
209DIST-FILES      = ChangeLog COPYING README Makefile.in bibclean.c bibclean.h	\
210		  bibclean.hlp bibclean.html bibclean.ini bibclean.isbn		\
211		  bibclean.key bibclean.man bibclean.pdf bibclean.ps		\
212		  bibclean.reg bibclean.txt build-all.sh ch.h chek.c		\
213		  config.hin configure configure.ac configure.sed custom.h	\
214		  delete.h do.c dbx-test.run fix.c fndfil.c isbn.c isbn.h	\
215		  isbn.tbl isbn-el-to-bibclean-isbn.awk keybrd.c keybrd.h	\
216		  match.c match.dat match.h option.c pattern.h rofvms.awk	\
217		  romtol.c romtol.dat strist.c strtol.c token.h toklst.h	\
218		  tstctype.c typedefs.h vaxvms.c vmswild.c xctype.h xerrno.h	\
219		  xlimits.h xpwd.h xstat.h xstdbool.h xstdio.h xstdlib.h	\
220		  xstring.h xtypes.h xunistd.h yesorno.h testscr2.bo2		\
221		  testscr2.eo2 ${FILES-DOC} ${FILES-IBMPC} ${FILES-SAVE}	\
222		  ${FILES-TEST} test/plain.bst ${FILES-VMS} ${FILES-WINDOWS}
223
224DISTILL		= distill
225
226DITROFF		= groff
227
228ETAGS		= etags
229
230EXEEXT		=
231
232EXPR		= expr
233
234### On UNIX systems, the FILES-xxx lists could be generated by `find xxx
235### -type f | sort`, but explicit enumeration eases portability to other
236### operating systems, and ensures that we do not accidentally include
237### unwanted temporary files that might be present.
238FILES-DOC       = doc/Makefile doc/bibclean.aux doc/bibclean.bbl	\
239		  doc/bibclean.bib doc/bibclean.blg doc/bibclean.dvi	\
240		  doc/bibclean.idw doc/bibclean.idx doc/bibclean.ilg	\
241		  doc/bibclean.ind doc/bibclean.log doc/bibclean.lot	\
242		  doc/bibclean.ltx doc/bibclean.pdf doc/bibclean.ps	\
243		  doc/bibclean.sok doc/bibclean.sty doc/bibclean.toc	\
244		  doc/is-plain.bst doc/ltugboat.sty doc/path.sty	\
245		  doc/texnames.sty doc/tugboat.cmn
246
247FILES-IBMPC	= ibmpc/dos/README ibmpc/dos/msc5p1/bibclean.exe		\
248		  ibmpc/dos/msc5p1/config.h ibmpc/dos/msc5p1/ibmclean.bat	\
249		  ibmpc/dos/msc5p1/ibmtest.bat ibmpc/dos/msc5p1/msc51bld.bat	\
250		  ibmpc/dos/msc5p1/msc51pth.bat ibmpc/dos/msc6p0/bibclean.exe	\
251		  ibmpc/dos/msc6p0/bibclean.map ibmpc/dos/msc6p0/config.h	\
252		  ibmpc/dos/msc6p0/ibmclean.bat ibmpc/dos/msc6p0/ibmtest.bat	\
253		  ibmpc/dos/msc6p0/msc60bld.bat ibmpc/dos/msc6p0/msc60pth.bat	\
254		  ibmpc/dos/msc7p0/config.h ibmpc/dos/msc7p0/ibmclean.bat	\
255		  ibmpc/dos/msc7p0/ibmtest.bat ibmpc/dos/msc7p0/msc70bld.bat	\
256		  ibmpc/dos/msc7p0/msc70pth.bat ibmpc/dos/tcc2p0/bibclean.exe	\
257		  ibmpc/dos/tcc2p0/config.h ibmpc/dos/tcc2p0/ibmclean.bat	\
258		  ibmpc/dos/tcc2p0/ibmtest.bat ibmpc/dos/tcc2p0/tcc20bld.bat	\
259		  ibmpc/dos/tcc2p0/tcc20pth.bat ibmpc/dos/tcc3p0/bibclean.exe	\
260		  ibmpc/dos/tcc3p0/config.h ibmpc/dos/tcc3p0/ibmclean.bat	\
261		  ibmpc/dos/tcc3p0/ibmtest.bat ibmpc/dos/tcc3p0/tcc30bld.bat	\
262		  ibmpc/dos/tcc3p0/tcc30pth.bat ibmpc/dos/tpp3p0/bibclean.exe	\
263		  ibmpc/dos/tpp3p0/config.h ibmpc/dos/tpp3p0/ibmclean.bat	\
264		  ibmpc/dos/tpp3p0/ibmtest.bat ibmpc/dos/tpp3p0/tcc30pth.bat	\
265		  ibmpc/dos/tpp3p0/tpp30bld.bat					\
266		  ibmpc/dos/wat10/wcc/bibclean.exe				\
267		  ibmpc/dos/wat10/wcc/bibclean.map				\
268		  ibmpc/dos/wat10/wcc/config.h					\
269		  ibmpc/dos/wat10/wcc/ibmclean.bat				\
270		  ibmpc/dos/wat10/wcc/ibmtest.bat				\
271		  ibmpc/dos/wat10/wcc/watcpp.bat				\
272		  ibmpc/dos/wat10/wcc/watpath.bat				\
273		  ibmpc/dos/wat10/wcc/watwcc.bat				\
274		  ibmpc/dos/wat10/wcc386/bibclean.exe				\
275		  ibmpc/dos/wat10/wcc386/config.h				\
276		  ibmpc/dos/wat10/wcc386/dos4gw.doc				\
277		  ibmpc/dos/wat10/wcc386/dos4gw.exe				\
278		  ibmpc/dos/wat10/wcc386/ibmclean.bat				\
279		  ibmpc/dos/wat10/wcc386/ibmtest.bat				\
280		  ibmpc/dos/wat10/wcc386/wat10bld.bat				\
281		  ibmpc/dos/wat10/wcc386/watpath.bat				\
282		  ibmpc/dos/wat10/wpp386/bibclean.exe				\
283		  ibmpc/dos/wat10/wpp386/config.h				\
284		  ibmpc/dos/wat10/wpp386/dos4gw.doc				\
285		  ibmpc/dos/wat10/wpp386/dos4gw.exe				\
286		  ibmpc/dos/wat10/wpp386/ibmclean.bat				\
287		  ibmpc/dos/wat10/wpp386/ibmtest.bat				\
288		  ibmpc/dos/wat10/wpp386/w386cpp.bat				\
289		  ibmpc/dos/wat10/wpp386/watpath.bat ibmpc/linux/bibclean
290
291FILES-SAVE	= save/Makefile save/config.h save/config.hin save/configure	\
292		  save/custom.h
293
294FILES-TEST      = test/match.in test/okay/match.err test/okay/match.out		\
295		  test/okay/romtol.err test/okay/romtol.out			\
296		  test/okay/testbib1.err test/okay/testbib1.out			\
297		  test/okay/testbib2.err test/okay/testbib2.out			\
298		  test/okay/testbib3.err test/okay/testbib3.out			\
299		  test/okay/testbib4.err test/okay/testbib4.out			\
300		  test/okay/testbib5.err test/okay/testbib5.out			\
301		  test/okay/testbib6.err test/okay/testbib6.out			\
302		  test/okay/testbib7.err test/okay/testbib7.out			\
303		  test/okay/testbib8.err test/okay/testbib8.out			\
304		  test/okay/testcodn.err test/okay/testcodn.out			\
305		  test/okay/testisxn.err test/okay/testisxn.out			\
306		  test/okay/testltx1.bbl test/okay/testltx1.blg			\
307		  test/okay/testltx1.err test/okay/testltx1.out			\
308		  test/okay/testopt1.err test/okay/testopt1.out			\
309		  test/okay/testopt2.err test/okay/testopt2.out			\
310		  test/okay/testopt3.err test/okay/testopt3.out			\
311		  test/okay/testopt4.err test/okay/testopt4.out			\
312		  test/okay/testopt5.err test/okay/testopt5.out			\
313		  test/okay/testopt6.err test/okay/testopt6.out			\
314		  test/okay/testopt7.err test/okay/testopt7.out			\
315		  test/okay/testopt8.err test/okay/testopt8.out			\
316		  test/okay/testopt9.err test/okay/testopt9.out			\
317		  test/okay/testopta.err test/okay/testopta.out			\
318		  test/okay/testoptb.err test/okay/testoptb.out			\
319		  test/okay/testoptc.err test/okay/testoptc.out			\
320		  test/okay/testoptd.err test/okay/testoptd.out			\
321		  test/okay/testopte.err test/okay/testopte.out			\
322		  test/okay/testoptf.err test/okay/testoptf.out			\
323		  test/okay/testoptg.err test/okay/testoptg.out			\
324		  test/okay/testopth.err test/okay/testopth.out			\
325		  test/okay/testopti.err test/okay/testopti.out			\
326		  test/okay/testoptj.err test/okay/testoptj.out			\
327		  test/okay/testoptk.err test/okay/testoptk.out			\
328		  test/okay/testoptl.err test/okay/testoptl.out			\
329		  test/okay/testoptm.err test/okay/testoptm.out			\
330		  test/okay/testoptn.err test/okay/testoptn.out			\
331		  test/okay/testopto.err test/okay/testopto.out			\
332		  test/okay/testoptp.err test/okay/testoptp.out			\
333		  test/okay/testoptq.err test/okay/testoptq.out			\
334		  test/okay/testoptr.err test/okay/testoptr.out			\
335		  test/okay/testopts.err test/okay/testopts.out			\
336		  test/okay/testoptt.err test/okay/testoptt.out			\
337		  test/okay/testoptu.err test/okay/testoptu.out			\
338		  test/okay/testoptu.win test/okay/testoptv.err			\
339		  test/okay/testoptv.out test/okay/testoptw.err			\
340		  test/okay/testoptw.out test/okay/testoptx.err			\
341		  test/okay/testoptx.out test/okay/testscr1.bbl			\
342		  test/okay/testscr1.blg test/okay/testscr1.err			\
343		  test/okay/testscr1.out test/okay/testscr2.bbl			\
344		  test/okay/testscr2.blg test/okay/testscr2.err			\
345		  test/okay/testscr2.out test/okay/testscr3.bbl			\
346		  test/okay/testscr3.blg test/okay/testscr3.err			\
347		  test/okay/testscr3.out test/okay/testscr4.bbl			\
348		  test/okay/testscr4.blg test/okay/testscr4.err			\
349		  test/okay/testscr4.out test/okay/topt101.err			\
350		  test/okay/topt101.out test/okay/topt102.err			\
351		  test/okay/topt102.out test/okay/topt103.err			\
352		  test/okay/topt103.out test/okay/topt104.err			\
353		  test/okay/topt104.out test/okay/topt105.err			\
354		  test/okay/topt105.out test/okay/topt106.err			\
355		  test/okay/topt106.out test/okay/topt107.err			\
356		  test/okay/topt107.out test/okay/topt108.err			\
357		  test/okay/topt108.out test/okay/topt109.err			\
358		  test/okay/topt109.out test/okay/topt110.err			\
359		  test/okay/topt110.out test/okay/topt111.err			\
360		  test/okay/topt111.out test/okay/topt112.err			\
361		  test/okay/topt112.out test/okay/topt113.err			\
362		  test/okay/topt113.out test/okay/topt114.err			\
363		  test/okay/topt114.out test/okay/topt115.err			\
364		  test/okay/topt115.out test/okay/topt116.err			\
365		  test/okay/topt116.out test/okay/topt117.err			\
366		  test/okay/topt117.out test/okay/topt118.err			\
367		  test/okay/topt118.out test/okay/topt119.err			\
368		  test/okay/topt119.out test/okay/topt120.err			\
369		  test/okay/topt120.out test/okay/topt121.err			\
370		  test/okay/topt121.out test/okay/topt122.err			\
371		  test/okay/topt122.out test/okay/topt123.err			\
372		  test/okay/topt123.out test/okay/topt124.err			\
373		  test/okay/topt124.out test/okay/topt125.err			\
374		  test/okay/topt125.out test/okay/topt126.err			\
375		  test/okay/topt126.out test/okay/topt127.err			\
376		  test/okay/topt127.out test/okay/topt128.err			\
377		  test/okay/topt128.out test/okay/topt129.err			\
378		  test/okay/topt129.out test/okay/topt130.err			\
379		  test/okay/topt130.out test/okay/topt131.err			\
380		  test/okay/topt131.out test/okay/topt132.err			\
381		  test/okay/topt132.out test/okay/topt133.err			\
382		  test/okay/topt133.out test/okay/topt134.err			\
383		  test/okay/topt134.out test/okay/topt135.err			\
384		  test/okay/topt135.out test/okay/topt136.err			\
385		  test/okay/topt136.out test/okay/topt137.err			\
386		  test/okay/topt137.out test/okay/topt138.err			\
387		  test/okay/topt138.out test/okay/topt139.err			\
388		  test/okay/topt139.out test/okay/topt140.err			\
389		  test/okay/topt140.out test/okay/topt141.err			\
390		  test/okay/topt141.out test/okay/topt142.err			\
391		  test/okay/topt142.out test/okay/topt143.err			\
392		  test/okay/topt143.out test/okay/topt144.err			\
393		  test/okay/topt144.out test/okay/topt145.err			\
394		  test/okay/topt145.out test/okay/topt146.err			\
395		  test/okay/topt146.out test/okay/topt147.err			\
396		  test/okay/topt147.out test/okay/topt148.err			\
397		  test/okay/topt148.out test/okay/topt149.err			\
398		  test/okay/topt149.out test/okay/topt150.err			\
399		  test/okay/topt150.out test/okay/topt151.err			\
400		  test/okay/topt151.out test/okay/topt152.err			\
401		  test/okay/topt152.out test/okay/topt153.err			\
402		  test/okay/topt153.out test/okay/topt154.err			\
403		  test/okay/topt154.out test/okay/topt155.err			\
404		  test/okay/topt155.out test/okay/topt156.err			\
405		  test/okay/topt156.out test/okay/topt157.err			\
406		  test/okay/topt157.out test/okay/topt158.err			\
407		  test/okay/topt158.out test/okay/topt159.err			\
408		  test/okay/topt159.out test/okay/topt160.err			\
409		  test/okay/topt160.out test/okay/topt161.err			\
410		  test/okay/topt161.out test/okay/topt162.err			\
411		  test/okay/topt162.out test/okay/topt163.err			\
412		  test/okay/topt163.out test/okay/topt164.err			\
413		  test/okay/topt164.out test/okay/topt165.err			\
414		  test/okay/topt165.out test/okay/topt166.err			\
415		  test/okay/topt166.out test/okay/topt167.err			\
416		  test/okay/topt167.out test/okay/topt168.err			\
417		  test/okay/topt168.out test/okay/topt169.err			\
418		  test/okay/topt169.out test/okay/topt170.err			\
419		  test/okay/topt170.out test/okay/topt171.err			\
420		  test/okay/topt171.out test/okay/topt301.err			\
421		  test/okay/topt301.out test/okay/topt302.err			\
422		  test/okay/topt302.out test/okay/topt303.err			\
423		  test/okay/topt303.out test/okay/topt304.err			\
424		  test/okay/topt304.out test/okay/topt305.err			\
425		  test/okay/topt305.out test/okay/topt306.err			\
426		  test/okay/topt306.out test/okay/topt307.err			\
427		  test/okay/topt307.out test/okay/topt308.err			\
428		  test/okay/topt308.out test/okay/topt309.err			\
429		  test/okay/topt309.out test/okay/topt310.err			\
430		  test/okay/topt310.out test/okay/topt311.err			\
431		  test/okay/topt311.out test/okay/topt312.err			\
432		  test/okay/topt312.out test/okay/topt313.err			\
433		  test/okay/topt313.out test/okay/topt314.err			\
434		  test/okay/topt314.out test/okay/topt315.err			\
435		  test/okay/topt315.out test/okay/topt316.err			\
436		  test/okay/topt316.out test/okay/topt317.err			\
437		  test/okay/topt317.out test/okay/topt318.err			\
438		  test/okay/topt318.out test/okay/topt319.err			\
439		  test/okay/topt319.out test/okay/topt320.err			\
440		  test/okay/topt320.out test/okay/topt321.err			\
441		  test/okay/topt321.out test/okay/topt322.err			\
442		  test/okay/topt322.out test/okay/topt323.err			\
443		  test/okay/topt323.out test/okay/topt324.err			\
444		  test/okay/topt324.out test/okay/topt325.err			\
445		  test/okay/topt325.out test/okay/topt326.err			\
446		  test/okay/topt326.out test/okay/topt327.err			\
447		  test/okay/topt327.out test/okay/topt328.err			\
448		  test/okay/topt328.out test/okay/topt329.err			\
449		  test/okay/topt329.out test/okay/topt330.err			\
450		  test/okay/topt330.out test/okay/topt331.err			\
451		  test/okay/topt331.out test/okay/topt332.err			\
452		  test/okay/topt332.out test/okay/topt333.err			\
453		  test/okay/topt333.out test/okay/topt334.err			\
454		  test/okay/topt334.out test/okay/topt335.err			\
455		  test/okay/topt335.out test/okay/topt336.err			\
456		  test/okay/topt336.out test/okay/topt337.err			\
457		  test/okay/topt337.out test/okay/topt338.err			\
458		  test/okay/topt338.out test/okay/topt339.err			\
459		  test/okay/topt339.out test/okay/topt340.err			\
460		  test/okay/topt340.out test/okay/topt341.err			\
461		  test/okay/topt341.out test/okay/topt342.err			\
462		  test/okay/topt342.out test/okay/topt343.err			\
463		  test/okay/topt343.out test/okay/topt344.err			\
464		  test/okay/topt344.out test/okay/topt345.err			\
465		  test/okay/topt345.out test/okay/topt346.err			\
466		  test/okay/topt346.out test/okay/topt347.err			\
467		  test/okay/topt347.out test/okay/topt348.err			\
468		  test/okay/topt348.out test/okay/topt349.err			\
469		  test/okay/topt349.out test/okay/topt350.err			\
470		  test/okay/topt350.out test/okay/topt351.err			\
471		  test/okay/topt351.out test/okay/topt352.err			\
472		  test/okay/topt352.out test/okay/topt353.err			\
473		  test/okay/topt353.out test/okay/topt354.err			\
474		  test/okay/topt354.out test/okay/topt355.err			\
475		  test/okay/topt355.out test/okay/topt356.err			\
476		  test/okay/topt356.out test/okay/topt357.err			\
477		  test/okay/topt357.out test/okay/topt358.err			\
478		  test/okay/topt358.out test/okay/topt359.err			\
479		  test/okay/topt359.out test/okay/topt360.err			\
480		  test/okay/topt360.out test/okay/topt361.err			\
481		  test/okay/topt361.out test/okay/topt362.err			\
482		  test/okay/topt362.out test/okay/topt363.err			\
483		  test/okay/topt363.out test/okay/topt364.err			\
484		  test/okay/topt364.out test/okay/topt365.err			\
485		  test/okay/topt365.out test/okay/topt366.err			\
486		  test/okay/topt366.out test/okay/topt367.err			\
487		  test/okay/topt367.out test/okay/topt368.err			\
488		  test/okay/topt368.out test/okay/topt369.err			\
489		  test/okay/topt369.out test/okay/topt370.err			\
490		  test/okay/topt370.out test/okay/topt371.err			\
491		  test/okay/topt371.out test/okay/tstctype.out test/romtol.in	\
492		  test/testbib1.bib test/testbib1.opt test/testbib2.bib		\
493		  test/testbib2.opt test/testbib3.bib test/testbib3.opt		\
494		  test/testbib4.bib test/testbib4.opt test/testbib5.bib		\
495		  test/testbib5.opt test/testbib6.bib test/testbib6.opt		\
496		  test/testbib7.bib test/testbib7.opt test/testbib8.bib		\
497		  test/testbib8.opt test/testcodn.bib test/testcodn.opt		\
498		  test/testisxn.bib test/testisxn.opt test/testltx1.bin		\
499		  test/testltx1.ltx test/testltx1.opt test/testopt1.bib		\
500		  test/testopt1.opt test/testopt2.bib test/testopt2.opt		\
501		  test/testopt3.bib test/testopt3.opt test/testopt4.bib		\
502		  test/testopt4.opt test/testopt5.bib test/testopt5.opt		\
503		  test/testopt6.bib test/testopt6.opt test/testopt7.bib		\
504		  test/testopt7.opt test/testopt8.bib test/testopt8.opt		\
505		  test/testopt9.bib test/testopt9.opt test/testopta.bib		\
506		  test/testopta.opt test/testoptb.bib test/testoptb.opt		\
507		  test/testoptc.bib test/testoptc.opt test/testoptd.bib		\
508		  test/testoptd.opt test/testopte.bib test/testopte.opt		\
509		  test/testoptf.bib test/testoptf.opt test/testoptg.bib		\
510		  test/testoptg.opt test/testopth.bib test/testopth.opt		\
511		  test/testopti.bib test/testopti.opt test/testoptj.bib		\
512		  test/testoptj.opt test/testoptk.bib test/testoptk.opt		\
513		  test/testoptl.bib test/testoptl.opt test/testoptm.bib		\
514		  test/testoptm.opt test/testoptn.bib test/testoptn.opt		\
515		  test/testopto.bib test/testopto.opt test/testoptp.bib		\
516		  test/testoptp.opt test/testoptq.bib test/testoptq.opt		\
517		  test/testoptr.bib test/testoptr.opt test/testopts.bib		\
518		  test/testopts.opt test/testoptt.bib test/testoptt.opt		\
519		  test/testoptu.bib test/testoptu.opt test/testoptv.bib		\
520		  test/testoptv.opt test/testoptw.bib test/testoptw.opt		\
521		  test/testoptx.in test/testoptx.opt test/testscr1.bib		\
522		  test/testscr1.opt test/testscr2.bib test/testscr2.opt		\
523		  test/testscr3.bib test/testscr3.opt test/testscr4.bib		\
524		  test/testscr4.opt test/topt101.bib test/topt101.opt		\
525		  test/topt102.bib test/topt102.opt test/topt103.bib		\
526		  test/topt103.opt test/topt104.bib test/topt104.opt		\
527		  test/topt105.bib test/topt105.opt test/topt106.bib		\
528		  test/topt106.opt test/topt107.bib test/topt107.opt		\
529		  test/topt108.bib test/topt108.opt test/topt109.bib		\
530		  test/topt109.opt test/topt110.bib test/topt110.opt		\
531		  test/topt111.bib test/topt111.opt test/topt112.bib		\
532		  test/topt112.opt test/topt113.bib test/topt113.opt		\
533		  test/topt114.bib test/topt114.opt test/topt115.bib		\
534		  test/topt115.opt test/topt116.bib test/topt116.opt		\
535		  test/topt117.bib test/topt117.opt test/topt118.bib		\
536		  test/topt118.opt test/topt119.bib test/topt119.opt		\
537		  test/topt120.bib test/topt120.opt test/topt121.bib		\
538		  test/topt121.opt test/topt122.bib test/topt122.opt		\
539		  test/topt123.bib test/topt123.opt test/topt124.bib		\
540		  test/topt124.opt test/topt125.bib test/topt125.opt		\
541		  test/topt126.bib test/topt126.opt test/topt127.bib		\
542		  test/topt127.opt test/topt128.bib test/topt128.opt		\
543		  test/topt129.bib test/topt129.opt test/topt130.bib		\
544		  test/topt130.opt test/topt131.bib test/topt131.opt		\
545		  test/topt132.bib test/topt132.opt test/topt133.bib		\
546		  test/topt133.opt test/topt134.bib test/topt134.opt		\
547		  test/topt135.bib test/topt135.opt test/topt136.bib		\
548		  test/topt136.opt test/topt137.bib test/topt137.opt		\
549		  test/topt138.bib test/topt138.opt test/topt139.bib		\
550		  test/topt139.opt test/topt140.bib test/topt140.opt		\
551		  test/topt141.bib test/topt141.opt test/topt142.bib		\
552		  test/topt142.opt test/topt143.bib test/topt143.opt		\
553		  test/topt144.bib test/topt144.opt test/topt145.bib		\
554		  test/topt145.opt test/topt146.bib test/topt146.opt		\
555		  test/topt147.bib test/topt147.opt test/topt148.bib		\
556		  test/topt148.opt test/topt149.bib test/topt149.opt		\
557		  test/topt150.bib test/topt150.opt test/topt151.bib		\
558		  test/topt151.opt test/topt152.bib test/topt152.opt		\
559		  test/topt153.bib test/topt153.opt test/topt154.bib		\
560		  test/topt154.opt test/topt155.bib test/topt155.opt		\
561		  test/topt156.bib test/topt156.opt test/topt157.bib		\
562		  test/topt157.opt test/topt158.bib test/topt158.opt		\
563		  test/topt159.bib test/topt159.opt test/topt160.bib		\
564		  test/topt160.opt test/topt161.bib test/topt161.opt		\
565		  test/topt162.bib test/topt162.opt test/topt163.bib		\
566		  test/topt163.opt test/topt164.bib test/topt164.opt		\
567		  test/topt165.bib test/topt165.opt test/topt166.bib		\
568		  test/topt166.opt test/topt167.bib test/topt167.opt		\
569		  test/topt168.bib test/topt168.opt test/topt169.bib		\
570		  test/topt169.opt test/topt170.bib test/topt170.opt		\
571		  test/topt171.bib test/topt171.opt test/topt301.bib		\
572		  test/topt301.opt test/topt302.bib test/topt302.opt		\
573		  test/topt303.bib test/topt303.opt test/topt304.bib		\
574		  test/topt304.opt test/topt305.bib test/topt305.opt		\
575		  test/topt306.bib test/topt306.opt test/topt307.bib		\
576		  test/topt307.opt test/topt308.bib test/topt308.opt		\
577		  test/topt309.bib test/topt309.opt test/topt310.bib		\
578		  test/topt310.opt test/topt311.bib test/topt311.opt		\
579		  test/topt312.bib test/topt312.opt test/topt313.bib		\
580		  test/topt313.opt test/topt314.bib test/topt314.opt		\
581		  test/topt315.bib test/topt315.opt test/topt316.bib		\
582		  test/topt316.opt test/topt317.bib test/topt317.opt		\
583		  test/topt318.bib test/topt318.opt test/topt319.bib		\
584		  test/topt319.opt test/topt320.bib test/topt320.opt		\
585		  test/topt321.bib test/topt321.opt test/topt322.bib		\
586		  test/topt322.opt test/topt323.bib test/topt323.opt		\
587		  test/topt324.bib test/topt324.opt test/topt325.bib		\
588		  test/topt325.opt test/topt326.bib test/topt326.opt		\
589		  test/topt327.bib test/topt327.opt test/topt328.bib		\
590		  test/topt328.opt test/topt329.bib test/topt329.opt		\
591		  test/topt330.bib test/topt330.opt test/topt331.bib		\
592		  test/topt331.opt test/topt332.bib test/topt332.opt		\
593		  test/topt333.bib test/topt333.opt test/topt334.bib		\
594		  test/topt334.opt test/topt335.bib test/topt335.opt		\
595		  test/topt336.bib test/topt336.opt test/topt337.bib		\
596		  test/topt337.opt test/topt338.bib test/topt338.opt		\
597		  test/topt339.bib test/topt339.opt test/topt340.bib		\
598		  test/topt340.opt test/topt341.bib test/topt341.opt		\
599		  test/topt342.bib test/topt342.opt test/topt343.bib		\
600		  test/topt343.opt test/topt344.bib test/topt344.opt		\
601		  test/topt345.bib test/topt345.opt test/topt346.bib		\
602		  test/topt346.opt test/topt347.bib test/topt347.opt		\
603		  test/topt348.bib test/topt348.opt test/topt349.bib		\
604		  test/topt349.opt test/topt350.bib test/topt350.opt		\
605		  test/topt351.bib test/topt351.opt test/topt352.bib		\
606		  test/topt352.opt test/topt353.bib test/topt353.opt		\
607		  test/topt354.bib test/topt354.opt test/topt355.bib		\
608		  test/topt355.opt test/topt356.bib test/topt356.opt		\
609		  test/topt357.bib test/topt357.opt test/topt358.bib		\
610		  test/topt358.opt test/topt359.bib test/topt359.opt		\
611		  test/topt360.bib test/topt360.opt test/topt361.bib		\
612		  test/topt361.opt test/topt362.bib test/topt362.opt		\
613		  test/topt363.bib test/topt363.opt test/topt364.bib		\
614		  test/topt364.opt test/topt365.bib test/topt365.opt		\
615		  test/topt366.bib test/topt366.opt test/topt367.bib		\
616		  test/topt367.opt test/topt368.bib test/topt368.opt		\
617		  test/topt369.bib test/topt369.opt test/topt370.bib		\
618		  test/topt370.opt test/topt371.bib test/topt371.opt
619
620FILES-VMS       = vms/config.h vms/alpha/bibclean.exe vms/alpha/recomp.com	\
621		  vms/alpha/vmsclean.com vms/alpha/vmsmake.com			\
622		  vms/alpha/vmstest.com vms/vax/README vms/vax/bibclean.exe	\
623		  vms/vax/bibclean.obj vms/vax/chek.obj vms/vax/config.h	\
624		  vms/vax/do.obj vms/vax/fix.obj vms/vax/fndfil.obj		\
625		  vms/vax/getoneheader.com vms/vax/getvmsheaders.com		\
626		  vms/vax/isbn.obj vms/vax/keybrd.obj vms/vax/match.obj		\
627		  vms/vax/option.obj vms/vax/recomp.com vms/vax/romtol.obj	\
628		  vms/vax/strist.obj vms/vax/vaxvms.obj vms/vax/vmsclean.com	\
629		  vms/vax/vmsmake.com vms/vax/vmstest.com vms/vax/vmswild.obj
630
631FILES-WINDOWS	= win32/bibclean.exe
632
633FIXBLG		= ${SED} -e "/^You've used/,/^write/d" -e "/^This is BibTeX/,/^Database file/d"
634
635GREP		= egrep
636
637GZIP		= gzip
638
639### Some systems define HOST or HOSTNAME, but others don't, so we
640### generate it at compile time with the hostname utility.
641HOST		= `hostname`
642
643### This program is freely available at ftp://ftp.math.utah.edu/pub/sgml/sp-*
644HTMLNCHECK	= html-ncheck
645
646### This program is freely available at ftp://ftp.math.utah.edu/pub/sgml/htmlpty-x.y.*
647HTMLPRETTY	= html-pretty
648
649JAR		= jar
650
651LATEX		= latex2e
652
653LN		= ln
654
655LS		= ls
656
657MAN2HTML	= man2html
658
659MATCH		= match${EXEEXT}
660
661MKDIR		= mkdir -p
662
663MV		= mv
664
665NROFF		= nroff
666
667PROGRAMS	= ${BIBCLEAN} ${BIBISBN} ${MATCH} ${ROMTOL} ${TSTCTYPE}
668
669RM		= rm -f
670
671ROMTOL		= romtol${EXEEXT}
672
673SED		= sed
674
675SHELL		= /bin/sh
676
677SRC             = bibclean.c chek.c do.c fix.c fndfil.c isbn.c		\
678		  keybrd.c match.c option.c romtol.c strist.c strtol.c
679
680STRIP		= strip
681
682### Only the subdirectories with Makefiles are listed here
683SUBDIRS		= doc
684
685TAR		= gtar
686
687TAGS-FILES      = bibclean.c bibclean.h ch.h chek.c config.h custom.h		\
688		  delete.h do.c fix.c fndfil.c isbn.c isbn.h keybrd.c		\
689		  keybrd.h match.c match.h option.c pattern.h romtol.c		\
690		  strist.c strtol.c token.h toklst.h vaxvms.c vmswild.c		\
691		  xctype.h xerrno.h xlimits.h xpwd.h xstat.h xstdbool.h		\
692		  xstdio.h xstdlib.h xstring.h xtypes.h xunistd.h yesorno.h
693
694TEST		= test
695
696TESTBIBCLEAN	= ${VM} ../${BIBCLEAN}
697
698### For testing purposes, make sure we always have the same
699### initialization files:
700TESTBIBCLEANFLAGS = -init-file ../bibclean.ini		\
701		    -ISBN-file ../bibclean.isbn		\
702		    -keyword-file ../bibclean.key
703
704TESTFLAGS	= ${DEFS} ${CPPFLAGS} ${CFLAGS} -DTEST
705
706TESTMATCH	= ${VM} ../${MATCH}
707
708TESTROMTOL	= ${VM} ../${ROMTOL}
709
710TESTTSTCTYPE	= ${VM} ../${TSTCTYPE}
711
712TMPDIR		= /tmp
713TMPDIR		= /var/tmp
714
715TOUCH		= touch
716
717TR		= tr
718
719TSTCTYPE	= tstctype${EXEEXT}
720
721UNZIP		= unzip
722
723VERSION		= `${AWK} '/^[ \t]*version *= *"[0-9.]+", *$$/ \
724		{ gsub(/[^0-9.]/,"",$$3); print $$3 }' bibclean.c`
725VERSION		= 3.06
726
727WINE		=
728
729### Use the make-time option
730###
731###	XDEFS="-Dname1=value1 -Dname2=value2 ..."
732###
733### to alter table sizes in bibclean from their defaults of:
734###
735###	-DMAXPATHLEN=<system dependent: typically 1024 to 4096>	# longest "/path/to/some/file.ext" or "c:\path\to\some\file.ext"
736###	-DMAX_BUFFER=8192			# maximum length of output buffer (does NOT limit lengths of input lines)
737###	-DMAX_FIELD_LENGTH=12			# maximum field name length
738###	-DMAX_ISBN_RANGE=2560			# maximum number of ISBN ranges
739###	-DMAX_KEYWORD=200			# maximum number of field names subject to lettercase change
740###	-DMAX_LINE=10240			# maximum line length in initialization file
741###	-DMAX_PATTERN_NAMES=100			# maximum different pattern names
742###	-DMAX_TOKEN=32760			# maximum field value length
743###	-DMAX_WIDTH=72				# maximum output line length
744###	-DSTD_MAX_TOKEN=1000			# original BibTeX maximum field value length
745###	-DSTD_MAX_TOKEN=5000			# for TeX Live 2003--2011
746###	-DSTD_MAX_TOKEN=20000			# for TeX Live 2012--2019
747###
748### Possible local customizations:
749###
750###	-DDOI_RAW_VALID				# accept DOI = "10.xxxx" values
751###	-DBIBCLEAN_INI=\"BIBCLEANINI\"		# environment variable name
752###	-DBIBCLEAN_ISBN=\"BIBCLEANISBN\"	# environment variable name
753###	-DBIBCLEAN_KEY=\"BIBCLEANKEY\"		# environment variable name
754###	-DINITDIR='"${initdir}"' ${XDEFS} -DHAVE_CONFIG_H
755
756XDEFS		=
757
758XSPLINTFLAGS	=
759
760ZIP		= zip
761
762ZOO		= zoo
763
764#=======================================================================
765# Syntax and security checker settings
766
767ANTIC		= antic
768ANTICFLAGS	=
769
770CPPCHECK	= cppcheck
771CPPCHECKFLAGS	= -I. --enable=all --force --verbose
772
773FLAWFINDER	= flawfinder
774FLAWFINDERFLAGS	=
775
776ITS4		= its4
777ITS4FLAGS	=
778
779LINT		= lint
780LINTFLAGS	= -I. -b -c -h -x
781LINTFLAGS	= -I. -errchk -h -x
782
783RATS		= rats
784RATSFLAGS	=
785
786SPLINT		= splint
787SPLINTFLAGS	= -I.				\
788		  -booltype _Bool		\
789		  -booltrue __true		\
790		  -boolfalse __false		\
791		  -bounds			\
792		  -initallelements		\
793		  +posixlib			\
794		  ${XSPLINTFLAGS}
795
796UNO		= uno
797UNOFLAGS	= -I. -w -D_Bool=int
798
799## Set VM=wine for testing Windows build with CC=i686-pc-mingw32-gcc
800VM		= wine
801VM		=
802
803### ====================================================================
804
805.SUFFIXES:
806
807.SUFFIXES: .o .i .c .bib-new .bib-old .bib
808
809.bib.bib-new:
810	-${TESTBIBCLEAN} ${TESTBIBCLEANFLAGS} ${BIBCLEANFLAGS} <$< >$@
811
812.c.i:
813	${CC} -E -I. -I${srcdir} ${DEFS} ${CPPFLAGS} ${CFLAGS} $< 2>&1 | \
814		grep -v '^[ 	]*$$' >$@
815
816.c.o:
817	${CC} -c -I. -I${srcdir} ${DEFS} ${CPPFLAGS} ${CFLAGS} $<
818
819### ====================================================================
820
821all: 	${PROGRAMS}
822
823BIBCLEAN-OBJS   = bibclean.o chek.o do.o fix.o fndfil.o isbn.o	\
824		  keybrd.o match.o option.o romtol.o strist.o	\
825		  ${LIBOBJS}
826
827${BIBCLEAN}:         ${BIBCLEAN-OBJS}
828	${CC} -o $@ ${CFLAGS} ${BIBCLEAN-OBJS} ${LDFLAGS} ${LIBS}
829
830bibclean.dvi: bibclean.texi
831	cd ${srcdir}; texi2dvi bibclean.texi
832
833### This target converts the option descriptions from the manual pages
834### to C code for inclusion in bibclean.c.  The first awk command
835### augments the bibclean.man file in a pipe with some small changes
836### after the .TH line (which sets page dimensions) to get longer
837### unhyphenated ragged-right lines without page headers, and reduces
838### the option description indentation.
839###
840### Here are the magic nroff incantations:
841###
842### .pl 100i	set page length to 100in
843### .nr LL 7.2i	set LL register (page width) to 7.2in
844### .nh		no hyphenation
845### .na		no right-adjusting
846###
847### That output feeds into nroff for formatting, col for removal of
848### underlining and escape sequences, expand for tab removal, sed to
849### backslash all quotes, and a final awk step to select the lines
850### between OPTIONS and ERROR headers for conversion to C code.
851
852bibclean.h:	bibclean.man
853	-test -f $@ && ${CHMOD} u+w $@
854	-${RM} $@
855	echo '/* WARNING: Do NOT edit this file.  It was created automatically'	\
856		>$@								\
857	echo '   with the command "make bibclean.h" by '$$USER@`hostname`	\
858		>>$@								\
859	echo '   in '$$PWD' on '`date`' */' >>$@
860	echo >>$@
861	${AWK} '{ if ($$0 ~ /^.TH/)						\
862		printf("%s\n.pl 100i\n.nr LL 7.2i\n.nh\n.na",$$0);		\
863	    else if ($$0 ~ /^.TP .*remove-OPT-prefixes.*/)			\
864		print ".TP 1in";						\
865	    else								\
866			print $$0}' < bibclean.man |				\
867	${NROFF} -man | col -b | expand | ${SED} -e 's/"/\\"/g' |		\
868		${SED} -e 's/\\n/|n/g' -e 's/\\"/|"/g'				\
869			-e 's/\\/\\\\/g' -e 's/|n/\\n/g' -e 's/|"/\\"/g' |	\
870		${AWK} '/^OPTION/,/^ERROR/ {if ($$0 !~ /^[A-Z]/)		\
871			printf("\t\"%s\\n\",\n",substr($$0,6))}' >>$@
872	echo '	(const char*)NULL,' >>$@
873	${CHMOD} a-w $@
874
875### VAX VMS help file format from bibclean.txt
876bibclean.hlp:	bibclean.txt rofvms.awk
877	${AWK} -f rofvms.awk <bibclean.txt >bibclean.hlp
878
879bibclean.html:	bibclean.man
880	-${CHMOD} u+w $@
881	${MAN2HTML} $<
882	${HTMLPRETTY} bibclean.html | ${CHECKSUM} >$@.tmp
883	${MV} $@.tmp $@
884	${CHMOD} a-w $@
885	${HTMLNCHECK} $@
886
887bibclean.info: bibclean.texi
888	cd ${srcdir}; makeinfo bibclean.texi
889
890bibclean.i:	bibclean.c ch.h config.h custom.h delete.h isbn.h keybrd.h	\
891		match.h pattern.h token.h toklst.h typedefs.h xctype.h		\
892		xlimits.h xstdbool.h xstdio.h xstdlib.h xstring.h xtypes.h	\
893		xunistd.h yesorno.h Makefile
894
895bibclean.jar:	subdist ${DIST-FILES}
896	-${RM} bibclean.jar bibclean.jar-lst
897	${JAR} cf bibclean.jar ${DIST-FILES}
898	-${MKDIR} bibclean-${VERSION}
899	cd bibclean-${VERSION}; ${JAR} xf ../bibclean.jar
900	${JAR} cf bibclean-${VERSION}.jar bibclean-${VERSION}
901	-${RM} -rf bibclean-${VERSION}
902	-${RM} bibclean.jar
903	${LN} bibclean-${VERSION}.jar bibclean.jar || \
904	${CP} ${CPFLAGS} bibclean-${VERSION}.jar bibclean.jar
905
906bibclean.o:	bibclean.c ch.h config.h custom.h delete.h isbn.h keybrd.h	\
907		match.h pattern.h token.h toklst.h typedefs.h xctype.h		\
908		xlimits.h xstdbool.h xstdio.h xstdlib.h xstring.h xtypes.h	\
909		xunistd.h yesorno.h
910
911bibclean.pdf:	bibclean.ps
912	${DISTILL} bibclean.ps
913
914bibclean.ps:	bibclean.man
915	${DITROFF} -Tps -man $? >$@
916
917bibclean.tar:	subdist ${DIST-FILES}
918	-${RM} bibclean.tar bibclean.tar-lst
919	${TAR} chf bibclean.tar ${DIST-FILES}
920	-${MKDIR} bibclean-${VERSION}
921	cd bibclean-${VERSION}; ${TAR} xf ../bibclean.tar
922	${TAR} cf bibclean-${VERSION}.tar bibclean-${VERSION}
923	-${RM} -r bibclean-${VERSION}
924	-${RM} bibclean.tar
925	${LN} bibclean-${VERSION}.tar bibclean.tar || \
926		${CP} ${CPFLAGS} bibclean-${VERSION}.tar bibclean.tar
927
928bibclean.txt:	bibclean.man
929	${NROFF} -man bibclean.man | col -b | expand >$@
930
931bibclean.zip:	subdist ${DIST-FILES}
932	-${RM} bibclean*.zip
933	-${RM} bibclean*.zip-lst
934	${ZIP} bibclean-${VERSION}.zip ${DIST-FILES}
935	${UNZIP} -v bibclean-${VERSION}.zip >bibclean-${VERSION}.zip-lst
936	${LN} bibclean-${VERSION}.zip bibclean.zip || \
937		${CP} ${CPFLAGS} bibclean-${VERSION}.zip bibclean.zip
938
939bibclean.zoo:	subdist ${DIST-FILES}
940	-${RM} bibclean*.zoo
941	-${RM} bibclean*.zoo-lst
942	${ZOO} a bibclean-${VERSION}.zoo ${DIST-FILES}
943	${ZOO} v bibclean-${VERSION}.zoo >bibclean-${VERSION}.zoo-lst
944	${LN} bibclean-${VERSION}.zoo bibclean.zoo || \
945		${CP} ${CPFLAGS} bibclean-${VERSION}.zoo bibclean.zoo
946
947${BIBISBN}:         isbn.c
948	${CC} -DTEST -I. ${CFLAGS} isbn.c ${LDFLAGS} ${LIBS} -o $@
949
950check:	check-setup check-ctype check-match check-romtol check-bibisbn check-bibtex \
951	check-latex check-scribe
952
953check-antic:
954	-${TEST} -n "${ANTIC}" && for f in ${SRC} ; do ${ANTIC} ${ANTICFLAGS} $$f ; done
955
956check-bibisbn: ${BIBISBN}
957	@echo "==================== begin ${BIBISBN} test ====================" ;		\
958	cd test ;										\
959	nfail=0 ;										\
960	npass=0 ;										\
961	ntest=0 ;										\
962	ntotal=`echo ${CHECK-BIBISBN} | wc -w` ;						\
963	ntotal=`expr $$ntotal + $$ntotal` ;							\
964	echo ;											\
965	echo "These checks should produce no output other than their numbers and names," ;	\
966	echo "followed by a test summary: no failures are expected anywhere." ;			\
967	echo ;											\
968	for f in ${CHECK-BIBISBN} ;								\
969	do											\
970	    ntest=`${EXPR} $$ntest + 2` ;							\
971	    printf "[%2d / %d] %s " $$ntest $$ntotal $$f ;					\
972	    test -f $$f.in  && ../${BIBISBN}                  < $$f.in > $$f.out 2> $$f.err ;	\
973	    test -f $$f.opt && ../${BIBISBN} `cat $$f.opt` < /dev/null > $$f.out 2> $$f.err ;	\
974	    ${CMP} -s okay/$$f.out $$f.out && ${RM} $$f.out ;					\
975	    ${CMP} -s okay/$$f.err $$f.err && ${RM} $$f.err ;					\
976	    test   -f $$f.out && printf "    FAIL "  && nfail=`expr $$nfail + 1` ;		\
977	    test ! -f $$f.out && printf "PASS "      && npass=`expr $$npass + 1` ;		\
978	    test   -f $$f.err && printf "    FAIL"   && nfail=`expr $$nfail + 1` ;		\
979	    test ! -f $$f.err && printf "PASS"       && npass=`expr $$npass + 1` ;		\
980	    echo ;										\
981	done ;											\
982	echo ;											\
983	echo PASS: $$npass of $$ntest tests ;							\
984	test $$nfail -ne 0 && echo FAIL: $$nfail of $$ntest tests ;				\
985	echo ;											\
986	test $$nfail -eq 0 && echo ALL TESTS PASSED! ;						\
987	echo ;											\
988	echo "===================== end ${BIBISBN} test =====================" ;		\
989	echo
990
991check-bibtex:	${BIBCLEAN}
992	@echo
993	@echo "===================== begin BibTeX test ======================"
994	@echo
995	@echo This test takes from 25 to 250 seconds on current and vintage machines.
996	@echo Test times that are much longer indicate a SERIOUS problem.
997	@echo
998	@-cd test ;										\
999	echo ${CHECK-BIBTEX} | wc -w > total.dat ;						\
1000	echo "These checks should produce no output other than their numbers and names," ;	\
1001	echo "followed by a test summary: no failures are expected anywhere." ;			\
1002	echo ;															\
1003	nfail=0 ;														\
1004	npass=0 ;														\
1005	ntest=0 ;														\
1006	ntotal=`echo ${CHECK-BIBTEX} | wc -w` ;											\
1007	for b in ${CHECK-BIBTEX} ;												\
1008	do															\
1009		ntest=`${EXPR} $$ntest + 1` ;											\
1010		bibfile=$$b.bib ;												\
1011		optfile=$$b.opt ;												\
1012		options=`${CAT} $$optfile` ;											\
1013		printf "[%2d / %d] " $$ntest $$ntotal ;										\
1014		echo $$b `echo $$options | ${CUT} -c -70 ` ;									\
1015		${TESTBIBCLEAN} ${TESTBIBCLEANFLAGS} ${BIBCLEANFLAGS} `${CAT} $$optfile` $$bibfile >$$b.out 2> $$b.ert ;	\
1016		${SED} -e ` printf 's/\015$$//' ` $$b.ert > ${TMPDIR}/$$b.ert.$$$$ ;						\
1017		${MV} ${TMPDIR}/$$b.ert.$$$$ $$b.ert ;										\
1018		${SED} -e ` printf 's/\015$$//' ` $$b.out > ${TMPDIR}/$$b.out.$$$$ ;						\
1019		${MV} ${TMPDIR}/$$b.out.$$$$ $$b.out ;										\
1020		${GREP} -v '^Compiled by' < $$b.ert >$$b.err ;									\
1021		${RM} $$b.ert ;													\
1022		${DIFF} okay/$$b.err $$b.err ;											\
1023		${CMP} -s okay/$$b.err $$b.err 2>/dev/null && ${RM} $$b.err ;							\
1024		${DIFF} okay/$$b.out $$b.out ;											\
1025		${CMP} -s okay/$$b.out $$b.out 2>/dev/null && ${RM} $$b.out ;							\
1026		if test -f $$b.err -o -f $$b.out ;										\
1027		then														\
1028		    nfail=`${EXPR} $$nfail + 1` ;										\
1029		else														\
1030		    npass=`${EXPR} $$npass + 1` ;										\
1031		fi ;														\
1032	done ;															\
1033	echo ;															\
1034	echo PASS: $$npass of $$ntest tests ;											\
1035	test $$nfail -ne 0 && echo FAIL: $$nfail of $$ntest tests ;								\
1036	echo ;															\
1037	test $$nfail -eq 0 && echo ALL TESTS PASSED! ;										\
1038	echo ;															\
1039	${RM} fail.dat pass.dat total.dat
1040	@echo
1041	@echo "====================== end BibTeX test ========================"
1042	@echo
1043
1044check-cppcheck:
1045	-${TEST} -n "${CPPCHECK}" && for f in ${SRC} ; do ${CPPCHECK} ${CPPCHECKFLAGS} $$f ; done
1046
1047check-ctype:	${TSTCTYPE}
1048	@echo
1049	@echo "===================== begin ctype test ======================"
1050	@echo
1051	-@cd test ;										\
1052	echo "NB: A failure of this test is SERIOUS.  It indicates that the C library" ;	\
1053	echo "<ctype.h> isxxx() and toxxx() functions are behaving unconventionally," ;		\
1054	echo "and the result will likely be later failure of the BibTeX testbib1 test." ;	\
1055	echo "Among systems tested for this release, OpenBSD 3.2 is known to fail here." ;	\
1056	echo ;											\
1057	echo "The following checks should produce no output other than their names." ;		\
1058	echo ;											\
1059	echo tstctype ;										\
1060	LANG=C ${TESTTSTCTYPE} | ${SED} -e ` printf 's/\015$$//' ` > tstctype.out ;		\
1061	${DIFF} okay/tstctype.out tstctype.out ;						\
1062	${CMP} -s okay/tstctype.out tstctype.out 2>/dev/null && ${RM} tstctype.out
1063	@echo
1064	@echo "====================== end ctype test ========================"
1065	@echo
1066
1067check-flawfinder:
1068	-${TEST} -n "${FLAWFINDER}" && for f in ${SRC} ; do ${FLAWFINDER} ${FLAWFINDERFLAGS} $$f ; done
1069
1070check-its4:
1071	-${TEST} -n "${ITS4}" && for f in ${SRC} ; do ${ITS4} ${ITS4FLAGS} $$f ; done
1072
1073check-latex:
1074	@echo
1075	@echo "===================== begin LaTeX test ======================="
1076	@echo
1077	@if test \( "xx${LATEX}" = "xx" \) -o \( "xx${BIBTEX}" = "xx" \) ;				\
1078	then												\
1079		echo "$@ skipped: missing LaTeX and/or BibTeX" ;					\
1080	else												\
1081		cd test ;										\
1082		echo "The following checks should produce no output other than their names." ;		\
1083		echo ;											\
1084		for f in ${CHECK-LATEX} ;								\
1085		do											\
1086			b=`basename $$f .ltx` ;								\
1087			optfile=$$b.opt ;								\
1088			echo $$b `${CAT} $$optfile` ;							\
1089			${TESTBIBCLEAN} ${TESTBIBCLEANFLAGS} ${BIBCLEANFLAGS} 				\
1090				`${CAT} $$optfile` $$b.bin > $$b.out 2> $$b.err ;			\
1091			${SED} -e ` printf 's/\015$$//' ` $$b.err > ${TMPDIR}/$$b.err.$$$$ ;		\
1092			${MV} ${TMPDIR}/$$b.err.$$$$ $$b.err ;						\
1093			${SED} -e ` printf 's/\015$$//' ` $$b.out > ${TMPDIR}/$$b.out.$$$$ ;		\
1094			${MV} ${TMPDIR}/$$b.out.$$$$ $$b.out ;						\
1095			${CP} ${CPFLAGS} $$b.out $$b.bib ;						\
1096			${LATEX} $$b.ltx >/dev/null 2>/dev/null ;					\
1097			${BIBTEX} $$b 1>/dev/null ;							\
1098			${TEST} -f $$b.blg && ${FIXBLG} $$b.blg > $$b.tmp && ${MV} $$b.tmp $$b.blg ;	\
1099			${RM} $$b.aux $$b.bib $$b.log ;							\
1100			${DIFF} okay/$$b.bbl $$b.bbl ;							\
1101			${CMP} -s okay/$$b.bbl $$b.bbl 2>/dev/null && ${RM} $$b.bbl ;			\
1102			${DIFF} okay/$$b.blg $$b.blg ;							\
1103			${CMP} -s okay/$$b.blg $$b.blg 2>/dev/null && ${RM} $$b.blg ;			\
1104			${DIFF} okay/$$b.err $$b.err ;							\
1105			${CMP} -s okay/$$b.err $$b.err 2>/dev/null && ${RM} $$b.err ;			\
1106			${DIFF} okay/$$b.out $$b.out ;							\
1107			${CMP} -s okay/$$b.out $$b.out 2>/dev/null && ${RM} $$b.out ;			\
1108		done ; \
1109	fi
1110	@echo
1111	@echo "====================== end LaTeX test ========================"
1112	@echo
1113
1114check-lint:
1115	-${TEST} -n "${LINT}" && for f in ${SRC} ; do ${LINT} ${LINTFLAGS} $$f ; done
1116
1117check-match:	${MATCH}
1118	@echo
1119	@echo "===================== begin match test ======================="
1120	@echo
1121	@cd test ;									\
1122	echo "The following checks should produce no output other than their names." ;	\
1123	echo ;										\
1124	for f in ${CHECK-MATCH} ;							\
1125	do										\
1126		b=`basename $$f .in` ;							\
1127		echo $$b ;								\
1128		${TESTMATCH} < $$f >$$b.out 2>$$b.err ;					\
1129		${SED} -e ` printf 's/\015$$//' ` $$b.err > ${TMPDIR}/$$b.err.$$$$ ;	\
1130		${MV} ${TMPDIR}/$$b.err.$$$$ $$b.err ;					\
1131		${SED} -e ` printf 's/\015$$//' ` $$b.out > ${TMPDIR}/$$b.out.$$$$ ;	\
1132		${MV} ${TMPDIR}/$$b.out.$$$$ $$b.out ;					\
1133		${DIFF} okay/$$b.err $$b.err ;						\
1134		${CMP} -s okay/$$b.err $$b.err 2>/dev/null && ${RM} $$b.err ;		\
1135		${DIFF} okay/$$b.out $$b.out ;						\
1136		${CMP} -s okay/$$b.out $$b.out 2>/dev/null && ${RM} $$b.out ;		\
1137	done
1138	@echo
1139	@echo "====================== end match test ========================"
1140	@echo
1141
1142check-rats:
1143	-${TEST} -n "${RATS}" && for f in ${SRC} ; do ${RATS} ${RATSFLAGS} $$f ; done
1144
1145check-romtol:	${ROMTOL}
1146	@echo
1147	@echo "===================== begin romtol test ======================"
1148	@echo
1149	@cd test ;									\
1150	echo "The following checks should produce no output other than their names." ;	\
1151	echo ;										\
1152	for f in ${CHECK-ROMTOL} ;							\
1153	do										\
1154		b=`basename $$f .in` ;							\
1155		echo $$b ;								\
1156		${TESTROMTOL} < $$f >$$b.out 2>$$b.err ;				\
1157		${SED} -e ` printf 's/\015$$//' ` $$b.err > ${TMPDIR}/$$b.err.$$$$ ;	\
1158		${MV} ${TMPDIR}/$$b.err.$$$$ $$b.err ;					\
1159		${SED} -e ` printf 's/\015$$//' ` $$b.out > ${TMPDIR}/$$b.out.$$$$ ;	\
1160		${MV} ${TMPDIR}/$$b.out.$$$$ $$b.out ;					\
1161		${DIFF} okay/$$b.err $$b.err ;						\
1162		${CMP} -s okay/$$b.err $$b.err 2>/dev/null && ${RM} $$b.err ;		\
1163		${DIFF} okay/$$b.out $$b.out ;						\
1164		${CMP} -s okay/$$b.out $$b.out 2>/dev/null && ${RM} $$b.out ;		\
1165	done
1166	@echo
1167	@echo "====================== end romtol test ======================="
1168	@echo
1169
1170### The peculiar step using tr to prepare the .aux files is needed to
1171### overcome inconsistencies in the handling of backslashes by the IBM
1172### RS/6000 shell.  The documented behavior in the SunOS 4.1.1 manual
1173### pages is (emphasis mine):
1174###     All characters enclosed between a pair of single quote marks
1175###     (''), except a single quote, are quoted by the shell.  BACKSLASH
1176###     HAS NO SPECIAL MEANING INSIDE A PAIR OF SINGLE QUOTES.  A single
1177###     quote may be quoted inside a pair of double quote marks (for
1178###     example, "'").
1179### On SunOS, HP UX, IBM 3090 AIX, NeXT Mach, and SGI IRIX, the shells
1180### csh, sh, bash, and ksh agree with this.  However, on IBM RS/6000
1181### AIX 3.2, backslashes in single quotes are untouched by csh, but
1182### expanded by sh and ksh.  This is clearly a bug, because the IBM AIX
1183### INFO system hypertext node on bsh/rsh says:
1184###     All characters, except the enclosing single quotation marks, are
1185###     taken literally, with any special meaning removed.
1186###
1187check-scribe:	${BIBCLEAN}
1188	@echo
1189	@echo "===================== begin Scribe test ======================"
1190	@echo
1191	@if test "xx${BIBTEX}" = "xx" ;									\
1192	then												\
1193		echo "$@ skipped: missing BibTeX" ;							\
1194	else												\
1195		cd test ;										\
1196		echo "The following checks should produce no output other than their names." ;		\
1197		echo ;											\
1198		for f in ${CHECK-SCRIBE} ;								\
1199		do											\
1200			b=`basename $$f .bib` ;								\
1201			optfile=$$b.opt ;								\
1202			echo $$b `${CAT} $$optfile` ;							\
1203			${TESTBIBCLEAN} ${TESTBIBCLEANFLAGS} ${BIBCLEANFLAGS} `${CAT} $$optfile` $$f >$$b.out 2>$$b.err ; \
1204			${SED} -e ` printf 's/\015$$//' ` $$b.err > ${TMPDIR}/$$b.err.$$$$ ;		\
1205			${MV} ${TMPDIR}/$$b.err.$$$$ $$b.err ;						\
1206			${SED} -e ` printf 's/\015$$//' ` $$b.out > ${TMPDIR}/$$b.out.$$$$ ;		\
1207			${MV} ${TMPDIR}/$$b.out.$$$$ $$b.out ;						\
1208			echo 'Bbibstyle{plain}NBcitation{*}NBbibdata{'$$b'}' |				\
1209				${TR} BN '\134\012' >$$b.aux ;						\
1210			${BIBTEX} $$b 1>/dev/null ;							\
1211			${TEST} -f $$b.blg && ${FIXBLG} $$b.blg > $$b.tmp && ${MV} $$b.tmp $$b.blg ;	\
1212			${RM} $$b.aux ;									\
1213			${DIFF} okay/$$b.bbl $$b.bbl ;							\
1214			${CMP} -s okay/$$b.bbl $$b.bbl 2>/dev/null && ${RM} $$b.bbl ;			\
1215			${DIFF} okay/$$b.blg $$b.blg ;							\
1216			${CMP} -s okay/$$b.blg $$b.blg 2>/dev/null && ${RM} $$b.blg ;			\
1217			${DIFF} okay/$$b.err $$b.err ;							\
1218			${CMP} -s okay/$$b.err $$b.err 2>/dev/null && ${RM} $$b.err ;			\
1219			${DIFF} okay/$$b.out $$b.out ;							\
1220			${CMP} -s okay/$$b.out $$b.out 2>/dev/null && ${RM} $$b.out ;			\
1221		done ;											\
1222	fi
1223	@echo
1224	@echo "====================== end Scribe test ========================"
1225	@echo
1226
1227check-setup:	${BIBCLEAN} ${MATCH} ${ROMTOL} ${TSTCTYPE}
1228
1229check-splint:
1230	-${TEST} -n "${SPLINT}" && for f in ${SRC} ; do ${SPLINT} ${SPLINTFLAGS} $$f ; done
1231
1232check-syntax: check-antic check-cppcheck check-flawfinder check-its4 \
1233	check-lint check-rats check-splint check-uno
1234
1235check-uno:
1236	-${TEST} -n "${UNO}" && ${UNO} ${UNOFLAGS} ${SRC}
1237
1238check-version:	Makefile
1239	@echo "Version number is ""'"${VERSION}"'"
1240
1241clean:	clean-test clean-dist
1242	-${RM} *.aux
1243	-${RM} *.bbl
1244	-${RM} *.blg
1245	-${RM} *.dvi
1246	-${RM} *.err
1247	-${RM} *.i
1248	-${RM} *.log
1249	-${RM} *.o
1250	-${RM} *~
1251	-${RM} \#*
1252	-${RM} configure.tmp
1253	-${RM} core test/core
1254	-${RM} ${MATCH} match.lst
1255	-${RM} ${ROMTOL} romtol.lst
1256	-${RM} testcodn.bib
1257	-${RM} testisxn.bib
1258	-${RM} testscr2.bi2 testscr2.er2
1259	-${RM} ${TSTCTYPE}
1260	# [08-Nov-1999] Suppress subdir make to preserve distribution files
1261	# -for d in ${SUBDIRS} ; do (cd $$d ; ${MAKE} clean ) ; done
1262
1263clean-dist:
1264	-${RM} bibclean.jar bibclean-?.??.jar
1265	-${RM} bibclean.jar-lst
1266	-${RM} bibclean.tar bibclean-?.??.tar
1267	-${RM} bibclean.tar-lst
1268	-${RM} bibclean-${VERSION}.tar
1269	-${RM} bibclean.zip bibclean-?.??.zip
1270	-${RM} bibclean.zip-lst bibclean-?.??.zip-lst
1271	-${RM} bibclean.zoo bibclean-?.??.zoo
1272	-${RM} bibclean.zoo-lst bibclean-?.??.zoo-lst
1273
1274clean-test:
1275	-${RM} test/*.aux test/*.bbl test/*.blg test/*.err test/*.ert \
1276		test/*.log test/*.out test/*.tmp
1277
1278clobber:	clean
1279	-${RM} ${PROGRAMS}
1280	-${RM} bibclean.hlp
1281	-${RM} bibclean.ps
1282	-${RM} bibclean.txt
1283	-${RM} install.time install-ftp.time
1284	# [08-Nov-1999] Suppress subdir make to preserve distribution files
1285	# -for d in ${SUBDIRS} ; do (cd $$d ; ${MAKE} clobber ) ; done
1286
1287dist:	bibclean.jar bibclean.tar bibclean.zip bibclean.zoo
1288
1289distclean: clobber
1290	-${RM} config.cache config.h config.log config.status
1291	-${RM} -r autom4te.cache
1292	-${RM} bibclean*.jar-lst bibclean*.tar-lst bibclean*.zip-lst \
1293		bibclean*.zoo-lst
1294	# [08-Nov-1999] Suppress subdir make to preserve distribution files
1295	# -for d in ${SUBDIRS} ; do (cd $$d ; ${MAKE} distclean ) ; done
1296	-${RM} Makefile
1297
1298docs:	bibclean.txt bibclean.hlp bibclean.html bibclean.ps bibclean.pdf
1299
1300chek.i:		chek.c config.h custom.h match.h token.h typedefs.h xctype.h	\
1301		xstat.h xstdio.h xstring.h yesorno.h Makefile
1302
1303chek.o:		chek.c config.h custom.h match.h token.h typedefs.h xctype.h	\
1304		xstat.h xstdio.h xstring.h yesorno.h
1305
1306do.i:           do.c ch.h config.h custom.h delete.h keybrd.h match.h		\
1307		pattern.h token.h toklst.h typedefs.h xctype.h xstdbool.h	\
1308		xstdio.h xstdlib.h xstring.h xunistd.h yesorno.h Makefile
1309
1310do.o:           do.c ch.h config.h custom.h delete.h keybrd.h match.h		\
1311		pattern.h token.h toklst.h typedefs.h xctype.h xstdbool.h	\
1312		xstdio.h xstdlib.h xstring.h xunistd.h yesorno.h
1313
1314fix.i:		fix.c config.h custom.h match.h token.h typedefs.h xctype.h	\
1315		xstring.h yesorno.h Makefile
1316
1317fix.o:		fix.c config.h custom.h match.h token.h typedefs.h xctype.h	\
1318		xstring.h yesorno.h
1319
1320fndfil.i:       fndfil.c config.h custom.h typedefs.h xctype.h xpwd.h		\
1321		xstdbool.h xstdio.h xstdlib.h xstring.h xunistd.h Makefile
1322
1323fndfil.o:       fndfil.c config.h custom.h typedefs.h xctype.h xpwd.h		\
1324		xstdbool.h xstdio.h xstdlib.h xstring.h xunistd.h
1325
1326isbn.i:         isbn.c ch.h config.h custom.h isbn.h isbn.tbl xctype.h		\
1327		xstdbool.h xstdio.h xstdlib.h xstring.h yesorno.h Makefile
1328
1329isbn.o:         isbn.c ch.h config.h custom.h isbn.h isbn.tbl xctype.h		\
1330		xstdbool.h xstdio.h xstdlib.h xstring.h yesorno.h
1331
1332keybrd.i:	ch.h config.h custom.h xstdio.h xstring.h xunistd.h		\
1333		yesorno.h Makefile
1334
1335keybrd.o:	keybrd.c ch.h config.h custom.h xctype.h xstdio.h xstring.h	\
1336		xunistd.h yesorno.h
1337
1338### Build a test program for match()
1339${MATCH}:	match.c romtol.o
1340	-${RM} matchx.o
1341	${CC} -I. -I${srcdir} ${TESTFLAGS} -o matchx.o -c match.c
1342	${CC} -I. -I${srcdir} ${TESTFLAGS} -o $@ matchx.o romtol.o ${LDFLAGS} ${LIBS}
1343	-${RM} matchx.o
1344
1345match.i:        match.c config.h custom.h match.h xctype.h xstdbool.h		\
1346		xstdio.h xstdlib.h xstring.h yesorno.h Makefile
1347
1348match.o:        match.c config.h custom.h match.h xctype.h xstdbool.h		\
1349		xstdio.h xstdlib.h xstring.h yesorno.h
1350
1351mostlyclean:	clean
1352	# [08-Nov-1999] Suppress subdir make to preserve distribution files
1353	# -for d in ${SUBDIRS} ; do (cd $$d ; ${MAKE} mostlyclean ) ; done
1354
1355option.i:       option.c bibclean.h ch.h config.h custom.h isbn.h match.h	\
1356		typedefs.h xstdbool.h xstdio.h xstdlib.h xstring.h yesorno.h	\
1357		Makefile
1358
1359### When HOST, USER, __DATE__, and __TIME__ are available,
1360### bibclean preserves them for its version output
1361option.o:       option.c bibclean.h ch.h config.h custom.h isbn.h match.h	\
1362		typedefs.h xstdbool.h xstdio.h xstdlib.h xstring.h yesorno.h
1363	${CC} -I. -I${srcdir} ${CFLAGS} -c -DHOST=\"${HOST}\" -DUSER=\"${USER}\" option.c
1364
1365### Build a test program for romtol()
1366${ROMTOL}:	romtol.c
1367	-${RM} romtolx.o
1368	${CC} -I. -I${srcdir} ${TESTFLAGS} -o romtolx.o -c romtol.c
1369	${CC} -I. -I${srcdir} ${TESTFLAGS} -o $@ romtolx.o ${LDFLAGS} ${LIBS}
1370	-${RM} romtolx.o
1371
1372romtol.i:       romtol.c config.h custom.h xctype.h xstring.h xstdbool.h	\
1373		xstdio.h xstdlib.h Makefile
1374
1375romtol.o:       romtol.c config.h custom.h xctype.h xstring.h xstdbool.h	\
1376		xstdio.h xstdlib.h
1377
1378splint:		splint.log
1379
1380splint.log:	${SRC} *.h Makefile
1381	-${SPLINT} ${SPLINTFLAGS} ${SRC} > $@
1382
1383strist.i:	strist.c config.h custom.h xctype.h xstdio.h xstring.h Makefile
1384
1385strist.o:	strist.c config.h custom.h xctype.h xstdio.h xstring.h
1386
1387strtol.i:       strtol.c config.h custom.h xctype.h xstdbool.h xstdio.h		\
1388		xstdlib.h xstring.h Makefile
1389
1390strtol.o:       strtol.c config.h custom.h xctype.h xstdbool.h xstdio.h		\
1391		xstdlib.h xstring.h
1392
1393### Subdirectory makes needed for distribution file creation
1394subdist:
1395	-for d in ${SUBDIRS} ; do (cd $$d ; ${MAKE} ) ; done
1396
1397${TSTCTYPE}:	tstctype.c
1398	${CC} ${CFLAGS} -o $@ $? ${LDFLAGS} ${LIBS}
1399
1400### ====================================================================
1401### Additional targets required by GNU Coding standards
1402
1403Makefile: Makefile.in config.status
1404	./config.status
1405
1406config.status: configure
1407	${srcdir}/configure --srcdir=${srcdir} --no-create --config-cache
1408
1409configure reconfigure: configure.ac configure.sed
1410	cd ${srcdir}; ${AUTOCONF} ; ${AUTOHEADER}
1411### Apply needed fixup for C++ with configure
1412	${MV} configure configure.tmp
1413	${SED} -f configure.sed <configure.tmp >configure
1414	-${RM} configure.tmp
1415	${CHMOD} +x configure
1416
1417maintainer-clean: distclean
1418	@echo "This command is intended for maintainers to use;"
1419	@echo "it deletes files that may require special tools to rebuild."
1420	-${CHMOD} u+w bibclean.html
1421	-${RM} bibclean.html
1422	-${RM} bibclean.pdf
1423	-${RM} TAGS
1424	-${RM} configure config.hin
1425	# [08-Nov-1999] Suppress subdir make to preserve distribution files
1426	# -for d in ${SUBDIRS} ; do (cd $$d ; ${MAKE} maintainer-clean ) ; done
1427
1428TAGS:	Makefile ${TAGS-FILES}
1429	cd ${srcdir}; ${ETAGS} ${TAGS-FILES}
1430
1431### ====================================================================
1432
1433install:	install.time
1434
1435install.time:	install-exe install-ini install-man
1436	${TOUCH} install.time
1437
1438install-exe:	uninstall-exe install-bibclean install-bibisbn
1439
1440install-bibclean:	${BIBCLEAN}
1441	test -d ${DESTDIR}${bindir} || ${MKDIR} ${DESTDIR}${bindir}
1442	if ${TEST} -f ${DESTDIR}${bindir}/${BIBCLEAN} ;		\
1443	then							\
1444		${MV} ${DESTDIR}${bindir}/${BIBCLEAN}		\
1445		      ${DESTDIR}${bindir}/${BIBCLEAN}.old ;	\
1446	fi
1447	-${RM} ${DESTDIR}${bindir}/bibclean-${VERSION}
1448	${CP} ${CPFLAGS} ${BIBCLEAN} ${DESTDIR}${bindir}/${BIBCLEAN}
1449	-${STRIP} ${DESTDIR}${bindir}/${BIBCLEAN}
1450	${LN} ${DESTDIR}${bindir}/${BIBCLEAN} ${DESTDIR}${bindir}/bibclean-${VERSION}${EXEEXT} || \
1451		${CP} ${CPFLAGS} ${DESTDIR}${bindir}/${BIBCLEAN} ${DESTDIR}${bindir}/bibclean-${VERSION}${EXEEXT}
1452	${CHMOD} 775 ${DESTDIR}${bindir}/${BIBCLEAN}
1453	$(MAKE)
1454
1455install-bibisbn:	${BIBISBN}
1456	test -d ${DESTDIR}${bindir} || ${MKDIR} ${DESTDIR}${bindir}
1457	if ${TEST} -f ${DESTDIR}${bindir}/${BIBISBN} ;		\
1458	then							\
1459		${MV} ${DESTDIR}${bindir}/${BIBISBN}		\
1460		      ${DESTDIR}${bindir}/${BIBISBN}.old ;	\
1461	fi
1462	-${RM} ${DESTDIR}${bindir}/bibisbn-${VERSION}
1463	${CP} ${CPFLAGS} ${BIBISBN} ${DESTDIR}${bindir}/${BIBISBN}
1464	-${STRIP} ${DESTDIR}${bindir}/${BIBISBN}
1465	${LN} ${DESTDIR}${bindir}/${BIBISBN} ${DESTDIR}${bindir}/bibisbn-${VERSION}${EXEEXT} || \
1466		${CP} ${CPFLAGS} ${DESTDIR}${bindir}/${BIBISBN} ${DESTDIR}${bindir}/bibisbn-${VERSION}${EXEEXT}
1467	${CHMOD} 775 ${DESTDIR}${bindir}/${BIBISBN}
1468
1469### Although it is generally considered bad form to install
1470### initialization files in the same location as executable files
1471### (mostly because they confuse directory listings), we make an
1472### exception for bibclean because (a) the files are, on UNIX, `hidden'
1473### (by their leading dot), (b) doing so avoids the need for yet
1474### another hard-coded configuration directory, or else another search path,
1475### and (c) search paths are more flexible than fixed configuration-file
1476### directories.
1477
1478install-ini:	 uninstall-ini
1479# OLD:	${CP} bibclean.ini ${DESTDIR}${bindir}/.bibcleanrc
1480# OLD:	${CHMOD} 664 ${DESTDIR}${bindir}/.bibcleanrc
1481# OLD:	${CP} bibclean.key ${DESTDIR}${bindir}/.bibclean.key
1482# OLD:	${CHMOD} 664 ${DESTDIR}${bindir}/.bibclean.key
1483# OLD:	${CP} bibclean.isbn ${DESTDIR}${bindir}/.bibclean.isbn
1484# OLD:	${CHMOD} 664 ${DESTDIR}${bindir}/.bibclean.isbn
1485	-${TEST} -d ${DESTDIR}${bibcleandir} || ${MKDIR} ${DESTDIR}${bibcleandir}
1486	-${TEST} -d ${DESTDIR}${initdir}     || ${MKDIR} ${DESTDIR}${initdir}
1487	-${TEST} ! -d ${DESTDIR}${initdir} && echo ERROR: cannot create ${DESTDIR}${initdir} && exit 1
1488	${CP} ${CPFLAGS} bibclean.ini bibclean.key bibclean.isbn ${DESTDIR}${initdir}/
1489	${CHMOD} 664 ${DESTDIR}${initdir}/bibclean.*
1490
1491install-man:	bibclean.man uninstall-man
1492	test -d ${DESTDIR}${mandir} || ${MKDIR} ${DESTDIR}${mandir}
1493	if ${TEST} -f ${DESTDIR}${mandir}/bibclean.${manext} ;		\
1494	then								\
1495		${MV} ${DESTDIR}${mandir}/bibclean.${manext}		\
1496		      ${DESTDIR}${mandir}/bibclean.old.${manext} ;	\
1497	fi
1498	${CP} ${CPFLAGS} bibclean.man ${DESTDIR}${mandir}/bibclean.${manext}
1499	-${RM} ${DESTDIR}${mandir}/../cat${manext}/bibclean.${manext}
1500	-${RM} ${DESTDIR}${mandir}/bibclean-${VERSION}.${manext}
1501	${LN} ${DESTDIR}${mandir}/bibclean.${manext} ${DESTDIR}${mandir}/bibclean-${VERSION}.${manext} || \
1502		${CP} ${CPFLAGS} ${DESTDIR}${mandir}/bibclean.${manext} ${DESTDIR}${mandir}/bibclean-${VERSION}.${manext}
1503	${CHMOD} 664 ${DESTDIR}${mandir}/bibclean.${manext}
1504
1505install-ftp:	uninstall-ftp install-ftp.time
1506
1507install-ftp.time:	dist
1508	${TAR} tvf bibclean-${VERSION}.tar >${FTPDIR}/bibclean-${VERSION}.tar-lst
1509	${GZIP} <bibclean-${VERSION}.tar		\
1510		>${FTPDIR}/bibclean-${VERSION}.tar.gz
1511	${CP} ${CPFLAGS} bibclean-${VERSION}.jar ${FTPDIR}
1512	${JAR} tvf bibclean-${VERSION}.jar		\
1513		2>${FTPDIR}/bibclean-${VERSION}.jar-lst
1514	${CP} ${CPFLAGS} bibclean-${VERSION}.zip ${FTPDIR}
1515	${CP} ${CPFLAGS} bibclean-${VERSION}.zip-lst ${FTPDIR}
1516	${CP} ${CPFLAGS} bibclean-${VERSION}.zoo ${FTPDIR}
1517	${CP} ${CPFLAGS} bibclean-${VERSION}.zoo-lst ${FTPDIR}
1518	${LS} -l ${FTPDIR}/bibclean*
1519	${DATE} >install-ftp.time
1520
1521lint:
1522	${LINT} ${LINTFLAGS} ${SRC}
1523
1524uninstall:	uninstall-exe uninstall-ini uninstall-man
1525	-${RM} install.time
1526
1527uninstall-exe:
1528	-${RM} ${DESTDIR}${bindir}/${BIBCLEAN} ${DESTDIR}${bindir}/bibclean-${VERSION}${EXEEXT}
1529	-${RM} ${DESTDIR}${bindir}/${BIBISBN}  ${DESTDIR}${bindir}/bibisbn-${VERSION}${EXEEXT}
1530
1531uninstall-ini:
1532	-${RM}  ${DESTDIR}${initdir}/bibclean.ini	\
1533		${DESTDIR}${initdir}/bibclean.isbn	\
1534		${DESTDIR}${initdir}/bibclean.key
1535
1536uninstall-man:
1537	-${RM}  ${DESTDIR}${mandir}/bibclean.${manext}					\
1538		${DESTDIR}${mandir}/bibclean-${VERSION}.${manext}			\
1539		${DESTDIR}${mandir}/../cat${manext}/bibclean.${manext}			\
1540		${DESTDIR}${mandir}/../cat${manext}/bibclean-${VERSION}.${manext}
1541
1542uninstall-ftp:
1543	-${RM} ${FTPDIR}/bibclean-${VERSION}.tar
1544	-${RM} ${FTPDIR}/bibclean-${VERSION}.tar-lst
1545	-${RM} ${FTPDIR}/bibclean-${VERSION}.zip
1546	-${RM} ${FTPDIR}/bibclean-${VERSION}.zip-lst
1547	-${RM} ${FTPDIR}/bibclean-${VERSION}.zoo
1548	-${RM} ${FTPDIR}/bibclean-${VERSION}.zoo-lst
1549	-${RM} install-ftp.time
1550
1551### Prevent GNU make v3 from overflowing arg limit on SysV.
1552.NOEXPORT:
1553