We can do this thanks to the new make macros '$(am__uniq)' introduced in
the recent commit '
v1.12-145-g112d08a'.
* automake.in (handle_dist): Don't "uniq"ify the contents of DIST_COMMON
here, but instead ...
* lib/am/distdir.am: ... "uniq"ify the contents of DISTFILES here.
* t/dist-repeated.sh: Remove sanity check checking for a once expected
invariant that is not there anymore now.
* t/distcom4.sh, t/distcom5.sh: Adjust.
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
}
}
- # Files to distributed. Don't use ->value_as_list_recursive
- # as it recursively expands '$(dist_pkgdata_DATA)' etc.
- my @dist_common = split (' ', rvar ('DIST_COMMON')->variable_value);
- @dist_common = uniq @dist_common;
- variable_delete 'DIST_COMMON';
- define_pretty_variable ('DIST_COMMON', TRUE, INTERNAL, @dist_common);
-
- # Now that we've processed DIST_COMMON, disallow further attempts
- # to set it.
+ # We don't expected further attempts to modify DIST_COMMON after
+ # this point, so disallow it, for extra safety.
$handle_dist_run = 1;
# Scan EXTRA_DIST to see if we need to distribute anything from a
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+DISTFILES = $(call am__uniq, \
+ $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST))
## Try to avoid repeated slashed in the $(DISTFILES) entries, to make the
## filtering in the 'am__dist_files_1' definition below more reliable.
python_PYTHON = bar.py
EXTRA_DIST = foo.c bar.py
-.PHONY: sanity-check
-sanity-check:
- for f in $(DISTFILES); do echo " $$f "; done > dist.txt
- cat dist.txt
- test `grep ' foo\.c ' dist.txt | wc -l` -eq 3
- test `grep ' bar\.py ' dist.txt | wc -l` -eq 2
-
# So that we don't have to require a C compiler.
AUTOMAKE_OPTIONS = no-dependencies
CC = false
$AUTOMAKE
./configure
-$MAKE sanity-check || fatal_ "expected invariants not verified"
$MAKE distdir
test -f cp-wrapper-has-seen-foo-c && test -f cp-wrapper-has-seen-bar-py \
|| fatal_ "our cp wrapper hasn't run correctly"
: > README
: > tests/wrapper.in
cat > Makefile.am << 'END'
-.PHONY: test
-test: distdir
+.PHONY: test1 test 2
+test1:
+ for x in $(DISTFILES); do echo $$x; done | grep 'tests/' > lst
+ cat lst # For debugging.
+ test `wc -l <lst` -eq 1
+test2: distdir
test -f $(distdir)/tests/wrapper.in
END
$AUTOCONF
$AUTOMAKE --add-missing
./configure
-$MAKE test
-
-sed -n -e '/^DIST_COMMON =.*\\$/ {
- :loop
- p
- n
- t clear
- :clear
- s/\\$/\\/
- t loop
- p
- n
- }' -e '/^DIST_COMMON =/ p' Makefile.in > dc.txt
-
-cat dc.txt # For debugging.
-
-test 1 = `grep tests dc.txt | wc -l`
-grep configure dc.txt
+$MAKE test1 test2
:
. ./defs || Exit 1
-extract_distcommon ()
-{
- sed -n -e '/^DIST_COMMON =.*\\$/ {
- :loop
- p
- n
- t clear
- :clear
- s/\\$/\\/
- t loop
- p
- n
- }' -e '/^DIST_COMMON =/ p' ${1+"$@"}
-}
-
cat >> configure.ac << 'END'
AC_CONFIG_FILES([tests/autoconf:tests/wrapper.in],
[chmod +x tests/autoconf])
mkdir tests
: > tests/wrapper.in
-: > tests/Makefile.am
+
cat > Makefile.am << 'END'
SUBDIRS = tests
.PHONY: test
test: distdir
test -f $(distdir)/tests/wrapper.in
+check-local: test
+ for x in $(DISTFILES); do echo $$x; done \
+ | grep tests && exit 1; :
+END
+
+cat > tests/Makefile.am <<'END'
+check-local:
+ for x in $(DISTFILES); do echo $$x; done | grep wrapper.in > lst
+ cat lst # For debugging.
+ test `wc -l <lst` -eq 1
END
$ACLOCAL
$AUTOCONF
$AUTOMAKE --add-missing
./configure
-$MAKE test
-
-extract_distcommon Makefile.in > top.txt
-extract_distcommon tests/Makefile.in > inner.txt
-
-# Might be useful for debugging.
-cat top.txt
-cat inner.txt
-
-test 0 = `grep tests top.txt | wc -l`
-test 1 = `grep wrapper inner.txt | wc -l`
+$MAKE check
+# Sanity check.
+test -f tests/lst
: