Index: ChangeLog
from Akim Demaille <[EMAIL PROTECTED]>
* automake.in (&initialize_per_input): %targets_conditionals is
new.
(&read_am_file): When slurping a rule, set the target related
variable, and no variable related variable.
(&file_contents): Likewise.
* tests/vartar.test, tests/ctarget1.test: New.
Index: TODO
--- TODO Sat, 17 Feb 2001 17:56:59 +0100 akim (am/f/42_TODO 1.3 644)
+++ TODO Thu, 22 Feb 2001 23:57:15 +0100 akim (am/f/42_TODO 1.3 644)
@@ -283,7 +283,6 @@
might make editing conceptually easier.
* finish up TAGS work
-* `acinstall'
* only remove libtool at top level?
@@ -604,14 +603,6 @@
Set name of output file
Then automake can use -MD -MH -MT 'foo.o foo.lo' -MF .deps/...
-
-================================================================
-
-Things to do for autoconf:
-
-* patch autoreconf to run automake and aclocal. I've done this but it is
- not really available. It can't be made available until automake
- is officially released
================================================================
Index: automake.in
--- automake.in Thu, 22 Feb 2001 22:29:01 +0100 akim (am/f/39_automake.i 1.66 755)
+++ automake.in Thu, 22 Feb 2001 22:41:11 +0100 akim (am/f/39_automake.i 1.66 755)
@@ -5426,7 +5426,7 @@ sub variable_defined ($$)
return 1;
}
- &am_line_error ($var, "\`$var' is target; expected variable")
+ &am_line_error ($var, "\`$var' is a target; expected a variable")
if defined $targets{$var};
return 0;
@@ -5770,7 +5770,7 @@ sub variable_value_as_list_worker
{
if (defined $targets{$var})
{
- &am_line_error ($var, "\`$var' is target; expected variable");
+ &am_line_error ($var, "\`$var' is a target; expected a variable");
}
else
{
@@ -6083,27 +6083,25 @@ sub read_am_file
{
# Found a rule.
$was_rule = 1;
- if (defined $contents{$1}
+ if (defined $targets{$1}
&& (@conditional_stack
- ? ! defined $conditional{$1}
- : defined $conditional{$1}))
+ ? ! defined $target_conditional{$1}
+ : defined $target_conditional{$1}))
{
&am_line_error ($1,
"$1 defined both conditionally and unconditionally");
}
# Value here doesn't matter; for targets we only note
# existence.
-# FIXME: I don't understand the next line at all, it seems dead wrong --akim
- $contents{$1} = 1;
$targets{$1} = 1;
my $cond_string = join ('', @conditional_stack);
if (@conditional_stack)
{
- if ($conditional{$1})
+ if ($target_conditional{$1})
{
&check_ambiguous_conditional ($1, $cond_string);
}
- ${$conditional{$1}}{$cond_string} = '1';
+ ${$target_conditional{$1}}{$cond_string} = '1';
}
$content_lines{$1} = $.;
$output_trailer .= $comment . $spacing . $cond_string . $_;
@@ -6454,10 +6452,6 @@ sub initialize_per_input
# read_am_file.
%contents = ();
- # This holds the names which are targets. These also appear in
- # %contents.
- %targets = ();
-
# This maps a variable name onto a flag. The flag is true iff the
# variable was first defined with `+='.
%var_was_plus_eq = ();
@@ -6483,6 +6477,13 @@ sub initialize_per_input
# This holds a 1 if a particular variable was examined.
%content_seen = ();
+ # This holds the names which are targets. These also appear in
+ # %contents.
+ %targets = ();
+
+ # Same as %CONDITIONAL, but for targets.
+ %target_conditional = ();
+
# This is the conditional stack.
@conditional_stack = ();
@@ -6797,7 +6798,7 @@ sub file_contents
{
# Free lance dependency. Output the rule for all the
# targets instead of one by one.
- if (!defined $contents{$targets})
+ if (!defined $targets{$targets})
{
# Some hair to avoid spurious trailing blank
# when there are no dependencies.
Index: tests/Makefile.am
--- tests/Makefile.am Sat, 17 Feb 2001 17:56:59 +0100 akim (am/f/4_Makefile.a 1.6 644)
+++ tests/Makefile.am Thu, 22 Feb 2001 23:50:16 +0100 akim (am/f/4_Makefile.a 1.6 644)
@@ -2,7 +2,7 @@
AUTOMAKE_OPTIONS = gnits
-XFAIL_TESTS =
+XFAIL_TESTS =
TESTS = \
acinclude.test \
aclocal.test \
@@ -74,6 +74,7 @@
confvar.test \
confvar2.test \
copy.test \
+ctarget1.test \
cxxansi.test \
cxxcpp.test \
cxxlibobj.test \
@@ -260,6 +261,7 @@
texinfo7.test \
texinfo8.test \
unused.test \
+vartar.test \
version.test \
version2.test \
version3.test \
Index: tests/ctarget1.test
--- tests/ctarget1.test Fri, 23 Feb 2001 00:00:44 +0100 akim ()
+++ tests/ctarget1.test Thu, 22 Feb 2001 23:40:26 +0100 akim (am/h/24_ctarget1.t 644)
@@ -0,0 +1,27 @@
+#! /bin/sh
+
+# Check basic use of conditionals.
+
+. $srcdir/defs || exit 1
+
+cat > configure.in << 'END'
+AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+AM_CONDITIONAL(TEST, true)
+AC_OUTPUT(Makefile)
+END
+
+cat > Makefile.am << 'END'
+if TEST
+target: true
+ action
+else
+target: false
+endif
+END
+
+$AUTOMAKE || exit 1
+
+grep '^@TEST_TRUE@target: true' Makefile.in || exit 1
+grep '^@TEST_TRUE@ action' Makefile.in || exit 1
+grep '^@TEST_FALSE@target: false' Makefile.in || exit 1
+exit 0
Index: tests/vartar.test
--- tests/vartar.test Fri, 23 Feb 2001 00:00:44 +0100 akim ()
+++ tests/vartar.test Thu, 22 Feb 2001 23:48:59 +0100 akim (am/h/25_vartar.tes 644)
@@ -0,0 +1,24 @@
+#! /bin/sh
+
+# Targets and macros are two different name spaces.
+
+. $srcdir/defs || exit 1
+
+cat > Makefile.am << 'END'
+INSTALL = INSTALL
+INSTALL:
+ $(INSTALL) INSTALL
+END
+
+$AUTOMAKE || exit 1
+
+grep '^INSTALL = INSTALL$' Makefile.in || exit 1
+
+cat > target.expected <<'EOF'
+INSTALL:
+ $(INSTALL) INSTALL
+EOF
+sed -n '/^INSTALL:/,/^ /p' Makefile.in > target.value
+diff target.expected target.value || exit 1
+
+exit 0
\ No newline at end of file