1 | use ExtUtils::MakeMaker; |
---|
2 | # See lib/ExtUtils/MakeMaker.pm for details on how to influence |
---|
3 | # the contents of the Makefile that gets written. |
---|
4 | |
---|
5 | # called from Makefile.main@buildMakefile |
---|
6 | |
---|
7 | my $name = 'ARB'; |
---|
8 | my $version_from = 'ARB.pm'; |
---|
9 | my $inc = '-I../INCLUDE'; |
---|
10 | |
---|
11 | my $compiler = $ENV{'A_CXX'}; |
---|
12 | my $execlibs = $ENV{'EXECLIBS'}; |
---|
13 | |
---|
14 | my $libs; |
---|
15 | { |
---|
16 | # Explicitly add directories from LD_LIBRARY_PATH to linker command. |
---|
17 | # |
---|
18 | # otherwise generated Makefile overrides dynamic linking of libstdc++ via LD_RUN_PATH |
---|
19 | # and make it impossible to build with non-system gcc (e.g. in /opt/gcc-4.7.1/..) |
---|
20 | |
---|
21 | my $LD_LIBRARY_PATH = $ENV{LD_LIBRARY_PATH}; |
---|
22 | if (not defined $LD_LIBRARY_PATH) { |
---|
23 | my $ARBBUILD_LIBRARY_PATH = $ENV{ARBBUILD_LIBRARY_PATH}; |
---|
24 | if (not defined $ARBBUILD_LIBRARY_PATH) { |
---|
25 | die "Neither LD_LIBRARY_PATH nor ARBBUILD_LIBRARY_PATH is defined"; |
---|
26 | } |
---|
27 | $LD_LIBRARY_PATH = $ARBBUILD_LIBRARY_PATH; |
---|
28 | } |
---|
29 | |
---|
30 | $libs = ''; |
---|
31 | foreach (split /:/,$LD_LIBRARY_PATH) { |
---|
32 | if (($_ ne '') and (-d $_)) { $libs .= ' -L'.$_; } |
---|
33 | } |
---|
34 | $libs =~ s/^\s+//; |
---|
35 | $libs .= ' -lCORE -lARBDB -lstdc++ '.$execlibs.' '; |
---|
36 | } |
---|
37 | |
---|
38 | my $args = scalar(@ARGV); |
---|
39 | if ($args!=2) { |
---|
40 | die "Usage: make_arbperl_makefile.pl compiler-flags linker-flags\n". |
---|
41 | "Error: missing arguments"; |
---|
42 | } |
---|
43 | |
---|
44 | my $cflags = shift @ARGV; |
---|
45 | my $lflags = shift @ARGV; |
---|
46 | |
---|
47 | WriteMakefile( |
---|
48 | 'NAME' => $name, |
---|
49 | 'VERSION_FROM' => $version_from, |
---|
50 | 'CC' => $compiler, |
---|
51 | 'CCFLAGS' => $cflags, |
---|
52 | 'LD' => $compiler, |
---|
53 | 'LDDLFLAGS' => $lflags, |
---|
54 | 'DEFINE' => '', |
---|
55 | 'INC' => $inc, |
---|
56 | 'LIBS' => $libs, |
---|
57 | ); |
---|
58 | |
---|