Integrate mainline
[p5sagit/p5-mst-13.2.git] / ext / Encode / EUC_JP / Makefile.PL
CommitLineData
d811239c 1use 5.7.2;
2use strict;
3use ExtUtils::MakeMaker;
4
023d8852 5my %tables = (EUC_JP => [
6 'euc-jp.ucm',
7# 'jis0201.enc',
8# 'jis0212.enc',
9# 'jis0208.enc',
10# 'shiftjis.enc',
11 ]);
d811239c 12
13
14WriteMakefile(
15 INC => "-I..",
16 NAME => "Encode::EUC_JP",
17 VERSION_FROM => 'EUC_JP.pm',
18 OBJECT => '$(O_FILES)',
19 'dist' => {
20 COMPRESS => 'gzip -9f',
21 SUFFIX => 'gz',
22 DIST_DEFAULT => 'all tardist',
23 },
24 MAN3PODS => {},
25 );
26
27package MY;
28
29
30sub post_initialize
31{
32 my ($self) = @_;
33 my %o;
34 my $x = $self->{'OBJ_EXT'};
35 # Add the table O_FILES
36 foreach my $e (keys %tables)
37 {
38 $o{$e.$x} = 1;
39 }
40 $self->{'O_FILES'} = [sort keys %o];
41 my @files;
42 my %xs;
43 foreach my $table (keys %tables) {
44 $xs{"$table.xs"} = "$table.c";
023d8852 45 foreach my $ext (qw($(OBJ_EXT) .xs .c .h _def.h .fnm)) {
d811239c 46 push (@files,$table.$ext);
47 }
48 }
49 $self->{'XS_FILES'} = {%xs};
50 $self->{'clean'}{'FILES'} .= join(' ',@files);
51 return '';
52}
53
54sub postamble
55{
56 my $self = shift;
57 my $dir = $self->catdir($self->updir,'Encode');
023d8852 58 my $str = "# Encode\$(OBJ_EXT) depends on .h and _def.h files not .c files - but all written by compile\n";
d811239c 59 $str .= 'Encode$(OBJ_EXT) :';
60 foreach my $table (keys %tables)
61 {
62 $str .= " $table.c";
63 }
64 $str .= "\n\n";
85f7ebdf 65 foreach my $table (keys %tables)
66 {
67 $str .= "$table.c : $table.xs\n";
68 }
69 $str .= "\n";
d811239c 70 my $compile = $self->catfile($self->updir,'compile');
71 foreach my $table (keys %tables)
72 {
73 my $numlines = 1;
74 my $lengthsofar = length($str);
75 my $continuator = '';
76 $str .= "$table.xs : $compile Makefile.PL";
77 foreach my $file (@{$tables{$table}})
78 {
79 $str .= $continuator.' '.$self->catfile($dir,$file);
80 if ( length($str)-$lengthsofar > 128*$numlines )
81 {
82 $continuator .= " \\\n\t";
83 $numlines++;
84 } else {
85 $continuator = '';
86 }
87 }
88 $str .= "\n\t\$(PERL) $compile -o \$\@ -f $table.fnm\n\n";
89 open (FILELIST, ">$table.fnm")
90 || die "Could not open $table.fnm: $!";
91 foreach my $file (@{$tables{$table}})
92 {
93 print FILELIST $self->catfile($dir,$file) . "\n";
94 }
95 close(FILELIST);
96 }
97 return $str;
98}
99