Initial import from FreeBSD RELENG_4:
[dragonfly.git] / contrib / perl5 / ext / SDBM_File / sdbm / Makefile.PL
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 $r = '
46 all :: static
47         $(NOECHO) $(NOOP)
48
49 config ::
50         $(NOECHO) $(NOOP)
51
52 lint:
53         lint -abchx $(LIBSRCS)
54
55 ';
56     $r .= '
57 # This is a workaround, the problem is that our old GNU make exports
58 # variables into the environment so $(MYEXTLIB) is set in here to this
59 # value which can not be built.
60 sdbm/libsdbm.a:
61         $(NOECHO) $(NOOP)
62 ' unless $^O eq 'VMS';
63
64     return $r;
65 }