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