X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=win32%2Fbuildext.pl;h=59935ac45935ff164670c768257d1f790b07ceda;hb=a5b1c163d928df548cbec60aa22830af0e4968d3;hp=6e64b91f5eb726960d7032cc52a99f76932aeeac;hpb=17af6fb0658e86e2f4a472e3392fc688e0c25b43;p=p5sagit%2Fp5-mst-13.2.git diff --git a/win32/buildext.pl b/win32/buildext.pl index 6e64b91..59935ac 100644 --- a/win32/buildext.pl +++ b/win32/buildext.pl @@ -1,6 +1,26 @@ -use File::Find; +=head1 NAME + +buildext.pl - build extensions + +=head1 SYNOPSIS + + buildext.pl make [-make_opts] dep directory [target] + +E.g. + + buildext.pl nmake -nologo perldll.def ..\ext + + buildext.pl nmake -nologo perldll.def ..\ext clean + + buildext.pl dmake perldll.def ..\ext + + buildext.pl dmake perldll.def ..\ext clean + +=cut + use File::Basename; use Cwd; +use FindExt; my $here = getcwd(); my $perl = $^X; $here =~ s,/,\\,g; @@ -9,25 +29,27 @@ if ($perl =~ m#^\.\.#) $perl = "$here\\$perl"; } my $make = shift; +$make .= " ".shift while $ARGV[0]=~/^-/; my $dep = shift; my $dmod = -M $dep; my $dir = shift; chdir($dir) || die "Cannot cd to $dir\n"; +my $targ = shift; (my $ext = getcwd()) =~ s,/,\\,g; -my $no = join('|',qw(DynaLoader GDBM_File ODBM_File NDBM_File DB_File Syslog Sysv)); -$no = qr/^(?:$no)$/i; -my %ext; -find(\&find_xs,'.'); +FindExt::scan_ext($ext); -foreach my $dir (sort keys %ext) +my @ext = FindExt::extensions(); + +foreach my $dir (sort @ext) { if (chdir("$ext\\$dir")) { my $mmod = -M 'Makefile'; if (!(-f 'Makefile') || $mmod > $dmod) { - print "\nMakefile.PL in $dir ($mmod > $dmod)\n"; - my $code = system($perl,"-I$here\\..\lib",'Makefile.PL','INSTALLDIRS=perl'); + print "\nRunning Makefile.PL in $dir\n"; + print "$perl \"-I$here\\..\\lib\" Makefile.PL INSTALLDIRS=perl\n"; + my $code = system($perl,"-I$here\\..\\lib",'Makefile.PL','INSTALLDIRS=perl'); warn "$code from $dir's Makefile.PL" if $code; $mmod = -M 'Makefile'; if ($mmod > $dmod) @@ -35,8 +57,16 @@ foreach my $dir (sort keys %ext) warn "Makefile $mmod > $dmod ($dep)\n"; } } - print "\nMaking $dir\n"; - system($make); + if ($targ) + { + print "Making $targ in $dir\n$make $targ\n"; + system($make,$targ); + } + else + { + print "Making $dir\n$make\n"; + system($make); + } chdir($here) || die "Cannot cd to $here:$!"; } else @@ -45,19 +75,3 @@ foreach my $dir (sort keys %ext) } } -sub find_xs -{ - if (/^(.*)\.pm$/i) - { - my $name = $1; - return if $name =~ $no; - my $dir = $File::Find::dir; - $dir =~ s,./,,; - return if exists $ext{$dir}; - return unless -f "$ext/$dir/Makefile.PL"; - if ($dir =~ /$name$/i) - { - $ext{$dir} = $name; - } - } -} \ No newline at end of file