8875f2c883586e5adb20e582eb859a5207282d2f
[jabaws.git] / binaries / src / ViennaRNA / interfaces / Perl / Makefile.PL.in
1 # File : Makefile.PL
2 use ExtUtils::MakeMaker;
3 use Config;
4
5 # unfortunately MakeMaker thinks it is clever
6 # with forcing several compiler and/or linker flags
7 # However, this behavior is a real pain in the a**
8 # when crosscompiling and therefore we need to adjust
9 # some things prior to the call of WriteMakefile()
10
11 my $CCFLAGS = $Config{'ccflags'};
12 my $OPTIMIZE = $Config{'optimize'};
13
14 # Perl is built with -Wdeclaration-after-statement on RHEL5 - this isn't
15 # meaningful for C++ - it only emits a warning but it's easy to fix.
16 $CCFLAGS =~ s/(?:^|\s+)-Wdeclaration-after-statement(?:\s+|$)/ /;
17
18 # The generated code causes "variable may be used uninitialized" warnings
19 # if Perl was built with -Wall.
20 $CCFLAGS =~ s/(^|\s+)-Wall(\s+|$)/$1-Wall -Wno-uninitialized$2/;
21
22 # add CPP/CXX flags if they exist
23 $CCFLAGS .= ' ' . $var{CPPFLAGS} if exists $var{CPPFLAGS};
24 $CCFLAGS .= ' ' . $var{CXXFLAGS} if exists $var{CXXFLAGS};
25
26 # add CXXFLAGS and AM_CXXFLAGS as shell variables
27 $CCFLAGS .= ' $(AM_CXXFLAGS) $(CXXFLAGS) -I../../H';
28
29 # we also need to strip some compiler flags from 'optimize'
30 # since architecture features of the host system may interfere
31 # with the target architecture when crooscompiling
32 $OPTIMIZE =~ s/-march=[a-zA-Z0-9_\-]+//g;
33 $OPTIMIZE =~ s/-mtune=[a-zA-Z0-9_\-]+//g;
34
35 # print "CCFLAGS:\t", $CCFLAGS, "\n";
36 # print "OPTIMIZE:\t", $OPTIMIZE, "\n";
37
38 WriteMakefile(
39               MAKEFILE    =>  "Makefile.perl",
40               NAME        =>  "RNA",
41               LIBS        =>  ["-lm"],
42               CCFLAGS     =>  $CCFLAGS,
43               OPTIMIZE    =>  $OPTIMIZE,
44               MYEXTLIB    =>  "../../lib/libRNA.a",
45               LD          =>  '${CXX}',
46               PM          =>  {"RNA.pm", '$(INST_LIBDIR)/RNA.pm'},
47               OBJECT      =>  "RNA_wrap.o",
48               dynamic_lib =>  {OTHERLDFLAGS => '$(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) @OPENMP_CFLAGS@'},
49               AUTHOR      =>  'Ivo Hofacker <ivo@tbi.univie.ac.at>',
50               VERSION     =>  '@VERSION@'
51 );