Commit | Line | Data |
2c674647 |
1 | use ExtUtils::MakeMaker; |
14a8264b |
2 | |
3 | my %tables = (iso8859 => ['ascii.enc', 'cp1250.enc'], |
4 | EBCDIC => ['cp1047.enc','cp37.enc','posix-bc.enc'], |
5 | Symbols => ['symbol.enc','dingbats.enc'], |
6 | ); |
7 | |
8 | opendir(ENC,'Encode'); |
9 | while (defined(my $file = readdir(ENC))) |
10 | { |
11 | if ($file =~ /iso8859.*\.enc/) |
12 | { |
13 | push(@{$tables{iso8859}},$file); |
14 | } |
15 | } |
16 | closedir(ENC); |
17 | |
311a0942 |
18 | |
2c674647 |
19 | WriteMakefile( |
20 | NAME => "Encode", |
21 | VERSION_FROM => 'Encode.pm', |
2f2b4ff2 |
22 | OBJECT => '$(O_FILES)', |
2c674647 |
23 | 'dist' => { |
24 | COMPRESS => 'gzip -9f', |
25 | SUFFIX => 'gz', |
26 | DIST_DEFAULT => 'all tardist', |
27 | }, |
28 | MAN3PODS => {}, |
29 | ); |
2f2b4ff2 |
30 | |
31 | package MY; |
32 | |
311a0942 |
33 | |
34 | sub post_initialize |
35 | { |
36 | my ($self) = @_; |
14a8264b |
37 | push(@{$self->{'O_FILES'}},map("$_\$(OBJ_EXT)",keys %tables)); |
38 | my @files; |
39 | foreach my $table (keys %tables) |
40 | { |
41 | foreach my $ext (qw($(OBJ_EXT) .c .h .def)) |
42 | { |
43 | push (@files,$table.$ext); |
44 | } |
45 | } |
46 | $self->{'clean'}{'FILES'} .= join(' ',@files); |
311a0942 |
47 | return ''; |
48 | } |
49 | |
2f2b4ff2 |
50 | sub postamble |
51 | { |
14a8264b |
52 | my $self = shift; |
53 | my $dir = $self->catdir($self->curdir,'Encode'); |
54 | my $str = "# Encode$(OBJ_EXT) depends on .h and .def files not .c files - but all written by compile\n"; |
55 | $str .= 'Encode$(OBJ_EXT) :'; |
56 | my @rules; |
57 | foreach my $table (keys %tables) |
58 | { |
59 | $str .= " $table.c"; |
60 | } |
61 | $str .= "\n\n"; |
62 | foreach my $table (keys %tables) |
63 | { |
64 | $str .= "$table.c : compile \$(MAKEFILE)"; |
65 | foreach my $file (@{$tables{$table}}) |
66 | { |
67 | $str .= ' '.$self->catfile($dir,$file); |
68 | } |
69 | $str .= "\n\t\$(PERL) compile \$\@"; |
70 | foreach my $file (@{$tables{$table}}) |
71 | { |
72 | $str .= ' '.$self->catfile($dir,$file); |
73 | } |
74 | $str .= "\n\n"; |
75 | } |
76 | return $str; |
2f2b4ff2 |
77 | } |