xref: /openbsd-src/gnu/usr.bin/perl/ext/SDBM_File/Makefile.PL (revision f2da64fbbbf1b03f09f390ab01267c93dfd77c4c)
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# Work around: Darwin ppc64 bug ignores archive contents when building bundles
10
11$define = ($^O eq 'MSWin32') ? '-DMSDOS' : '';
12if ($^O eq 'MSWin32') { $myextlib = 'sdbm\\libsdbm$(LIB_EXT)'; }
13elsif ($^O eq 'darwin' && $Config{'ldflags'} =~/-arch ppc64/) {
14                        $myextlib = '-all_load sdbm/libsdbm$(LIB_EXT)'; }
15else                  { $myextlib = 'sdbm/libsdbm$(LIB_EXT)';  }
16
17WriteMakefile(
18              NAME	=> 'SDBM_File',
19              MYEXTLIB => $myextlib,
20              XSPROTOARG => '-noprototypes', 		# XXX remove later?
21              VERSION_FROM => 'SDBM_File.pm',
22              DEFINE => $define,
23             );
24
25# We don't want the default subdir rule, as it creates a race condition with the
26# rule we add below.
27sub MY::subdir_x {
28    return '';
29}
30
31sub MY::postamble {
32  if ($^O =~ /MSWin32/ && !defined($ENV{SYSTEMROOT})) {
33	if ($Config{'make'} =~ /dmake/i) {
34	    # dmake-specific
35	    return <<'EOT';
36$(MYEXTLIB): sdbm/Makefile
37@[
38	cd sdbm
39	$(MAKE) all
40	cd ..
41]
42EOT
43	} elsif ($Config{'make'} =~ /nmake/i) {
44	    #
45	    return <<'EOT';
46$(MYEXTLIB): sdbm/Makefile
47	cd sdbm
48	$(MAKE) all
49	cd ..
50EOT
51	}
52} elsif ($^O ne 'VMS') {
53    '
54$(MYEXTLIB): sdbm/Makefile
55	cd sdbm && $(MAKE) all
56';
57  }
58  else {
59    '
60$(MYEXTLIB) : [.sdbm]descrip.mms
61	set def [.sdbm]
62    $(MMS) all
63    set def [-]
64';
65  }
66}
67