From: Tom Tromey Date: Mon, 1 Dec 1997 22:54:35 +0000 (+0000) Subject: fixed conditional sources bug X-Git-Tag: pre-depend-change~17 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=f3694534f94afbb8133bde0492560119c14cfa1e;p=automake.git fixed conditional sources bug --- diff --git a/ChangeLog b/ChangeLog index 70255cdf..35385b84 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ Mon Dec 1 13:52:39 1997 Tom Tromey + * 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 b838cdc1..8b573c33 100644 --- 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 diff --git a/automake.in b/automake.in index 2f673f4f..39a819b6 100755 --- a/automake.in +++ b/automake.in @@ -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; } } diff --git a/tests/ChangeLog b/tests/ChangeLog index b36e9606..351cc34a 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,7 @@ +Mon Dec 1 15:48:16 1997 Tom Tromey + + * cond3.test: New file. + Sat Nov 29 22:09:27 1997 Tom Tromey * objc.test: New file. diff --git a/tests/Makefile.am b/tests/Makefile.am index c32b5ab1..86ccbff3 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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) diff --git a/tests/Makefile.in b/tests/Makefile.in index 3111e824..6fa561d5 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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 index 00000000..2099ca6d --- /dev/null +++ b/tests/cond3.test @@ -0,0 +1,43 @@ +#! /bin/sh + +# Test sources listed in conditional. +# Report from Rob Savoye . + +. $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