Skip to content

have pmake set environment variables #1

@klp2

Description

@klp2

Original: https://rt.cpan.org/Ticket/Display.html?id=5716

Hi Nick,

On my windows machine i'm a user of your very useful
pmake. On otherplateform, with other make avartar, it
seems to me that when you put parameters on the command
line, these parameters are automatically defined
as environment variables. So the following minor
modification of the apply() method. That's satisfied my
own needs, but i ignore if this modification is really
right.

Regards
Philippe

sub apply
{
 my $self = shift;
 my $method = shift;
 $self->NextPass;
 my @targets = ();
 # print STDERR join(' ',Apply => $method,@_),"\n";
 foreach (@_)
 {
 if (/^(\w+)=(.*)$/)
 {
 #print STDERR "OVERRIDE: $1 = $2\n";
 $self->{Override}{$1} = $2;
 # PHV
 $ENV{$1} = $2;
 # PHV
 }
 else
 {
 push(@targets,$_);
 }
 }
 #
 # This expansion is dubious as it alters the database
 # as a function of current values of Override.
 #
 $self->ExpandTarget; # Process $(VAR) :
 @targets = ($self->{'Targets'}[0])->Name unless (@targets);
 # print STDERR join(' ',Targets => $method,map($_->Name,@targets)),"\n";
 foreach (@targets)
 {
 my $t = $self->{Depend}{$_};
 unless (defined $t)
 {
 print STDERR join(' ',$method,@_),"\n";
 die "Cannot `$method' - no target $_"
 }
 $t->$method();
 }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions