source: tags/ms_r18q1/PERL2ARB/make_arbperl_makefile.pl

Last change on this file was 16223, checked in by westram, 7 years ago
File size: 1.6 KB
Line 
1use 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
7my $name         = 'ARB';
8my $version_from = 'ARB.pm';
9my $inc          = '-I../INCLUDE';
10
11my $compiler = $ENV{'A_CXX'};
12
13my $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
37my $args = scalar(@ARGV);
38if ($args!=2) {
39  die "Usage: make_arbperl_makefile.pl compiler-flags linker-flags\n".
40    "Error: missing arguments";
41}
42
43my $cflags = shift @ARGV;
44my $lflags = shift @ARGV;
45
46WriteMakefile(
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
Note: See TracBrowser for help on using the repository browser.