summaryrefslogtreecommitdiff
path: root/Build/source/texk/chktex/chktex-1.7.1/Makefile.in
blob: ee8dda3eead0a366e5779de35b76489b86f13796 (plain)
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
#
#  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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@
datarootdir=@datarootdir@
datadir=@datadir@
sysconfdir=@sysconfdir@
srcdir=@srcdir@
mandir=@mandir@
INSTALL=@INSTALL@
INSTALL_PROGRAM=@INSTALL_PROGRAM@
INSTALL_DATA=@INSTALL_DATA@
MKDIR_P=@MKDIR_P@
ELISPDIR=@ELISPDIR@
CLEAN=@CLEAN@

CC=@CC@
CFLAGS=@CFLAGS@
CPPFLAGS=@CPPFLAGS@ -I$(srcdir) -I. $(DEFS) $(USRDEFS)
DEFS=@DEFS@
LIBS=@LIBS@
LDFLAGS=@LDFLAGS@
LN_S=@LN_S@
LATEX=@LATEX@
DVIPS=@DVIPS@
PS2PDF=ps2pdf
PERL5=@PERL5@
LATEX2HTML=@LATEX2HTML@
LYNX=@LYNX@
GROFF=@GROFF@
SHELL=/bin/sh

BUILT_SCRIPTS=@BUILT_SCRIPTS@
SCRIPTS=@SCRIPTS@

USRDEFS=-DSYSCONFDIR=\"$(sysconfdir)\" -D__unix__

VPATH=$(srcdir)

#####################################################################

EXTRA_DIST=configure.in Makefile.in stamp-h.in config.h.in rmeheader.in \
	MakeHTML.pl ChkTeX.tex.in aclocal.m4 NEWS \
	chktex.el chkweb deweb.in COPYING chktex.1 chkweb.1 deweb.1 \
	Test.tex input.tex Test.out configure install-sh lacheck chktexrc \
	$(wildcard m4/*.m4)

# created by configure
CONFIG_DIST=ChkTeX.tex

# created at make time
BUILT_DIST=chktex.doc chkweb.doc deweb.doc README ChkTeX.dvi

CSOURCES=ChkTeX.c FindErrs.c OpSys.c Resource.c Utility.c

# The sources are the C sources and possibly the files with the same base name
# but ending with .h
SOURCEFILES=$(CSOURCES) $(wildcard $(CSOURCES:.c=.h)) types.h

DISTFILES=$(EXTRA_DIST) $(SOURCEFILES)

all: chktex

DISTDIR:=chktex-@PACKAGE_VERSION@
dist: $(DISTDIR).tar.gz
$(DISTDIR).tar.gz: $(DISTFILES) $(CONFIG_DIST) $(BUILT_DIST) html
	rm -r $(DISTDIR) 2>/dev/null ; true
	$(MKDIR_P) $(DISTDIR)
	for f in $(DISTFILES) ; do \
	  cp $(srcdir)/$$f $(DISTDIR) ; \
	done
	cp $(CONFIG_DIST) $(BUILT_DIST) $(DISTDIR)
	$(MKDIR_P) $(DISTDIR)/html
	cp HTML/ChkTeX/*.{html,css} $(DISTDIR)/html
	rm -f $(DISTDIR).tar.gz
	tar --owner=0 --group=0 -chzf $@ $(DISTDIR)
	rm -rf $(DISTDIR)

########################################################################

.c.o:
	$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
CLEAN+=$(CSOURCES:.c=.o)

.%.d: %.c
	$(CC) -M $(CPPFLAGS) $< > $@.tmp
	sed 's,\($*\)\.o *:,\1.o $@ : Makefile,g' $@.tmp > $@
	-rm -f $@.tmp 2>/dev/null

DEPFILES=$(patsubst %.c,.%.d,$(CSOURCES))
CLEAN+=$(DEPFILES)

ifeq ($(findstring clean,$(MAKECMDGOALS)),)
include $(DEPFILES)
endif

###################### MAIN DEPENDENCIES ################################

OBJS= ChkTeX.o FindErrs.o OpSys.o Resource.o Utility.o

MAKETEST= (builddir=`pwd` ; cd $(srcdir) ; $${builddir}/chktex -mall -r -g0 -lchktexrc -v5 Test.tex)

$(srcdir)/Test.out: $(srcdir)/Test.tex
	-rm -f $(srcdir)/Test.out
	@echo ""
	@echo "***Warning: creating Test.out***"
	@echo ""
	$(MAKETEST) 1> $(srcdir)/Test.out

check: chktex $(srcdir)/Test.out
	@echo ">>> Testing that checking algorithms work correctly..."
	@-rm -f chktest
	$(MAKETEST) 1> chktest
	@if cmp -s chktest $(srcdir)/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 -u $(srcdir)/Test.out chktest; \
	fi


chktex: $(OBJS)
	$(CC) $(LDFLAGS) -o chktex $(OBJS) $(LIBS)

install: chktex ChkTeX.dvi
	$(MKDIR_P) $(DESTDIR)$(bindir)
	for program in chktex $(BUILT_SCRIPTS); do \
		$(INSTALL_PROGRAM) $$program $(DESTDIR)$(bindir); \
	done
	for program in $(SCRIPTS); do \
		$(INSTALL_PROGRAM) $(srcdir)/$$program $(DESTDIR)$(bindir); \
	done
	$(MKDIR_P) $(DESTDIR)$(sysconfdir)
	$(INSTALL_DATA) $(srcdir)/chktexrc $(DESTDIR)$(sysconfdir)
	if (eval echo "$(BUILT_SCRIPTS)") | egrep deweb >/dev/null 2>&1; then \
		$(MKDIR_P) $(DESTDIR)$(mandir)/man1; \
                cp $(srcdir)/deweb.1 $(DESTDIR)$(mandir)/man1; \
	fi
	if (eval echo "$(ELISPDIR)") | egrep "/" >/dev/null 2>&1; then \
		$(INSTALL_DATA) $(srcdir)/chktex.el $(DESTDIR)$(ELISPDIR); \
	fi



uninstall:
	for program in chktex $(SCRIPTS) $(BUILT_SCRIPTS); do \
		rm -f $(DESTDIR)$(bindir)/$$program; \
	done
	rm -f $(DESTDIR)$(sysconfdir)/chktexrc  $(DESTDIR)$(mandir)/man1/deweb.1
	if (eval echo "$(ELISPDIR)") | egrep "/" >/dev/null 2>&1; then \
		rm -f $(DESTDIR)$(ELISPDIR)/chktex.el ; \
	fi

test:
	chktex -v2 -mall $(srcdir)/Test.tex | less -r

indent:
	indent -npsl -bli0 -npcs -nut -i4 $(SOURCEFILES)

mostlyclean: clean

clean:
	rm -rf $(CLEAN) $(BUILT_DIST) $(DISTDIR).tar.gz \
	  *.aux *.log *.pdf *.dvi *.ps \
	  chktex HTML rme chktest

distclean: clean
	rm -rf $(CONFIG_DIST) *.cache *.status *.log *.tar.gz \
	  deweb Makefile autom4te.cache config.h

maintainer-clean: distclean
	rm -rf *.rme install-sh config.guess config.sub aclocal.m4 \
	  configure missing rmeheader stamp-h mkinstalldirs tags

dvi: ChkTeX.dvi

pdf: ChkTeX.pdf

ifneq ($(LATEX2HTML),)
html: ChkTeX.tex MakeHTML.pl
	-rm -r HTML
	$(MKDIR_P) HTML
	$(PERL5) $(srcdir)/MakeHTML.pl ChkTeX.tex > HTML/ChkTeX.tex
	cd HTML; $(LATEX2HTML) ChkTeX.tex
	$(PERL5) -i -pe 's%</code> %</code>%gi;s%\s+([.,?!])%$$1%g;' HTML/ChkTeX/*.html

README: ChkTeX.tex rmeheader MakeHTML.pl
	rm -rf rme
	$(MKDIR_P) rme
	$(PERL5) $(srcdir)/MakeHTML.pl ChkTeX.tex > rme/ChkTeX.tex
	cd rme; $(LATEX2HTML) -split 0 ChkTeX.tex
	$(PERL5) -i -pe 's%L<SUP><SMALL>A</SMALL></SUP>%La%g;s%T<SMALL>E</SMALL>X%TeX%g;s%<SUB>(.*)</SUB>%$$1%g' rme/ChkTeX/*.html
	$(PERL5) -i -pe 's%</code> %</code>%gi;s%\s+([.,?!])%$$1%g;' rme/ChkTeX/*.html
	$(LYNX) -dump rme/ChkTeX/ChkTeX.html > rme/ChkTeX.rme
	cp rmeheader 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;' rme/ChkTeX.rme >> README
	rm -rf rme
else
html README:
	@echo "latex2html is unavailable on this system, cant create target $@."; exit 1
endif

###################### AUTOCONF REMAKING ################################

$(srcdir)/configure: configure.in aclocal.m4
	cd $(srcdir) && autoconf

#autoheader might not change config.h.in, so touch a stamp file.
$(srcdir)/config.h.in: stamp-h.in
$(srcdir)/stamp-h.in: configure.in aclocal.m4
	cd $(srcdir) && autoheader
	echo timestamp > $(srcdir)/stamp-h.in

config.h: stamp-h
stamp-h: config.h.in config.status
	./config.status

ChkTeX.tex: ChkTeX.tex.in
	./config.status ChkTeX.tex

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

config.status: configure
	./config.status --recheck

###################### INDIVIDUAL DEPENDENCIES ##########################

%.doc: %.1
	$(GROFF) $< > $@

ChkTeX.dvi: ChkTeX.tex
ifdef LATEX
	$(LATEX) ChkTeX.tex
else
	echo "No latex program found by configure"
	false
endif

ChkTeX.ps: ChkTeX.dvi
	$(DVIPS) -o ChkTeX.ps ChkTeX.dvi

ChkTeX.pdf: ChkTeX.ps
	$(PS2PDF) $< $@

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\
Length: %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
	for file in $(CSOURCES); do gcov $(GCOVOPTS) $$file; done