2 use ExtUtils::MakeMaker;
5 my %ARGV = map { split /=/; defined $_[1] or $_[1]=1; @_ } @ARGV;
6 $ARGV{DEBUG} and warn "$_ => $ARGV{$_}\n" for keys %ARGV;
7 $ENV{PERL_CORE} ||= $ARGV{PERL_CORE};
11 def_t => ['ascii.ucm',
18 my @exe_files = qw(bin/enc2xs
21 my @more_exe_files = qw(
24 my @pmlibdirs = qw(lib Encode);
26 $ARGV{MORE_SCRIOPTS} and push @exe_files, @more_exe_files;
27 $ARGV{INSTALL_UCM} and push @pmlibdirs, "ucm";
31 EXE_FILES => \@exe_files,
32 VERSION_FROM => 'Encode.pm',
33 OBJECT => '$(O_FILES)',
35 COMPRESS => 'gzip -9f',
37 DIST_DEFAULT => 'all tardist',
42 PMLIBDIRS => \@pmlibdirs,
43 INSTALLDIRS => 'perl',
53 # Find existing O_FILES
54 foreach my $f (@{$self->{'O_FILES'}})
58 my $x = $self->{'OBJ_EXT'};
59 # Add the table O_FILES
60 foreach my $e (keys %tables)
64 # Trick case-blind filesystems.
65 delete $o{'encode'.$x};
68 $self->{'O_FILES'} = [sort keys %o];
70 foreach my $table (keys %tables)
72 foreach my $ext (qw($(OBJ_EXT) .c .h .exh .fnm))
74 push (@files,$table.$ext);
76 $self->{SOURCE} .= " $table.c"
77 if $^O eq 'MacOS' && $self->{SOURCE} !~ /\b$table\.c\b/;
79 $self->{'clean'}{'FILES'} .= join(' ',@files);
86 my $dir = $self->catdir($self->curdir,'ucm');
87 my $str = "# Encode\$(OBJ_EXT) does not depend on .c files directly\n";
88 $str .= "# (except Encode.c), but on .h and .exh files written by enc2xs\n";
89 $str .= $^O eq 'MacOS' ? 'Encode.c.{$(MACPERL_BUILD_EXT_STATIC)}.o :' : 'Encode$(OBJ_EXT) :';
91 foreach my $table (keys %tables)
96 foreach my $table (keys %tables)
99 my $lengthsofar = length($str);
100 my $continuator = '';
101 my $enc2xs = $self->catfile('bin', 'enc2xs');
102 $str .= "$table.c : $enc2xs Makefile.PL";
103 foreach my $file (@{$tables{$table}})
105 $str .= $continuator.' '.$self->catfile($dir,$file);
106 if ( length($str)-$lengthsofar > 128*$numlines )
108 $continuator .= " \\\n\t";
114 my $plib = $self->{PERL_CORE} ? '"-I$(PERL_LIB)"' : '';
115 $plib .= " -MCross=$::Cross::platform" if defined $::Cross::platform;
116 my $ucopts = '-"Q" -"O"';
118 qq{\n\t\$(PERL) $plib $enc2xs $ucopts -o \$\@ -f $table.fnm\n\n};
119 open (FILELIST, ">$table.fnm")
120 || die "Could not open $table.fnm: $!";
121 foreach my $file (@{$tables{$table}})
123 print FILELIST $self->catfile($dir,$file) . "\n";