b45d70e095e5c8b08884fbcc84d2ff836fa243e8
[debian/tar] / doc / Makefile.am
1 # Makefile for GNU tar documentation.
2
3 # Copyright 1994-1997, 1999-2001, 2003, 2006-2007, 2013 Free Software
4 # Foundation, Inc.
5
6 # This file is part of GNU tar.
7
8 # GNU tar is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
12
13 # GNU tar is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17
18 # You should have received a copy of the GNU General Public License
19 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
21 info_TEXINFOS = tar.texi
22 tar_TEXINFOS = \
23  dumpdir.texi\
24  tar-snapshot-edit.texi\
25  fdl.texi\
26  freemanuals.texi\
27  genfile.texi\
28  header.texi\
29  intern.texi\
30  parse-datetime.texi\
31  rendition.texi\
32  snapshot.texi\
33  sparse.texi\
34  value.texi
35 EXTRA_DIST = gendocs_template mastermenu.el texify.sed untabify.el
36
37 # The rendering level is anyone of PUBLISH, DISTRIB or PROOF.
38 # Just call 'make RENDITION=PROOF [target]' if you want PROOF rendition.
39 RENDITION = DISTRIB
40
41 MAKEINFOFLAGS=-D$(RENDITION)
42
43 header.texi: $(top_srcdir)/src/tar.h
44         sed -f $(srcdir)/texify.sed $(top_srcdir)/src/tar.h \
45           | expand >$@
46
47 master-menu: $(tar_TEXINFOS)
48         emacs -batch -l mastermenu.el -f make-master-menu $(info_TEXINFOS)
49
50 untabify:
51         emacs -batch -l untabify.el $(info_TEXINFOS) $(tar_TEXINFOS)
52
53 final: untabify master-menu
54
55 # Checking
56 check-format:
57         @if test -n "`cat $(info_TEXINFOS) $(tar_TEXINFOS) | tr -d -c '\t'`"; then \
58                 echo "Sources contain tabs; run make untabify"; \
59                 false; \
60         fi
61
62 check-options:
63         @ARGP_HELP_FMT='usage-indent=0,short-opt-col=0,long-opt-col=0,doc-opt-col=0,opt-doc-col=0,header-col=0,rmargin=1' \
64         $(top_builddir)/src/tar --usage | \
65         sed -n 's/^\[--\([^]\=\[]*\).*/\1/p' | sort | uniq > opts.$$$$;\
66         $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) -E - \
67             $(info_TEXINFOS) | \
68         sed -n '/^@macro/,/^@end macro/d;s/@opindex *\([^@,]*\).*/\1/p' \
69              | sort | uniq > docs.$$$$;\
70         status=0;\
71         join -v1 opts.$$$$ docs.$$$$ > report.$$$$;\
72         if test -s report.$$$$; then \
73           echo 'Not documented options:'; \
74           cat report.$$$$; \
75           status=1; \
76         fi; \
77         join -v2 opts.$$$$ docs.$$$$ > report.$$$$;\
78         if test -s report.$$$$; then \
79           echo 'Non-existing options:';\
80           cat report.$$$$; \
81           status=1; \
82         fi; \
83         rm opts.$$$$ docs.$$$$ report.$$$$;\
84         test $$status -ne 0 && exit $$status
85
86 check-refs:
87         @for file in $(info_TEXINFOS) $(tar_TEXINFOS); \
88         do \
89           sed -e = $$file | \
90            sed -n 'N;/@FIXME-.*ref/{s/\(^[0-9][0-9]*\).*@FIXME-.*ref{\([^}]*\).*/'$$file':\1: \2/gp}'; \
91         done > $@-t; \
92         if [ -s $@-t ]; then \
93           echo "Unresolved cross-references:"; \
94           cat $@-t;\
95           rm $@-t; \
96         else \
97           rm -f $@-t; \
98         fi
99
100 check-fixmes:
101         @for file in $(info_TEXINFOS); \
102         do \
103           sed -e = $$file | \
104            sed -n 'N;/@FIXME{/{s/\(^[0-9][0-9]*\).*@FIXME{\([^}]*\).*/'$$file':\1: \2/gp}'; \
105         done > $@-t; \
106         if [ -s $@-t ]; then \
107           echo "Unresolved FIXMEs:"; \
108           cat $@-t; \
109           rm $@-t; \
110           false; \
111         else \
112           rm -f $@-t; \
113         fi
114
115 check-unrevised:
116         @grep -Hn @UNREVISED $(info_TEXINFOS) > $@-t; \
117         if [ -s $@-t ]; then \
118           echo "Unrevised nodes:"; \
119           cat $@-t; \
120           rm $@-t; \
121           false;\
122         else \
123           rm $@-t; \
124         fi
125
126 all-check-docs: check-format check-options check-refs check-fixmes check-unrevised
127
128 check-docs:
129         $(MAKE) -k all-check-docs
130
131 #
132
133 clean-local:
134         rm -rf manual
135
136 GENDOCS=gendocs.sh
137
138 TEXI2DVI=texi2dvi -t '@set $(RENDITION)' -E
139
140 # Make sure you set TEXINPUTS
141 # Usual value is:
142 # /usr/share/texmf/pdftex/plain/misc:/usr/share/texmf/pdftex/config
143 manual:
144         TEXINPUTS=$(srcdir):$(top_srcdir)/build-tex:$(TEXINPUTS) \
145          MAKEINFO="$(MAKEINFO) $(MAKEINFOFLAGS)" \
146          TEXI2DVI="$(TEXI2DVI) -t @finalout" \
147         $(GENDOCS) --texi2html tar 'GNU tar manual'