forked from samv/threads-tbb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.PL
72 lines (66 loc) · 1.89 KB
/
Makefile.PL
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
use 5.008;
use strict;
use warnings;
use ExtUtils::MakeMaker;
use Config;
use FindBin qw($Bin);
use File::Find;
if (not $Config{useithreads} or $Config{use5005threads} ) {
print STDERR "Can't use threads::lite without threading support";
exit 0;
}
my $CC = 'g++';
my (@clean, @OBJECT, @LD_FROM, %XS, %PM);
{
my @xs;
my @pm;
find(sub {
!m{^\.} && m{\.xs$} && push @xs, $File::Find::name;
!m{^\.} && m{\.p(m|od)$} && push @pm, $File::Find::name;
}, "lib");
for my $xs (@xs) {
(my $c = $xs) =~ s/\.xs$/.c/i;
(my $o = $xs) =~ s/\.xs$/\$(OBJ_EXT)/i;
#$o =~ s{.*/}{};
$XS{$xs} = $c;
push @OBJECT, $o;
#$o =~ s{.*/}{};
push @LD_FROM, $o;
push @clean, $o;
}
for my $c (<src/*.cc>) {
(my $o = $c) =~ s/\.cc$/\$(OBJ_EXT)/i;
push @OBJECT, $o;
#$o =~ s{.*/}{};
push @LD_FROM, $o;
push @clean, $o;
}
for my $pm ( @pm ) {
my $inst = $pm;
$inst =~ s{^lib}{\$(INST_LIBDIR)};
$PM{$pm} = $inst;
}
}
WriteMakefile(
NAME => 'threads::tbb',
VERSION_FROM => 'lib/threads/tbb.pm', # finds $VERSION
PREREQ_PM => {
'ExtUtils::XSpp' => '0.01',
}, # e.g., Module::Name => 1.1
ABSTRACT_FROM => 'lib/threads/tbb.pod',
AUTHOR => 'Sam Vilain <[email protected]>',
LIBS => ['-ltbb'], # e.g., '-lm'
DEFINE => '', # e.g., '-DHAVE_SOMETHING'
INC => '-Isrc', # e.g., '-I. -I/usr/include/other'
XSOPT => '-C++ -hiertype',
TYPEMAPS => ["$Bin/src/typemap.xsc"],
CC => $CC,
LD => '$(CC)',
CCFLAGS => '-o $@',
LDFROM => join (q{ }, @LD_FROM),
clean => { FILES => join(q{ }, @clean) },
OBJECT => join (q{ }, @OBJECT),
XS => \%XS,
PM => \%PM,
depend => { '$(OBJECT)' => join(" ", glob "src/*.h") },
);