Upgrade to Devel::PPPort 3.08_06
[p5sagit/p5-mst-13.2.git] / ext / Devel / PPPort / Makefile.PL
CommitLineData
adfe19db 1################################################################################
2#
3# Makefile.PL -- generate Makefile
4#
5################################################################################
6#
236afa0a 7# $Revision: 24 $
adfe19db 8# $Author: mhx $
236afa0a 9# $Date: 2006/06/25 06:30:56 +0200 $
adfe19db 10#
11################################################################################
12#
0d0f8426 13# Version 3.x, Copyright (C) 2004-2006, Marcus Holland-Moritz.
adfe19db 14# Version 2.x, Copyright (C) 2001, Paul Marquess.
15# Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
16#
17# This program is free software; you can redistribute it and/or
18# modify it under the same terms as Perl itself.
19#
20################################################################################
21
0a7c7f4f 22use ExtUtils::MakeMaker;
236afa0a 23use strict;
adfe19db 24require 5.003;
0a7c7f4f 25
adfe19db 26unless ($ENV{'PERL_CORE'}) {
27 $ENV{'PERL_CORE'} = 1 if grep { $_ eq 'PERL_CORE=1' } @ARGV;
9fdbfc11 28}
adfe19db 29
236afa0a 30my %opt;
e8b5c247 31
236afa0a 32@ARGV = map { /^--with-(.*)/ && ++$opt{$1} ? () : $_ } @ARGV;
0d0f8426 33
0a7c7f4f 34WriteMakefile(
adfe19db 35 NAME => 'Devel::PPPort',
36 VERSION_FROM => 'PPPort_pm.PL',
adfe19db 37 PM => { 'PPPort.pm' => '$(INST_LIBDIR)/PPPort.pm' },
adfe19db 38 H => [ qw(ppport.h) ],
39 OBJECT => '$(BASEEXT)$(OBJ_EXT) $(O_FILES)',
40 XSPROTOARG => '-noprototypes',
236afa0a 41 CONFIGURE => \&configure,
0a7c7f4f 42);
adfe19db 43
236afa0a 44sub configure
45{
46 my @clean = qw{ $(H_FILES) PPPort.xs PPPort.c };
47 my %depend = ('$(OBJECT)' => '$(H_FILES)');
48 my @C_FILES = qw{ module2.c module3.c },
49 my %PL_FILES = (
50 'ppport_h.PL' => 'ppport.h',
51 'PPPort_pm.PL' => 'PPPort.pm',
52 'PPPort_xs.PL' => 'PPPort.xs',
53 );
54 my @moreopts;
55
56 if (eval $ExtUtils::MakeMaker::VERSION >= 6) {
57 push @moreopts, AUTHOR => 'Marcus Holland-Moritz <mhx@cpan.org>';
58 if (-f 'PPPort.pm') {
59 push @moreopts, ABSTRACT_FROM => 'PPPort.pm';
60 }
61 }
62
63 if (eval $ExtUtils::MakeMaker::VERSION >= 6.30_01) {
64 print "Setting license tag...\n";
65 push @moreopts, LICENSE => 'perl';
66 }
67
68 if ($ENV{'PERL_CORE'}) {
69 # Pods will be built by installman.
70 push @moreopts, MAN3PODS => {};
71 push @clean, 'PPPort.pm';
72 }
73 else {
74 # Devel::PPPort is in the core since 5.7.3
75 push @moreopts, INSTALLDIRS => ($] >= 5.007003 ? 'perl' : 'site');
76 }
77
78 if ($opt{'apicheck'}) {
79 $PL_FILES{'apicheck_c.PL'} = 'apicheck.c';
80 push @C_FILES, qw{ apicheck.c };
81 push @clean, qw{ apicheck.c apicheck.i };
82 $depend{'apicheck.i'} = 'ppport.h';
83 }
84
85 return {
86 C => \@C_FILES,
87 XS => { 'PPPort.xs' => 'PPPort.c' },
88 PL_FILES => \%PL_FILES,
89 depend => \%depend,
90 clean => { FILES => "@clean" },
91 @moreopts,
92 };
93}
94
95sub MY::postamble
96{
adfe19db 97 package MY;
98 my $post = shift->SUPER::postamble(@_);
99 $post .= <<'POSTAMBLE';
100
101purge_all: realclean
102 @$(RM_F) PPPort.pm PPPort.xs t/*.t
103
104regen:
105 $(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) PPPort_pm.PL
106 $(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) PPPort_xs.PL
107 $(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) mktests.PL
108 $(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) ppport_h.PL
109
110POSTAMBLE
111 return $post;
112}
113
236afa0a 114sub MY::c_o
115{
ba120f6f 116 package MY;
117 my $co = shift->SUPER::c_o(@_);
118
119 $co .= <<'CO' if $::opt{'apicheck'} && $co !~ /^\.c\.i:/m;
120
121.SUFFIXES: .i
122
123.c.i:
124 $(CCCMD) -E -I$(PERL_INC) $(DEFINE) $*.c > $*.i
125CO
126
127 return $co;
128}
129