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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
|
# @configure_input@
#
# Makefile for ChkTeX project, creates the stuff.
# Copyright (C) 1996 Jens T. Berger Thielemann
#
# 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.
#
# Contact the author at:
# Jens Berger
# Spektrumvn. 4
# N-0666 Oslo
# Norway
# E-mail: <jensthi@ifi.uio.no>
#
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
datadir=@datadir@
srcdir=@srcdir@
mandir=@mandir@
INSTALL=@INSTALL@
INSTALL_PROGRAM=@INSTALL_PROGRAM@
INSTALL_DATA=@INSTALL_DATA@
ELISPDIR=@ELISPDIR@
CC=@CC@
CFLAGS=@CFLAGS@
CPPFLAGS=@CPPFLAGS@
DEFS=@DEFS@
LIBS=@LIBS@
LDFLAGS=@LDFLAGS@
LN_S=@LN_S@
LATEX=@LATEX@
DVIPS=@DVIPS@
PERL5=@PERL5@
LATEX2HTML=@LATEX2HTML@
LYNX=@LYNX@
GROFF=@GROFF@
SHELL=/bin/sh
SCRIPTS=@SCRIPTS@
USRDEFS=-DDATADIR=\"$(datadir)\"
#####################################################################
INSTALLFILES= configure.in Makefile.in config.h.in chktexrc MakeHTML.in
WEBFILES= chkweb deweb.in
DOCFILES= ChkTeX.tex ChkTeX.dvi \
ChkTeX.readme COPYING WB2Argv.readme deweb.1 deweb.doc
SOURCEFILES= ChkTeX.c ChkTeX.h FindErrs.c FindErrs.h OpSys.c OpSys.h \
Resource.c Resource.h Utility.c Utility.h WB2Argv.c WB2Argv.h \
getopt.c getopt.h getopt1.c HashWord.a chktex.el
PORTFILES= config.msd ChkTeX.dsk ChkTeX.prj SCOPTIONS SMakefile config.AMIGA
TESTFILES= Test.tex input.tex Test.out
###
#
# OS specific files
#
###
## AMIGA
REXXFILES= amiga/ChkTeX.ced amiga/ChkTeX.ged amiga/ChkTeX.scm \
amiga/ChkTeX.vbr amiga/GotoFile.ced
AMIGAFILES= amiga/ChkTeX.install amiga/ChkTeX.install.info \
amiga/ChkTeX amiga/ChkTeX.info amiga/COPYING.info \
amiga/ChkTeX.readme.info amiga/lacheck $(REXXFILES)
## MSDOS
MSDOSFILES= msdos/ChkTeX.exe
## OS/2
OS2FILES= os2/Readme.os2 os2/ChkTeX.exe
## UNIX
UNIXFILES= configure install-sh unix/lacheck
COMMONFILES= $(INSTALLFILES) $(WEBFILES) $(DOCFILES) $(SOURCEFILES) \
$(TESTFILES) $(PORTFILES)
ARCHIVES= chktex.lha chktex.tar.gz
all: chktex
dist: configure ChkTeX.dvi Test.out ChkTeX.readme deweb.doc
touch chktex $(ARCHIVES)
rm -r chktex $(ARCHIVES)
mkdir chktex chktex/generic chktex/generic/exec
for file in $(COMMONFILES); do \
cp $$file chktex/generic; \
done
cp exec/types.h chktex/generic/exec
srcdir=`pwd`; \
for dir in chktex/amiga/ chktex/msdos/ chktex/os2/ chktex/unix; do \
cd $$srcdir; \
mkdir $$dir; \
cd $$dir; \
for file in $(COMMONFILES); do \
$(LN_S) ../generic/$$file .; \
done; \
mkdir exec; cd exec; \
$(LN_S) ../../generic/exec/types.h .; \
done
for file in $(AMIGAFILES); do\
cp /hom/jensthi/chktex/source/$$file chktex/amiga; \
done
for file in $(MSDOSFILES); do\
cp /hom/jensthi/chktex/source/$$file chktex/msdos; \
done
for file in $(OS2FILES); do\
cp /hom/jensthi/chktex/source/$$file chktex/os2; \
done
for file in $(UNIXFILES); do\
cp /hom/jensthi/chktex/source/$$file chktex/unix; \
done
cp README chktex/
-rm chktex.lha
lha a chktex.lha chktex/amiga/ chktex/README
-rm chktex_unix.tar.gz
tar chf chktex_unix.tar chktex/unix
gzip chktex_unix.tar
-rm chktex_gen.tar.gz
tar chf chktex_gen.tar chktex/generic
gzip chktex_gen.tar
-rm chktex_msdos.zip chktex_os2.zip
zip -r chktex_msdos chktex/msdos
tar cf chktex.tar chktex
gzip chktex.tar
rm -r chktex
########################################################################
.c.o:
$(CC) $(CFLAGS) -I$(srcdir) -I. $(DEFS) $(USRDEFS) -c $< -o $@
###################### MAIN DEPENDENCIES ################################
OBJS= ChkTeX.o FindErrs.o getopt.o getopt1.o OpSys.o Resource.o Utility.o
MAKETEST= ./chktex -mall -r -g0 -lchktexrc Test.tex
Test.out: chktex Test.tex ChkTeX.tex
touch Test.out
rm -f Test.out
$(MAKETEST) 1> Test.out
check: chktex
@echo ">>> Testing that checking algorithms work correctly..."
@touch chktest
@rm -f chktest
@$(MAKETEST) 1> chktest
@if cmp -s chktest Test.out; then \
echo ">>> OK!"; \
rm -f chktest; \
else \
echo "***WARNING***"; \
echo "Problems when checking compilation. This may or may not"; \
echo "be a problem; anyway, I'm giving you a diff from what the"; \
echo "results were *supposed* to be..."; \
diff -c chktest Test.out; \
fi
chktex: $(OBJS)
touch chktex
rm -r chktex
$(CC) $(LDFLAGS) -o chktex $(OBJS) $(LIBS)
install: chktex ChkTeX.dvi
$(INSTALL) -d $(bindir)
for program in chktex $(SCRIPTS); do \
$(INSTALL_PROGRAM) $$program $(bindir); \
done
$(INSTALL) -d $(datadir)
$(INSTALL_DATA) chktexrc $(datadir)
if (eval echo "$(SCRIPTS)") | egrep deweb >/dev/null 2>&1; then \
$(INSTALL) -d $(mandir); \
$(INSTALL) -d $(mandir)/man1; \
cp deweb.1 $(mandir)/man1; \
fi
if (eval echo "$(ELISPDIR)") | egrep "/" >/dev/null 2>&1; then \
$(INSTALL_DATA) chktex.el $(ELISPDIR); \
fi
uninstall:
-rm -f $(bindir)/chktex
-rm -f $(bindir)/chkweb
-rm -f $(bindir)/deweb
-rm -f $(datadir)/chktexrc
test:
chktex -v2 -mall Test.tex | less -r
mostlyclean: clean
clean:
-rm -r *.o *.aux *.log MakeHTML chktex deweb HTML rme 2> /dev/null
distclean: clean
-rm -r *.cache *.status *.log *.tar.gz *.lha 2> /dev/null
maintainer-clean: clean
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
-rm -r *.rme *.dvi *.ps *.doc Test.out 2> /dev/null
dvi: ChkTeX.dvi
html:
touch HTML
rm -r HTML
mkdir HTML
chmod u+x MakeHTML
./MakeHTML ChkTeX.tex > HTML/ChkTeX.tex
cd HTML; $(LATEX2HTML) ChkTeX.tex
$(PERL5) -i -pe 's%</code> %</code>%gi;s%\s+([.,?!])%$$1%g;' HTML/ChkTeX/*.html
ChkTeX.readme: ChkTeX.tex
touch rme
rm -r rme
mkdir rme
chmod u+x MakeHTML
./MakeHTML ChkTeX.tex > rme/ChkTeX.tex
cd rme; $(LATEX2HTML) -split 0 ChkTeX.tex
$(PERL5) -i -pe 's%</code> %</code>%gi;s%\s+([.,?!])%$$1%g;' rme/ChkTeX/*.html
$(LYNX) -dump rme/ChkTeX/ChkTeX.html > ChkTeX.rme
cp Readme.header ChkTeX.readme
$(PERL5) -e 'undef $$/;$$_=<>;($$_)=/(.*INTRODUCTION(.|\n)*?)[ \t]+ABOUT THIS DOCUMENT/i;s/[ \t]+\n/\n/g;s/\n\n\n/\n/g;s/\[\d+\]//g;print;' ChkTeX.rme >> ChkTeX.readme
###################### INDIVIDUAL DEPENDENCIES ##########################
deweb.doc: deweb.1
touch deweb.doc
rm -rf deweb.doc
$(GROFF) deweb.1 > deweb.doc
configure: configure.in
autoconf
ChkTeX.dvi: ChkTeX.tex
$(LATEX) ChkTeX.tex
ChkTeX.ps: ChkTeX.dvi
$(DVIPS) -o ChkTeX.ps ChkTeX.dvi
ChkTeX: ChkTeX.c
@echo
ChkTeX.o: ChkTeX.c WB2Argv.h getopt.h ChkTeX.h exec/types.h \
Utility.h OpSys.h FindErrs.h Resource.h config.h
FindErrs.o: FindErrs.c ChkTeX.h exec/types.h FindErrs.h \
Utility.h OpSys.h Resource.h config.h
getopt.o: getopt.c config.h getopt.h
getopt1.o: getopt1.c config.h getopt.h
OpSys.o: OpSys.c ChkTeX.h exec/types.h Utility.h OpSys.h config.h
Resource.o: Resource.c ChkTeX.h exec/types.h Utility.h OpSys.h Resource.h \
config.h
Utility.o: Utility.c ChkTeX.h exec/types.h Utility.h OpSys.h Resource.h \
config.h
RegExps.o: RegExps.c RegExps.h config.h
WB2Argv.o: WB2Argv.c WB2Argv.h
cover:
chktex -h
chktex Test.tex
chktex -v2 -t -o tmptmptmp <Test.tex
chktex -v2 -t -o tmptmptmp Test.tex
chktex Test.tex -v
chktex Test.tex -v0
chktex Test.tex -v1
chktex Test.tex -v2
chktex Test.tex -v3
chktex Test.tex -v4
chktex -t -v0s::: Test.tex -x
chktex -p FOO Test.tex
chktex -t Test.tex
chktex -o tmptmptmp -o tmptmptmptmp Test.tex
chktex -l t:faultrc test.tex
chktex -e30w22n1 Test.tex
chktex -w33e-n1 Test.tex
chktex -i
chktex -v2 -t -o tmptmptmp <Test.tex
chktex -I Test.tex
chktex -rd2 Test.tex
chktex -gd2 Test.tex
chktex -f "*N\
Between: %b*N\
Column: %c*N\
Lenght: %d*N\
File: %f*N\
%iInverse%I*N\
Kind: %k*N\
Line: %l*N\
Msg: %m*N\
Num: %n*N\
Und: %u*N\
Pre: %r*N\
Str: %s*N\
Post: %t*N\
*N\
%k in %f line %l: %m*N\
%r%i%s%I%t*N\
%u*N\
*N" Test.tex
chktex -o tmptmptmp -r -d2 Test.tex
chktex -qv0 Test.tex
chktex -w30 Test.tex
chktex -g --localrc=.testrc -d2 Test.tex
cover
|