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