maint: allow 'sha*sum:' tag in commit summaries
[coreutils.git] / Makefile.am
blobcc4fde7aa2f683619b78b500f4dc0b71f62521dc
1 # Make coreutils.                                       -*-Makefile-*-
3 # Copyright (C) 1990-2015 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 = po . 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/gen-lists-of-programs.sh    \
53   build-aux/gen-single-binary.sh        \
54   cfg.mk                                \
55   dist-check.mk                         \
56   maint.mk                              \
57   tests/GNUmakefile                     \
58   thanks-gen
60 gen_progs_lists = $(top_srcdir)/build-aux/gen-lists-of-programs.sh
61 gen_single_binary = $(top_srcdir)/build-aux/gen-single-binary.sh
63 # Keep these in sync with bootstrap.conf:bootstrap_post_import_hook().
64 # Use '$(top_srcdir)/m4' and '$(srcdir)/src' for the benefit of non-GNU
65 # makes: it is with those directories that 'cu-progs.m4' and 'cu-progs.mk'
66 # appear in our dependencies.
67 $(top_srcdir)/m4/cu-progs.m4: $(gen_progs_lists)
68         $(AM_V_GEN)rm -f $@ $@-t \
69           && $(SHELL) $(gen_progs_lists) --autoconf >$@-t \
70           && chmod a-w $@-t && mv -f $@-t $@
71 $(srcdir)/src/cu-progs.mk: $(gen_progs_lists)
72         $(AM_V_GEN)rm -f $@ $@-t \
73           && $(SHELL) $(gen_progs_lists) --automake >$@-t \
74           && chmod a-w $@-t && mv -f $@-t $@
75 $(srcdir)/src/single-binary.mk: $(gen_single_binary) $(srcdir)/src/local.mk
76         $(AM_V_GEN)rm -f $@ $@-t \
77           && $(SHELL) $(gen_single_binary) $(srcdir)/src/local.mk >$@-t \
78           && chmod a-w $@-t && mv -f $@-t $@
80 ACLOCAL_AMFLAGS = -I m4
82 # Shortcut targets to make it easier to run (very) expensive tests.
83 check-expensive:
84         $(MAKE) check RUN_EXPENSIVE_TESTS=yes
85 check-very-expensive:
86         $(MAKE) check-expensive RUN_VERY_EXPENSIVE_TESTS=yes
88 # Just prior to distribution, ...
89 # transform the automake-generated rule that runs 'rm -f rm'.
90 # On some systems, that command would fail with a diagnostic like
91 # "rm: cannot unlink 'rm': Text file busy" when '.' appears so early
92 # in the shell's search path that running 'rm' would run the 'rm'
93 # executable in the current directory.
94 # Similarly, adjust the clean-binPROGRAMS rule.
95 rm_subst = \
96   s!(rm -f (rm\b|\$$\(bin_PROGRAMS\)$$))!$$1 > /dev/null 2>&1 || /bin/$$1!
98 BUILT_SOURCES = .version
99 .version:
100         $(AM_V_GEN)echo $(VERSION) > $@-t && mv $@-t $@
102 # Arrange so that .tarball-version appears only in the distribution
103 # tarball, and never in a checked-out repository.
104 # The perl substitution is to change some key uses of "rm" to "/bin/rm".
105 # See the rm_subst comment for details.
106 dist-hook: gen-ChangeLog
107         $(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
108         $(AM_V_at)perl -pi -e '$(rm_subst)' $(distdir)/Makefile.in
110 gen_start_date = 2008-02-08
111 .PHONY: gen-ChangeLog
112 gen-ChangeLog:
113         $(AM_V_GEN)if test -d .git; then                                \
114           log_fix="$(srcdir)/build-aux/git-log-fix";                    \
115           test -e "$$log_fix"                                           \
116             && amend_git_log="--amend=$$log_fix"                        \
117             || amend_git_log=;                                          \
118           $(top_srcdir)/build-aux/gitlog-to-changelog                   \
119             $$amend_git_log --since=$(gen_start_date) > $(distdir)/cl-t && \
120             { rm -f $(distdir)/ChangeLog &&                             \
121               mv $(distdir)/cl-t $(distdir)/ChangeLog; }                \
122         fi
124 ALL_RECURSIVE_TARGETS += distcheck-hook
125 distcheck-hook: check-ls-dircolors
126         $(MAKE) my-distcheck
127         $(MAKE) taint-distcheck
129 DISTCLEANFILES = VERSION
130 MAINTAINERCLEANFILES = THANKS-to-translators
131 THANKS-to-translators: po/LINGUAS THANKStt.in
132         $(AM_V_GEN)(                                                    \
133           cat $(srcdir)/THANKStt.in;                                    \
134           for lang in `cat $(srcdir)/po/LINGUAS`; do                    \
135             echo http://translationproject.org/team/$$lang.html;        \
136           done;                                                         \
137         ) > $@-tmp && mv $@-tmp $@
139 # Ensure that the sets of two-letter codes in ls.c and dircolors.c
140 # remain in sync.
141 .PHONY: check-ls-dircolors
142 check-ls-dircolors:
143         $(AM_V_GEN)dc=$$(sed -n '/static.*ls_codes\[/,/};'/p    \
144             $(srcdir)/src/dircolors.c                           \
145           |sed -n '/^  *"/p'|tr , '\n'|sed 's/^  *//'           \
146           |sed -n 's/^"\(..\)"/\1/p'|sort -u);                  \
147         ls=$$(sed -n '/static.*indicator_name\[/,/};'/\p        \
148             $(srcdir)/src/ls.c                                  \
149           |sed -n '/^  *"/p'|tr , '\n'|sed 's/^  *//'           \
150           |sed -n 's/^"\(..\)"/\1/p'|sort -u);                  \
151         test "$$dc" = "$$ls"
153 # Sort in traditional ASCII order, regardless of the current locale;
154 # otherwise we may get into trouble with distinct strings that the
155 # current locale considers to be equal.
156 ASSORT = LC_ALL=C sort
158 # Extract all lines up to the first one starting with "##".
159 prologue = perl -ne '/^\#\#/ and exit; print' $(srcdir)/THANKS.in
161 # FIXME: avoid dependency to build our own 'sort' for 'make dist' ...
162 # when common platforms have a functional case-folding implementation:
163 #   $ test 'abácad' = "$(printf '%s\n' 'ab' 'ác' 'ad' \
164 #                          | LC_ALL=en_US.UTF-8 sort -f \
165 #                          | tr -d '\n')" && echo GOOD || echo BAD
166 # Note we don't enable case folding (-f) in the sort below, due to bugs
167 # in the I18N patch used in many distros (as of 2015).  Also using our
168 # own src/sort here would induce awkward dependencies for `make dist`.
169 THANKS: THANKS.in Makefile.am .mailmap thanks-gen .version
170         $(AM_V_GEN)rm -f $@-t $@;                                       \
171         {                                                               \
172           $(prologue); echo;                                            \
173           { perl -ne '/^$$/.../^$$/ and !/^$$/ and s/  +/\0/ and print' \
174               $(srcdir)/THANKS.in;                                      \
175             git log --pretty=format:'%aN%x00%aE'                        \
176               | $(ASSORT) -u;                                           \
177           } | $(srcdir)/thanks-gen                                      \
178             | LC_ALL=en_US.UTF-8 sort -k1,1;                            \
179           echo;                                                         \
180           printf ';; %s\n' 'Local Variables:' 'coding: utf-8' End:;     \
181         } > $@-t && chmod a-w $@-t && mv $@-t $@
183 # Some of our git hook scripts are supposed to be identical to git's samples.
184 # See if they are still in sync.
185 .PHONY: check-git-hook-script-sync
186 check-git-hook-script-sync:
187         @fail=0;                                                        \
188         t=$$(mktemp -d)                                                 \
189           && cd $$t && git init -q && cd .git/hooks                     \
190           && for i in pre-commit pre-applypatch applypatch-msg; do      \
191                diff $(abs_top_srcdir)/scripts/git-hooks/$$i $$i.sample  \
192                  || fail=1;                                             \
193              done;                                                      \
194         rm -rf $$t;                                                     \
195         test $$fail = 0
197 # If we are building a single-binary, create symlinks or shebangs for
198 # the selected tools when installing.
199 install-exec-hook:
200         $(AM_V_at)ctrans=$$(printf coreutils | sed -e "$(transform)");  \
201         for p in x $(single_binary_progs); do                           \
202           test $$p = x && continue;                                     \
203           ptrans=$$(printf '%s' "$$p" | sed -e "$(transform)");         \
204           rm -f $(DESTDIR)$(bindir)/$$ptrans$(EXEEXT) || exit $$?;      \
205           if test "x$(single_binary_install_type)" = xshebangs; then    \
206             printf '#!%s --coreutils-prog-shebang=%s\n'                 \
207               $(bindir)/$$ctrans$(EXEEXT) $$p                           \
208               >$(DESTDIR)$(bindir)/$$ptrans$(EXEEXT) || exit $$?;       \
209             chmod a+x,a-w $(DESTDIR)$(bindir)/$$ptrans$(EXEEXT) || exit $$?;\
210           else                                                          \
211             $(LN_S) -s $$ctrans$(EXEEXT)                                \
212               $(DESTDIR)$(bindir)/$$ptrans$(EXEEXT) || exit $$?;        \
213           fi                                                            \
214         done
216 noinst_LIBRARIES =
217 MOSTLYCLEANFILES =
218 CLEANFILES =
219 MOSTLYCLEANDIRS =
221 AM_CPPFLAGS = -Ilib -I$(top_srcdir)/lib -Isrc -I$(top_srcdir)/src
223 include $(top_srcdir)/lib/local.mk
224 include $(top_srcdir)/src/local.mk
225 include $(top_srcdir)/doc/local.mk
226 include $(top_srcdir)/man/local.mk
227 include $(top_srcdir)/tests/local.mk