Re: [PATCH regexec.c] lookahead for REF, MINMOD, PLUS, CURLY*
[p5sagit/p5-mst-13.2.git] / ext / Encode / Makefile.PL
CommitLineData
2c674647 1use ExtUtils::MakeMaker;
14a8264b 2
94b89828 3my %tables = (8859 => ['ascii.ucm', 'cp1250.ucm', 'koi8-r.ucm' ],
e03ac092 4 EBCDIC => ['cp1047.ucm','cp37.ucm','posix-bc.ucm'],
5 Symbols => ['symbol.ucm','dingbats.ucm'],
14a8264b 6 );
7
8opendir(ENC,'Encode');
9while (defined(my $file = readdir(ENC)))
10 {
62756987 11 if ($file =~ /8859.*\.ucm/)
14a8264b 12 {
94b89828 13 push(@{$tables{8859}},$file);
14a8264b 14 }
15 }
16closedir(ENC);
17
311a0942 18
2c674647 19WriteMakefile(
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
31package MY;
32
311a0942 33
34sub post_initialize
35{
36 my ($self) = @_;
8d7e77d6 37 my %o;
38 # Find existing O_FILES
39 foreach my $f (@{$self->{'O_FILES'}})
40 {
41 $o{$f} = 1;
c6fdb90a 42 }
8d7e77d6 43 my $x = $self->{'OBJ_EXT'};
44 # Add the table O_FILES
45 foreach my $e (keys %tables)
46 {
47 $o{$e.$x} = 1;
c6fdb90a 48 }
b9a7ec59 49 # Trick case-blind filesystems.
50 delete $o{'encode'.$x};
4d53c495 51 $o{'Encode'.$x} = 1;
c6fdb90a 52 # Reset the variable
8d7e77d6 53 $self->{'O_FILES'} = [sort keys %o];
14a8264b 54 my @files;
55 foreach my $table (keys %tables)
56 {
c6fdb90a 57 foreach my $ext (qw($(OBJ_EXT) .c .h .def .fnm))
14a8264b 58 {
59 push (@files,$table.$ext);
60 }
61 }
62 $self->{'clean'}{'FILES'} .= join(' ',@files);
311a0942 63 return '';
64}
65
2f2b4ff2 66sub postamble
67{
14a8264b 68 my $self = shift;
69 my $dir = $self->catdir($self->curdir,'Encode');
c6fdb90a 70 my $str = "# Encode\$(OBJ_EXT) depends on .h and .def files not .c files - but all written by compile\n";
14a8264b 71 $str .= 'Encode$(OBJ_EXT) :';
14a8264b 72 foreach my $table (keys %tables)
73 {
74 $str .= " $table.c";
75 }
76 $str .= "\n\n";
77 foreach my $table (keys %tables)
78 {
c429baee 79 my $numlines = 1;
80 my $lengthsofar = length($str);
81 my $continuator = '';
8d7e77d6 82 $str .= "$table.c : compile Makefile.PL";
14a8264b 83 foreach my $file (@{$tables{$table}})
84 {
c429baee 85 $str .= $continuator.' '.$self->catfile($dir,$file);
86 if ( length($str)-$lengthsofar > 128*$numlines )
87 {
88 $continuator .= " \\\n\t";
89 $numlines++;
90 } else {
91 $continuator = '';
92 }
14a8264b 93 }
3865e8e1 94 $str .= "\n\t\$(PERL) compile -o \$\@ -f $table.fnm\n\n";
c6fdb90a 95 open (FILELIST, ">$table.fnm")
96 || die "Could not open $table.fnm: $!";
14a8264b 97 foreach my $file (@{$tables{$table}})
98 {
c6fdb90a 99 print FILELIST $self->catfile($dir,$file) . "\n";
14a8264b 100 }
c6fdb90a 101 close(FILELIST);
14a8264b 102 }
103 return $str;
2f2b4ff2 104}