diff --git a/Basic/Math/Makefile.PL b/Basic/Math/Makefile.PL index c19b29a0e..e15dada15 100644 --- a/Basic/Math/Makefile.PL +++ b/Basic/Math/Makefile.PL @@ -1,39 +1,10 @@ use strict; use warnings; -use ExtUtils::MakeMaker; - -# Files for each routine (.c assumed) -my %source = qw( - j0 j0 - j1 j1 - jn jn - y0 j0 - y1 j1 - yn yn -); -my @keys = sort keys %source; - -my $libs = get_maths_libs(); -# Test for presence of besfuncs -my $include = qq{#include "mconf.h"}; -$source{$_} = 'system' for grep trylink('', $include, "$_(1.);", $libs), qw(j0 j1 y0 y1); -$source{$_} = 'system' for grep trylink('', $include, "$_(1,1.);", $libs), qw(jn yn); my @pack = (["math.pd", qw(Math PDL::Math)]); my %hash = pdlpp_stdargs_int(@pack); - -my %seen; # Build object file list -foreach my $func (@keys) { - my $file = $source{$func}; - next if $file eq 'system'; - die "File for function $func not found\n" if $file eq ''; - $hash{OBJECT} .= " $file\$(OBJ_EXT)" unless $seen{$file}++; -} - -# Add support routines -$hash{OBJECT} .= join '', map " $_\$(OBJ_EXT)", qw(const mtherr polevl cpoly ndtri); - -$hash{LIBS}[0] .= " $libs"; +$hash{OBJECT} .= $PDL::Core::Dev::EXTRAS{'math.pd'}{OBJECT}; +$hash{LIBS}[0] .= " " . PDL::Core::Dev::get_maths_libs(); undef &MY::postamble; # suppress warning *MY::postamble = sub { diff --git a/Basic/Math/math.pd b/Basic/Math/math.pd index 6949fcbf5..e3756f72f 100644 --- a/Basic/Math/math.pd +++ b/Basic/Math/math.pd @@ -4,6 +4,33 @@ use Config; use PDL::Types qw(ppdefs ppdefs_complex types); require PDL::Core::Dev; +{ # pass info back to Makefile.PL +# Files for each routine (.c assumed) +my %source = qw( + j0 j0 + j1 j1 + jn jn + y0 j0 + y1 j1 + yn yn +); +my @keys = sort keys %source; +my $libs = PDL::Core::Dev::get_maths_libs(); +# Test for presence of besfuncs +my $include = qq{#include "mconf.h"}; +$source{$_} = 'system' for grep PDL::Core::Dev::trylink('', $include, "$_(1.);", $libs), qw(j0 j1 y0 y1); +$source{$_} = 'system' for grep PDL::Core::Dev::trylink('', $include, "$_(1,1.);", $libs), qw(jn yn); +my %seen; # Build object file list +foreach my $func (@keys) { + my $file = $source{$func}; + next if $file eq 'system'; + die "File for function $func not found\n" if $file eq ''; + $PDL::Core::Dev::EXTRAS{$::PDLMOD}{OBJECT} .= " $file\$(OBJ_EXT)" unless $seen{$file}++; +} +# Add support routines +$PDL::Core::Dev::EXTRAS{$::PDLMOD}{OBJECT} .= join '', map " $_\$(OBJ_EXT)", qw(const mtherr polevl cpoly ndtri); +} + my $R = [ppdefs()]; my $F = [map $_->ppsym, grep $_->real && !$_->integer, types()]; my $C = [ppdefs_complex()]; diff --git a/Basic/lib/PDL/PP.pm b/Basic/lib/PDL/PP.pm index 42ec9484c..d1212a1f0 100644 --- a/Basic/lib/PDL/PP.pm +++ b/Basic/lib/PDL/PP.pm @@ -539,7 +539,8 @@ sub list_functions { local *PDL::PP::pp_def = sub { push @funcs, (_pp_parsename($_[0]))[0]}; undef &PDL::PP::pp_done; local *PDL::PP::pp_done = sub {}; - $_ = '' for $::PDLMOD, $::CALLPACK, $::PDLOBJ; # stop warnings + $::PDLMOD = $file; + $_ ||= '' for $::CALLPACK, $::PDLOBJ; # stop warnings require File::Spec::Functions; do ''.File::Spec::Functions::rel2abs($file); die $@ if $@;