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