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