1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22use ExtUtils::MakeMaker;
23
24my $define = '-DSDBM -DDUFF';
25$define .= ' -DWIN32 -DPERL_STATIC_SYMS' if ($^O eq 'MSWin32');
26
27if ($^O eq 'VMS') {  # Old VAXC compiler can't handle Duff's device
28    require Config;
29    $define =~ s/\s+-DDUFF// if $Config::Config{'vms_cc_type'} eq 'vaxc';
30}
31
32WriteMakefile(
33    NAME      => 'sdbm', # (doesn't matter what the name is here) oh yes it does
34#    LINKTYPE  => 'static',
35    DEFINE    => $define,
36    INC       => '-I$(PERL_INC)', # force PERL_INC dir ahead of system -I's
37    SKIP      => [qw(dynamic dynamic_lib dlsyms)],
38    OBJECT    => '$(O_FILES)',
39    clean     => {'FILES' => 'dbu libsdbm.a dbd dba dbe x-dbu *.dir *.pag'},
40    H         => [qw(tune.h sdbm.h pair.h $(PERL_INC)/config.h)],
41    C         => [qw(sdbm.c pair.c hash.c)]
42);
43
44sub MY::constants {
45    package MY;
46    my $self = shift;
47
48    $self->{INST_STATIC} = 'libsdbm$(LIB_EXT)';
49
50    return $self->SUPER::constants();
51}
52
53sub MY::top_targets {
54    my $r = '
55all :: static
56	$(NOECHO) $(NOOP)
57
58config ::
59	$(NOECHO) $(NOOP)
60
61lint:
62	lint -abchx $(LIBSRCS)
63
64';
65    $r .= '
66# This is a workaround, the problem is that our old GNU make exports
67# variables into the environment so $(MYEXTLIB) is set in here to this
68# value which can not be built.
69sdbm/libsdbm.a:
70	$(NOECHO) $(NOOP)
71' unless $^O eq 'VMS';
72
73    return $r;
74}
75