]> sourceware.org Git - automake.git/commitdiff
fixed conditional sources bug
authorTom Tromey <tromey@redhat.com>
Mon, 1 Dec 1997 22:54:35 +0000 (22:54 +0000)
committerTom Tromey <tromey@redhat.com>
Mon, 1 Dec 1997 22:54:35 +0000 (22:54 +0000)
ChangeLog
THANKS
automake.in
tests/ChangeLog
tests/Makefile.am
tests/Makefile.in
tests/cond3.test [new file with mode: 0755]

index 70255cdf2bb05959d3a231ba8099b4b08ed3f840..35385b8446043908582b437d72b200ef0fec7654 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 Mon Dec  1 13:52:39 1997  Tom Tromey  <tromey@cygnus.com>
 
+       * automake.in (handle_source_transform): Correctly generate
+       _OBJECTS when _SOURCES is defined conditionally.  Reported by Rob
+       Savoye.  Test cond3.test.
+
        Fixes for test objc.test:
        * automake.in (initialize_per_input): New global seen_any_source.
        (handle_yacc_lex_cxx): Use seen_any_source to decide when to
diff --git a/THANKS b/THANKS
index b838cdc160543746efed2c8a07ad35ac5ccb91cc..8b573c33bffe9374a3ada94134366b6fcf4c591e 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -51,6 +51,7 @@ Peter Mattis          petm@scam.XCF.Berkeley.EDU
 Phil Nelson            phil@cs.wwu.edu
 Ralph Schleicher       rs@purple.UL.BaWue.DE
 Ramón García Fernández ramon@jl1.quim.ucm.es
+Rob Savoye             rob@cygnus.com
 Steve M. Robbins       steve@nyongwa.montreal.qc.ca
 Tatu Ylonen            ylo@ssh.fi
 The Crimson Binome     steve@nyongwa.montreal.qc.ca
index 2f673f4f8aa6d3f65d4833da841ad5fcad4d3bd1..39a819b663126b6bd9810e4223d910b6c9bdf508 100755 (executable)
@@ -1243,17 +1243,29 @@ sub handle_source_transform
            }
            else
            {
-               local ($cond);
+               local ($cond, $cond_var_name);
+               local ($count) = 0;
+               local (@namelist) = ();
                foreach $cond (@conds)
                {
                    @files = &variable_value_as_list ($var, $cond);
                    ($temp, @result) = &handle_single_transform_list (@files);
                    $linker = $temp if $linker eq '';
-                   &define_pretty_variable ($one_file . "_OBJECTS", $cond,
-                                            @result)
+
+                   # We have to have a new name for each such
+                   # variable.  Then we define the _OBJECTS variable
+                   # as the union of all such variables.  Hopefully
+                   # this is the Right Thing.
+                   $cond_var_name = 'cond' . $count . $one_file . '_OBJECTS';
+                   &define_pretty_variable ($cond_var_name, $cond, @result)
                        unless $prefix eq 'EXTRA_';
+                   push (@namelist, '$(' . $cond_var_name . ')');
+                   ++$count;
                }
 
+               &define_pretty_variable ($one_file . '_OBJECTS', '',
+                                        @namelist);
+
                next;
            }
        }
index b36e9606fd49cd64127fe97b6760c94cfabea8f0..351cc34a0dee32ebce4fc9d206b692d8dea09691 100644 (file)
@@ -1,3 +1,7 @@
+Mon Dec  1 15:48:16 1997  Tom Tromey  <tromey@cygnus.com>
+
+       * cond3.test: New file.
+
 Sat Nov 29 22:09:27 1997  Tom Tromey  <tromey@cygnus.com>
 
        * objc.test: New file.
index c32b5ab1105f7d12cfb335d0959b39b9317022b6..86ccbff33e9bc72d7d9cf6669cb92cb034a97f23 100644 (file)
@@ -27,7 +27,7 @@ yaccpp.test texinfo3.test texinfo4.test tagsub.test cxxlibobj.test \
 seenc.test cygwin32.test lisp.test stamph.test ldadd.test \
 version2.test conf2.test cond.test cond2.test xsource.test \
 libobj6.test depend3.test output5.test ammissing.test install.test \
-libobj7.test objc.test
+libobj7.test objc.test cond3.test
 
 EXTRA_DIST = defs $(TESTS)
 
index 3111e824195af0f71e36a39809daf18259a462b5..6fa561d56f42a34844c55ff7b0afb80fdb49ffa7 100644 (file)
@@ -88,7 +88,7 @@ yaccpp.test texinfo3.test texinfo4.test tagsub.test cxxlibobj.test \
 seenc.test cygwin32.test lisp.test stamph.test ldadd.test \
 version2.test conf2.test cond.test cond2.test xsource.test \
 libobj6.test depend3.test output5.test ammissing.test install.test \
-libobj7.test objc.test
+libobj7.test objc.test cond3.test
 
 EXTRA_DIST = defs $(TESTS)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
diff --git a/tests/cond3.test b/tests/cond3.test
new file mode 100755 (executable)
index 0000000..2099ca6
--- /dev/null
@@ -0,0 +1,43 @@
+#! /bin/sh
+
+# Test sources listed in conditional.
+# Report from Rob Savoye <rob@cygnus.com>.
+
+. $srcdir/defs || exit 1
+
+cat > configure.in << 'END'
+AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+AC_PROG_CC
+AM_CONDITIONAL(ONE, true)
+AM_CONDITIONAL(TWO, false)
+AM_CONDITIONAL(THREE, maybe)
+AC_OUTPUT(Makefile)
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = targ
+
+if ONE
+SONE = one.c
+else
+SONE =
+endif
+
+if TWO
+STWO = two.c
+else
+STWO =
+endif
+
+if THREE
+STHREE = three.c
+else
+STHREE =
+endif
+
+targ_SOURCES = $(SONE) $(STWO) $(STHREE)
+END
+
+$AUTOMAKE || exit 1
+
+test "`grep '^targ_OBJECTS' Makefile.in | wc -l`" -eq 1
This page took 0.050702 seconds and 5 git commands to generate.