maint: replace a use of strcpy in chmod.c with memcpy
[coreutils.git] / Makefile.am
blob72d93d5443414fad86e92ecff52311eebd2d0bb4
1 # Make coreutils.                                       -*-Makefile-*-
3 # Copyright (C) 1990-2012 Free Software Foundation, Inc.
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.
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.
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/>.
18 ALL_RECURSIVE_TARGETS =
20 SUBDIRS = lib src doc man po tests gnulib-tests
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
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
58 ALL_RECURSIVE_TARGETS += install-root
59 install-root:
60         cd src && $(MAKE) $@
62 ACLOCAL_AMFLAGS = -I m4
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=
69 # Shortcut targets to make it easier to run (very) expensive tests.
70 check-expensive:
71         $(MAKE) check RUN_EXPENSIVE_TESTS=yes
72 check-very-expensive:
73         $(MAKE) check-expensive RUN_VERY_EXPENSIVE_TESTS=yes
75 # Just prior to distribution, ...
76 # transform the automake-generated rule that runs 'rm -f rm'.
77 # On some systems, that command would fail with a diagnostic like
78 # "rm: cannot unlink 'rm': Text file busy" when '.' appears so early
79 # in the shell's search path that running 'rm' would run the 'rm'
80 # executable in the current directory.
81 # Similarly, adjust the clean-binPROGRAMS rule.
82 rm_subst = \
83   s!(rm -f (rm\b|\$$\(bin_PROGRAMS\)$$))!$$1 > /dev/null 2>&1 || /bin/$$1!
85 BUILT_SOURCES = .version
86 .version:
87         $(AM_V_GEN)echo $(VERSION) > $@-t && mv $@-t $@
89 # Arrange so that .tarball-version appears only in the distribution
90 # tarball, and never in a checked-out repository.
91 # The perl substitution is to change some key uses of "rm" to "/bin/rm".
92 # See the rm_subst comment for details.
93 dist-hook: gen-ChangeLog
94         $(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
95         $(AM_V_at)perl -pi -e '$(rm_subst)' $(distdir)/src/Makefile.in
97 gen_start_date = 2008-02-08
98 .PHONY: gen-ChangeLog
99 gen-ChangeLog:
100         $(AM_V_GEN)if test -d .git; then                                \
101           $(top_srcdir)/build-aux/gitlog-to-changelog                   \
102             --amend=$(srcdir)/build-aux/git-log-fix                     \
103             --since=$(gen_start_date) > $(distdir)/cl-t;                \
104           rm -f $(distdir)/ChangeLog;                                   \
105           mv $(distdir)/cl-t $(distdir)/ChangeLog;                      \
106         fi
108 ALL_RECURSIVE_TARGETS += distcheck-hook
109 distcheck-hook: check-ls-dircolors
110         $(MAKE) my-distcheck
111         $(MAKE) taint-distcheck
113 DISTCLEANFILES = VERSION
114 MAINTAINERCLEANFILES = THANKS-to-translators
115 THANKS-to-translators: po/LINGUAS THANKStt.in
116         $(AM_V_GEN)(                                                    \
117           cat $(srcdir)/THANKStt.in;                                    \
118           for lang in `cat $(srcdir)/po/LINGUAS`; do                    \
119             echo http://translationproject.org/team/$$lang.html;        \
120           done;                                                         \
121         ) > $@-tmp && mv $@-tmp $@
123 # Ensure that the sets of two-letter codes in ls.c and dircolors.c
124 # remain in sync.
125 .PHONY: check-ls-dircolors
126 check-ls-dircolors:
127         $(AM_V_GEN)dc=$$(sed -n '/static.*ls_codes\[/,/};'/p    \
128             $(srcdir)/src/dircolors.c                           \
129           |sed -n '/^  *"/p'|tr , '\n'|sed 's/^  *//'           \
130           |sed -n 's/^"\(..\)"/\1/p'|sort -u);                  \
131         ls=$$(sed -n '/static.*indicator_name\[/,/};'/\p        \
132             $(srcdir)/src/ls.c                                  \
133           |sed -n '/^  *"/p'|tr , '\n'|sed 's/^  *//'           \
134           |sed -n 's/^"\(..\)"/\1/p'|sort -u);                  \
135         test "$$dc" = "$$ls"
137 # Sort in traditional ASCII order, regardless of the current locale;
138 # otherwise we may get into trouble with distinct strings that the
139 # current locale considers to be equal.
140 ASSORT = LC_ALL=C sort
142 # Extract all lines up to the first one starting with "##".
143 prologue = perl -ne '/^\#\#/ and exit; print' $(srcdir)/THANKS.in
145 THANKS: THANKS.in Makefile.am .mailmap thanks-gen .version
146         $(AM_V_GEN)rm -f $@-t $@;                                       \
147         {                                                               \
148           $(prologue); echo;                                            \
149           { perl -ne '/^$$/.../^$$/ and print' $(srcdir)/THANKS.in      \
150               | grep -v '^$$' | perl -pe 's/  +/\0/';                   \
151             git log --pretty=format:'%aN%x00%aE'                        \
152               | $(ASSORT) -u;                                           \
153           } | $(srcdir)/thanks-gen                                      \
154             | LC_ALL=en_US.UTF-8 sort -f;                               \
155           echo;                                                         \
156           printf ';; %s\n' 'Local Variables:' 'coding: utf-8' End:;     \
157         } > $@-t && chmod a-w $@-t && mv $@-t $@
159 # Some of our git hook scripts are supposed to be identical to git's samples.
160 # See if they are still in sync.
161 .PHONY: check-git-hook-script-sync
162 check-git-hook-script-sync:
163         @fail=0;                                                        \
164         t=$$(mktemp -d)                                                 \
165           && cd $$t && git init -q && cd .git/hooks                     \
166           && for i in pre-commit pre-applypatch applypatch-msg; do      \
167                diff $(abs_top_srcdir)/scripts/git-hooks/$$i $$i.sample  \
168                  || fail=1;                                             \
169              done;                                                      \
170         rm -rf $$t;                                                     \
171         test $$fail = 0