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