2 # $Id: Makefile.PL,v 2.7 2008/07/01 20:56:17 dankogai Exp dankogai $
7 use ExtUtils::MakeMaker;
11 my %ARGV = map { my @r = split /=/,$_; defined $r[1] or $r[1]=1; @r } @ARGV;
12 $ARGV{DEBUG} and warn "$_ => $ARGV{$_}\n" for keys %ARGV;
13 $ENV{PERL_CORE} ||= $ARGV{PERL_CORE} if $ARGV{PERL_CORE};
17 def_t => ['ascii.ucm',
24 my @exe_files = qw(bin/enc2xs
27 my @more_exe_files = qw(
30 my @pmlibdirs = qw(lib Encode);
32 $ARGV{MORE_SCRIPTS} and push @exe_files, @more_exe_files;
33 $ARGV{INSTALL_UCM} and push @pmlibdirs, "ucm";
35 @man = ( MAN1PODS => {}, MAN3PODS => {} ) if $ENV{PERL_CORE};
39 EXE_FILES => \@exe_files,
40 VERSION_FROM => 'Encode.pm',
41 OBJECT => '$(O_FILES)',
43 COMPRESS => 'gzip -9f',
45 DIST_DEFAULT => 'all tardist',
48 INC => '-I' . File::Spec->catfile( '.', 'Encode' ),
49 PMLIBDIRS => \@pmlibdirs,
50 INSTALLDIRS => 'perl',
60 # Find existing O_FILES
61 foreach my $f (@{$self->{'O_FILES'}})
65 my $x = $self->{'OBJ_EXT'};
66 # Add the table O_FILES
67 foreach my $e (keys %tables)
71 # Trick case-blind filesystems.
72 delete $o{'encode'.$x};
75 $self->{'O_FILES'} = [sort keys %o];
77 foreach my $table (keys %tables)
79 foreach my $ext (qw($(OBJ_EXT) .c .h .exh .fnm))
81 push (@files,$table.$ext);
83 $self->{SOURCE} .= " $table.c"
84 if $^O eq 'MacOS' && $self->{SOURCE} !~ /\b$table\.c\b/;
86 $self->{'clean'}{'FILES'} .= join(' ',@files);
93 my $dir = $self->catdir($self->curdir,'ucm');
94 my $str = "# Encode\$(OBJ_EXT) does not depend on .c files directly\n";
95 $str .= "# (except Encode.c), but on .h and .exh files written by enc2xs\n";
96 $str .= $^O eq 'MacOS' ? 'Encode.c.{$(MACPERL_BUILD_EXT_STATIC)}.o :' : 'Encode$(OBJ_EXT) :';
98 foreach my $table (keys %tables)
103 foreach my $table (keys %tables)
106 my $lengthsofar = length($str);
107 my $continuator = '';
108 my $enc2xs = $self->catfile('bin', 'enc2xs');
109 $str .= "$table.c : $enc2xs Makefile.PL";
110 foreach my $file (@{$tables{$table}})
112 $str .= $continuator.' '.$self->catfile($dir,$file);
113 if ( length($str)-$lengthsofar > 128*$numlines )
115 $continuator .= " \\\n\t";
121 my $plib = $self->{PERL_CORE} ? '"-I$(PERL_LIB)"' : '';
122 $plib .= " -MCross=$::Cross::platform" if defined $::Cross::platform;
123 my $ucopts = '-"Q" -"O"';
125 qq{\n\t\$(PERL) $plib $enc2xs $ucopts -o \$\@ -f $table.fnm\n\n};
126 open (FILELIST, ">$table.fnm")
127 || die "Could not open $table.fnm: $!";
128 foreach my $file (@{$tables{$table}})
130 print FILELIST $self->catfile($dir,$file) . "\n";