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