Makefile.am 11.5 KB
Newer Older
1
# $Id: Makefile.am,v 1.62 2003/10/06 08:28:18 ceder Exp $
Per Cederqvist's avatar
Per Cederqvist committed
2
# Copyright (C) 1998-1999, 2001-2002  Lysator Academic Computer Association.
Per Cederqvist's avatar
Per Cederqvist committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#
# This file is part of the LysKOM server.
# 
# LysKOM 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 1, or (at your option) 
# any later version.
# 
# LysKOM 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 LysKOM; see the file COPYING.  If not, write to
# Lysator, c/o ISY, Linkoping University, S-581 83 Linkoping, SWEDEN,
# or the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, 
# MA 02139, USA.
#
Per Cederqvist's avatar
Per Cederqvist committed
22
# Please report bugs at http://bugzilla.lysator.liu.se/. 
Per Cederqvist's avatar
Per Cederqvist committed
23 24
#

25
include $(top_srcdir)/scripts/common.make
Per Cederqvist's avatar
Per Cederqvist committed
26

Per Cederqvist's avatar
Per Cederqvist committed
27 28
SUBDIRS = man

29
info_TEXINFOS = Protocol-A.texi lyskomd.texi
30

31 32 33
MOSTLYCLEANFILES = Protocol-A.notab lyskomd.notab *.tmp \
    protocol-a.texi protocol-a.aux protocol-a.fns protocol-a.log \
    protocol-a.toc protocol-a.am protocol-a.cp protocol-a.fn \
34 35
    protocol-a.ky protocol-a.pg protocol-a.tp protocol-a.vr \
    Protocol-A.dvi
36

37 38
DISTCLEANFILES = Protocol-A.pdf protocol-a-current.txt \
	protocol-a-recommended.txt protocol-a-full.txt
39

40
EXTRA_DIST = \
Per Cederqvist's avatar
Per Cederqvist committed
41
	IDEAS \
42 43
	checkargs.py \
	cmsltt12.mf \
44 45
	constructs.expected \
	filterlines.py \
46
	kom-style.el \
47
	tac.py
48

Per Cederqvist's avatar
Per Cederqvist committed
49 50 51 52
# Automake does not yet support these targets automatically.
pdf: Protocol-A.pdf
html: protocol-a/index.html protocol-a.html

53 54 55
# Automake tries to generate this rule automatically, but it fails
# because of the capital letters in the file name of the source file.
protocol-a.info: Protocol-A.texi
56 57 58
	$(RM) $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]
	$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
	 -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
59

Per Cederqvist's avatar
Per Cederqvist committed
60 61 62 63 64 65 66
# The TeX implementation cannot cope with Protocol-A.texi.  We use too
# many macros in too complex ways.  But if we expand a few of them
# with a simple sed-script, texinfo.tex will do a fair job.
# Unfortunately, this means that the automake magic fails, so we
# disable it with a explicit targets for the dvi and pdf output.

Protocol-A.dvi: protocol-a.texi
67
	TEXINPUTS="$(top_srcdir)/scripts:$$TEXINPUTS" \
Per Cederqvist's avatar
Per Cederqvist committed
68 69 70 71 72
	MAKEINFO='makeinfo -I .' \
	texi2dvi protocol-a.texi
	mv protocol-a.dvi $@

Protocol-A.pdf: protocol-a.texi
73
	TEXINPUTS="$(top_srcdir)/scripts:$$TEXINPUTS" \
Per Cederqvist's avatar
Per Cederqvist committed
74 75 76 77 78 79 80 81 82 83
	MAKEINFO='makeinfo -I .' \
	texi2dvi --pdf protocol-a.texi
	mv protocol-a.pdf $@

protocol-a.texi: Protocol-A.texi
	## This sed script works with texinfo.tex version 2002-03-26.08.
	## With any luck, this could be replaced by a simple "cp" when
	## a future version of texinfo.tex is created.
	sed < $(srcdir)/Protocol-A.texi \
	    -e 's/@holl{\([^,]*\),\([^}]*\)}/\1H\2/g' \
84
	    -e 's/@value{IAM}/Inl@"agg @}t mig/g' \
Per Cederqvist's avatar
Per Cederqvist committed
85 86 87 88 89 90
	    -e 's/@lt{\([^}]*\)}/\1/g' \
	> $@.tmp
	chmod 444 $@.tmp
	$(RM) $@
	mv $@.tmp $@

91 92 93
SUFFIXES = .texi .notab

.texi.notab:
Per Cederqvist's avatar
Per Cederqvist committed
94 95
	## Mixing tabs and non-tabs may cause the info file to look
	## ugly.  Ban tabs.
96 97
	$(RM) $@
	if grep -n '	' $< /dev/null ; then echo tabs detected ; exit 1; fi
98
	$(AWK) 'length($0) > 79 {print FILENAME ":" NR ": too long line"; e=1}\
99
		END {exit(e)}' $<
100
	echo no tabs found > $@
101

Per Cederqvist's avatar
Per Cederqvist committed
102 103 104
protocol-a/index.html: Protocol-A.texi
	makeinfo --html $(srcdir)/Protocol-A.texi

105 106 107
protocol-a.html: Protocol-A.texi
	makeinfo --html --no-split $(srcdir)/Protocol-A.texi

108 109 110 111 112
# The stuff below is used to update the official WWW pages at
# http://www.lysator.liu.se/lyskom/protocol/
WWWROOT=/lysator/www/www-pages/html/lyskom/protocol
PROTOEDITION=`sed -n 's/^@set PROTOEDITION //p' < $(srcdir)/Protocol-A.texi`
WWWREV=$(WWWROOT)/$(PROTOEDITION)
Per Cederqvist's avatar
Per Cederqvist committed
113
update-www: protocol-a.info protocol-a.html protocol-a/index.html \
114
    Protocol-A.dvi Protocol-A.pdf protocol-a-full.txt
115
	cd $(WWWROOT) || false
Per Cederqvist's avatar
Per Cederqvist committed
116 117
	rm -rf $(WWWREV) \
		Protocol-A-$(PROTOEDITION)-info \
118 119
		$(WWWROOT)/Protocol-A-$(PROTOEDITION)-info.tar \
		$(WWWROOT)/Protocol-A-$(PROTOEDITION)-info.tar.gz
120
	mkdir $(WWWREV)
121 122 123 124 125
	mkdir Protocol-A-$(PROTOEDITION)-info
	cp protocol-a.info* Protocol-A-$(PROTOEDITION)-info
	tar cvf $(WWWROOT)/Protocol-A-$(PROTOEDITION)-info.tar \
	    Protocol-A-$(PROTOEDITION)-info
	echo Protocol-A-$(PROTOEDITION)-info.tar|(cd $(WWWROOT)&&xargs gzip -9)
126
	cp $(srcdir)/Protocol-A.texi $(WWWROOT)/Protocol-A-$(PROTOEDITION).texi
127
	rm -r Protocol-A-$(PROTOEDITION)-info
Per Cederqvist's avatar
Per Cederqvist committed
128 129
	cp Protocol-A.dvi $(WWWROOT)/Protocol-A-$(PROTOEDITION).dvi
	cp Protocol-A.pdf $(WWWROOT)/Protocol-A-$(PROTOEDITION).pdf
130
	ln -s ../Protocol-A-$(PROTOEDITION).texi $(WWWREV)/Protocol-A.texi
131
	cp protocol-a.html $(WWWREV)/protocol-a.html
Per Cederqvist's avatar
Per Cederqvist committed
132
	cp protocol-a/* $(WWWREV)/
133
	cp protocol-a-*.txt $(WWWREV)/
134 135
	echo "Don't forget to edit $(WWWROOT)/index.html"

Per Cederqvist's avatar
Per Cederqvist committed
136
check: check-doc pdf dvi
137

138 139 140
protocol-a-full.txt: Protocol-A.texi checkargs.py
	$(MAKE) check-doc

141
check-doc: Protocol-A.notab lyskomd.notab info
142
if HAVE_PYTHON
143
	## Create a list of all aux-items.
144 145 146
	sed -n 's/[0-9][0-9]* : \([^ ]*\) (.*/\1/p' \
		$(top_srcdir)/run-support/aux-items.conf \
	| tee aux-items.tmp \
147
	| sed 's/.*/@aux{&}/' \
148
	| LANG=C LC_ALL=C LC_COLLATE=C LC_CTYPE=C sort \
149
	> aux-items-@.tmp
150
	##
151 152 153 154 155
	## Create a list of client-specific aux items.
	sed -n '/^@c BEGIN-EXTRA-AUX$$/,/^@c END-EXTRA-AUX$$/s/^@item \(.*\) \[[0-9]*\] (.*)$$/@aux{\1}/p' \
	< $(srcdir)/Protocol-A.texi \
	| LANG=C LC_ALL=C LC_COLLATE=C LC_CTYPE=C sort \
	> aux-items-extra-@.tmp
156
	##
157
	## Check for any overlap between the aux-item lists.
158
	$(PYTHON) $(srcdir)/filterlines.py aux-items-extra-@.tmp \
159
	< aux-items-@.tmp \
160
	| diff -c aux-items-@.tmp -
161
	##
162
	$(PYTHON) $(srcdir)/filterlines.py aux-items-@.tmp \
163 164
	< aux-items-extra-@.tmp \
	| diff -c aux-items-extra-@.tmp -
165
	##
166
	## Create a list of all requests.
Per Cederqvist's avatar
Per Cederqvist committed
167 168 169 170 171
	sed -e '/^#ifdef/,/^#endif/d' \
	    -e '/^#/d' \
	    -e '/^$$/d' \
	< $(top_srcdir)/src/server/fncdef.txt \
	| awk '{print $$1, $$3}' \
172
	| sed 's/_/-/g' \
173
	| tee requests-numbered.tmp \
Per Cederqvist's avatar
Per Cederqvist committed
174
	| awk '{print $$2}' \
175
	| tee requests.tmp \
176
	| sed 's/.*/@req{&}/' \
177
	> requests-@.tmp
178
	sed 's/.*/@reqlink{&}/' \
179
	< requests.tmp >> requests-@.tmp
180
	sed 's/.*/@reqdlink{&}/' \
181
	< requests.tmp >> requests-@.tmp
182
	##
183
	## Create a list of all async messages.
184 185 186
	sed -n -e '/^#if 0/,/^#endif/d' \
	       -e '/^#ifdef/,/^#endif/d' \
	       -e 's/[ 	]*ay_\([^ ]*\) = \([0-9]*\).*/\2 async_\1/p' \
187 188
	       $(top_srcdir)/src/server/async.h \
	| sed 's/_/-/g' \
189 190
	| tee asyncs-numbered.tmp \
	| awk '{print $$2}' \
191
	| tee asyncs.tmp \
192
	| sed 's/.*/@async{&}/' \
193
	> async-@.tmp
194
	sed 's/.*/@asynclink{&}/' \
195
	< asyncs.tmp >> async-@.tmp
196
	sed 's/.*/@asyncdlink{&}/' \
197
	< asyncs.tmp >> async-@.tmp
198
	##
199
	## Create a list of all miscinfos.
200 201
	cat $(top_srcdir)/src/include/kom-types.h \
	| sed -e '/^enum info_type {/,/};/!d' \
202
	| sed -n -e 's/ *\([^ ]*\)[ 	]*= *\([0-9]*\),.*/\2 \1/p' \
203 204
	| sed 's/_/-/g' \
	| grep -v unknown-info \
205 206
	| tee miscs-numbered.tmp \
	| sed 's/[0-9]* //' \
207
	| tee miscs.tmp \
208
	| sed 's/.*/@misc{&}/' \
209
	> miscs-@.tmp
210
	##
211
	## Create a list of all conf-type bits.
212
	$(PYTHON) $(srcdir)/tac.py < $(top_srcdir)/src/include/kom-types.h \
213 214 215 216 217 218
	| sed -e '/} Conf_type/,/typedef/!d' \
	| sed -n -e 's/.*unsigned int[ 	]*\([^ 	:]*\)[ 	]*:.*/\1/p' \
	| sed -e 's/_/-/g' \
	      -e 's/allow-anon/allow-anonymous/' \
	      -e 's/letter-box/letterbox/' \
	| tee conftypes.tmp \
219
	| sed 's/.*/@conftype{&}/' \
220
	> conftypes-@.tmp
221
	##
222 223 224
	## Create a list of all types.  We do this from the
	## documentation, and not the source, since the source has its
	## own funny names in a few places.
225 226
	sed -n 's/@tindex //p' < $(srcdir)/Protocol-A.texi \
	| tee types.tmp \
227
	| sed 's/.*/@type{&}/' \
228
	> types-@.tmp
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
	## Create a list of all error codes.
	cat $(top_srcdir)/src/include/kom-errno.h \
	| sed -n -e '/enum kom_err/,/};/!d' \
	         -e 's/ *KOM_\([A-Z_]*\) *= *\([0-9]*\),.*/\2 \1/p' \
	| tr '[A-Z]' '[a-z]' \
	| sed -e 's/_/-/g' \
	      -e 's/ not-impl$$/ not-implemented/' \
	      -e 's/ obsolete$$/ obsolete-call/' \
	      -e 's/ pwd$$/ invalid-password/' \
	      -e 's/ long-str$$/ string-too-long/' \
	      -e 's/ login$$/ login-first/' \
	      -e 's/ conf-zero$$/ conference-zero/' \
	      -e 's/ undef-conf$$/ undefined-conference/' \
	      -e 's/ undef-pers$$/ undefined-person/' \
	      -e 's/ access$$/ access-denied/' \
	      -e 's/ perm$$/ permission-denied/' \
	      -e 's/ conf-exists$$/ conference-exists/' \
	      -e 's/ pers-exists$$/ person-exists/' \
	      -e 's/ letter-box$$/ letterbox/' \
	      -e 's/ ldb-err$$/ ldb-error/' \
	      -e 's/ ill-misc$$/ illegal-misc/' \
	      -e 's/ comm-limit$$/ comment-limit/' \
	      -e 's/ foot-limit$$/ footnote-limit/' \
	      -e 's/ undef-session$$/ undefined-session/' \
	      -e 's/ tempfail$$/ temporary-failure/' \
	      -e 's/ anon-rejected$$/ anonymous-rejected/' \
256 257
	      -e 's/ ill-aux-tag$$/ illegal-aux-item-tag/' \
	      -e 's/ ill-aux-data$$/ illegal-aux-item-data/' \
258 259 260 261
	      -e 's/ aux-perm$$/ aux-item-permission/' \
	| tee errorcodes-numbered.tmp \
	| sed 's/[0-9]* //' \
	| tee errorcodes.tmp \
262
	| sed 's/.*/@errorcode{&}/' \
263
	> errorcodes-@.tmp
264
	##
265
	## Create a list of all privilege bits.
266
	$(PYTHON) $(srcdir)/tac.py < $(top_srcdir)/src/include/kom-types.h \
267 268
	| sed -n -e '/} Priv_bits;/,/typedef[ 	]struct/!d' \
	         -e 's/_/-/g' \
269
	         -e 's/.* int[ 	]\([-a-z0-9]*\)[ 	]*:.*/\1/p' \
270
	| tee privbits.tmp \
271
	| sed 's/.*/@priv{&}/' \
272
	> privbits-@.tmp
273
	##
274
	## Create a list of all @x{}-constructs used.
275 276
	sed -e '/@bye/,$$d' \
	    -e '/^@c /d' \
277 278 279 280 281 282 283 284
	    -e '/^@c$$/d' \
	    -e '/^@comment /d' \
	    -e '/^@macro /,/@end macro/d' \
	    -e 's/@{//g' \
	    -e 's/@}//g' \
	    -e "`echo s/@/\\\\  ;echo @/g`" \
	    $(srcdir)/Protocol-A.texi \
	| sed -n 's/\(@[^{}]*{[^}]*}\).*/\1/p' \
285 286
	| grep -v '^@holl{' \
	| grep -v '^@badspell{' \
287 288
	| LANG=C LC_ALL=C LC_COLLATE=C LC_CTYPE=C sort \
	| LANG=C LC_ALL=C LC_COLLATE=C LC_CTYPE=C uniq \
289
	> constructs.tmp
290
	##
291 292 293 294
	## Remove the expected stuff.  @rarg{} and @aarg{} constructs
	## are checked below, so ignore them here.  Various @ref
	## constructs are checked by makeinfo, so we ignore them as
	## well.  @t{} are not interresting.
295 296 297 298 299 300 301 302 303
	cat constructs.tmp \
	| grep -v '@rarg{' \
	| grep -v '@aarg{' \
	| grep -v '@ref{' \
	| grep -v '@xref{' \
	| grep -v '@pxref{' \
	| grep -v '@t{' \
	| grep -v '@footnote{' \
	| grep -v '@field{' \
304 305
	| grep -v '@anchor{' \
	| grep -v '@lt{' \
306
	| $(PYTHON) $(srcdir)/filterlines.py \
307
	    aux-items-@.tmp \
308
	    aux-items-extra-@.tmp \
309 310 311 312 313 314 315
	    requests-@.tmp \
	    types-@.tmp \
	    async-@.tmp \
	    miscs-@.tmp \
	    conftypes-@.tmp \
	    errorcodes-@.tmp \
	    privbits-@.tmp \
316
	> constructs-@.tmp
317 318 319 320
	## If the diff command below finds any differences, you have to
	## check that they are expected, and then manually update
	## constructs.expected.  Please be careful when you examine the
	## diff.
321
	diff -c $(srcdir)/constructs.expected constructs-@.tmp
322
	##
323 324
	## Check @rarg{} and @aarg{} constructs.  They are only allowed
	## to refer to named arguments of the call they are documenting.
325 326 327 328 329 330 331
	$(PYTHON) $(srcdir)/checkargs.py $(srcdir)/Protocol-A.texi
else
	@echo >&2
	@echo WARNING: no python interpreter was found by configure, so >&2
	@echo most documentation tests could not be run. >&2
	@echo >&2
endif
Per Cederqvist's avatar
Per Cederqvist committed
332 333 334 335 336 337 338 339 340 341 342

# The targets below are for the benefit of the Xenofarm automated 
# builds.  They provide information for the build summary.  See
# http://www.lysator.liu.se/lyskom/lyskom-server/xenofarm.html
ident-makeinfo:
	@echo '$$(MAKEINFO):' $(MAKEINFO)
	@-type makeinfo
	@echo Obtaining version:
	-makeinfo --version
	@echo Obtaining version:
	-$(MAKEINFO) --version