Wrap the macro arguments for ck_proto in ().
[p5sagit/p5-mst-13.2.git] / ext / Devel / PPPort / Makefile.PL
CommitLineData
adfe19db 1################################################################################
2#
3# Makefile.PL -- generate Makefile
4#
5################################################################################
6#
56093a11 7# $Revision: 26 $
adfe19db 8# $Author: mhx $
56093a11 9# $Date: 2006/07/08 11:44:45 +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
adfe19db 22require 5.003;
0a7c7f4f 23
56093a11 24use strict;
25use ExtUtils::MakeMaker;
26
27use vars '%opt'; # needs to be global, and we can't use 'our'
28
adfe19db 29unless ($ENV{'PERL_CORE'}) {
30 $ENV{'PERL_CORE'} = 1 if grep { $_ eq 'PERL_CORE=1' } @ARGV;
9fdbfc11 31}
adfe19db 32
56093a11 33@ARGV = map { /^--with-(apicheck)$/ && ++$opt{$1} ? () : $_ } @ARGV;
0d0f8426 34
0a7c7f4f 35WriteMakefile(
adfe19db 36 NAME => 'Devel::PPPort',
37 VERSION_FROM => 'PPPort_pm.PL',
adfe19db 38 PM => { 'PPPort.pm' => '$(INST_LIBDIR)/PPPort.pm' },
adfe19db 39 H => [ qw(ppport.h) ],
78b4ff79 40 OBJECT => 'RealPPPort$(OBJ_EXT) $(O_FILES)',
adfe19db 41 XSPROTOARG => '-noprototypes',
236afa0a 42 CONFIGURE => \&configure,
0a7c7f4f 43);
adfe19db 44
236afa0a 45sub configure
46{
78b4ff79 47 my @clean = qw{ $(H_FILES) RealPPPort.xs RealPPPort.c };
236afa0a 48 my %depend = ('$(OBJECT)' => '$(H_FILES)');
49 my @C_FILES = qw{ module2.c module3.c },
50 my %PL_FILES = (
51 'ppport_h.PL' => 'ppport.h',
52 'PPPort_pm.PL' => 'PPPort.pm',
78b4ff79 53 'PPPort_xs.PL' => 'RealPPPort.xs',
236afa0a 54 );
55 my @moreopts;
56
57 if (eval $ExtUtils::MakeMaker::VERSION >= 6) {
58 push @moreopts, AUTHOR => 'Marcus Holland-Moritz <mhx@cpan.org>';
59 if (-f 'PPPort.pm') {
60 push @moreopts, ABSTRACT_FROM => 'PPPort.pm';
61 }
62 }
63
64 if (eval $ExtUtils::MakeMaker::VERSION >= 6.30_01) {
65 print "Setting license tag...\n";
66 push @moreopts, LICENSE => 'perl';
67 }
68
69 if ($ENV{'PERL_CORE'}) {
70 # Pods will be built by installman.
71 push @moreopts, MAN3PODS => {};
72 push @clean, 'PPPort.pm';
73 }
74 else {
75 # Devel::PPPort is in the core since 5.7.3
76 push @moreopts, INSTALLDIRS => ($] >= 5.007003 ? 'perl' : 'site');
77 }
78
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';
84 }
85
86 return {
87 C => \@C_FILES,
78b4ff79 88 XS => { 'RealPPPort.xs' => 'RealPPPort.c' },
236afa0a 89 PL_FILES => \%PL_FILES,
90 depend => \%depend,
91 clean => { FILES => "@clean" },
92 @moreopts,
93 };
94}
95
96sub MY::postamble
97{
adfe19db 98 package MY;
99 my $post = shift->SUPER::postamble(@_);
100 $post .= <<'POSTAMBLE';
101
102purge_all: realclean
78b4ff79 103 @$(RM_F) PPPort.pm t/*.t
adfe19db 104
78b4ff79 105regen_pm:
adfe19db 106 $(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) PPPort_pm.PL
78b4ff79 107
108regen_xs:
adfe19db 109 $(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) PPPort_xs.PL
78b4ff79 110
111regen_tests:
adfe19db 112 $(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) mktests.PL
78b4ff79 113
114regen_h:
adfe19db 115 $(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) ppport_h.PL
116
78b4ff79 117regen: regen_pm regen_xs regen_tests regen_h
118
adfe19db 119POSTAMBLE
120 return $post;
121}
122
236afa0a 123sub MY::c_o
124{
ba120f6f 125 package MY;
126 my $co = shift->SUPER::c_o(@_);
127
56093a11 128 if ($::opt{'apicheck'} && $co !~ /^\.c\.i:/m) {
129 print "Adding custom rule for preprocessed apicheck file...\n";
130
131 $co .= <<'CO'
ba120f6f 132
133.SUFFIXES: .i
134
135.c.i:
136 $(CCCMD) -E -I$(PERL_INC) $(DEFINE) $*.c > $*.i
137CO
56093a11 138 }
ba120f6f 139
140 return $co;
141}
142