use File::Basename qw(basename dirname fileparse);
use DirHandle;
use strict;
-our ($Is_Mac,$Is_OS2,$Is_VMS,$Is_Win32,$Is_Dos,$Is_PERL_OBJECT,
+our ($Is_Mac,$Is_OS2,$Is_VMS,$Is_Win32,$Is_Dos,
$Verbose,%pm,%static,$Xsubpp_Version);
our $VERSION = '1.12603';
$Is_Win32 = $^O eq 'MSWin32';
$Is_Dos = $^O eq 'dos';
-$Is_PERL_OBJECT = $Config{'ccflags'} =~ /-DPERL_OBJECT/;
-
if ($Is_VMS = $^O eq 'VMS') {
require VMS::Filespec;
import VMS::Filespec qw( &vmsify );
sub ExtUtils::MM_Unix::ppd ;
sub ExtUtils::MM_Unix::prefixify ;
sub ExtUtils::MM_Unix::processPL ;
+sub ExtUtils::MM_Unix::quote_paren ;
sub ExtUtils::MM_Unix::realclean ;
sub ExtUtils::MM_Unix::replace_manpage_separator ;
sub ExtUtils::MM_Unix::static ;
$cpp_cmd =~ s/^CCCMD\s*=\s*\$\(CC\)/$cpp/;
push @m, '
.c.i:
- '. $cpp_cmd . ' $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c > $*.i
+ '. $cpp_cmd . ' $(CCCDLFLAGS) -I$(PERL_INC) $(PASTHRU_DEFINE) $(DEFINE) $*.c > $*.i
';
}
push @m, '
.c.s:
- $(CCCMD) -S $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c
+ $(CCCMD) -S $(CCCDLFLAGS) -I$(PERL_INC) $(PASTHRU_DEFINE) $(DEFINE) $*.c
';
push @m, '
.c$(OBJ_EXT):
- $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c
+ $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(PASTHRU_DEFINE) $(DEFINE) $*.c
';
push @m, '
.C$(OBJ_EXT):
- $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.C
+ $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(PASTHRU_DEFINE) $(DEFINE) $*.C
' if $^O ne 'os2' and $^O ne 'MSWin32' and $^O ne 'dos'; #Case-specific
push @m, '
.cpp$(OBJ_EXT):
- $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.cpp
+ $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(PASTHRU_DEFINE) $(DEFINE) $*.cpp
.cxx$(OBJ_EXT):
- $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.cxx
+ $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(PASTHRU_DEFINE) $(DEFINE) $*.cxx
.cc$(OBJ_EXT):
- $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.cc
+ $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(PASTHRU_DEFINE) $(DEFINE) $*.cc
';
join "", @m;
}
$self->{uc $_} ||= $cflags{$_}
}
- if ($Is_PERL_OBJECT) {
- $self->{CCFLAGS} =~ s/-DPERL_OBJECT(\b|$)/-DPERL_CAPI/g;
- if ($Is_Win32) {
- if ($Config{'cc'} =~ /^cl/i) {
- # Turn off C++ mode of the MSC compiler
- $self->{CCFLAGS} =~ s/-TP(\s|$)//g;
- $self->{OPTIMIZE} =~ s/-TP(\s|$)//g;
- }
- elsif ($Config{'cc'} =~ /^bcc32/i) {
- # Turn off C++ mode of the Borland compiler
- $self->{CCFLAGS} =~ s/-P(\s|$)//g;
- $self->{OPTIMIZE} =~ s/-P(\s|$)//g;
- }
- elsif ($Config{'cc'} =~ /^gcc/i) {
- # Turn off C++ mode of the GCC compiler
- $self->{CCFLAGS} =~ s/-xc\+\+(\s|$)//g;
- $self->{OPTIMIZE} =~ s/-xc\+\+(\s|$)//g;
- }
- }
- }
-
if ($self->{POLLUTE}) {
$self->{CCFLAGS} .= ' -DPERL_POLLUTE ';
}
$pollute = '$(PERL_MALLOC_DEF)';
}
+ $self->{CCFLAGS} = quote_paren($self->{CCFLAGS});
+ $self->{OPTIMIZE} = quote_paren($self->{CCFLAGS});
+
return $self->{CFLAGS} = qq{
CCFLAGS = $self->{CCFLAGS}
OPTIMIZE = $self->{OPTIMIZE}
}
my(@otherfiles) = values %{$self->{XS}}; # .c files from *.xs files
+ if ( $^O eq 'qnx' ) {
+ my @errfiles = @{$self->{C}};
+ for ( @errfiles ) {
+ s/.c$/.err/;
+ }
+ push( @otherfiles, @errfiles, 'perlmain.err' );
+ }
push(@otherfiles, $attribs{FILES}) if $attribs{FILES};
push(@otherfiles, qw[./blib $(MAKE_APERL_FILE) $(INST_ARCHAUTODIR)/extralibs.all
perlmain.c tmon.out mon.out core core.*perl.*.?
*$(OBJ_EXT) *$(LIB_EXT) perl.exe perl perl$(EXE_EXT)
$(BOOTSTRAP) $(BASEEXT).bso
$(BASEEXT).def lib$(BASEEXT).def
- $(BASEEXT).exp
+ $(BASEEXT).exp $(BASEEXT).x
]);
push @m, "\t-$self->{RM_RF} @otherfiles\n";
# See realclean and ext/utils/make_ext for usage of Makefile.old
return $self->{CONST_CCCMD} if $self->{CONST_CCCMD};
return '' unless $self->needs_linking();
return $self->{CONST_CCCMD} =
- q{CCCMD = $(CC) -c $(INC) $(CCFLAGS) $(OPTIMIZE) \\
+ q{CCCMD = $(CC) -c $(PASTHRU_INC) $(INC) \\
+ $(CCFLAGS) $(OPTIMIZE) \\
$(PERLTYPE) $(MPOLLUTE) $(DEFINE_VERSION) \\
$(XS_DEFINE_VERSION)};
}
foreach $m (@{$self->{CONFIG}}){
# SITE*EXP macros are defined in &constants; avoid duplicates here
next if $once_only{$m} or $m eq 'sitelibexp' or $m eq 'sitearchexp';
- push @m, "\U$m\E = ".$self->{uc $m}."\n";
+ $self->{uc $m} = quote_paren($self->{uc $m});
+ push @m, uc($m) , ' = ' , $self->{uc $m}, "\n";
$once_only{$m} = 1;
}
join('', @m);
# Remove "Configure.pm" and similar, if it's not the only pod listed
# To force inclusion, just name it "Configure.pod", or override MAN3PODS
foreach $name (keys %manifypods) {
- if ($name =~ /(config|setup).*\.pm/is) {
+ if ($self->{PERL_CORE} and $name =~ /(config|setup).*\.pm/is) {
delete $manifypods{$name};
next;
}
$self->{INST_SCRIPT} ||= $self->catdir($self->curdir,'blib','script');
# The user who requests an installation directory explicitly
- # should not have to tell us a architecture installation directory
+ # should not have to tell us an architecture installation directory
# as well. We look if a directory exists that is named after the
# architecture. If not we take it as a sign that it should be the
# same as the requested installation directory. Otherwise we take
my $inpod = 0;
while (<FH>) {
$inpod = /^=(?!cut)/ ? 1 : /^=cut/ ? 0 : $inpod;
- next if $inpod;
+ next if $inpod || /^\s*#/;
chop;
# next unless /\$(([\w\:\']*)\bVERSION)\b.*\=/;
next unless /([\$*])(([\w\:\']*)\bVERSION)\b.*\=/;
my($sep) = $Is_VMS ? ',' : '';
$sep .= "\\\n\t";
- foreach $key (qw(LIB LIBPERL_A LINKTYPE PREFIX OPTIMIZE INC DEFINE)){
+ foreach $key (qw(LIB LIBPERL_A LINKTYPE PREFIX OPTIMIZE)) {
push @pasthru, "$key=\"\$($key)\"";
}
+ foreach $key (qw(DEFINE INC)) {
+ push @pasthru, "PASTHRU_$key=\"\$(PASTHRU_$key)\"";
+ }
+
push @m, "\nPASTHRU = ", join ($sep, @pasthru), "\n";
join "", @m;
}
$(PERL_INC)/keywords.h \
$(PERL_INC)/mg.h \
$(PERL_INC)/nostdio.h \
- $(PERL_INC)/objXSUB.h \
$(PERL_INC)/op.h \
$(PERL_INC)/opcode.h \
$(PERL_INC)/opnames.h \
=cut
+sub _pm_to_blib_flush {
+ my ($self, $autodir, $rr, $ra, $rl) = @_;
+ $$rr .=
+q{ }.$self->{NOECHO}.q[$(PERLRUNINST) -MExtUtils::Install \
+ -e "pm_to_blib({qw{].qq[@$ra].q[}},'].$autodir.q{','$(PM_FILTER)')"
+};
+ @$ra = ();
+ $$rl = 0;
+}
+
sub pm_to_blib {
my $self = shift;
my($autodir) = $self->catdir('$(INST_LIB)','auto');
- return q{
+ my $r = q{
pm_to_blib: $(TO_INST_PM)
- }.$self->{NOECHO}.q{$(PERLRUNINST) -MExtUtils::Install \
- -e "pm_to_blib({qw{$(PM_TO_BLIB)}},'}.$autodir.q{','$(PM_FILTER)')"
- }.$self->{NOECHO}.q{$(TOUCH) $@
};
+ my %pm_to_blib = %{$self->{PM}};
+ my @a;
+ my $l;
+ while (my ($pm, $blib) = each %pm_to_blib) {
+ my $la = length $pm;
+ my $lb = length $blib;
+ if ($l + $la + $lb + @a / 2 > 200) { # limit line length
+ _pm_to_blib_flush($self, $autodir, \$r, \@a, \$l);
+ }
+ push @a, $pm, $blib;
+ $l += $la + $lb;
+ }
+ _pm_to_blib_flush($self, $autodir, \$r, \@a, \$l);
+ return $r.q{ }.$self->{NOECHO}.q{$(TOUCH) $@};
}
=item post_constants (o)
join "", @m;
}
+=item quote_paren
+
+Backslashes parentheses C<()> in command line arguments.
+Doesn't handle recursive Makefile C<$(...)> constructs,
+but handles simple ones.
+
+=cut
+
+sub quote_paren {
+ local $_ = shift;
+ s/\$\((.+?)\)/\$\\\\($1\\\\)/g; # protect $(...)
+ s/(?<!\\)([()])/\\$1/g; # quote unprotected
+ s/\$\\\\\((.+?)\\\\\)/\$($1)/g; # unprotect $(...)
+ return $_;
+}
+
=item realclean (o)
Defines the realclean target.
subdirs ::
@[
cd $subdir
- \$(MAKE) all \$(PASTHRU)
+ \$(MAKE) -f \$(FIRST_MAKEFILE) all \$(PASTHRU)
cd ..
]
EOT
return <<EOT;
subdirs ::
cd $subdir
- \$(MAKE) all \$(PASTHRU)
+ \$(MAKE) -f \$(FIRST_MAKEFILE) all \$(PASTHRU)
cd ..
EOT
}
return <<EOT;
subdirs ::
- $self->{NOECHO}cd $subdir && \$(MAKE) all \$(PASTHRU)
-
+ $self->{NOECHO}cd $subdir && \$(MAKE) -f \$(FIRST_MAKEFILE) all \$(PASTHRU)
EOT
}
}
'
.xs$(OBJ_EXT):
$(PERLRUN) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.c
- $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c
+ $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(PASTHRU_DEFINE) $(DEFINE) $*.c
';
}