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,
43 web => 'https://github.com/mhx/Devel-PPPort/issues/',
47 url => 'git://github.com/mhx/Devel-PPPort.git',
48 web => 'https://github.com/mhx/Devel-PPPort/',
56 my @clean = qw{ $(H_FILES) RealPPPort.xs RealPPPort.c };
57 my %depend = ('$(OBJECT)' => '$(H_FILES)');
58 my @C_FILES = qw{ module2.c module3.c },
60 'ppport_h.PL' => 'ppport.h',
61 'PPPort_pm.PL' => 'PPPort.pm',
62 'PPPort_xs.PL' => 'RealPPPort.xs',
66 if (eval $ExtUtils::MakeMaker::VERSION >= 6) {
67 push @moreopts, AUTHOR => 'Marcus Holland-Moritz <mhx@cpan.org>';
69 push @moreopts, ABSTRACT_FROM => 'PPPort.pm';
73 if (eval $ExtUtils::MakeMaker::VERSION >= 6.30_01) {
74 print "Setting license tag...\n";
75 push @moreopts, LICENSE => 'perl';
78 if ($ENV{'PERL_CORE'}) {
79 # Pods will be built by installman.
80 push @clean, 'PPPort.pm';
83 # Devel::PPPort is in the core since 5.7.3
84 # 5.11.0+ has site before perl
85 push @moreopts, INSTALLDIRS => (
86 ($] >= 5.007003 and $] < 5.011)
92 if ($opt{'apicheck'}) {
93 $PL_FILES{'apicheck_c.PL'} = 'apicheck.c';
94 push @C_FILES, qw{ apicheck.c };
95 push @clean, qw{ apicheck.c apicheck.i };
96 $depend{'apicheck.i'} = 'ppport.h';
101 XS => { 'RealPPPort.xs' => 'RealPPPort.c' },
102 PL_FILES => \%PL_FILES,
104 clean => { FILES => "@clean" },
112 my $post = shift->SUPER::postamble(@_);
113 $post .= <<'POSTAMBLE';
116 @$(RM_F) PPPort.pm t/*.t
119 $(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) PPPort_pm.PL
122 $(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) PPPort_xs.PL
125 $(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) mktests.PL
128 $(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) ppport_h.PL
130 regen: regen_pm regen_xs regen_tests regen_h
139 my $co = shift->SUPER::c_o(@_);
141 if ($::opt{'apicheck'} && $co !~ /^\.c\.i:/m) {
142 print "Adding custom rule for preprocessed apicheck file...\n";
149 $(CCCMD) -E -I$(PERL_INC) $(DEFINE) $*.c > $*.i