use ExtUtils::MakeMaker;
-WriteMakefile(
- 'LINKTYPE' => 'static',
- 'DEFINE' => '-DSDBM -DDUFF',
- 'SKIP' => [qw(static static_lib dynamic dynamic_lib)],
- 'clean'
- => {'FILES' => 'dbu libsdbm.a dbd dba dbe x-dbu *.dir *.pag'}
-);
+$define = '-DSDBM -DDUFF';
+$define .= ' -DWIN32 -DPERL_STATIC_SYMS' if ($^O eq 'MSWin32');
-sub MY::top_targets {
- '
-LIBOBJS = sdbm.o pair.o hash.o
-LIBSRCS = sdbm.c pair.c hash.c
-HDRS = tune.h sdbm.h pair.h
+if ($^O eq 'VMS') { # Old VAXC compiler can't handle Duff's device
+ require Config;
+ $define =~ s/\s+-DDUFF// if $Config::Config{'vms_cc_type'} eq 'vaxc';
+}
-all :: static
+WriteMakefile(
+ NAME => 'sdbm', # (doesn't matter what the name is here) oh yes it does
+# LINKTYPE => 'static',
+ DEFINE => $define,
+ INC => '-I$(PERL_INC)', # force PERL_INC dir ahead of system -I's
+ INST_ARCHLIB => '.',
+ SKIP => [qw(dynamic dynamic_lib dlsyms)],
+ OBJECT => '$(O_FILES)',
+ clean => {'FILES' => 'dbu libsdbm.a dbd dba dbe x-dbu *.dir *.pag'},
+ H => [qw(tune.h sdbm.h pair.h $(PERL_INC)/config.h)],
+ C => [qw(sdbm.c pair.c hash.c)]
+);
-static :: libsdbm.a
+sub MY::constants {
+ package MY;
+ my $r = shift->SUPER::constants();
+ if ($^O eq 'VMS') {
+ $r =~ s/^INST_STATIC =.*$/INST_STATIC = libsdbm\$(LIB_EXT)/m
+ }
+ return $r;
+}
-libsdbm.a: $(LIBOBJS)
- ar cr libsdbm.a $(LIBOBJS)
- $(RANLIB) libsdbm.a
+sub MY::post_constants {
+ package MY;
+ if ($^O eq 'VMS') {
+ shift->SUPER::post_constants();
+ } else {
+'
+INST_STATIC = libsdbm$(LIB_EXT)
+'
+ }
+}
-$(LIBOBJS): $(HDRS) $(PERL_INC)/config.h
+sub MY::top_targets {
+ my $noecho = shift->{NOECHO};
+
+ my $r = '
+all :: static
+ ' . $noecho . '$(NOOP)
config ::
+ ' . $noecho . '$(NOOP)
lint:
lint -abchx $(LIBSRCS)
-';
-}
-
-sub MY::realclean {
- '
-realclean :: clean
- rm -f Makefile
';
-}
+ $r .= '
+# This is a workaround, the problem is that our old GNU make exports
+# variables into the environment so $(MYEXTLIB) is set in here to this
+# value which can not be built.
+sdbm/libsdbm.a:
+ ' . $noecho . '$(NOOP)
+' unless $^O eq 'VMS';
-
-sub MY::postamble {
- '
-sdbm.o : sdbm.c $(PERL_INC)/config.h sdbm.h tune.h pair.h
-hash.o : hash.c $(PERL_INC)/config.h sdbm.h
-pair.o : pair.c $(PERL_INC)/config.h sdbm.h tune.h pair.h
-';
+ return $r;
}