This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re-structure Japanese encodings - part 1
[perl5.git] / ext / Encode / EUC_JP / Makefile.PL
CommitLineData
d811239c
NIS
1use 5.7.2;
2use strict;
3use ExtUtils::MakeMaker;
4
3de3d21f
NIS
5my %tables = (EUC_JP => ['euc-jp.ucm'],
6 JIS0208 => ['jis0208.enc'],
7 JIS0212 => ['jis0212.enc'],
8 SHIFTJIS => ['shiftjis.enc'],
9 );
d811239c
NIS
10
11
12WriteMakefile(
13 INC => "-I..",
3de3d21f
NIS
14 NAME => "Encode::Japanese",
15 VERSION_FROM => 'Japanese.pm',
d811239c
NIS
16 OBJECT => '$(O_FILES)',
17 'dist' => {
18 COMPRESS => 'gzip -9f',
19 SUFFIX => 'gz',
20 DIST_DEFAULT => 'all tardist',
21 },
22 MAN3PODS => {},
1604a540
NIS
23 # OS 390 winges about line numbers > 64K ???
24 XSOPT => '-nolinenumbers',
d811239c
NIS
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
NIS
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
NIS
59 $str .= 'Encode$(OBJ_EXT) :';
60 foreach my $table (keys %tables)
61 {
62 $str .= " $table.c";
63 }
64 $str .= "\n\n";
85f7ebdf
CB
65 foreach my $table (keys %tables)
66 {
67 $str .= "$table.c : $table.xs\n";
68 }
69 $str .= "\n";
d811239c
NIS
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