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