1 ################################################################################
3 # Makefile.PL -- generate Makefile
5 ################################################################################
7 # Version 3.x, Copyright (C) 2004-2013, Marcus Holland-Moritz.
8 # Version 2.x, Copyright (C) 2001, Paul Marquess.
9 # Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
11 # This program is free software; you can redistribute it and/or
12 # modify it under the same terms as Perl itself.
14 ################################################################################
19 use ExtUtils::MakeMaker;
21 use vars '%opt'; # needs to be global, and we can't use 'our'
23 unless ($ENV{'PERL_CORE'}) {
24 $ENV{'PERL_CORE'} = 1 if grep { $_ eq 'PERL_CORE=1' } @ARGV;
27 @ARGV = map { /^--with-(apicheck)$/ && ++$opt{$1} ? () : $_ } @ARGV;
30 NAME => 'Devel::PPPort',
31 VERSION_FROM => 'PPPort_pm.PL',
32 PM => { 'PPPort.pm' => '$(INST_LIBDIR)/PPPort.pm' },
33 H => [ qw(ppport.h) ],
34 OBJECT => 'RealPPPort$(OBJ_EXT) $(O_FILES)',
35 XSPROTOARG => '-noprototypes',
36 CONFIGURE => \&configure,
41 my @clean = qw{ $(H_FILES) RealPPPort.xs RealPPPort.c };
42 my %depend = ('$(OBJECT)' => '$(H_FILES)');
43 my @C_FILES = qw{ module2.c module3.c },
45 'ppport_h.PL' => 'ppport.h',
46 'PPPort_pm.PL' => 'PPPort.pm',
47 'PPPort_xs.PL' => 'RealPPPort.xs',
51 if (eval $ExtUtils::MakeMaker::VERSION >= 6) {
52 push @moreopts, AUTHOR => 'Marcus Holland-Moritz <mhx@cpan.org>';
54 push @moreopts, ABSTRACT_FROM => 'PPPort.pm';
58 if (eval $ExtUtils::MakeMaker::VERSION >= 6.30_01) {
59 print "Setting license tag...\n";
60 push @moreopts, LICENSE => 'perl';
63 if ($ENV{'PERL_CORE'}) {
64 # Pods will be built by installman.
65 push @clean, 'PPPort.pm';
68 # Devel::PPPort is in the core since 5.7.3
69 # 5.11.0+ has site before perl
70 push @moreopts, INSTALLDIRS => (
71 ($] >= 5.007003 and $] < 5.011)
77 if ($opt{'apicheck'}) {
78 $PL_FILES{'apicheck_c.PL'} = 'apicheck.c';
79 push @C_FILES, qw{ apicheck.c };
80 push @clean, qw{ apicheck.c apicheck.i };
81 $depend{'apicheck.i'} = 'ppport.h';
86 XS => { 'RealPPPort.xs' => 'RealPPPort.c' },
87 PL_FILES => \%PL_FILES,
89 clean => { FILES => "@clean" },
97 my $post = shift->SUPER::postamble(@_);
98 $post .= <<'POSTAMBLE';
101 @$(RM_F) PPPort.pm t/*.t
104 $(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) PPPort_pm.PL
107 $(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) PPPort_xs.PL
110 $(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) mktests.PL
113 $(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) ppport_h.PL
115 regen: regen_pm regen_xs regen_tests regen_h
124 my $co = shift->SUPER::c_o(@_);
126 if ($::opt{'apicheck'} && $co !~ /^\.c\.i:/m) {
127 print "Adding custom rule for preprocessed apicheck file...\n";
134 $(CCCMD) -E -I$(PERL_INC) $(DEFINE) $*.c > $*.i