source: branches/profile/PERL2ARB/make_arbperl_makefile.pl

Last change on this file was 10973, checked in by westram, 11 years ago
  • merge makefile-generation scripts (creating perl-makefile no longer differed between OSX and LINUX)
File size: 1.4 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) { die "LD_LIBRARY_PATH is undefined"; }
22
23  $libs = '';
24  foreach (split /:/,$LD_LIBRARY_PATH) {
25    if (($_ ne '') and (-d $_)) { $libs .= ' -L'.$_; }
26  }
27  $libs =~ s/^\s+//;
28  $libs .= ' -lCORE -lARBDB -lstdc++';
29}
30
31my $args = scalar(@ARGV);
32if ($args!=2) {
33  die "Usage: make_arbperl_makefile.pl compiler-flags linker-flags\n".
34    "Error: missing arguments";
35}
36
37my $cflags = shift @ARGV;
38my $lflags = shift @ARGV;
39
40WriteMakefile(
41              'NAME'         => $name,
42              'VERSION_FROM' => $version_from,
43              'CC'           => $compiler,
44              'CCFLAGS'      => $cflags,
45              'LD'           => $compiler.' '.$lflags,
46              'DEFINE'       => '',
47              'INC'          => $inc,
48              'LIBS'         => $libs,
49             );
50
Note: See TracBrowser for help on using the repository browser.