Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

have pmake set environment variables #1

Open
klp2 opened this issue Mar 8, 2016 · 2 comments
Open

have pmake set environment variables #1

klp2 opened this issue Mar 8, 2016 · 2 comments

Comments

@klp2
Copy link
Owner

klp2 commented Mar 8, 2016

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();
 }
}
@mohawk2
Copy link
Collaborator

mohawk2 commented Jul 29, 2020

Since other makes don't do this, and there are already ways to set env-vars, there is no reason to do so in this program. Reluctantly closing. (RT ticket also closed)

@mohawk2 mohawk2 closed this as completed Jul 29, 2020
@mohawk2
Copy link
Collaborator

mohawk2 commented Aug 2, 2020

In fact, GNU make does do this: https://www.gnu.org/software/make/manual/make.html#Environment

@mohawk2 mohawk2 reopened this Aug 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants