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
|
use ExtUtils::MakeMaker;
use Config;
use POSIX;
# Check if this is an arch where we need position independent code
my $CCFLAGS = '';
my $machine = (POSIX::uname())[4];
if ($machine =~ /64|arm/) {
$CCFLAGS = '-fPIC';
}
WriteMakefile(
NAME => 'libcluster',
VERSION_FROM => '../perl/Cluster.pm',
SKIP => [qw(all static static_lib dynamic dynamic_lib)],
C => ['cluster.c'],
H => ['cluster.h'],
OBJECT => 'cluster.o',
MYEXTLIB => 'libcluster$(LIB_EXT)',
CCFLAGS => $CCFLAGS,
clean => {'FILES' => 'libcluster$(LIBEEXT) $(OBJECT)'},
);
sub MY::top_targets {
'
all :: static
pure_all :: static
static :: $(OBJECT) libcluster$(LIB_EXT)
cluster.o :
$(CC) -c $(INC) $(DEFINE_VERSION) $(XS_DEFINE_VERSION) $(CCFLAGS) -o cluster.o cluster.c
libcluster$(LIB_EXT): $(O_FILES)
$(AR) cru libcluster$(LIB_EXT) $(OBJECT)
$(RANLIB) libcluster$(LIB_EXT)
';
}
|