build: update gnulib submodule to latest
[platform/upstream/coreutils.git] / Makefile.am
1 # Make coreutils.                                       -*-Makefile-*-
2
3 # Copyright (C) 1990, 1993-2011 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_bindtextdomain                  \
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_always-defined_macros  \
51   .x-sc_prohibit_atoi_atof              \
52   .x-sc_prohibit_empty_lines_at_EOF     \
53   .x-sc_prohibit_fail_0                 \
54   .x-sc_prohibit_magic_number_exit      \
55   .x-sc_prohibit_stat_st_blocks         \
56   .x-sc_prohibit_strcmp                 \
57   .x-sc_prohibit_tab_based_indentation  \
58   .x-sc_require_config_h                \
59   .x-sc_require_config_h_first          \
60   .x-sc_space_tab                       \
61   .x-sc_sun_os_names                    \
62   .x-sc_system_h_headers                \
63   .x-sc_trailing_blank                  \
64   .x-sc_prohibit_always_true_header_tests \
65   .x-sc_unmarked_diagnostics            \
66   .x-sc_useless_cpp_parens
67
68 EXTRA_DIST =                            \
69   $(changelog_etc)                      \
70   $(syntax_check_exceptions)            \
71   .mailmap                              \
72   .prev-version                         \
73   .version                              \
74   .vg-suppressions                      \
75   THANKS.in                             \
76   THANKS-to-translators                 \
77   THANKStt.in                           \
78   bootstrap                             \
79   bootstrap.conf                        \
80   build-aux/cvsu                        \
81   cfg.mk                                \
82   dist-check.mk                         \
83   gl/modules/getloadavg.diff            \
84   maint.mk                              \
85   thanks-gen
86
87 ALL_RECURSIVE_TARGETS += install-root
88 install-root:
89         cd src && $(MAKE) $@
90
91 ACLOCAL_AMFLAGS = -I m4
92
93 # Some tests always need root privileges, others need them only sometimes.
94 ALL_RECURSIVE_TARGETS += check-root
95 check-root:
96         cd tests && $(MAKE) $@ SUBDIRS=
97
98 # Just prior to distribution, ...
99 # transform the automake-generated rule that runs `rm -f rm'.
100 # On some systems, that command would fail with a diagnostic like
101 # `rm: cannot unlink `rm': Text file busy' when `.' appears so early
102 # in the shell's search path that running `rm' would run the `rm'
103 # executable in the current directory.
104 # Similarly, adjust the clean-binPROGRAMS rule.
105 rm_subst = \
106   s!(rm -f (rm\b|\$$\(bin_PROGRAMS\)$$))!$$1 > /dev/null 2>&1 || /bin/$$1!
107
108 BUILT_SOURCES = .version
109 .version:
110         $(AM_V_GEN)echo $(VERSION) > $@-t && mv $@-t $@
111
112 # Arrange so that .tarball-version appears only in the distribution
113 # tarball, and never in a checked-out repository.
114 # The perl substitution is to change some key uses of "rm" to "/bin/rm".
115 # See the rm_subst comment for details.
116 dist-hook: gen-ChangeLog
117         $(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
118         $(AM_V_at)perl -pi -e '$(rm_subst)' $(distdir)/src/Makefile.in
119
120 gen_start_date = 2008-02-08
121 .PHONY: gen-ChangeLog
122 gen-ChangeLog:
123         $(AM_V_GEN)if test -d .git; then                                \
124           $(top_srcdir)/build-aux/gitlog-to-changelog                   \
125             --since=$(gen_start_date) > $(distdir)/cl-t;                \
126           rm -f $(distdir)/ChangeLog;                                   \
127           mv $(distdir)/cl-t $(distdir)/ChangeLog;                      \
128         fi
129
130 ALL_RECURSIVE_TARGETS += distcheck-hook
131 distcheck-hook: check-ls-dircolors
132         $(MAKE) my-distcheck
133         $(MAKE) taint-distcheck
134
135 DISTCLEANFILES = VERSION
136 MAINTAINERCLEANFILES = THANKS-to-translators
137 THANKS-to-translators: po/LINGUAS THANKStt.in
138         $(AM_V_GEN)(                                                    \
139           cat $(srcdir)/THANKStt.in;                                    \
140           for lang in `cat $(srcdir)/po/LINGUAS`; do                    \
141             echo http://translationproject.org/team/$$lang.html;        \
142           done;                                                         \
143         ) > $@-tmp && mv $@-tmp $@
144
145 # Ensure that the sets of two-letter codes in ls.c and dircolors.c
146 # remain in sync.
147 .PHONY: check-ls-dircolors
148 check-ls-dircolors:
149         $(AM_V_GEN)dc=$$(sed -n '/static.*ls_codes\[/,/};'/p    \
150             $(srcdir)/src/dircolors.c                           \
151           |sed -n '/^  *"/p'|tr , '\n'|sed 's/^  *//'           \
152           |sed -n 's/^"\(..\)"/\1/p'|sort -u);                  \
153         ls=$$(sed -n '/static.*indicator_name\[/,/};'/\p        \
154             $(srcdir)/src/ls.c                                  \
155           |sed -n '/^  *"/p'|tr , '\n'|sed 's/^  *//'           \
156           |sed -n 's/^"\(..\)"/\1/p'|sort -u);                  \
157         test "$$dc" = "$$ls"
158
159 # Sort in traditional ASCII order, regardless of the current locale;
160 # otherwise we may get into trouble with distinct strings that the
161 # current locale considers to be equal.
162 ASSORT = LC_ALL=C sort
163
164 # Extract all lines up to the first one starting with "##".
165 prologue = perl -ne '/^\#\#/ and exit; print' $(srcdir)/THANKS.in
166
167 THANKS: THANKS.in Makefile.am .mailmap thanks-gen .version
168         $(AM_V_GEN)                                                     \
169         {                                                               \
170           $(prologue); echo;                                            \
171           { perl -ne '/^$$/.../^$$/ and print' $(srcdir)/THANKS.in      \
172               | grep -v '^$$' | perl -pe 's/  +/\0/';                   \
173             git log --pretty=format:'%aN%x00%aE'                        \
174               | $(ASSORT) -u;                                           \
175           } | $(srcdir)/thanks-gen                                      \
176             | LC_ALL=en_US.UTF-8 sort -f;                               \
177           echo;                                                         \
178           printf ';; %s\n' 'Local Variables:' 'coding: utf-8' End:;     \
179         } > $@-t && mv $@-t $@