bug-automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: conditionals and dist target


From: Alexandre Duret-Lutz
Subject: Re: conditionals and dist target
Date: 01 Oct 2002 21:58:40 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

>>> "Marcus" == Marcus Brinkmann <address@hidden> writes:

 Marcus> Hi,

 Marcus> I am using automake conditionals, and contrary to what
 Marcus> the manual says, it is not including both cases' source
 Marcus> files into the make dist target.

[...]

 Marcus> Should the example in the manual work as I think it should?

Thanks for reporting this.  Indeed the example from the manual
doesn't work (and has never worked AFAICT).

As a workaround, you can list all conditional files (w32-* posix-*)
in the EXTRA_libgpgme_la_SOURCES variable.  

I'm installing the following fix on CVS, this will be in Automake 1.7.1.

(To automake-patches@ readers: the patch is against branch-1-7, 
on HEAD define_pretty_variable takes `$where' as third argument.)

2002-10-01  Alexandre Duret-Lutz  <address@hidden>

        * automake.in (handle_source_transform): If foo_SOURCES is defined
        conditionally, create and use am__foo_SOURCES_DIST for distribution.
        * tests/condd.test: Extend to check distributed files.
        * tests/substref.test: Make sure we don't use such a variable when
        it's not needed.
        Reported by Marcus Brinkmann.

Index: THANKS
===================================================================
RCS file: /cvs/automake/automake/THANKS,v
retrieving revision 1.186.2.2
diff -u -r1.186.2.2 THANKS
--- THANKS      30 Sep 2002 20:13:03 -0000      1.186.2.2
+++ THANKS      1 Oct 2002 19:28:13 -0000
@@ -112,6 +112,7 @@
 Maciej Stachowiak      address@hidden
 Maciej W. Rozycki      address@hidden
 Manu Rouat             address@hidden
+Marcus Brinkmann       address@hidden
 Marcus G. Daniels      address@hidden
 Marius Vollmer         address@hidden
 Mark Eichin            address@hidden
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1365.2.3
diff -u -r1.1365.2.3 automake.in
--- automake.in 30 Sep 2002 20:10:11 -0000      1.1365.2.3
+++ automake.in 1 Oct 2002 19:28:40 -0000
@@ -2788,8 +2788,23 @@
          unless $prefix =~ /EXTRA_/;
 
        push @sources, "\$($var)";
-       push @dist_sources, "\$($var)"
-         unless $prefix =~ /^nodist_/;
+       if ($prefix !~ /^nodist_/)
+         {
+           # If the VAR wasn't definined conditionally, we add
+           # it to DIST_SOURCES as is.  Otherwise we create a
+           # am__VAR_DIST variable which contains all possible values,
+           # and add this variable to DIST_SOURCES.
+           my $distvar = "$var";
+           my @conds = variable_conditions_recursive ($var);
+           if (@conds && $conds[0] ne 'TRUE')
+             {
+               $distvar = "am__${var}_DIST";
+               my @files =
+                 uniq (variable_value_as_list_recursive ($var, 'all'));
+               define_pretty_variable ($distvar, '', @files);
+             }
+           push @dist_sources, "\$($distvar)"
+         }
 
        @substfroms = ();
        @substtos = ();
Index: tests/condd.test
===================================================================
RCS file: /cvs/automake/automake/tests/condd.test,v
retrieving revision 1.3
diff -u -r1.3 condd.test
--- tests/condd.test    8 Sep 2002 13:07:55 -0000       1.3
+++ tests/condd.test    1 Oct 2002 19:28:48 -0000
@@ -22,9 +22,14 @@
 
 . ./defs || exit 1
 
+set -e
+
 cat >> configure.in << 'END'
 AC_PROG_CC
-AM_CONDITIONAL(COND1, true)
+AM_CONDITIONAL(COND1, false)
+AC_CONFIG_FILES([foo/Makefile])
+AC_CONFIG_FILES([bar/Makefile])
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
@@ -41,9 +46,25 @@
 else
 hello_SOURCES += hello-generic.c
 endif
+
+test: distdir
+       test -f $(distdir)/foo/Makefile.am
+       test -f $(distdir)/bar/Makefile.am
+       test -f $(distdir)/hello-common.c
+       test -f $(distdir)/hello-cond1.c
+       test -f $(distdir)/hello-generic.c
 END
 
 mkdir foo bar
 
-$ACLOCAL || exit 1
+: > foo/Makefile.am
+: > bar/Makefile.am
+: > hello-common.c
+: > hello-cond1.c
+: > hello-generic.c
+
+$ACLOCAL
+$AUTOCONF
 $AUTOMAKE
+./configure
+$MAKE test
Index: tests/substref.test
===================================================================
RCS file: /cvs/automake/automake/tests/substref.test,v
retrieving revision 1.8
diff -u -r1.8 substref.test
--- tests/substref.test 8 Sep 2002 13:07:56 -0000       1.8
+++ tests/substref.test 1 Oct 2002 19:28:48 -0000
@@ -64,3 +64,9 @@
 val=`$MAKE -s echorule`;
 echo $val
 test "x$val" = "xdlmain.c dlmain.o"
+
+# This is unrelated to the rest of this test.  But while we are
+# at it, make sure we don't use am__helldl_SOURCES_DIST here, since
+# it's not needed.  DIST_SOURCES should contains $(helldl_SOURCES).
+grep am__helldl_SOURCES_DIST Makefile && exit 1
+grep 'DIST_SOURCES.*\(helldl_SOURCES\)' Makefile


-- 
Alexandre Duret-Lutz





reply via email to

[Prev in Thread] Current Thread [Next in Thread]