1 ################################################################################
3 # Makefile.PL -- generate Makefile
5 ################################################################################
9 # $Date: 2009/01/18 14:10:49 +0100 $
11 ################################################################################
13 # Version 3.x, Copyright (C) 2004-2009, Marcus Holland-Moritz.
14 # Version 2.x, Copyright (C) 2001, Paul Marquess.
15 # Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
17 # This program is free software; you can redistribute it and/or
18 # modify it under the same terms as Perl itself.
20 ################################################################################
25 use ExtUtils::MakeMaker;
27 use vars '%opt'; # needs to be global, and we can't use 'our'
29 unless ($ENV{'PERL_CORE'}) {
30 $ENV{'PERL_CORE'} = 1 if grep { $_ eq 'PERL_CORE=1' } @ARGV;
33 @ARGV = map { /^--with-(apicheck)$/ && ++$opt{$1} ? () : $_ } @ARGV;
36 NAME => 'Devel::PPPort',
37 VERSION_FROM => 'PPPort_pm.PL',
38 PM => { 'PPPort.pm' => '$(INST_LIBDIR)/PPPort.pm' },
39 H => [ qw(ppport.h) ],
40 OBJECT => 'RealPPPort$(OBJ_EXT) $(O_FILES)',
41 XSPROTOARG => '-noprototypes',
42 CONFIGURE => \&configure,
47 my @clean = qw{ $(H_FILES) RealPPPort.xs RealPPPort.c };
48 my %depend = ('$(OBJECT)' => '$(H_FILES)');
49 my @C_FILES = qw{ module2.c module3.c },
51 'ppport_h.PL' => 'ppport.h',
52 'PPPort_pm.PL' => 'PPPort.pm',
53 'PPPort_xs.PL' => 'RealPPPort.xs',
57 if (eval $ExtUtils::MakeMaker::VERSION >= 6) {
58 push @moreopts, AUTHOR => 'Marcus Holland-Moritz <mhx@cpan.org>';
60 push @moreopts, ABSTRACT_FROM => 'PPPort.pm';
64 if (eval $ExtUtils::MakeMaker::VERSION >= 6.30_01) {
65 print "Setting license tag...\n";
66 push @moreopts, LICENSE => 'perl';
69 if ($ENV{'PERL_CORE'}) {
70 # Pods will be built by installman.
71 push @moreopts, MAN3PODS => {};
72 push @clean, 'PPPort.pm';
75 # Devel::PPPort is in the core since 5.7.3
76 push @moreopts, INSTALLDIRS => ($] >= 5.007003 ? 'perl' : 'site');
79 if ($opt{'apicheck'}) {
80 $PL_FILES{'apicheck_c.PL'} = 'apicheck.c';
81 push @C_FILES, qw{ apicheck.c };
82 push @clean, qw{ apicheck.c apicheck.i };
83 $depend{'apicheck.i'} = 'ppport.h';
88 XS => { 'RealPPPort.xs' => 'RealPPPort.c' },
89 PL_FILES => \%PL_FILES,
91 clean => { FILES => "@clean" },
99 my $post = shift->SUPER::postamble(@_);
100 $post .= <<'POSTAMBLE';
103 @$(RM_F) PPPort.pm t/*.t
106 $(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) PPPort_pm.PL
109 $(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) PPPort_xs.PL
112 $(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) mktests.PL
115 $(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) ppport_h.PL
117 regen: regen_pm regen_xs regen_tests regen_h
126 my $co = shift->SUPER::c_o(@_);
128 if ($::opt{'apicheck'} && $co !~ /^\.c\.i:/m) {
129 print "Adding custom rule for preprocessed apicheck file...\n";
136 $(CCCMD) -E -I$(PERL_INC) $(DEFINE) $*.c > $*.i