File: Makefile.PL

package info (click to toggle)
libmath-cephes-perl 0.5308-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,848 kB
  • sloc: ansic: 26,135; perl: 4,954; makefile: 10
file content (111 lines) | stat: -rw-r--r-- 2,236 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.

use strict;
use ExtUtils::MakeMaker;
use Config;
use File::Copy;

my $arch = $Config{archname};
my $is_win32 = ($arch =~ /MSWin32/i && $Config{cc} eq 'cl');
my $is_387 = ($arch =~ /^i\d+-linux/i);
my $is_sol = ($arch =~ /sun4-solaris|sparc/i);
my $is_dar = ($arch =~ /darwin/i);
my $is_cyg = ($arch =~ /cygwin/i || ($arch =~ /MSWin32/i && !$is_win32));
my $is_vms = ($arch =~ /vms/i);

unless ($is_387) {
    my $from = $is_win32 ? 'setpmsvc.c.win32' : 'setprec.c.unix';
    my $to = 'setprec.c';
    unless (-e $to) {
        copy($from, $to) or die "Cannot copy $from to $to: $!";
    }
}

unless ($is_387 or $is_sol) {
    my $from = 'sqrt.c.src';
    my $to = 'sqrt.c';
    unless (-e $to) {
        copy($from, $to) or die "Cannot copy $from to $to: $!";
    }
}

opendir(DIR, '.') or die "Cannot opendir '.': $!\n";
my @objs = map {s/\.c$/.o/; $_} grep { /\.c$/ } sort readdir DIR;
closedir DIR;
my %objs = map {$_ => 1} @objs;
foreach (qw(setprec.o sqrt.o)) {
    push @objs, $_ unless $objs{$_};
}

my %opts = (
            NAME      => 'Math::Cephes::libmd',
            VERSION_FROM => '../lib/Math/Cephes.pm', # finds $VERSION
	    OBJECT => join(' ', @objs),
            SKIP      =>  [ qw( dynamic test ) ] ,
            LINKTYPE  =>  'static',
            clean => {FILES => 'libmd$(LIB_EXT)'},
	   );


$opts{CCFLAGS} = $Config{ccflags} . ' -Wall -fno-builtin '
    if $Config{gccversion};

WriteMakefile(%opts);

package MY;
sub c_o {
    my $self = shift;
    my $c_o = $self->SUPER::c_o(@_);
   if ($is_387) {
      $c_o .= << 'END';

sqrt.o: sqrtelf.387
	$(AS) -o sqrt.o sqrtelf.387

setprec.o: setprelf.387
	$(AS) -o setprec.o setprelf.387

END
   }
    elsif ($is_sol) {
       $c_o .= << 'END';

sqrt.o: sqrt.spa
	$(AS) -o sqrt.o sqrt.spa

END
   }
   else {

   }
   return $c_o;
}

sub post_constants {
    my $postconstant = <<'END';
INST_STATIC = libmd$(LIB_EXT)
END

  return $postconstant;
}

sub top_targets {
    my $top_targets = <<'END';
all    ::    static
	@$(NOOP)

static ::    libmd$(LIB_EXT)
	@$(NOOP)

config ::

test :

test_static ::

test_dynamic ::

END
   return $top_targets;
}