diff options
Diffstat (limited to 'lib/Automake')
-rw-r--r-- | lib/Automake/ChannelDefs.pm | 51 | ||||
-rw-r--r-- | lib/Automake/Channels.pm | 119 | ||||
-rw-r--r-- | lib/Automake/Config.in | 10 | ||||
-rw-r--r-- | lib/Automake/DisjConditions.pm | 20 | ||||
-rw-r--r-- | lib/Automake/ItemDef.pm | 17 | ||||
-rw-r--r-- | lib/Automake/Location.pm | 47 | ||||
-rw-r--r-- | lib/Automake/Makefile.inc | 3 | ||||
-rw-r--r-- | lib/Automake/Options.pm | 29 | ||||
-rw-r--r-- | lib/Automake/Rule.pm | 267 | ||||
-rw-r--r-- | lib/Automake/RuleDef.pm | 13 | ||||
-rw-r--r-- | lib/Automake/VarDef.pm | 105 | ||||
-rw-r--r-- | lib/Automake/Variable.pm | 277 |
12 files changed, 149 insertions, 809 deletions
diff --git a/lib/Automake/ChannelDefs.pm b/lib/Automake/ChannelDefs.pm index bc53eae69..62f64a7e0 100644 --- a/lib/Automake/ChannelDefs.pm +++ b/lib/Automake/ChannelDefs.pm @@ -16,14 +16,6 @@ package Automake::ChannelDefs; use Automake::Config; -BEGIN -{ - if ($perl_threads) - { - require threads; - import threads; - } -} use Automake::Channels; =head1 NAME @@ -142,7 +134,7 @@ Informative messages. # Do not forget to update &usage and the manual # if you add or change a warning channel. -register_channel 'fatal', type => 'fatal', uniq_part => UP_NONE, ordered => 0; +register_channel 'fatal', type => 'fatal', uniq_part => UP_NONE; register_channel 'error', type => 'error'; register_channel 'error-gnu', type => 'error'; register_channel 'error-gnu/warn', type => 'error'; @@ -152,19 +144,17 @@ register_channel 'automake', type => 'fatal', backtrace => 1, "## Internal Error ##\n" . "####################\n"), footer => "\nPlease contact <$PACKAGE_BUGREPORT>.", - uniq_part => UP_NONE, ordered => 0; + uniq_part => UP_NONE; register_channel 'extra-portability', type => 'warning', silent => 1; register_channel 'gnu', type => 'warning'; register_channel 'obsolete', type => 'warning'; register_channel 'override', type => 'warning', silent => 1; register_channel 'portability', type => 'warning', silent => 1; -register_channel 'portability-recursive', type => 'warning', silent => 1; register_channel 'syntax', type => 'warning'; register_channel 'unsupported', type => 'warning'; -register_channel 'verb', type => 'debug', silent => 1, uniq_part => UP_NONE, - ordered => 0; +register_channel 'verb', type => 'debug', silent => 1, uniq_part => UP_NONE; register_channel 'note', type => 'debug', silent => 0; setup_channel_type 'warning', header => 'warning: '; @@ -249,8 +239,6 @@ C<--verbose> messages. sub verb ($;%) { my ($msg, %opts) = @_; - $msg = "thread " . threads->tid . ": " . $msg - if $perl_threads; msg 'verb', '', $msg, %opts; } @@ -292,37 +280,18 @@ sub switch_warning ($) elsif (channel_type ($cat) eq 'warning') { setup_channel $cat, silent => $has_no; - # - # Handling of portability warnings is trickier. For relevant tests, - # see 'dollarvar2', 'extra-portability' and 'extra-portability3'. - # - # -Wportability-recursive and -Wno-portability-recursive should not - # have any effect on other 'portability' or 'extra-portability' - # warnings, so there's no need to handle them separately or ad-hoc. - # + # Handling of portability warnings is trickier. + # See 'extra-portability.test'. if ($cat eq 'extra-portability' && ! $has_no) # -Wextra-portability { - # -Wextra-portability must enable 'portability' and - # 'portability-recursive' warnings. + # '-Wextra-portability' must enable 'portability' warnings. setup_channel 'portability', silent => 0; - setup_channel 'portability-recursive', silent => 0; } - if ($cat eq 'portability') # -Wportability or -Wno-portability + if ($cat eq 'portability' && $has_no) # -Wno-portability { - if ($has_no) # -Wno-portability - { - # -Wno-portability must disable 'extra-portability' and - # 'portability-recursive' warnings. - setup_channel 'portability-recursive', silent => 1; - setup_channel 'extra-portability', silent => 1; - } - else # -Wportability - { - # -Wportability must enable 'portability-recursive' - # warnings. But it should have no influence over the - # 'extra-portability' warnings. - setup_channel 'portability-recursive', silent => 0; - } + # '-Wno-portability' must disable 'extra-portability' + # warnings. + setup_channel 'extra-portability', silent => 1; } } else diff --git a/lib/Automake/Channels.pm b/lib/Automake/Channels.pm index 558532e14..b7eaac88b 100644 --- a/lib/Automake/Channels.pm +++ b/lib/Automake/Channels.pm @@ -43,13 +43,6 @@ Automake::Channels - support functions for error and warning management # Turn on all channels of type 'warning'. setup_channel_type 'warning', silent => 0; - # Redirect all channels to push messages on a Thread::Queue using - # the specified serialization key. - setup_channel_queue $queue, $key; - - # Output a message pending in a Thread::Queue. - pop_channel_queue $queue; - # Treat all warnings as errors. $warnings_are_errors = 1; @@ -81,7 +74,6 @@ use vars qw (@ISA @EXPORT %channels $me); &setup_channel &setup_channel_type &dup_channel_setup &drop_channel_setup &buffer_messages &flush_messages - &setup_channel_queue &pop_channel_queue US_GLOBAL US_LOCAL UP_NONE UP_TEXT UP_LOC_TEXT); @@ -181,11 +173,6 @@ The file where the error should be output. Whether the channel should be silent. Use this do disable a category of warning, for instance. -=item C<ordered =E<gt> 1> - -Whether, with multi-threaded execution, the message should be queued -for ordered output. - =item C<uniq_part =E<gt> UP_LOC_TEXT> The part of the message subject to duplicate filtering. See the @@ -269,9 +256,6 @@ use vars qw (%_default_options %_global_duplicate_messages exit_code => 1, file => \*STDERR, silent => 0, - ordered => 1, - queue => 0, - queue_key => undef, uniq_scope => US_LOCAL, uniq_part => UP_LOC_TEXT, header => '', @@ -343,13 +327,6 @@ sub _merge_options (\%%) confess "unknown option '$_'"; } } - if ($hash->{'ordered'}) - { - confess "fatal messages cannot be ordered" - if $hash->{'type'} eq 'fatal'; - confess "backtrace cannot be output on ordered messages" - if $hash->{'backtrace'}; - } } =item C<register_channel ($name, [%options])> @@ -433,63 +410,6 @@ sub _format_message ($$%) return $msg; } -# _enqueue ($QUEUE, $KEY, $UNIQ_SCOPE, $TO_FILTER, $MSG, $FILE) -# ------------------------------------------------------------- -# Push message on a queue, to be processed by another thread. -sub _enqueue ($$$$$$) -{ - my ($queue, $key, $uniq_scope, $to_filter, $msg, $file) = @_; - $queue->enqueue ($key, $msg, $to_filter, $uniq_scope); - confess "message queuing works only for STDERR" - if $file ne \*STDERR; -} - -# _dequeue ($QUEUE) -# ----------------- -# Pop a message from a queue, and print, similarly to how -# _print_message would do it. Return 0 if the queue is -# empty. Note that the key has already been dequeued. -sub _dequeue ($) -{ - my ($queue) = @_; - my $msg = $queue->dequeue || return 0; - my $to_filter = $queue->dequeue; - my $uniq_scope = $queue->dequeue; - my $file = \*STDERR; - - if ($to_filter ne '') - { - # Do we want local or global uniqueness? - my $dups; - if ($uniq_scope == US_LOCAL) - { - $dups = \%_local_duplicate_messages; - } - elsif ($uniq_scope == US_GLOBAL) - { - $dups = \%_global_duplicate_messages; - } - else - { - confess "unknown value for uniq_scope: " . $uniq_scope; - } - - # Update the hash of messages. - if (exists $dups->{$to_filter}) - { - ++$dups->{$to_filter}; - return 1; - } - else - { - $dups->{$to_filter} = 0; - } - } - print $file $msg; - return 1; -} - - # _print_message ($LOCATION, $MESSAGE, %OPTIONS) # ---------------------------------------------- # Format the message, check duplicates, and print it. @@ -561,15 +481,7 @@ sub _print_message ($$%) } } my $file = $opts{'file'}; - if ($opts{'ordered'} && $opts{'queue'}) - { - _enqueue ($opts{'queue'}, $opts{'queue_key'}, $opts{'uniq_scope'}, - $to_filter, $msg, $file); - } - else - { - print $file $msg; - } + print $file $msg; return 1; } @@ -662,7 +574,7 @@ sub msg ($$;$%) confess if $opts{'backtrace'}; if ($opts{'type'} eq 'fatal') { - # flush messages explicitly here, needed in worker threads. + # Flush messages explicitly here, for extra safety. STDERR->flush; exit $exit_code; } @@ -777,33 +689,6 @@ sub flush_messages () @backlog = (); } -=item C<setup_channel_queue ($queue, $key)> - -Set the queue to fill for each channel that is ordered, -and the key to use for serialization. - -=cut -sub setup_channel_queue ($$) -{ - my ($queue, $key) = @_; - foreach my $channel (keys %channels) - { - setup_channel $channel, queue => $queue, queue_key => $key - if $channels{$channel}{'ordered'}; - } -} - -=item C<pop_channel_queue ($queue)> - -pop a message off the $queue; the key has already been popped. - -=cut -sub pop_channel_queue ($) -{ - my ($queue) = @_; - return _dequeue ($queue); -} - =back =head1 SEE ALSO diff --git a/lib/Automake/Config.in b/lib/Automake/Config.in index 6661d0342..f6a447fb6 100644 --- a/lib/Automake/Config.in +++ b/lib/Automake/Config.in @@ -23,7 +23,7 @@ require Exporter; our @ISA = qw (Exporter); our @EXPORT = qw ($APIVERSION $PACKAGE $PACKAGE_BUGREPORT $VERSION - $RELEASE_YEAR $libdir $perl_threads); + $RELEASE_YEAR $libdir); # Parameters set by configure. Not to be changed. NOTE: assign # VERSION as string so that e.g. version 0.30 will print correctly. @@ -34,14 +34,6 @@ our $VERSION = '@VERSION@'; our $RELEASE_YEAR = '@RELEASE_YEAR@'; our $libdir = '@datadir@/@PACKAGE@-@APIVERSION@'; -our $perl_threads = 0; -# We need at least this version for CLONE support. -if (eval { require 5.007_002; }) - { - use Config; - $perl_threads = $Config{useithreads}; - } - 1; ### Setup "GNU" style for perl-mode and cperl-mode. diff --git a/lib/Automake/DisjConditions.pm b/lib/Automake/DisjConditions.pm index 6281e96db..87cf2a5ff 100644 --- a/lib/Automake/DisjConditions.pm +++ b/lib/Automake/DisjConditions.pm @@ -193,26 +193,6 @@ sub new ($;@) return $self; } - -=item C<CLONE> - -Internal special subroutine to fix up the self hashes in -C<%_disjcondition_singletons> upon thread creation. C<CLONE> is invoked -automatically with ithreads from Perl 5.7.2 or later, so if you use this -module with earlier versions of Perl, it is not thread-safe. - -=cut - -sub CLONE -{ - foreach my $self (values %_disjcondition_singletons) - { - my %h = map { $_ => $_ } @{$self->{'conds'}}; - $self->{'hash'} = \%h; - } -} - - =item C<@conds = $set-E<gt>conds> Return the list of C<Condition> objects involved in C<$set>. diff --git a/lib/Automake/ItemDef.pm b/lib/Automake/ItemDef.pm index ed62094a4..e38f93225 100644 --- a/lib/Automake/ItemDef.pm +++ b/lib/Automake/ItemDef.pm @@ -33,10 +33,6 @@ Automake::ItemDef - base class for Automake::VarDef and Automake::RuleDef Create a new Makefile-item definition. -C<$comment> is any comment preceding the definition. (Because -Automake reorders items in the output, it also tries to carry comments -around.) - C<$location> is the place where the definition occurred, it should be an instance of L<Automake::Location>. @@ -44,12 +40,11 @@ C<$owner> specifies who owns the rule. =cut -sub new ($$$$) +sub new ($$$) { - my ($class, $comment, $location, $owner) = @_; + my ($class, $location, $owner) = @_; my $self = { - comment => $comment, location => $location, owner => $owner, }; @@ -58,8 +53,6 @@ sub new ($$$$) return $self; } -=item C<$def-E<gt>comment> - =item C<$def-E<gt>location> =item C<$def-E<gt>owner> @@ -69,12 +62,6 @@ documentation of C<new>'s arguments for a description of these. =cut -sub comment ($) -{ - my ($self) = @_; - return $self->{'comment'}; -} - sub location ($) { my ($self) = @_; diff --git a/lib/Automake/Location.pm b/lib/Automake/Location.pm index 945d90ebd..78735ae49 100644 --- a/lib/Automake/Location.pm +++ b/lib/Automake/Location.pm @@ -59,13 +59,6 @@ Automake::Location - a class for location tracking, with a stack of contexts # that would otherwise be modified. my $where_copy = $where->clone; - # Serialize a Location object (for passing through a thread queue, - # for example) - my @array = $where->serialize (); - - # De-serialize: recreate a Location object from a queue. - my $where = new Automake::Location::deserialize ($queue); - =head1 DESCRIPTION C<Location> objects are used to keep track of locations in Automake, @@ -207,46 +200,6 @@ sub dump ($) return $res; } -=item C<@array = $location-E<gt>serialize> - -Serialize a Location object (for passing through a thread queue, -for example). - -=cut - -sub serialize ($) -{ - my ($self) = @_; - my @serial = (); - push @serial, $self->get; - my @contexts = $self->get_contexts; - for my $pair (@contexts) - { - push @serial, @{$pair}; - } - push @serial, undef; - return @serial; -} - -=item C<new Automake::Location::deserialize ($queue)> - -De-serialize: recreate a Location object from a queue. - -=cut - -sub deserialize ($) -{ - my ($queue) = @_; - my $position = $queue->dequeue (); - my $self = new Automake::Location $position; - while (my $position = $queue->dequeue ()) - { - my $context = $queue->dequeue (); - push @{$self->{'contexts'}}, [$position, $context]; - } - return $self; -} - =back =head1 SEE ALSO diff --git a/lib/Automake/Makefile.inc b/lib/Automake/Makefile.inc index 2e5722e70..134994c67 100644 --- a/lib/Automake/Makefile.inc +++ b/lib/Automake/Makefile.inc @@ -48,8 +48,7 @@ CLEANFILES += $(nodist_perllib_DATA) %D%/Config.pm: %D%/Config.in Makefile $(AM_V_at)rm -f $@ $@-t $(AM_V_at)$(MKDIR_P) %D% - $(AM_V_GEN)in=Config.in \ - && $(do_subst) <$(srcdir)/%D%/Config.in >$@-t + $(AM_V_GEN)$(do_subst) $(generated_file_finalize) EXTRA_DIST += %D%/Config.in diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm index d7eeebf08..90e5b012a 100644 --- a/lib/Automake/Options.pm +++ b/lib/Automake/Options.pm @@ -273,15 +273,11 @@ sub _is_valid_easy_option ($) check-news color-tests dejagnu - dist-bzip2 - dist-lzip - dist-xz - dist-zip info-in-builddir + ng no-define no-dependencies no-dist - no-dist-gzip no-exeext no-installinfo no-installman @@ -332,26 +328,11 @@ sub _process_option_list (\%@) error $where, "support for Cygnus-style trees has been removed"; $ret = 0; } - # TODO: Remove this special check in Automake 3.0. - elsif ($_ eq 'dist-lzma') - { - error ($where, "support for lzma-compressed distribution " . - "archives has been removed"); - $ret = 0; - } - # TODO: Remove this special check in Automake 3.0. - elsif ($_ eq 'dist-shar') + elsif (/^(?:no-)?dist-.*/) { - error ($where, "support for shar distribution archives has " . - "been removed."); - $ret = 0; - } - # TODO: Remove this special check in Automake 3.0. - elsif ($_ eq 'dist-tarZ') - { - error ($where, "support for distribution archives compressed " . - "with legacy program 'compress' has " . - "been removed."); + error ($where, + "'$_' option and the like are no more supported;\n" . + "use AM_DIST_FORMATS in top-level Makefile.am instead"); $ret = 0; } elsif (/^filename-length-max=(\d+)$/) diff --git a/lib/Automake/Rule.pm b/lib/Automake/Rule.pm index 100408cd6..2f72fdcd6 100644 --- a/lib/Automake/Rule.pm +++ b/lib/Automake/Rule.pm @@ -29,10 +29,8 @@ use Automake::DisjConditions; require Exporter; use vars '@ISA', '@EXPORT', '@EXPORT_OK'; @ISA = qw/Automake::Item Exporter/; -@EXPORT = qw (reset register_suffix_rule next_in_suffix_chain - suffixes rules $KNOWN_EXTENSIONS_PATTERN +@EXPORT = qw (reset rules depend %dependencies %actions register_action - accept_extensions reject_rule msg_rule msg_cond_rule err_rule err_cond_rule rule rrule ruledef rruledef); @@ -95,20 +93,7 @@ non-object). =cut -my $_SUFFIX_RULE_PATTERN = - '^(\.[a-zA-Z0-9_(){}$+@\-]+)(\.[a-zA-Z0-9_(){}$+@\-]+)' . "\$"; - -my @_suffixes = (); -my @_known_extensions_list = (); -my %_rule_dict = (); - -# See comments in the implementation of the 'next_in_suffix_chain()' -# variable for details. -my %_suffix_rules; - -# Same as $suffix_rules, but records only the default rules -# supplied by the languages Automake supports. -my %_suffix_rules_builtin; +my %_rule_dict; =item C<%dependencies> @@ -131,20 +116,6 @@ only when keys exists in C<%dependencies>. use vars '%actions'; -=item C<$KNOWN_EXTENSIONS_PATTERN> - -Pattern that matches all know input extensions (i.e. extensions used -by the languages supported by Automake). Using this pattern (instead -of '\..*$') to match extensions allows Automake to support dot-less -extensions. - -New extensions should be registered with C<accept_extensions>. - -=cut - -use vars qw ($KNOWN_EXTENSIONS_PATTERN); -$KNOWN_EXTENSIONS_PATTERN = ""; - =back =head2 Error reporting functions @@ -231,20 +202,6 @@ sub reject_rule ($$) =over 4 -=item C<accept_extensions (@exts)> - -Update C<$KNOWN_EXTENSIONS_PATTERN> to recognize the extensions -listed in C<@exts>. Extensions should contain a dot if needed. - -=cut - -sub accept_extensions (@) -{ - push @_known_extensions_list, @_; - $KNOWN_EXTENSIONS_PATTERN = - '(?:' . join ('|', map (quotemeta, @_known_extensions_list)) . ')'; -} - =item C<rules> Return the list of all L<Automake::Rule> instances. (I.e., all @@ -289,8 +246,6 @@ other internal data. sub reset() { %_rule_dict = (); - @_suffixes = (); - %_suffix_rules = %_suffix_rules_builtin; %dependencies = ( @@ -342,139 +297,10 @@ sub reset() '.PHONY' => [], '.PRECIOUS' => [], - # Recursive install targets (so "make -n install" works for BSD Make). - '.MAKE' => [], ); %actions = (); } -=item C<next_in_suffix_chain ($ext1, $ext2)> - -Return the target suffix for the next rule to use to reach C<$ext2> -from C<$ext1>, or C<undef> if no such rule exists. - -=cut - -sub next_in_suffix_chain ($$) -{ - my ($ext1, $ext2) = @_; - return undef unless (exists $_suffix_rules{$ext1} and - exists $_suffix_rules{$ext1}{$ext2}); - return $_suffix_rules{$ext1}{$ext2}[0]; -} - -=item C<register_suffix_rule ($where, $src, $dest)> - -Register a suffix rule defined on C<$where> that transforms -files ending in C<$src> into files ending in C<$dest>. - -=cut - -sub register_suffix_rule ($$$) -{ - my ($where, $src, $dest) = @_; - my $suffix_rules = $where->{'position'} ? \%_suffix_rules - : \%_suffix_rules_builtin; - - verb "Sources ending in $src become $dest"; - push @_suffixes, $src, $dest; - - # When transforming sources to objects, Automake uses the - # %suffix_rules to move from each source extension to - # '.$(OBJEXT)', not to '.o' or '.obj'. However some people - # define suffix rules for '.o' or '.obj', so internally we will - # consider these extensions equivalent to '.$(OBJEXT)'. We - # CANNOT rewrite the target (i.e., automagically replace '.o' - # and '.obj' by '.$(OBJEXT)' in the output), or warn the user - # that (s)he'd better use '.$(OBJEXT)', because Automake itself - # output suffix rules for '.o' or '.obj' ... - $dest = '.$(OBJEXT)' if ($dest eq '.o' || $dest eq '.obj'); - - # ---------------------------------------------------------------------- - # The $suffix_rules variable maps the source extension for all suffix - # rules seen to a hash whose keys are the possible output extensions. - # - # Note that this is transitively closed by construction: - # if we have - # - # exists $suffix_rules{$ext1}{$ext2} - # && exists $suffix_rules{$ext2}{$ext3} - # - # then we also have - # - # exists $suffix_rules{$ext1}{$ext3} - # - # So it's easy to check whether '.foo' can be transformed to - # '.$(OBJEXT)' by checking whether $suffix_rules{'.foo'}{'.$(OBJEXT)'} - # exists. This will work even if transforming '.foo' to '.$(OBJEXT)' - # involves a chain of several suffix rules. - # - # The value of $suffix_rules{$ext1}{$ext2} is a pair [$next_sfx, $dist] - # where $next_sfx is target suffix for the next rule to use to reach - # $ext2, and $dist the distance to $ext2. - # ---------------------------------------------------------------------- - - # Register $dest as a possible destination from $src. - # We might have the create the \hash. - if (exists $suffix_rules->{$src}) - { - $suffix_rules->{$src}{$dest} = [ $dest, 1 ]; - } - else - { - $suffix_rules->{$src} = { $dest => [ $dest, 1 ] }; - } - - # If we know how to transform $dest in something else, then - # we know how to transform $src in that "something else". - if (exists $suffix_rules->{$dest}) - { - for my $dest2 (keys %{$suffix_rules->{$dest}}) - { - my $dist = $suffix_rules->{$dest}{$dest2}[1] + 1; - # Overwrite an existing $src->$dest2 path only if - # the path via $dest which is shorter. - if (! exists $suffix_rules->{$src}{$dest2} - || $suffix_rules->{$src}{$dest2}[1] > $dist) - { - $suffix_rules->{$src}{$dest2} = [ $dest, $dist ]; - } - } - } - - # Similarly, any extension that can be derived into $src - # can be derived into the same extensions as $src can. - my @dest2 = keys %{$suffix_rules->{$src}}; - for my $src2 (keys %$suffix_rules) - { - if (exists $suffix_rules->{$src2}{$src}) - { - for my $dest2 (@dest2) - { - my $dist = $suffix_rules->{$src}{$dest2} + 1; - # Overwrite an existing $src2->$dest2 path only if - # the path via $src is shorter. - if (! exists $suffix_rules->{$src2}{$dest2} - || $suffix_rules->{$src2}{$dest2}[1] > $dist) - { - $suffix_rules->{$src2}{$dest2} = [ $src, $dist ]; - } - } - } - } -} - -=item C<@list = suffixes> - -Return the list of known suffixes. - -=cut - -sub suffixes () -{ - return @_suffixes; -} - =item C<rule ($rulename)> Return the C<Automake::Rule> object for the rule @@ -608,23 +434,17 @@ sub _maybe_warn_about_duplicated_target ($$$$$$) { if ($oldowner == RULE_USER) { - # Ignore '%'-style pattern rules. We'd need the - # dependencies to detect duplicates, and they are - # already diagnosed as unportable by -Wportability. - if ($target !~ /^[^%]*%[^%]*$/) - { - ## FIXME: Presently we can't diagnose duplicate user rules - ## because we don't distinguish rules with commands - ## from rules that only add dependencies. E.g., - ## .PHONY: foo - ## .PHONY: bar - ## is legitimate. This is checked in the 'phony.sh' test. - - # msg ('syntax', $where, - # "redefinition of '$target'$condmsg ...", partial => 1); - # msg_cond_rule ('syntax', $cond, $target, - # "... '$target' previously defined here"); - } + ## FIXME: Presently we can't diagnose duplicate user rules + ## because we don't distinguish rules with commands + ## from rules that only add dependencies. E.g., + ## .PHONY: foo + ## .PHONY: bar + ## is legitimate. This is checked in the 'phony.sh' test. + + # msg ('syntax', $where, + # "redefinition of '$target'$condmsg ...", partial => 1); + # msg_cond_rule ('syntax', $cond, $target, + # "... '$target' previously defined here"); } else { @@ -694,9 +514,13 @@ sub _conditionals_for_rule ($$$$) return $cond if !$message; # No ambiguity. + # Ignore possible ambiguity in '%'-style pattern rules. We'd need the + # dependencies to detect duplicates, and would be overkill anyway, worth + # the possibility of annoying false positives. + return $cond if $target =~ /%/; + if ($owner == RULE_USER) { - # For user rules, just diagnose the ambiguity. msg 'syntax', $where, "$message ...", partial => 1; msg_cond_rule ('syntax', $ambig_cond, $target, "... '$target' previously defined here"); @@ -736,22 +560,24 @@ sub _conditionals_for_rule ($$$$) return @conds; } -=item C<@conds = define ($rulename, $source, $owner, $cond, $where)> +=item C<@conds = define ($rulename, $source, $owner, $cond, $where, [$deps])> Define a new rule. C<$rulename> is the list of targets. C<$source> is the filename the rule comes from. C<$owner> is the owner of the rule (C<RULE_AUTOMAKE> or C<RULE_USER>). C<$cond> is the C<Automake::Condition> under which the rule is defined. C<$where> is -the C<Automake::Location> where the rule is defined. +the C<Automake::Location> where the rule is defined. C<$deps> is a +withespace-separated list of dependencies (currently unused). Returns a (possibly empty) list of C<Automake::Condition>s where the rule's definition should be output. =cut -sub define ($$$$$) +sub define ($$$$$;$) { - my ($target, $source, $owner, $cond, $where) = @_; + my ($target, $source, $owner, $cond, $where, $deps) = @_; + $deps = '' unless defined $deps; prog_error "$where is not a reference" unless ref $where; @@ -763,13 +589,11 @@ sub define ($$$$$) my $tdef = _rule_defn_with_exeext_awareness ($target, $cond, $where); - # A GNU make-style pattern rule has a single "%" in the target name. - msg ('portability', $where, - "'%'-style pattern rules are a GNU make extension") - if $target =~ /^[^%]*%[^%]*$/; - # See whether this is a duplicated target declaration. - if ($tdef) + # Ignore '%'-style pattern rules. We'd need to scan the dependencies + # to detect duplicates, and doing so would be overkill anyway, not + # worth the possibility of annoying false positives. + if ($tdef && $target !~ /%/) { # Diagnose invalid target redefinitions, if any. Note that some # target redefinitions are valid (e.g., for multiple-targets @@ -797,42 +621,11 @@ sub define ($$$$$) # Finally define this rule. for my $c (@conds) { - my $def = new Automake::RuleDef ($target, '', $where->clone, - $owner, $source); + my $def = new Automake::RuleDef ($target, $where->clone, $owner, + $source); $rule->set ($c, $def); } - # We honor inference rules with multiple targets because many - # makes support this and people use it. However this is disallowed - # by POSIX. We'll print a warning later. - my $target_count = 0; - my $inference_rule_count = 0; - - for my $t (split (' ', $target)) - { - ++$target_count; - # Check if the rule is a suffix rule: either it's a rule for - # two known extensions... - if ($t =~ /^($KNOWN_EXTENSIONS_PATTERN)($KNOWN_EXTENSIONS_PATTERN)$/ - # ...or it's a rule with unknown extensions (i.e., the rule - # looks like '.foo.bar:' but '.foo' or '.bar' are not - # declared in SUFFIXES and are not known language - # extensions). Automake will complete SUFFIXES from - # @suffixes automatically (see handle_footer). - || ($t =~ /$_SUFFIX_RULE_PATTERN/o && accept_extensions($1))) - { - ++$inference_rule_count; - register_suffix_rule ($where, $1, $2); - } - } - - # POSIX allows multiple targets before the colon, but disallows - # definitions of multiple inference rules. It's also - # disallowed to mix plain targets with inference rules. - msg ('portability', $where, - "inference rules can have only one target before the colon (POSIX)") - if $inference_rule_count > 0 && $target_count > 1; - return @conds; } diff --git a/lib/Automake/RuleDef.pm b/lib/Automake/RuleDef.pm index b90060e40..bedd5aafe 100644 --- a/lib/Automake/RuleDef.pm +++ b/lib/Automake/RuleDef.pm @@ -59,19 +59,18 @@ use constant RULE_USER => 1; # Rule defined in the user's Makefile.am. =over 4 -=item C<new Automake::RuleDef ($name, $comment, $location, $owner, $source)> +=item C<new Automake::RuleDef ($name, $location, $owner, $source)> -Create a new rule definition with target C<$name>, with associated comment -C<$comment>, Location C<$location> and owner C<$owner>, defined in file -C<$source>. +Create a new rule definition with target C<$name>, Location C<$location> +and owner C<$owner>, defined in file C<$source>. =cut -sub new ($$$$$) +sub new ($$$$) { - my ($class, $name, $comment, $location, $owner, $source) = @_; + my ($class, $name, $location, $owner, $source) = @_; - my $self = Automake::ItemDef::new ($class, $comment, $location, $owner); + my $self = Automake::ItemDef::new ($class, $location, $owner); $self->{'source'} = $source; $self->{'name'} = $name; return $self; diff --git a/lib/Automake/VarDef.pm b/lib/Automake/VarDef.pm index dc6558e6e..52dd417f3 100644 --- a/lib/Automake/VarDef.pm +++ b/lib/Automake/VarDef.pm @@ -24,8 +24,7 @@ use Automake::ItemDef; require Exporter; use vars '@ISA', '@EXPORT'; @ISA = qw/Automake::ItemDef Exporter/; -@EXPORT = qw (&VAR_AUTOMAKE &VAR_CONFIGURE &VAR_MAKEFILE - &VAR_ASIS &VAR_PRETTY &VAR_SILENT &VAR_SORTED); +@EXPORT = qw (&VAR_AUTOMAKE &VAR_CONFIGURE &VAR_MAKEFILE); =head1 NAME @@ -43,7 +42,7 @@ Automake::VarDef - a class for variable definitions my $loc = new Automake::Location 'Makefile.am:2'; my $def = new Automake::VarDef ('foo', 'bar # more comment', '# any comment', - $loc, '', VAR_MAKEFILE, VAR_ASIS); + $loc, '', VAR_MAKEFILE); # Appending to a definition. $def->append ('value to append', 'comment to append'); @@ -56,7 +55,6 @@ Automake::VarDef - a class for variable definitions my $location = $def->location; my $type = $def->type; my $owner = $def->owner; - my $pretty = $def->pretty; # Changing owner. $def->set_owner (VAR_CONFIGURE, @@ -91,27 +89,6 @@ use constant VAR_AUTOMAKE => 0; # Variable defined by Automake. use constant VAR_CONFIGURE => 1;# Variable defined in configure.ac. use constant VAR_MAKEFILE => 2; # Variable defined in Makefile.am. -=item C<VAR_ASIS>, C<VAR_PRETTY>, C<VAR_SILENT>, C<VAR_SORTED> - -Possible print styles. C<VAR_ASIS> variables should be output as-is. -C<VAR_PRETTY> variables are wrapped on multiple lines if they cannot -fit on one. C<VAR_SILENT> variables are not output at all. Finally, -C<VAR_SORTED> variables should be sorted and then handled as -C<VAR_PRETTY> variables. - -C<VAR_SILENT> variables can also be overridden silently (unlike the -other kinds of variables whose overriding may sometimes produce -warnings). - -=cut - -# Possible values for pretty. -use constant VAR_ASIS => 0; # Output as-is. -use constant VAR_PRETTY => 1; # Pretty printed on output. -use constant VAR_SILENT => 2; # Not output. (Can also be - # overridden silently.) -use constant VAR_SORTED => 3; # Sorted and pretty-printed. - =back =head2 Methods @@ -121,7 +98,7 @@ from L<Automake::ItemDef>. =over 4 -=item C<my $def = new Automake::VarDef ($varname, $value, $comment, $location, $type, $owner, $pretty)> +=item C<my $def = new Automake::VarDef ($varname, $value, $comment, $location, $type, $owner)> Create a new Makefile-variable definition. C<$varname> is the name of the variable being defined and C<$value> its value. @@ -140,15 +117,12 @@ C<$owner> specifies who owns the variables, it can be one of C<VAR_AUTOMAKE>, C<VAR_CONFIGURE>, or C<VAR_MAKEFILE> (see these definitions). -Finally, C<$pretty> tells how the variable should be output, and can -be one of C<VAR_ASIS>, C<VAR_PRETTY>, or C<VAR_SILENT>, or -C<VAR_SORTED> (see these definitions). - =cut sub new ($$$$$$$$) { - my ($class, $var, $value, $comment, $location, $type, $owner, $pretty) = @_; + my ($class, $var, $value, $comment, $cond, $location, $type, + $owner) = @_; # A user variable must be set by either '=' or ':=', and later # promoted to '+='. @@ -157,42 +131,28 @@ sub new ($$$$$$$$) error $location, "$var must be set with '=' before using '+='"; } - my $self = Automake::ItemDef::new ($class, $comment, $location, $owner); - $self->{'value'} = $value; + my $self = Automake::ItemDef::new ($class, $location, $owner); + $self->{'value_list'} = [ { value => $value, cond => $cond } ]; $self->{'type'} = $type; - $self->{'pretty'} = $pretty; $self->{'seen'} = 0; + $self->{'comment_list'} = [ { text => $comment, cond => $cond } ]; return $self; } -=item C<$def-E<gt>append ($value, $comment)> +=item C<$def-E<gt>append ($value, $comment, $cond)> -Append C<$value> and <$comment> to the existing value and comment of -C<$def>. This is normally called on C<+=> definitions. +Append C<$value> and C<$comment> to the existing value and comment of +C<$def> in condition C<$cond>. This is normally called on C<+=> +definitions. =cut sub append ($$$) { - my ($self, $value, $comment) = @_; - $self->{'comment'} .= $comment; - - my $val = $self->{'value'}; + my ($self, $value, $comment, $cond) = @_; - # Strip comments from augmented variables. This is so that - # VAR = foo # com - # VAR += bar - # does not become - # VAR = foo # com bar - # Furthermore keeping '#' would not be portable if the variable is - # output on multiple lines. - $val =~ s/ ?#.*//; - # Insert a separator, if required. - $val .= ' ' if $val; - $self->{'value'} = $val . $value; - # Turn ASIS appended variables into PRETTY variables. This is to - # cope with 'make' implementation that cannot read very long lines. - $self->{'pretty'} = VAR_PRETTY if $self->{'pretty'} == VAR_ASIS; + push @{$self->{'comment_list'}}, { text => $comment, cond => $cond }; + push @{$self->{'value_list'}}, { value => $value, cond => $cond }; } =item C<$def-E<gt>value> @@ -201,8 +161,6 @@ sub append ($$$) =item C<$def-E<gt>type> -=item C<$def-E<gt>pretty> - Accessors to the various constituents of a C<VarDef>. See the documentation of C<new>'s arguments for a description of these. @@ -212,30 +170,48 @@ sub value ($) { my ($self) = @_; my $val = $self->raw_value; + # Strip anything past '#'. '#' characters cannot be escaped # in Makefiles, so we don't have to be smart. + # FIXME: Actually, '#' *can* be escaped in GNU make ... + # FIXME: Should we adapt our code? $val =~ s/#.*$//s; # Strip backslashes. $val =~ s/\\$/ /mg; return $val; } -sub raw_value ($) +sub comment ($) { my ($self) = @_; - return $self->{'value'}; + return join ("", map { $_->{text} } @{$self->{'comment_list'}}); } -sub type ($) +sub raw_value ($) { my ($self) = @_; - return $self->{'type'}; + my @values = map { $_->{value} } @{$self->{'value_list'}}; + + # Strip comments from augmented variables. This is so that + # VAR = foo # com + # VAR += bar + # does not become + # VAR = foo # com bar + # Furthermore keeping '#' would not be portable if the variable is + # output on multiple lines. + # But we have to preserve escaped '#', so that a definition line: + # hash = \# + # remains possible. To make our life easier, we just assume that + # any tailed comment must be separated with whitespace from the + # actual variable value. + map { s/^#.*//; s/[ \t]+#.*// } @values; + return join (' ', @values); } -sub pretty ($) +sub type ($) { my ($self) = @_; - return $self->{'pretty'}; + return $self->{'type'}; } =item C<$def-E<gt>set_owner ($owner, $location)> @@ -309,13 +285,12 @@ sub dump ($) } my $where = $self->location->dump; - my $comment = $self->comment; my $value = $self->raw_value; my $type = $self->type; return "{ type: $type= - where: $where comment: $comment + where: $where value: $value owner: $owner }\n"; diff --git a/lib/Automake/Variable.pm b/lib/Automake/Variable.pm index bbd74c88b..faae1f7f9 100644 --- a/lib/Automake/Variable.pm +++ b/lib/Automake/Variable.pm @@ -34,7 +34,7 @@ use vars '@ISA', '@EXPORT', '@EXPORT_OK'; @EXPORT = qw (err_var msg_var msg_cond_var reject_var var rvar vardef rvardef variables - scan_variable_expansions check_variable_expansions + scan_variable_expansions variable_delete variables_dump set_seen @@ -55,7 +55,7 @@ Automake::Variable - support for variable definitions # Defining a variable. Automake::Variable::define($varname, $owner, $type, $cond, $value, $comment, - $where, $pretty) + $where) # Looking up a variable. my $var = var $varname; @@ -129,11 +129,6 @@ non-object). =cut -my $_VARIABLE_CHARACTERS = '[.A-Za-z0-9_@]+'; -my $_VARIABLE_PATTERN = '^' . $_VARIABLE_CHARACTERS . "\$"; -my $_VARIABLE_RECURSIVE_PATTERN = - '^([.A-Za-z0-9_@]|\$[({]' . $_VARIABLE_CHARACTERS . '[})]?)+' . "\$"; - # The order in which variables should be output. (May contain # duplicates -- only the first occurrence matters.) my @_var_order; @@ -284,25 +279,6 @@ sub reject_var ($$) =over 4 -=item C<Automake::Variable::hook ($varname, $fun)> - -Declare a function to be called whenever a variable -named C<$varname> is defined or redefined. - -C<$fun> should take two arguments: C<$type> and C<$value>. -When type is C<''> or <':'>, C<$value> is the value being -assigned to C<$varname>. When C<$type> is C<'+'>, C<$value> -is the value being appended to C<$varname>. - -=cut - -use vars '%_hooks'; -sub hook ($$) -{ - my ($var, $fun) = @_; - $_hooks{$var} = $fun; -} - =item C<variables ([$suffix])> Returns the list of all L<Automake::Variable> instances. (I.e., all @@ -445,7 +421,6 @@ sub _new ($$) my ($class, $name) = @_; my $self = Automake::Item::new ($class, $name); $self->{'scanned'} = 0; - $self->{'last-append'} = []; # helper variable for last conditional append. $_variable_dict{$name} = $self; if ($name =~ /_([[:alnum:]]+)$/) { @@ -469,7 +444,7 @@ sub _check_ambiguous_condition ($$$) # We allow silent variables to be overridden silently, # by either silent or non-silent variables. my $def = $self->def ($ambig_cond); - if ($message && $def->pretty != VAR_SILENT) + if ($message) { msg 'syntax', $where, "$message ...", partial => 1; msg_var ('syntax', $var, "... '$var' previously defined here"); @@ -506,6 +481,16 @@ sub check_defined_unconditionally ($;$$) } } +sub _has_line_too_long ($) +{ + my ($text) = @_; + foreach my $line (split "\n", $text) + { + return 1 if length ($line) >= 1000 ; + } + return 0; +} + =item C<$str = $var-E<gt>output ([@conds])> Format all the definitions of C<$var> if C<@cond> is not specified, @@ -530,48 +515,32 @@ sub output ($@) . $self->name . "'") unless $def; - next - if $def->pretty == VAR_SILENT; - $res .= $def->comment; my $val = $def->raw_value; my $equals = $def->type eq ':' ? ':=' : '='; my $str = $cond->subst_string; - - - if ($def->pretty == VAR_ASIS) - { - my $output_var = "$name $equals $val"; - $output_var =~ s/^/$str/meg; - $res .= "$output_var\n"; - } - elsif ($def->pretty == VAR_PRETTY) - { - # Suppress escaped new lines. &makefile_wrap will - # add them back, maybe at other places. - $val =~ s/\\$//mg; - my $wrap = makefile_wrap ("$str$name $equals", "$str\t", - split (' ', $val)); - - # If the last line of the definition is made only of - # @substitutions@, append an empty variable to make sure it - # cannot be substituted as a blank line (that would confuse - # HP-UX Make). - $wrap = makefile_wrap ("$str$name $equals", "$str\t", - split (' ', $val), '$(am__empty)') - if $wrap =~ /\n(\s*@\w+@)+\s*$/; - - $res .= $wrap; - } - else # ($def->pretty == VAR_SORTED) - { - # Suppress escaped new lines. &makefile_wrap will - # add them back, maybe at other places. - $val =~ s/\\$//mg; - $res .= makefile_wrap ("$str$name $equals", "$str\t", - sort (split (' ' , $val))); - } + my $output_var; + # Definition of variables whose value contains unescaped newlines + # (likely as a result of a "+=" appending) cannot be output as-is; + # we need to wrap their definition. We also wrap the definition if + # the length of any line is too big, since POSIX-compliant systems + # are not required to support lines longer than 2048 bytes (most + # notably, some sed implementation are limited to 4000 bytes, and + # sed is used by config.status to rewrite Makefile.in into Makefile). + if (_has_line_too_long ($val) or $val =~ /(:?\\\\)*[^\\]\n./) + { + $val =~ s/\\$//mg; + $output_var = makefile_wrap ("$str$name $equals", "$str\t", + split (' ', $val)); + } + else + { + $val =~ s/^[ \t]*//; + $output_var = "$name $equals $val"; + $output_var =~ s/^/$str/meg; + } + $res .= "$output_var\n"; } return $res; } @@ -725,74 +694,7 @@ sub dump ($) =over 4 -=item C<@list = scan_variable_expansions ($text)> - -Return the list of variable names expanded in C<$text>. Note that -unlike some other functions, C<$text> is not split on spaces before we -check for subvariables. - -=cut - -sub scan_variable_expansions ($) -{ - my ($text) = @_; - my @result = (); - - # Strip comments. - $text =~ s/#.*$//; - - # Record each use of ${stuff} or $(stuff) that does not follow a $. - while ($text =~ /(?<!\$)\$(?:\{([^\}]*)\}|\(([^\)]*)\))/g) - { - my $var = $1 || $2; - # The occurrence may look like $(string1[:subst1=[subst2]]) but - # we want only 'string1'. - $var =~ s/:[^:=]*=[^=]*$//; - push @result, $var; - } - - return @result; -} - -=item C<check_variable_expansions ($text, $where)> - -Check variable expansions in C<$text> and warn about any name that -does not conform to POSIX. C<$where> is the location of C<$text> -for the error message. - -=cut - -sub check_variable_expansions ($$) -{ - my ($text, $where) = @_; - # Catch expansion of variables whose name does not conform to POSIX. - foreach my $var (scan_variable_expansions ($text)) - { - if ($var !~ /$_VARIABLE_PATTERN/o) - { - # If the variable name contains a space, it's likely - # to be a GNU make extension (such as $(addsuffix ...)). - # Mention this in the diagnostic. - my $gnuext = ""; - $gnuext = "\n(probably a GNU make extension)" if $var =~ / /; - # Accept recursive variable expansions if so desired - # (we hope they are rather portable in practice). - if ($var =~ /$_VARIABLE_RECURSIVE_PATTERN/o) - { - msg ('portability-recursive', $where, - "$var: non-POSIX recursive variable expansion$gnuext"); - } - else - { - msg ('portability', $where, "$var: non-POSIX variable name$gnuext"); - } - } - } -} - - - -=item C<Automake::Variable::define($varname, $owner, $type, $cond, $value, $comment, $where, $pretty)> +=item C<Automake::Variable::define($varname, $owner, $type, $cond, $value, $comment, $where)> Define or append to a new variable. @@ -816,20 +718,11 @@ assignment. C<$where>: the C<Location> of the assignment. -C<$pretty>: whether C<$value> should be pretty printed (one of -C<VAR_ASIS>, C<VAR_PRETTY>, C<VAR_SILENT>, or C<VAR_SORTED>, defined -by by L<Automake::VarDef>). C<$pretty> applies only to real -assignments. I.e., it does not apply to a C<+=> assignment (except -when part of it is being done as a conditional C<=> assignment). - -This function will all run any hook registered with the C<hook> -function. - =cut -sub define ($$$$$$$$) +sub define ($$$$$$$) { - my ($var, $owner, $type, $cond, $value, $comment, $where, $pretty) = @_; + my ($var, $owner, $type, $cond, $value, $comment, $where) = @_; prog_error "$cond is not a reference" unless ref $cond; @@ -837,24 +730,6 @@ sub define ($$$$$$$$) prog_error "$where is not a reference" unless ref $where; - prog_error "pretty argument missing" - unless defined $pretty && ($pretty == VAR_ASIS - || $pretty == VAR_PRETTY - || $pretty == VAR_SILENT - || $pretty == VAR_SORTED); - - error $where, "bad characters in variable name '$var'" - if $var !~ /$_VARIABLE_PATTERN/o; - - # ':='-style assignments are not acknowledged by POSIX. Moreover it - # has multiple meanings. In GNU make or BSD make it means "assign - # with immediate expansion", while in OSF make it is used for - # conditional assignments. - msg ('portability', $where, "':='-style assignments are not portable") - if $type eq ':'; - - check_variable_expansions ($value, $where); - # If there's a comment, make sure it is \n-terminated. if ($comment) { @@ -911,9 +786,7 @@ sub define ($$$$$$$$) # 1. append (+=) to a variable defined for current condition if ($type eq '+' && ! $new_var) { - $def->append ($value, $comment); - $self->{'last-append'} = []; - + $def->append ($value, $comment, $cond); # Only increase owners. A VAR_CONFIGURE variable augmented in a # Makefile.am becomes a VAR_MAKEFILE variable. $def->set_owner ($owner, $where->clone) @@ -922,63 +795,24 @@ sub define ($$$$$$$$) # 2. append (+=) to a variable defined for *another* condition elsif ($type eq '+' && ! $self->conditions->false) { - # * Generally, $cond is not TRUE. For instance: + # * If we have an input like: # FOO = foo # if COND # FOO += bar # endif - # In this case, we declare an helper variable conditionally, - # and append it to FOO: + # we declare an helper variable conditionally, and append + # it to FOO: # FOO = foo $(am__append_1) # @COND_TRUE@am__append_1 = bar # Of course if FOO is defined under several conditions, we add # $(am__append_1) to each definitions. - # - # * If $cond is TRUE, we don't need the helper variable. E.g., in - # if COND1 - # FOO = foo1 - # else - # FOO = foo2 - # endif - # FOO += bar - # we can add bar directly to all definition of FOO, and output - # @COND_TRUE@FOO = foo1 bar - # @COND_FALSE@FOO = foo2 bar - - my $lastappend = []; - # Do we need an helper variable? - if ($cond != TRUE) - { - # Can we reuse the helper variable created for the previous - # append? (We cannot reuse older helper variables because - # we must preserve the order of items appended to the - # variable.) - my $condstr = $cond->string; - my $key = "$var:$condstr"; - my ($appendvar, $appendvarcond) = @{$self->{'last-append'}}; - if ($appendvar && $condstr eq $appendvarcond) - { - # Yes, let's simply append to it. - $var = $appendvar; - $owner = VAR_AUTOMAKE; - $self = var ($var); - $def = $self->rdef ($cond); - $new_var = 0; - } - else - { - # No, create it. - my $num = ++$_appendvar; - my $hvar = "am__append_$num"; - $lastappend = [$hvar, $condstr]; - &define ($hvar, VAR_AUTOMAKE, '+', - $cond, $value, $comment, $where, $pretty); - - # Now HVAR is to be added to VAR. - $comment = ''; - $value = "\$($hvar)"; - } - } + my $num = ++$_appendvar; + my $hvar = "am__append_$num"; + &define ($hvar, VAR_AUTOMAKE, '+', + $cond, $value, $comment, $where); + # Now HVAR is to be added to VAR. + $comment = ''; + $value = "\$($hvar)"; # Add VALUE to all definitions of SELF. foreach my $vcond ($self->conditions->conds) @@ -1004,11 +838,9 @@ sub define ($$$$$$$$) } else { - &define ($var, $owner, '+', $vcond, $value, $comment, - $where, $pretty); + &define ($var, $owner, '+', $vcond, $value, $comment, $where); } } - $self->{'last-append'} = $lastappend; } # 3. first assignment (=, :=, or +=) else @@ -1028,16 +860,11 @@ sub define ($$$$$$$$) # Assignments to a macro set its location. We don't adjust # locations for '+='. Ideally I suppose we would associate # line numbers with random bits of text. - $def = new Automake::VarDef ($var, $value, $comment, $where->clone, - $type, $owner, $pretty); + $def = new Automake::VarDef ($var, $value, $comment, $cond, + $where->clone, $type, $owner); $self->set ($cond, $def); push @_var_order, $var; } - - # Call any defined hook. This helps to update some internal state - # *while* parsing the file. For instance the handling of SUFFIXES - # requires this (see var_SUFFIXES_trigger). - &{$_hooks{$var}}($type, $value) if exists $_hooks{$var}; } =item C<variable_delete ($varname, [@conds])> @@ -1647,7 +1474,7 @@ sub transform_variable_recursively ($$$$$&;%) foreach (@conds) { define ($varname, VAR_AUTOMAKE, '', $_, "@result", - '', $where, VAR_PRETTY); + '', $where); } } } |