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 | |
---|
13 | my $libs; |
---|
14 | { |
---|
15 | # Explicitly add directories from LD_LIBRARY_PATH to linker command. |
---|
16 | # |
---|
17 | # otherwise generated Makefile overrides dynamic linking of libstdc++ via LD_RUN_PATH |
---|
18 | # and make it impossible to build with non-system gcc (e.g. in /opt/gcc-4.7.1/..) |
---|
19 | |
---|
20 | my $LD_LIBRARY_PATH = $ENV{LD_LIBRARY_PATH}; |
---|
21 | if (not defined $LD_LIBRARY_PATH) { |
---|
22 | my $ARBBUILD_LIBRARY_PATH = $ENV{ARBBUILD_LIBRARY_PATH}; |
---|
23 | if (not defined $ARBBUILD_LIBRARY_PATH) { |
---|
24 | die "Neither LD_LIBRARY_PATH nor ARBBUILD_LIBRARY_PATH is defined"; |
---|
25 | } |
---|
26 | $LD_LIBRARY_PATH = $ARBBUILD_LIBRARY_PATH; |
---|
27 | } |
---|
28 | |
---|
29 | $libs = ''; |
---|
30 | foreach (split /:/,$LD_LIBRARY_PATH) { |
---|
31 | if (($_ ne '') and (-d $_)) { $libs .= ' -L'.$_; } |
---|
32 | } |
---|
33 | $libs =~ s/^\s+//; |
---|
34 | $libs .= ' -lCORE -lARBDB -lstdc++'; |
---|
35 | } |
---|
36 | |
---|
37 | my $args = scalar(@ARGV); |
---|
38 | if ($args!=2) { |
---|
39 | die "Usage: make_arbperl_makefile.pl compiler-flags linker-flags\n". |
---|
40 | "Error: missing arguments"; |
---|
41 | } |
---|
42 | |
---|
43 | my $cflags = shift @ARGV; |
---|
44 | my $lflags = shift @ARGV; |
---|
45 | |
---|
46 | WriteMakefile( |
---|
47 | 'NAME' => $name, |
---|
48 | 'VERSION_FROM' => $version_from, |
---|
49 | 'CC' => $compiler, |
---|
50 | 'CCFLAGS' => $cflags, |
---|
51 | 'LD' => $compiler, |
---|
52 | 'LDDLFLAGS' => $lflags, |
---|
53 | 'DEFINE' => '', |
---|
54 | 'INC' => $inc, |
---|
55 | 'LIBS' => $libs, |
---|
56 | ); |
---|
57 | |
---|