maint: extend the always_defined_macros syntax-check
[platform/upstream/coreutils.git] / Makefile.am
1 # Make coreutils.                                       -*-Makefile-*-
2
3 # Copyright (C) 1990, 1993-2010 Free Software Foundation, Inc.
4
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.
9
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.
14
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/>.
17
18 ALL_RECURSIVE_TARGETS =
19
20 SUBDIRS = lib src doc man po tests gnulib-tests
21
22 changelog_etc =                         \
23   ChangeLog-2005                        \
24   ChangeLog-2006                        \
25   ChangeLog-2007                        \
26   ChangeLog-2008                        \
27   build-aux/ChangeLog-2007              \
28   build-aux/update-copyright            \
29   doc/ChangeLog-2007                    \
30   lib/ChangeLog-2007                    \
31   m4/ChangeLog-2007                     \
32   old/fileutils/ChangeLog               \
33   old/fileutils/ChangeLog-1997          \
34   old/fileutils/NEWS                    \
35   old/sh-utils/ChangeLog                \
36   old/sh-utils/ChangeLog.0              \
37   old/sh-utils/NEWS                     \
38   old/textutils/ChangeLog               \
39   old/textutils/NEWS                    \
40   po/ChangeLog-2007
41
42 syntax_check_exceptions =               \
43   .x-sc_GPL_version                     \
44   .x-sc_always_defined_macros           \
45   .x-sc_error_message_uppercase         \
46   .x-sc_file_system                     \
47   .x-sc_obsolete_symbols                \
48   .x-sc_po_check                        \
49   .x-sc_program_name                    \
50   .x-sc_prohibit_atoi_atof              \
51   .x-sc_prohibit_empty_lines_at_EOF     \
52   .x-sc_prohibit_fail_0                 \
53   .x-sc_prohibit_magic_number_exit      \
54   .x-sc_prohibit_stat_st_blocks         \
55   .x-sc_prohibit_strcmp                 \
56   .x-sc_prohibit_tab_based_indentation  \
57   .x-sc_require_config_h                \
58   .x-sc_require_config_h_first          \
59   .x-sc_space_tab                       \
60   .x-sc_sun_os_names                    \
61   .x-sc_system_h_headers                \
62   .x-sc_trailing_blank                  \
63   .x-sc_prohibit_always_true_header_tests \
64   .x-sc_unmarked_diagnostics            \
65   .x-sc_useless_cpp_parens
66
67 EXTRA_DIST =                            \
68   $(changelog_etc)                      \
69   $(syntax_check_exceptions)            \
70   .prev-version                         \
71   .version                              \
72   .vg-suppressions                      \
73   THANKS-to-translators                 \
74   THANKStt.in                           \
75   bootstrap                             \
76   bootstrap.conf                        \
77   build-aux/cvsu                        \
78   cfg.mk                                \
79   dist-check.mk                         \
80   gl/modules/getloadavg.diff            \
81   maint.mk
82
83 ALL_RECURSIVE_TARGETS += install-root
84 install-root:
85         cd src && $(MAKE) $@
86
87 ACLOCAL_AMFLAGS = -I m4
88
89 # Some tests always need root privileges, others need them only sometimes.
90 ALL_RECURSIVE_TARGETS += check-root
91 check-root:
92         cd tests && $(MAKE) $@ SUBDIRS=
93
94 # Just prior to distribution, ...
95 # transform the automake-generated rule that runs `rm -f rm'.
96 # On some systems, that command would fail with a diagnostic like
97 # `rm: cannot unlink `rm': Text file busy' when `.' appears so early
98 # in the shell's search path that running `rm' would run the `rm'
99 # executable in the current directory.
100 # Similarly, adjust the clean-binPROGRAMS rule.
101 rm_subst = \
102   s!(rm -f (rm\b|\$$\(bin_PROGRAMS\)$$))!$$1 > /dev/null 2>&1 || /bin/$$1!
103
104 BUILT_SOURCES = .version
105 .version:
106         $(AM_V_GEN)echo $(VERSION) > $@-t && mv $@-t $@
107
108 # Arrange so that .tarball-version appears only in the distribution
109 # tarball, and never in a checked-out repository.
110 # The perl substitution is to change some key uses of "rm" to "/bin/rm".
111 # See the rm_subst comment for details.
112 dist-hook: gen-ChangeLog
113         $(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
114         $(AM_V_at)perl -pi -e '$(rm_subst)' $(distdir)/src/Makefile.in
115
116 gen_start_date = 2008-02-08
117 .PHONY: gen-ChangeLog
118 gen-ChangeLog:
119         $(AM_V_GEN)if test -d .git; then                                \
120           $(top_srcdir)/build-aux/gitlog-to-changelog                   \
121             --since=$(gen_start_date) > $(distdir)/cl-t;                \
122           rm -f $(distdir)/ChangeLog;                                   \
123           mv $(distdir)/cl-t $(distdir)/ChangeLog;                      \
124         fi
125
126 ALL_RECURSIVE_TARGETS += distcheck-hook
127 distcheck-hook: check-ls-dircolors
128         $(MAKE) my-distcheck
129         $(MAKE) taint-distcheck
130
131 DISTCLEANFILES = VERSION
132 MAINTAINERCLEANFILES = THANKS-to-translators
133 THANKS-to-translators: po/LINGUAS THANKStt.in
134         $(AM_V_GEN)(                                                    \
135           cat $(srcdir)/THANKStt.in;                                    \
136           for lang in `cat $(srcdir)/po/LINGUAS`; do                    \
137             echo http://translationproject.org/team/$$lang.html;        \
138           done;                                                         \
139         ) > $@-tmp && mv $@-tmp $@
140
141 # Ensure that the sets of two-letter codes in ls.c and dircolors.c
142 # remain in sync.
143 .PHONY: check-ls-dircolors
144 check-ls-dircolors:
145         $(AM_V_GEN)dc=$$(sed -n '/static.*ls_codes\[/,/};'/p    \
146             $(srcdir)/src/dircolors.c                           \
147           |sed -n '/^  *"/p'|tr , '\n'|sed 's/^  *//'           \
148           |sed -n 's/^"\(..\)"/\1/p'|sort -u);                  \
149         ls=$$(sed -n '/static.*indicator_name\[/,/};'/\p        \
150             $(srcdir)/src/ls.c                                  \
151           |sed -n '/^  *"/p'|tr , '\n'|sed 's/^  *//'           \
152           |sed -n 's/^"\(..\)"/\1/p'|sort -u);                  \
153         test "$$dc" = "$$ls"