tests: reenable "make -C tests ..." commands
[platform/upstream/coreutils.git] / Makefile.am
1 # Make coreutils.                                       -*-Makefile-*-
2
3 # Copyright (C) 1990-2012 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 = po . gnulib-tests
21
22 changelog_etc =                         \
23   ChangeLog-2005                        \
24   ChangeLog-2006                        \
25   ChangeLog-2007                        \
26   ChangeLog-2008                        \
27   build-aux/ChangeLog-2007              \
28   doc/ChangeLog-2007                    \
29   lib/ChangeLog-2007                    \
30   m4/ChangeLog-2007                     \
31   old/fileutils/ChangeLog               \
32   old/fileutils/ChangeLog-1997          \
33   old/fileutils/NEWS                    \
34   old/sh-utils/ChangeLog                \
35   old/sh-utils/ChangeLog.0              \
36   old/sh-utils/NEWS                     \
37   old/textutils/ChangeLog               \
38   old/textutils/NEWS                    \
39   po/ChangeLog-2007
40
41 EXTRA_DIST =                            \
42   $(changelog_etc)                      \
43   .mailmap                              \
44   .prev-version                         \
45   .version                              \
46   .vg-suppressions                      \
47   THANKS.in                             \
48   THANKS-to-translators                 \
49   THANKStt.in                           \
50   bootstrap                             \
51   bootstrap.conf                        \
52   build-aux/gen-lists-of-programs.sh    \
53   cfg.mk                                \
54   dist-check.mk                         \
55   maint.mk                              \
56   tests/GNUmakefile                     \
57   thanks-gen
58
59 gen_progs_lists = $(top_srcdir)/build-aux/gen-lists-of-programs.sh
60
61 # Keep these in sync with bootstrap.conf:bootstrap_post_import_hook().
62 # Use '$(top_srcdir)/m4' and '$(srcdir)/src' for the benefit of non-GNU
63 # makes: it is with those directories that 'cu-progs.m4' and 'cu-progs.mk'
64 # appear in our dependencies.
65 $(top_srcdir)/m4/cu-progs.m4: $(gen_progs_lists)
66         $(AM_V_GEN)rm -f $@ $@-t \
67           && $(SHELL) $(gen_progs_lists) --autoconf >$@-t \
68           && chmod a-w $@-t && mv -f $@-t $@
69 $(srcdir)/src/cu-progs.mk: $(gen_progs_lists)
70         $(AM_V_GEN)rm -f $@ $@-t \
71           && $(SHELL) $(gen_progs_lists) --automake >$@-t \
72           && chmod a-w $@-t && mv -f $@-t $@
73
74 ACLOCAL_AMFLAGS = -I m4
75
76 # Shortcut targets to make it easier to run (very) expensive tests.
77 check-expensive:
78         $(MAKE) check RUN_EXPENSIVE_TESTS=yes
79 check-very-expensive:
80         $(MAKE) check-expensive RUN_VERY_EXPENSIVE_TESTS=yes
81
82 # Just prior to distribution, ...
83 # transform the automake-generated rule that runs 'rm -f rm'.
84 # On some systems, that command would fail with a diagnostic like
85 # "rm: cannot unlink 'rm': Text file busy" when '.' appears so early
86 # in the shell's search path that running 'rm' would run the 'rm'
87 # executable in the current directory.
88 # Similarly, adjust the clean-binPROGRAMS rule.
89 rm_subst = \
90   s!(rm -f (rm\b|\$$\(bin_PROGRAMS\)$$))!$$1 > /dev/null 2>&1 || /bin/$$1!
91
92 BUILT_SOURCES = .version
93 .version:
94         $(AM_V_GEN)echo $(VERSION) > $@-t && mv $@-t $@
95
96 # In general, we run help2man to build a man page from the binary's --help
97 # output, but when building from a just-unpacked distribution tarball, we
98 # must not do that, since help2man uses perl.  We don't want to depend on
99 # perl in that case.  In general, the .1 file does indeed depend on the
100 # binary.  I.e., for cat, we have this Makefile dependency:
101 #   man/cat.1: src/cat
102 # That means that once we build src/cat, we would trigger the .x.1
103 # rule which runs help2man.  The trick is simply to change the RHS to
104 # "src/cat.c" in the $(distdir) that we're about to tar and compress.
105 # Also handle the three exceptions corresponding to the three binaries
106 # for which there is no like-named .c file: dir, vdir, ginstall.
107 .PHONY: do-not-require-help2man
108 do-not-require-help2man:
109         perl -pi -e 's,^(man/.+?\.1:\s*src/.+?)$$,$$1.c,;'              \
110             -e  's,^(man/.+?\.1:\s*src)/ginstall\.c$$,$$1/install.c,;'  \
111             -e  's,^(man/.+?\.1:\s*src)/v?dir\.c$$,$$1/ls.c,;'          \
112           $(distdir)/Makefile.in
113
114 # Arrange so that .tarball-version appears only in the distribution
115 # tarball, and never in a checked-out repository.
116 # The perl substitution is to change some key uses of "rm" to "/bin/rm".
117 # See the rm_subst comment for details.
118 dist-hook: gen-ChangeLog do-not-require-help2man
119         $(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
120         $(AM_V_at)perl -pi -e '$(rm_subst)' $(distdir)/Makefile.in
121
122 gen_start_date = 2008-02-08
123 .PHONY: gen-ChangeLog
124 gen-ChangeLog:
125         $(AM_V_GEN)if test -d .git; then                                \
126           $(top_srcdir)/build-aux/gitlog-to-changelog                   \
127             --amend=$(srcdir)/build-aux/git-log-fix                     \
128             --since=$(gen_start_date) > $(distdir)/cl-t;                \
129           rm -f $(distdir)/ChangeLog;                                   \
130           mv $(distdir)/cl-t $(distdir)/ChangeLog;                      \
131         fi
132
133 ALL_RECURSIVE_TARGETS += distcheck-hook
134 distcheck-hook: check-ls-dircolors
135         $(MAKE) my-distcheck
136         $(MAKE) taint-distcheck
137
138 DISTCLEANFILES = VERSION
139 MAINTAINERCLEANFILES = THANKS-to-translators
140 THANKS-to-translators: po/LINGUAS THANKStt.in
141         $(AM_V_GEN)(                                                    \
142           cat $(srcdir)/THANKStt.in;                                    \
143           for lang in `cat $(srcdir)/po/LINGUAS`; do                    \
144             echo http://translationproject.org/team/$$lang.html;        \
145           done;                                                         \
146         ) > $@-tmp && mv $@-tmp $@
147
148 # Ensure that the sets of two-letter codes in ls.c and dircolors.c
149 # remain in sync.
150 .PHONY: check-ls-dircolors
151 check-ls-dircolors:
152         $(AM_V_GEN)dc=$$(sed -n '/static.*ls_codes\[/,/};'/p    \
153             $(srcdir)/src/dircolors.c                           \
154           |sed -n '/^  *"/p'|tr , '\n'|sed 's/^  *//'           \
155           |sed -n 's/^"\(..\)"/\1/p'|sort -u);                  \
156         ls=$$(sed -n '/static.*indicator_name\[/,/};'/\p        \
157             $(srcdir)/src/ls.c                                  \
158           |sed -n '/^  *"/p'|tr , '\n'|sed 's/^  *//'           \
159           |sed -n 's/^"\(..\)"/\1/p'|sort -u);                  \
160         test "$$dc" = "$$ls"
161
162 # Sort in traditional ASCII order, regardless of the current locale;
163 # otherwise we may get into trouble with distinct strings that the
164 # current locale considers to be equal.
165 ASSORT = LC_ALL=C sort
166
167 # Extract all lines up to the first one starting with "##".
168 prologue = perl -ne '/^\#\#/ and exit; print' $(srcdir)/THANKS.in
169
170 THANKS: THANKS.in Makefile.am .mailmap thanks-gen .version
171         $(AM_V_GEN)rm -f $@-t $@;                                       \
172         {                                                               \
173           $(prologue); echo;                                            \
174           { perl -ne '/^$$/.../^$$/ and print' $(srcdir)/THANKS.in      \
175               | grep -v '^$$' | perl -pe 's/  +/\0/';                   \
176             git log --pretty=format:'%aN%x00%aE'                        \
177               | $(ASSORT) -u;                                           \
178           } | $(srcdir)/thanks-gen                                      \
179             | LC_ALL=en_US.UTF-8 sort -f;                               \
180           echo;                                                         \
181           printf ';; %s\n' 'Local Variables:' 'coding: utf-8' End:;     \
182         } > $@-t && chmod a-w $@-t && mv $@-t $@
183
184 # Some of our git hook scripts are supposed to be identical to git's samples.
185 # See if they are still in sync.
186 .PHONY: check-git-hook-script-sync
187 check-git-hook-script-sync:
188         @fail=0;                                                        \
189         t=$$(mktemp -d)                                                 \
190           && cd $$t && git init -q && cd .git/hooks                     \
191           && for i in pre-commit pre-applypatch applypatch-msg; do      \
192                diff $(abs_top_srcdir)/scripts/git-hooks/$$i $$i.sample  \
193                  || fail=1;                                             \
194              done;                                                      \
195         rm -rf $$t;                                                     \
196         test $$fail = 0
197
198 noinst_LIBRARIES =
199 MOSTLYCLEANFILES =
200 CLEANFILES =
201 MOSTLYCLEANDIRS =
202
203 AM_CPPFLAGS = -Ilib -I$(top_srcdir)/lib -Isrc -I$(top_srcdir)/src
204
205 include $(top_srcdir)/lib/local.mk
206 include $(top_srcdir)/src/local.mk
207 include $(top_srcdir)/doc/local.mk
208 include $(top_srcdir)/man/local.mk
209 include $(top_srcdir)/tests/local.mk