36e715d5e73d7f430a8ec5ce9b05a195d0d4235f
[platform/upstream/coreutils.git] / Makefile.am
1 # Make coreutils.                                       -*-Makefile-*-
2
3 # Copyright (C) 1990-2013 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 # Arrange so that .tarball-version appears only in the distribution
97 # tarball, and never in a checked-out repository.
98 # The perl substitution is to change some key uses of "rm" to "/bin/rm".
99 # See the rm_subst comment for details.
100 dist-hook: gen-ChangeLog
101         $(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
102         $(AM_V_at)perl -pi -e '$(rm_subst)' $(distdir)/Makefile.in
103
104 gen_start_date = 2008-02-08
105 .PHONY: gen-ChangeLog
106 gen-ChangeLog:
107         $(AM_V_GEN)if test -d .git; then                                \
108           $(top_srcdir)/build-aux/gitlog-to-changelog                   \
109             --amend=$(srcdir)/build-aux/git-log-fix                     \
110             --since=$(gen_start_date) > $(distdir)/cl-t;                \
111           rm -f $(distdir)/ChangeLog;                                   \
112           mv $(distdir)/cl-t $(distdir)/ChangeLog;                      \
113         fi
114
115 ALL_RECURSIVE_TARGETS += distcheck-hook
116 distcheck-hook: check-ls-dircolors
117         $(MAKE) my-distcheck
118         $(MAKE) taint-distcheck
119
120 DISTCLEANFILES = VERSION
121 MAINTAINERCLEANFILES = THANKS-to-translators
122 THANKS-to-translators: po/LINGUAS THANKStt.in
123         $(AM_V_GEN)(                                                    \
124           cat $(srcdir)/THANKStt.in;                                    \
125           for lang in `cat $(srcdir)/po/LINGUAS`; do                    \
126             echo http://translationproject.org/team/$$lang.html;        \
127           done;                                                         \
128         ) > $@-tmp && mv $@-tmp $@
129
130 # Ensure that the sets of two-letter codes in ls.c and dircolors.c
131 # remain in sync.
132 .PHONY: check-ls-dircolors
133 check-ls-dircolors:
134         $(AM_V_GEN)dc=$$(sed -n '/static.*ls_codes\[/,/};'/p    \
135             $(srcdir)/src/dircolors.c                           \
136           |sed -n '/^  *"/p'|tr , '\n'|sed 's/^  *//'           \
137           |sed -n 's/^"\(..\)"/\1/p'|sort -u);                  \
138         ls=$$(sed -n '/static.*indicator_name\[/,/};'/\p        \
139             $(srcdir)/src/ls.c                                  \
140           |sed -n '/^  *"/p'|tr , '\n'|sed 's/^  *//'           \
141           |sed -n 's/^"\(..\)"/\1/p'|sort -u);                  \
142         test "$$dc" = "$$ls"
143
144 # Sort in traditional ASCII order, regardless of the current locale;
145 # otherwise we may get into trouble with distinct strings that the
146 # current locale considers to be equal.
147 ASSORT = LC_ALL=C sort
148
149 # Extract all lines up to the first one starting with "##".
150 prologue = perl -ne '/^\#\#/ and exit; print' $(srcdir)/THANKS.in
151
152 THANKS: THANKS.in Makefile.am .mailmap thanks-gen .version
153         $(AM_V_GEN)rm -f $@-t $@;                                       \
154         {                                                               \
155           $(prologue); echo;                                            \
156           { perl -ne '/^$$/.../^$$/ and print' $(srcdir)/THANKS.in      \
157               | grep -v '^$$' | perl -pe 's/  +/\0/';                   \
158             git log --pretty=format:'%aN%x00%aE'                        \
159               | $(ASSORT) -u;                                           \
160           } | $(srcdir)/thanks-gen                                      \
161             | LC_ALL=en_US.UTF-8 sort -f;                               \
162           echo;                                                         \
163           printf ';; %s\n' 'Local Variables:' 'coding: utf-8' End:;     \
164         } > $@-t && chmod a-w $@-t && mv $@-t $@
165
166 # Some of our git hook scripts are supposed to be identical to git's samples.
167 # See if they are still in sync.
168 .PHONY: check-git-hook-script-sync
169 check-git-hook-script-sync:
170         @fail=0;                                                        \
171         t=$$(mktemp -d)                                                 \
172           && cd $$t && git init -q && cd .git/hooks                     \
173           && for i in pre-commit pre-applypatch applypatch-msg; do      \
174                diff $(abs_top_srcdir)/scripts/git-hooks/$$i $$i.sample  \
175                  || fail=1;                                             \
176              done;                                                      \
177         rm -rf $$t;                                                     \
178         test $$fail = 0
179
180 noinst_LIBRARIES =
181 MOSTLYCLEANFILES =
182 CLEANFILES =
183 MOSTLYCLEANDIRS =
184
185 AM_CPPFLAGS = -Ilib -I$(top_srcdir)/lib -Isrc -I$(top_srcdir)/src
186
187 include $(top_srcdir)/lib/local.mk
188 include $(top_srcdir)/src/local.mk
189 include $(top_srcdir)/doc/local.mk
190 include $(top_srcdir)/man/local.mk
191 include $(top_srcdir)/tests/local.mk