1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
|
# catdvi - get text from DVI files
# Copyright (C) 1999 J.H.M. Dassen (Ray) <jdassen@wi.LeidenUniv.nl>
# Copyright (C) 1999, 2000, 2001 Antti-Juhani Kaijanaho <gaia@iki.fi>
# Copyright (C) 2000-2002 Bjoern Brill <brill@fs.math.uni-frankfurt.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#CC = gcc
#CFLAGS = -Wall -W -Wshadow -Wpointer-arith -Wbad-function-cast \
# -Wcast-qual -Wcast-align -Wstrict-prototypes -Wmissing-prototypes \
# -Wmissing-declarations -ansi -pedantic -g
include config.mk
ifeq ($(CFG_HAS_GETOPT_LONG),yes)
GETOPT = # nothing
CPPFLAGS += -DCFG_HAS_GETOPT_LONG
else
ifeq ($(CFG_KPATHSEA_HAS_GETOPT_LONG),yes)
GETOPT = # nothing
CPPFLAGS += -DCFG_KPATHSEA_HAS_GETOPT_LONG
else
GETOPT = getopt.c getopt1.c
endif
endif
ifeq ($(CFG_HAS_KPATHSEA),yes)
FINDTFM = kpathsea.o
LDLIBS = -lkpathsea
else
$(error Sorry) # Implement a replacement for kpathsea.c yourself...
endif
ifeq ($(CFG_SHOW_PSE2UNIC_WARNINGS),yes)
PSE2UNICFLAGS = # nothing
else
PSE2UNICFLAGS = -w
endif
programs := catdvi pse2unic adobe2h tfminfo
tests := $(wildcard test/*.tex)
sources := $(wildcard *.c)
encfiles := $(wildcard enc/*.enc)
all1 : $(programs) $(tests:.tex=.dvi)
catdvi : bytesex.o catdvi.o fixword.o fntenc.o fontinfo.o outenc.o \
page.o readdvi.o regsta.o util.o glyphops.o linebuf.o\
density.o sparse.o pageref.o vlist.o canvas.o layout.o\
$(GETOPT) $(FINDTFM)
# fontinfo : fontinfo.o bytesex.o util.o
tfminfo : tfminfo.o bytesex.o fixword.o fontinfo.o util.o fntenc.o $(FINDTFM)
pse2unic : pse2unic.o util.o
adobe2h : adobe2h.o
fntenc.o fntenc.d : $(encfiles:.enc=.h)
glyphops.o glyphops.d : glyphenm.h
glyphenm.h : adobe2h
./adobe2h > glyphenm.h
config.mk : config.mk.in
./config.status
ChangeLog :
CVS_RSH=ssh $(CVS2CL) -U changelog-authors -W 1200 -b --gmt -w --ignore ChangeLog
.PHONY : ChangeLog
clean :
$(RM) *.o $(programs) core tags test/*.log test/*.aux
$(RM) enc/*.log enc/*.aux
find . -name '*~' -or -name '*.bck' | xargs $(RM)
distclean : clean
$(RM) *.d test/*.dvi test/*.log test/*.aux 1
$(RM) enc/*.dvi enc/*.tex
$(RM) glyphenm.h $(encfiles:.enc=.h)
$(RM) config.cache config.status config.mk version.h config.log
$(RM) -r $(package)-$(version)
$(RM) -r test/auto
maintainer-clean : distclean
$(RM) test/*.dvi configure ChangeLog
%.d: %.c
set -e; $(CC) -MM $(CPPFLAGS) $< | \
sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
[ -s $@ ] || rm -f $@
test/%.dvi : test/%.tex
cd test && latex $(notdir $<)
enc/%.h enc/%.tex : enc/%.enc pse2unic
./pse2unic $(PSE2UNICFLAGS) $< $(<:.enc=.h) $(<:.enc=.tex)
# autogenerated documentation
#
enc/%.dvi : enc/%.tex
cd enc && latex $(notdir $<)
encreports : $(encfiles:.enc=.dvi)
catdvi.txt : catdvi.1
man -l catdvi.1 -Tascii | col -b -x > catdvi.txt
catdvi.html: catdvi.1
troff2html -man catdvi.1 > catdvi.html
# release packaging
#
dist : distdir=$(package)-$(version)
dist : $(sources:.c=.d) ChangeLog
rm -rf $(distdir)
$(RM) $(distdir).tar
$(RM) $(distdir).tar.bz2
$(RM) $(distdir).tar.gz
mkdir $(distdir)
set -e ; for d in $(shell cat Manifest | xargs -l1 dirname | sort | uniq) ;\
do \
echo -n "Making directory $(distdir)/$$d ..." ;\
mkdir -p $(distdir)/$$d ;\
echo "done." ;\
done
set -e ; for f in $(shell cat Manifest);\
do \
echo -n "Copying $$f ..." ;\
ln $$f $(distdir)/$$f ;\
echo "done." ;\
done
tar cf $(distdir).tar $(distdir)
bzip2 -9k $(distdir).tar
gzip -9 $(distdir).tar
install: catdvi
$(INSTALL_PROGRAM) catdvi $(bindir)/catdvi
$(INSTALL_DATA) catdvi.1 $(man1dir)/catdvi.1
uninstall:
$(RM) $(bindir)/catdvi
$(RM) $(man1dir)/catdvi.1
# For fun ;-)
linecount :
rmccmt $(filter-out getopt.c getopt.h getopt1.c adobetbl.h, \
$(wildcard *.c *.h)) | indent | uniq | wc -l
Manifest:
rm -f $@.new $@.edi
./cvsparser.pl | ./manifest-filter.pl > $@.edi
sort $@.edi -o $@.new
mv $@.new $@
rm -f $@.edi
.PHONY: Manifest MD5SUMS
SIGN=gpg --clearsign
MD5SUMS: Manifest
rm -f $@.new
set -e; for f in `egrep -v '^$@$$' Manifest `;\
do \
sum=$$(md5sum $$f | awk '{ print $$1; }'); \
size=$$(ls -l $$f | awk '{ print $$5; }'); \
printf "%s %5i %s\n" $$sum $$size $$f >> $@.new;\
done
if [ "$(NOSIGN)" = "" ] ;\
then\
$(SIGN) $@.new ;\
rm -f $@.new ;\
mv $@.new.asc $@ ;\
else\
mv $@.new $@ ;\
fi
CVSTAG=none
official-release : VERSION=$(shell echo $(CVSTAG) \
| sed -e 's/^rel_//' -e 's/_/./g')
official-release : grbdir=catdvi-release-build
official-release :
rm -rf $(grbdir)
set -e ;\
if $$(echo $(VERSION) \
| egrep '^[0-9]+\.[0-9]+(\.(pre)?[0-9]+)?$$' >/dev/null);\
then\
:; \
else \
echo "Bad VERSION"; \
exit 1; \
fi
cvs -z3 -d$(shell cat CVS/Root) checkout -r $(CVSTAG) \
-d $(grbdir) catdvi
cd $(grbdir) && autoconf && ./configure
make -C $(grbdir) Manifest
make -C $(grbdir) `egrep -v '^(Manifest|MD5SUMS)$$' $(grbdir)/Manifest`
make -C $(grbdir) -o Manifest NOSIGN=$(NOSIGN) MD5SUMS
make -C $(grbdir) -o ChangeLog dist
ln -f $(grbdir)/catdvi-$(VERSION).tar.gz
ln -f $(grbdir)/catdvi-$(VERSION).tar.bz2
rm -rf $(grbdir)
include $(sources:.c=.d)
|