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