[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
58-var-vs-target.patch
From: |
Akim Demaille |
Subject: |
58-var-vs-target.patch |
Date: |
Fri, 23 Feb 2001 00:03:34 +0100 |
It's only the beginning, but Automake shall not forbid us from having
both a variable INSTALL and a target INSTALL. More is needed, but at
first sight, not too much.
In fact, I've had to finish the job, because the following test was
falling:
cat > Makefile.am << 'END'
bin_PROGRAMS = consud
## Note next line is target, not variable.
consud_SOURCES: consud.c
END
echo > consud.c
$AUTOMAKE && exit 1
Why did it in spite of the fact that my change was only making
automake complain when a non exisiting variable appears to exist as a
target?
Because the reader inserts the targets in %contents, which holds the
variables...
The next patch addresses this issue.
Index: ChangeLog
from Akim Demaille <address@hidden>
* automake.in (&variable_defined, &variable_value_as_list_worker):
If $VAR is effectively a variable, don't die if it's also a
target.
Plus some formatting changes.
Index: automake.in
--- automake.in Thu, 22 Feb 2001 22:00:07 +0100 akim (am/f/39_automake.i 1.65
755)
+++ automake.in Thu, 22 Feb 2001 22:26:53 +0100 akim (am/f/39_automake.i 1.65
755)
@@ -5385,19 +5385,19 @@ sub check_ambiguous_conditional ($$)
}
}
-# See if a variable exists. The first argument is the variable name,
-# and the optional second argument is the condition which we should
-# check. If no condition is given, we currently return true if the
-# variable is defined under any condition.
+
+# $BOOLEAN
+# &variable_defined ($VAR, [$COND])
+# ---------------------------------
+# See if a variable exists. $VAR is the variable name, and $COND is
+# the condition which we should check. If no condition is given, we
+# currently return true if the variable is defined under any
+# condition.
sub variable_defined ($$)
{
my ($var, $cond) = @_;
- if (defined $targets{$var})
- {
- &am_line_error ($var, "\`$var' is target; expected variable");
- return 0;
- }
- elsif (defined $contents{$var})
+
+ if (defined $contents{$var})
{
if ($cond && $conditional{$var})
{
@@ -5425,6 +5425,10 @@ sub variable_defined ($$)
$content_seen{$var} = 1;
return 1;
}
+
+ &am_line_error ($var, "\`$var' is target; expected variable")
+ if defined $targets{$var};
+
return 0;
}
@@ -5762,13 +5766,16 @@ sub variable_value_as_list_worker
my ($var, $cond, $parent) = @_;
my @result = ();
- if (defined $targets{$var})
+ if (! defined $contents{$var} && ! defined $am_var_defs{$var})
{
- &am_line_error ($var, "\`$var' is target; expected variable");
- }
- elsif (! defined $contents{$var} && ! defined $am_var_defs{$var})
- {
- &am_line_error ($parent, "variable \`$var' not defined");
+ if (defined $targets{$var})
+ {
+ &am_line_error ($var, "\`$var' is target; expected variable");
+ }
+ else
+ {
+ &am_line_error ($parent, "variable \`$var' not defined");
+ }
}
elsif (defined $vars_scanned{$var})
{
@@ -5851,7 +5858,8 @@ sub define_variable
}
elsif ($var_was_plus_eq{$var})
{
- &am_line_error ($var, "internally generated variable \`$var' was set
with \`+='");
+ &am_line_error ($var,
+ "internally generated variable \`$var' was set with
\`+='");
}
}
@@ -6814,7 +6822,7 @@ sub file_contents
$result_vars .= "$separator$comment$_\n"
unless defined $contents{$1};
$comment = $separator = '';
- &prog_error (".am macro \`$1' with trailing backslash at $file:$.")
+ &prog_error ("$file:$.: macro \`$1' with trailing backslash")
if /\\$/;;
$am_var_defs{$1} = $3;
}
@@ -7049,10 +7057,8 @@ sub am_install_var
if (! $warned_about_extra)
{
$warned_about_extra = 1;
- {
- &am_line_error ($one_name,
- "\`$one_name' contains
configure substitution, but shouldn't");
- }
+ &am_line_error ($one_name,
+ "\`$one_name' contains configure
substitution, but shouldn't");
}
}
# Check here to make sure variables defined in
- 58-var-vs-target.patch,
Akim Demaille <=