1use ExtUtils::MakeMaker;
2use Config;
3
4# The existence of the ./sdbm/Makefile.PL file causes MakeMaker
5# to automatically include Makefile code for the targets
6#	config, all, clean, realclean and sdbm/Makefile
7# which perform the corresponding actions in the subdirectory.
8
9$define = ($^O eq 'MSWin32') ? '-DMSDOS' : '';
10if ($^O eq 'MSWin32') { $myextlib = 'sdbm\\libsdbm$(LIB_EXT)'; }
11else                  { $myextlib = 'sdbm/libsdbm$(LIB_EXT)';  }
12
13WriteMakefile(
14              NAME	=> 'SDBM_File',
15              MYEXTLIB => $myextlib,
16              MAN3PODS 	=> {}, 	# Pods will be built by installman.
17              XSPROTOARG => '-noprototypes', 		# XXX remove later?
18              VERSION_FROM => 'SDBM_File.pm',
19              DEFINE => $define,
20	      PERL_MALLOC_OK => 1,
21             );
22
23sub MY::postamble {
24  if ($^O =~ /MSWin32/ && Win32::IsWin95()) {
25	if ($Config{'make'} =~ /dmake/i) {
26	    # dmake-specific
27	    return <<'EOT';
28$(MYEXTLIB): sdbm/Makefile
29@[
30	cd sdbm
31	$(MAKE) all
32	cd ..
33]
34EOT
35	} elsif ($Config{'make'} =~ /nmake/i) {
36	    #
37	    return <<'EOT';
38$(MYEXTLIB): sdbm/Makefile
39	cd sdbm
40	$(MAKE) all
41	cd ..
42EOT
43	}
44} elsif ($^O ne 'VMS') {
45    '
46$(MYEXTLIB): sdbm/Makefile
47	cd sdbm && $(MAKE) all
48';
49  }
50  else {
51    '
52$(MYEXTLIB) : [.sdbm]descrip.mms
53	set def [.sdbm]
54    $(MMS) all
55    set def [-]
56';
57  }
58}
59