summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>1998-10-30 14:04:49 +0000
committerTom Tromey <tromey@redhat.com>1998-10-30 14:04:49 +0000
commitcb0d31f8f7e9c141920ee1ae21c364b908291c99 (patch)
treefd6dac9420b944434b86f7ace7d2427f5d8105f0
parent5eb5065071c1ccab32ae9de58d8ab135f53b8ef6 (diff)
downloadautomake-cb0d31f8f7e9c141920ee1ae21c364b908291c99.tar.gz
* automake.in (MACRO_PATTERN): Recognize `+='.
(BOGUS_MACRO_PATTERN): Likewise. (read_am_file): Handle `+=' assignments.
-rw-r--r--ChangeLog6
-rw-r--r--NEWS2
-rw-r--r--TODO16
-rwxr-xr-xautomake.in120
4 files changed, 118 insertions, 26 deletions
diff --git a/ChangeLog b/ChangeLog
index b46359443..4050cc140 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+1998-10-30 Tom Tromey <tromey@cygnus.com>
+
+ * automake.in (MACRO_PATTERN): Recognize `+='.
+ (BOGUS_MACRO_PATTERN): Likewise.
+ (read_am_file): Handle `+=' assignments.
+
1998-10-28 Tom Tromey <tromey@cygnus.com>
* Makefile.am (maintainer-check): Changed code to be acceptable to
diff --git a/NEWS b/NEWS
index ce6fc85f8..70bf6252b 100644
--- a/NEWS
+++ b/NEWS
@@ -5,7 +5,7 @@ New in 1.3b:
e.g. AM_CFLAGS can be used in Makefile.am to set C compiler flags
* Support for latest autoconf, including support for objext
* Can now put `.' in SUBDIRS to control build order
-* `include' command
+* `include' command and `+=' support for macro assignment
* Dependency tracking no long susceptible to deleted header file problem
* Maintainer mode now a conditional. @MAINT@ is now an anachronism.
* Bug fixes
diff --git a/TODO b/TODO
index 0dae17027..9b46e23a3 100644
--- a/TODO
+++ b/TODO
@@ -1,3 +1,6 @@
+* document user namespace for macro/target names
+ adopt some conventions and use uniformly
+
* distclean must remove config.status
can't this cause problems for maintainer-clean?
shouldn't maintainer-clean print the message before running
@@ -16,6 +19,8 @@
Then have automake know about fnmatch.h.
* Add a conditional for dependency tracking
+ (what to name it is the biggest problem here)
+ (because we want it to flag dist/no-dist -- not just deps)
* Allow per-object cflags:
bin_PROGRAMS = foo
@@ -52,8 +57,6 @@ DONE: but needs to be documented
* add $(srcdir)/ before some dependencies?
-* mention PACKAGE/VERSION -vs- autoheader in manual
-
* define LINK if a program is mentioned, even if no C sources appear
* BUILT_SOURCES should not be distributed, even when they appear in
@@ -171,11 +174,8 @@ Some long-term projects:
* if $(FOO) is used somewhere, ensure FOO is defined, either by
user or by automake if possible
-* Handle += assignments
-X Handle `include' lines by scanning other files, and adding
- to Makefile.in dependency [ this is done, but needs += to be really
- useful ]
- even better would be allowing targets in different included
+[ include, += support ]
+* even better would be allowing targets in different included
fragments to be merged. e.g., `install-local'.
consider putting all check-* targets onto @check?
@@ -205,7 +205,7 @@ Per> .class files from a list of .java source files.
certain part of the standards apply. saw idea in message from
Craig Burley. wouldn't it be really cool if compile-mode in Emacs
understood this convention, and you could click on such text to
- go to the appropriate info page?
+ go to the appropriate info page? [ I think you can ]
Jim's idea: should look for @setfilename and warn if filenames too long
* guess split size
diff --git a/automake.in b/automake.in
index de651fa34..250357c91 100755
--- a/automake.in
+++ b/automake.in
@@ -41,8 +41,8 @@ $WHITE_PATTERN = "^[ \t]*\$";
$COMMENT_PATTERN = "^#";
$RULE_PATTERN = "^([\$a-zA-Z_.][-.a-zA-Z0-9_(){}/\$]*) *:([^=].*|)\$";
$SUFFIX_RULE_PATTERN = "^\\.([a-zA-Z]+)\\.([a-zA-Z]+)\$";
-$MACRO_PATTERN = "^([A-Za-z][A-Za-z0-9_]*)[ \t]*:?=[ \t]*(.*)\$";
-$BOGUS_MACRO_PATTERN = "^([^ \t]*)[ \t]*:?=[ \t]*(.*)\$";
+$MACRO_PATTERN = "^([A-Za-z][A-Za-z0-9_]*)[ \t]*([:+]?)=[ \t]*(.*)\$";
+$BOGUS_MACRO_PATTERN = "^([^ \t]*)[ \t]*([:+]?)=[ \t]*(.*)\$";
$GNITS_VERSION_PATTERN = "[0-9]+\\.[0-9]+([a-z]|\\.[0-9]+)?";
$IF_PATTERN = "^if[ \t]+\([A-Za-z][A-Za-z0-9_]*\)[ \t]*\(#.*\)?\$";
$ELSE_PATTERN = "^else[ \t]*\(#.*\)?\$";
@@ -5659,7 +5659,12 @@ sub read_am_file
$output_vars .= $comment . "\n";
$comment = '';
$spacing = "\n";
- local ($am_vars) = '';
+
+ # The keys here are variables we want to dump at the end of this
+ # function. The values are corresponding comments.
+ local (%am_vars) = ();
+ local (@var_list) = ();
+ local (%def_type) = ();
local ($is_ok_macro);
while ($_)
@@ -5700,7 +5705,6 @@ sub read_am_file
}
else
{
- $am_vars .= join ('', @conditional_stack) . $_;
$saw_bk = /\\$/;
# Chop newline and backslash if this line is
# continued. ensure trailing whitespace exists.
@@ -5813,34 +5817,90 @@ sub read_am_file
&am_line_error ($1,
"$1 defined both conditionally and unconditionally");
}
- if ($2 ne '' && substr ($2, -1) eq "\\")
+ local ($value);
+ if ($3 ne '' && substr ($3, -1) eq "\\")
{
- $contents{$last_var_name} = substr ($2, 0, length ($2) - 1);
+ $value = substr ($3, 0, length ($3) - 1);
}
else
{
- $contents{$last_var_name} = $2;
+ $value = $3;
+ }
+ local ($type) = $2;
+ if ($type eq '+')
+ {
+ $contents{$last_var_name} .= ' ' . $value;
+ }
+ else
+ {
+ $contents{$last_var_name} = $value;
+ # The first assignment to a macro sets the line
+ # number. Ideally I suppose we would associate line
+ # numbers with random bits of text.
+ $content_lines{$last_var_name} = $.;
}
local ($cond_string) = join ('', @conditional_stack);
if (@conditional_stack)
{
+ local ($found) = 0;
+ local ($val) = $contents{$last_var_name};
+ $val = &quote_cond_val ($val);
if ($conditional{$last_var_name})
{
- &check_ambiguous_conditional ($last_var_name,
- $cond_string);
- $conditional{$last_var_name} .= ' ';
+ if ($type eq '+')
+ {
+ # If we're adding to the conditional, and it
+ # exists, then we might want to simply replace
+ # the old value with the new one.
+ local (@new_vals, @cond_vals);
+ @cond_vals = split (' ', $conditional{$last_var_name});
+ while (@cond_vals)
+ {
+ local ($vcond) = shift (@cond_vals);
+ push (@new_vals, $vcond);
+ if (&conditional_stack ($vcond, $cond_string))
+ {
+ $found = 1;
+ shift (@cond_vals);
+ push (@new_vals, $val);
+ }
+ else
+ {
+ push (@new_vals, shift (@cond_vals));
+ }
+ }
+ if ($found)
+ {
+ $conditional{$last_var_name}
+ = join (' ', @new_vals);
+ }
+ }
+
+ if (! $found)
+ {
+ &check_ambiguous_conditional ($last_var_name,
+ $cond_string);
+ $conditional{$last_var_name} .= ' ';
+ }
}
else
{
$conditional{$last_var_name} = '';
}
- local ($val) = $contents{$last_var_name};
- $conditional{$last_var_name} .= ($cond_string
- . ' '
- . &quote_cond_val ($val));
+ if (! $found)
+ {
+ $conditional{$last_var_name} .= ($cond_string
+ . ' '
+ . $val);
+ }
}
- $content_lines{$last_var_name} = $.;
- $am_vars .= $comment . $spacing . $cond_string . $_;
+
+ # FIXME: this doesn't always work correctly; it will group
+ # all comments for a given variable, no matter where
+ # defined.
+ $am_vars{$last_var_name} = $comment . $spacing;
+ $def_type{$last_var_name} = ($type eq ':') ? ':' : '';
+ push (@var_list, $last_var_name);
$comment = $spacing = '';
$saw_bk = /\\$/;
@@ -5933,7 +5993,33 @@ sub read_am_file
&define_configure_variable ($curs);
}
- $output_vars .= $am_vars;
+ # Now dump the variables that were defined. We do it in the same
+ # order in which they were defined (skipping duplicates).
+ local (%done);
+ foreach $curs (@var_list)
+ {
+ next if $done{$curs};
+ $done{$curs} = 1;
+
+ $output_vars .= $am_vars{$curs};
+ if ($conditional{$curs})
+ {
+ local (@cond_vals) = split (' ', $conditional{$curs});
+ while (@cond_vals)
+ {
+ local ($vcond) = shift (@cond_vals);
+ local ($val) = &unquote_cond_val (shift (@cond_vals));
+ $output_vars .= ($vcond . $curs
+ . ' ' . $def_type{$curs} . '= '
+ . $val . "\n");
+ }
+ }
+ else
+ {
+ $output_vars .= ($curs . ' ' . $def_type{$curs} . '= '
+ . $contents{$curs} . "\n");
+ }
+ }
}
################################################################