tests: change copyright year from 2011 to 2012 in sample-test
[coreutils/ericb.git] / doc / Makefile.am
blob888048396513c804abb6d84213f99adeea3b7c1d
1 # Make coreutils documentation.                         -*-Makefile-*-
3 # Copyright (C) 1995-1998, 2001-2011 Free Software Foundation, Inc.
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 info_TEXINFOS = coreutils.texi
20 EXTRA_DIST = perm.texi parse-datetime.texi constants.texi fdl.texi
22 # The following is necessary if the package name is 8 characters or longer.
23 # If the info documentation would be split into 10 or more separate files,
24 # then this is necessary even if the package name is 7 characters long.
26 # Tell makeinfo to put everything in a single info file: <package>.info.
27 # Otherwise, it would also generate files with names like <package>.info-[123],
28 # and those names all map to one 14-byte name (<package>.info-) on some crufty
29 # old systems.
30 AM_MAKEINFOFLAGS = --no-split
32 constants.texi: $(top_srcdir)/src/tail.c $(top_srcdir)/src/shred.c
33         $(AM_V_GEN)LC_ALL=C; export LC_ALL; \
34         { sed -n -e 's/^#define \(DEFAULT_MAX[_A-Z]*\) \(.*\)/@set \1 \2/p' \
35             $(top_srcdir)/src/tail.c && \
36           sed -n -e \
37               's/.*\(DEFAULT_PASSES\)[ =]* \([0-9]*\).*/@set SHRED_\1 \2/p'\
38             $(top_srcdir)/src/shred.c; } > t-$@ \
39           && mv t-$@ $@
41 MAINTAINERCLEANFILES = constants.texi
43 $(DVIS): $(EXTRA_DIST)
44 $(INFO_DEPS): $(EXTRA_DIST)
46 # Extended regular expressions to match word starts and ends.
47 _W = (^|[^A-Za-z0-9_])
48 W_ = ([^A-Za-z0-9_]|$$)
50 syntax_checks =         \
51   sc-avoid-builtin      \
52   sc-avoid-io           \
53   sc-avoid-non-zero     \
54   sc-avoid-path         \
55   sc-avoid-timezone     \
56   sc-avoid-zeroes       \
57   sc-exponent-grouping  \
58   sc-lower-case-var     \
59   sc-use-small-caps-NUL
61 .PHONY: $(syntax_checks) check-texinfo
63 # List words/regexps here that should not appear in the texinfo documentation.
64 BAD_POSIX_PERL = /\bPOSIX\b/ && !/\@acronym{POSIX}/ && !/^\* / || /{posix}/
65 check-texinfo: $(syntax_checks)
66         $(AM_V_GEN)fail=0;                                              \
67         grep '@url{' $(srcdir)/*.texi && fail=1;                        \
68         grep '\$$@"' $(srcdir)/*.texi && fail=1;                        \
69         grep -n '[^[:punct:]]@footnote' $(srcdir)/*.texi && fail=1;     \
70         grep -n filename $(srcdir)/*.texi                               \
71             | $(EGREP) -v 'setfilename|[{]filename[}]'                  \
72           && fail=1;                                                    \
73         $(PERL) -e 1 2> /dev/null && { $(PERL) -ne                      \
74           '$(BAD_POSIX_PERL) and print,exit 1'                          \
75           $(srcdir)/*.texi 2> /dev/null || fail=1; };                   \
76         exit $$fail
78 sc-avoid-builtin:
79         $(AM_V_GEN)$(EGREP) -i '$(_W)builtins?$(W_)' $(srcdir)/*.texi   \
80           && exit 1 || :
82 sc-avoid-path:
83         $(AM_V_GEN)fail=0;                                              \
84         $(EGREP) -i '$(_W)path(name)?s?$(W_)' $(srcdir)/*.texi          \
85           | $(EGREP) -v                                                 \
86           'PATH=|path search|search path|@vindex PATH$$|@env[{]PATH[}]' \
87           && fail=1;                                                    \
88         exit $$fail
90 # Use `time zone', not `timezone'.
91 sc-avoid-timezone:
92         $(AM_V_GEN)$(EGREP) timezone $(srcdir)/*.texi && exit 1 || :
94 # Check for insufficient exponent grouping, e.g.,
95 # @math{2^64} should be @math{2^{64}}.
96 sc-exponent-grouping:
97         $(AM_V_GEN)$(EGREP) '\{.*\^[0-9][0-9]' $(srcdir)/*.texi && exit 1 || :
99 # E.g., use @sc{nul}, not NUL.
100 sc-use-small-caps-NUL:
101         $(AM_V_GEN)$(EGREP) '$(_W)NUL$(W_)' $(srcdir)/*.texi && exit 1 || :
103 # Say I/O, not IO.
104 sc-avoid-io:
105         $(AM_V_GEN)$(EGREP) '$(_W)IO$(W_)' $(srcdir)/*.texi && exit 1 || :
107 # I prefer nonzero over non-zero.
108 sc-avoid-non-zero:
109         $(AM_V_GEN)$(EGREP) non-zero $(srcdir)/*.texi && exit 1 || :
111 # Use `zeros', not `zeroes' (nothing wrong with `zeroes'. just be consistent).
112 sc-avoid-zeroes:
113         $(AM_V_GEN)$(EGREP) -i '$(_W)zeroes$(W_)' $(srcdir)/*.texi \
114           && exit 1 || :
116 # ME = $(subdir)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
117 ME = doc/Makefile
119 # The quantity inside @var{...} should not contain upper case letters.
120 # The leading backslash exemption is to permit in-macro uses like
121 # @var{\varName\} where the upper case letter is part of a parameter name.
122 find_upper_case_var =           \
123   '/\@var{/ or next;            \
124    while (/\@var{(.+?)}/g)      \
125      {                          \
126        $$v = $$1;               \
127        $$v =~ /[A-Z]/ && $$v !~ /^\\/ and (print "$$ARGV:$$.:$$_"), $$m = 1 \
128      }                          \
129    END {$$m and (warn "$(ME): do not use upper case in \@var{...}\n"), exit 1}'
130 sc-lower-case-var:
131         $(AM_V_GEN)$(PERL) -e 1 || { echo $@: skipping test; exit 0; }; \
132           $(PERL) -lne $(find_upper_case_var) $(srcdir)/*.texi
134 check: check-texinfo