1#=======================================================================
2# Makefile for bibclean TUBboat article and GNU Emacs info documentation
3# [23-Aug-2003] -- add rules for bibclean.pdf and bibclean.ps, and
4#		   remove dependencies on .bbl and .ind files to prevent
5#		   unnecessary rebuilds
6# [03-May-1996] -- update style and macro files with latest versions,
7#		   update GNU standard targets, and update spelling
8#		   error checks to use style of TUG bibliography
9#		   collection
10# [31-Dec-1993] -- final polishing of Makefile for public release
11#                  after TUGboat publication
12# [04-May-1993] -- add bundle, SHAR, SHARFILES, and add quoting of @
13#		   in index
14# [14-Jan-1993]
15#=======================================================================
16BIBTEX		= bibtex
17CP		= /bin/cp
18DETEX		= detex
19DVIPS		= dvips -Pcmr
20DVIPS		= dvips-type1
21DW		= dw
22ISPELL		= ispell
23LATEX		= latex
24MAKEINDEX 	= makeindex
25MV		= /bin/mv
26PS2PDF		= ps2pdf
27PS2PDF		= distill
28RM		= /bin/rm -f
29SED		= sed
30SHAR		= shar -c -v
31SHARFILES       = Makefile bibclean.aux bibclean.bbl bibclean.bib \
32		  bibclean.idx bibclean.ind bibclean.lot bibclean.ltx \
33		  bibclean.sok bibclean.sty bibclean.toc is-plain.bst
34SPELL		= spell
35TEXINDEX 	= texindex
36
37ALL:	bibclean.dvi bibclean.ps bibclean.pdf
38
39all:	bibclean.ser dw bibclean.dvi
40
41bibclean.aux:
42	if [ ! -f bibclean.aux ] ; then touch bibclean.aux ; fi
43
44bibclean.bbl:	bibclean.bib bibclean.aux
45	if [ ! -f bibclean.aux ] ; then touch bibclean.aux ; fi
46	-$(BIBTEX) bibclean
47
48bibclean.dvi:	bibclean.ltx bibclean.sty
49	$(LATEX) bibclean.ltx
50	$(MAKE) bibclean.bbl bibclean.ind
51	$(LATEX) bibclean.ltx
52	$(LATEX) bibclean.ltx
53
54bibclean.idx:
55	if [ ! -f bibclean.idx ] ; then touch bibclean.idx ; fi
56
57bibclean.ind:	bibclean.idx Makefile
58	$(MV) bibclean.idx bibclean.idw
59	$(SED) -e 's/{\\tt <}@/<@/' \
60		-e 's/{\\tt >}@/>@/' \
61		-e 's/{\\%\\%@{\\tt \\%\\%}}/{\\%\\%@{\\protect\\tt \\%\\%}}/' \
62		-e 's/@@{\\tt @}/"@@{\\tt "@}/' \
63		-e 's/{@@{\\tt @}}/{"@@{\\tt "@}}/' \
64		-e 's/\\{ */\\{/g' \
65		-e 's/\\} */\\}/g' \
66		<bibclean.idw >bibclean.idx
67	-$(MAKEINDEX) bibclean
68
69bibclean.pdf:	bibclean.ps
70	$(MV) bibclean.log bibclean.log.save
71	$(PS2PDF) $?
72	$(MV) bibclean.log.save bibclean.log
73
74bibclean.ps:	bibclean.dvi
75	$(DVIPS) -o $@ $?
76
77bibclean.ser:	bibclean.ltx bibclean.sok
78	if [ ! -f bibclean.sok ] ; then touch bibclean.sok ; fi
79	@echo '==================== spelling exceptions ===================='
80	$(DETEX) bibclean.ltx | $(SED) -e 's/[0-9,.:;]/ /g' | \
81		$(SPELL) +bibclean.sok >bibclean.ser
82	$(DETEX) bibclean.ltx | $(SED) -e 's/[0-9,.:;]/ /g' | \
83		$(ISPELL) -l -p bibclean.sok | sort -u >>bibclean.ser
84	cat bibclean.ser
85
86bundle:	$(SHARFILES)
87	$(SHAR) $(SHARFILES) >$@
88
89clean mostlyclean:
90	$(RM) *.blg
91	$(RM) *.dvi*
92	$(RM) *.idw
93	$(RM) *.ilg
94	$(RM) *.log
95	$(RM) *.o
96	$(RM) *.ser
97	$(RM) *.tmp
98	$(RM) *~
99	$(RM) \#*
100	$(RM) core
101
102clobber distclean:	clean
103	$(RM) *.aux
104	$(RM) *.bbl
105	$(RM) *.idx
106	$(RM) *.ind
107	$(RM) *.lof
108	$(RM) *.lot
109	$(RM) *.toc
110
111# We strip \index{} entries first to avoid large numbers of bogus duplicate
112# word warnings.
113dw:
114	@echo '==================== doubled words ===================='
115	$(SED) -e 's/^ *\\index{.*$$//' bibclean.ltx | $(DETEX) | $(DW)
116
117maintainer-clean: distclean
118	@echo "This command is intended for maintainers to use;"
119	@echo "it deletes files that may require special tools to rebuild."
120	$(RM) bibclean.pdf
121	$(RM) bibclean.ps
122
123spell: bibclean.ser
124