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