Noise with -w.
[p5sagit/p5-mst-13.2.git] / ext / Encode / Makefile.PL
CommitLineData
18586f54 1use 5.7.2;
2use strict;
2c674647 3use ExtUtils::MakeMaker;
14a8264b 4
5d030b67 5my %tables =
6 (
071db25d 7 def_t => ['ascii.ucm',
8 '8859-1.ucm',
9 ]
5d030b67 10 );
14a8264b 11
2c674647 12WriteMakefile(
18586f54 13 NAME => "Encode",
023d8852 14 VERSION_FROM => 'Encode.pm',
18586f54 15 OBJECT => '$(O_FILES)',
16 'dist' => {
17 COMPRESS => 'gzip -9f',
18 SUFFIX => 'gz',
19 DIST_DEFAULT => 'all tardist',
20 },
21 MAN3PODS => {},
22 );
2f2b4ff2 23
24package MY;
25
311a0942 26
27sub post_initialize
28{
18586f54 29 my ($self) = @_;
30 my %o;
31 # Find existing O_FILES
32 foreach my $f (@{$self->{'O_FILES'}})
33 {
34 $o{$f} = 1;
35 }
36 my $x = $self->{'OBJ_EXT'};
37 # Add the table O_FILES
38 foreach my $e (keys %tables)
14a8264b 39 {
18586f54 40 $o{$e.$x} = 1;
14a8264b 41 }
18586f54 42 # Trick case-blind filesystems.
43 delete $o{'encode'.$x};
44 $o{'Encode'.$x} = 1;
45 # Reset the variable
46 $self->{'O_FILES'} = [sort keys %o];
47 my @files;
48 foreach my $table (keys %tables)
49 {
023d8852 50 foreach my $ext (qw($(OBJ_EXT) .c .h _def.h .fnm))
18586f54 51 {
52 push (@files,$table.$ext);
53 }
54}
55$self->{'clean'}{'FILES'} .= join(' ',@files);
56return '';
311a0942 57}
58
2f2b4ff2 59sub postamble
60{
18586f54 61 my $self = shift;
62 my $dir = $self->catdir($self->curdir,'Encode');
023d8852 63 my $str = "# Encode\$(OBJ_EXT) depends on .h and _def.h files not .c files - but all written by compile\n";
18586f54 64 $str .= 'Encode$(OBJ_EXT) :';
65 foreach my $table (keys %tables)
14a8264b 66 {
18586f54 67 $str .= " $table.c";
14a8264b 68 }
18586f54 69 $str .= "\n\n";
70 foreach my $table (keys %tables)
14a8264b 71 {
18586f54 72 my $numlines = 1;
73 my $lengthsofar = length($str);
74 my $continuator = '';
75 $str .= "$table.c : compile Makefile.PL";
76 foreach my $file (@{$tables{$table}})
77 {
78 $str .= $continuator.' '.$self->catfile($dir,$file);
79 if ( length($str)-$lengthsofar > 128*$numlines )
80 {
81 $continuator .= " \\\n\t";
82 $numlines++;
83 } else {
84 $continuator = '';
85 }
86 }
3964a085 87 $str .= $^O eq 'VMS' # In VMS quote to preserve case
88 ? qq{\n\t\$(PERL) compile -"Q" -"O" -o \$\@ -f $table.fnm\n\n}
89 : qq{\n\t\$(PERL) compile -Q -O -o \$\@ -f $table.fnm\n\n};
18586f54 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);
14a8264b 97 }
18586f54 98 return $str;
2f2b4ff2 99}