Commit | Line | Data |
d811239c |
1 | use 5.7.2; |
2 | use strict; |
3 | use ExtUtils::MakeMaker; |
4 | |
023d8852 |
5 | my %tables = (EUC_JP => [ |
4cfc977c |
6 | 'euc-jp.ucm', |
7 | 'jis0208.enc', |
8 | 'jis0212.enc', |
9 | 'shiftjis.enc', |
023d8852 |
10 | ]); |
d811239c |
11 | |
12 | |
13 | WriteMakefile( |
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 => {}, |
1604a540 |
24 | # OS 390 winges about line numbers > 64K ??? |
25 | XSOPT => '-nolinenumbers', |
d811239c |
26 | ); |
27 | |
28 | package MY; |
29 | |
30 | |
31 | sub post_initialize |
32 | { |
33 | my ($self) = @_; |
34 | my %o; |
35 | my $x = $self->{'OBJ_EXT'}; |
36 | # Add the table O_FILES |
37 | foreach my $e (keys %tables) |
38 | { |
39 | $o{$e.$x} = 1; |
40 | } |
41 | $self->{'O_FILES'} = [sort keys %o]; |
42 | my @files; |
43 | my %xs; |
44 | foreach my $table (keys %tables) { |
45 | $xs{"$table.xs"} = "$table.c"; |
023d8852 |
46 | foreach my $ext (qw($(OBJ_EXT) .xs .c .h _def.h .fnm)) { |
d811239c |
47 | push (@files,$table.$ext); |
48 | } |
49 | } |
50 | $self->{'XS_FILES'} = {%xs}; |
51 | $self->{'clean'}{'FILES'} .= join(' ',@files); |
52 | return ''; |
53 | } |
54 | |
55 | sub postamble |
56 | { |
57 | my $self = shift; |
58 | my $dir = $self->catdir($self->updir,'Encode'); |
023d8852 |
59 | my $str = "# Encode\$(OBJ_EXT) depends on .h and _def.h files not .c files - but all written by compile\n"; |
d811239c |
60 | $str .= 'Encode$(OBJ_EXT) :'; |
61 | foreach my $table (keys %tables) |
62 | { |
63 | $str .= " $table.c"; |
64 | } |
65 | $str .= "\n\n"; |
85f7ebdf |
66 | foreach my $table (keys %tables) |
67 | { |
68 | $str .= "$table.c : $table.xs\n"; |
69 | } |
70 | $str .= "\n"; |
d811239c |
71 | my $compile = $self->catfile($self->updir,'compile'); |
72 | foreach my $table (keys %tables) |
73 | { |
74 | my $numlines = 1; |
75 | my $lengthsofar = length($str); |
76 | my $continuator = ''; |
77 | $str .= "$table.xs : $compile Makefile.PL"; |
78 | foreach my $file (@{$tables{$table}}) |
79 | { |
80 | $str .= $continuator.' '.$self->catfile($dir,$file); |
81 | if ( length($str)-$lengthsofar > 128*$numlines ) |
82 | { |
83 | $continuator .= " \\\n\t"; |
84 | $numlines++; |
85 | } else { |
86 | $continuator = ''; |
87 | } |
88 | } |
89 | $str .= "\n\t\$(PERL) $compile -o \$\@ -f $table.fnm\n\n"; |
90 | open (FILELIST, ">$table.fnm") |
91 | || die "Could not open $table.fnm: $!"; |
92 | foreach my $file (@{$tables{$table}}) |
93 | { |
94 | print FILELIST $self->catfile($dir,$file) . "\n"; |
95 | } |
96 | close(FILELIST); |
97 | } |
98 | return $str; |
99 | } |
100 | |