home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / perl560.zip / ext / SDBM_File / sdbm / Makefile.PL < prev    next >
Makefile  |  1999-07-20  |  2KB  |  68 lines

  1. use ExtUtils::MakeMaker;
  2.  
  3. $define = '-DSDBM -DDUFF';
  4. $define .= ' -DWIN32 -DPERL_STATIC_SYMS' if ($^O eq 'MSWin32');
  5.  
  6. if ($^O eq 'VMS') {  # Old VAXC compiler can't handle Duff's device
  7.     require Config;
  8.     $define =~ s/\s+-DDUFF// if $Config::Config{'vms_cc_type'} eq 'vaxc';
  9. }
  10.  
  11. WriteMakefile(
  12.     NAME      => 'sdbm', # (doesn't matter what the name is here) oh yes it does
  13. #    LINKTYPE  => 'static',
  14.     DEFINE    => $define,
  15.     INC       => '-I$(PERL_INC)', # force PERL_INC dir ahead of system -I's
  16.     INST_ARCHLIB => '.',
  17.     SKIP      => [qw(dynamic dynamic_lib dlsyms)],
  18.     OBJECT    => '$(O_FILES)',
  19.     clean     => {'FILES' => 'dbu libsdbm.a dbd dba dbe x-dbu *.dir *.pag'},
  20.     H         => [qw(tune.h sdbm.h pair.h $(PERL_INC)/config.h)],
  21.     C         => [qw(sdbm.c pair.c hash.c)]
  22. );
  23.  
  24. sub MY::constants {
  25.   package MY;
  26.   my $r = shift->SUPER::constants();
  27.   if ($^O eq 'VMS') {
  28.     $r =~ s/^INST_STATIC =.*$/INST_STATIC = libsdbm\$(LIB_EXT)/m
  29.   }
  30.   return $r;
  31. }
  32.  
  33. sub MY::post_constants {
  34.   package MY;
  35.   if ($^O eq 'VMS') {
  36.     shift->SUPER::post_constants();
  37.   } else {
  38. '
  39. INST_STATIC = libsdbm$(LIB_EXT)
  40. '
  41.   }
  42. }
  43.  
  44. sub MY::top_targets {
  45.     my $noecho = shift->{NOECHO};
  46.     
  47.     my $r = '
  48. all :: static
  49.     ' . $noecho . '$(NOOP)
  50.  
  51. config ::
  52.     ' . $noecho . '$(NOOP)
  53.  
  54. lint:
  55.     lint -abchx $(LIBSRCS)
  56.  
  57. ';
  58.     $r .= '
  59. # This is a workaround, the problem is that our old GNU make exports
  60. # variables into the environment so $(MYEXTLIB) is set in here to this
  61. # value which can not be built.
  62. sdbm/libsdbm.a:
  63.     ' . $noecho . '$(NOOP)
  64. ' unless $^O eq 'VMS';
  65.  
  66.     return $r;
  67. }
  68.