3 use ExtUtils::MakeMaker;
6 EUC_JP => ['euc-jp.ucm'],
7 SHIFTJIS => ['shiftjis.enc'],
8 MACJAPAN => ['macJapan.enc'],
9 CP932 => ['cp932.enc'],
16 NAME => 'Encode::'.$name,
17 VERSION_FROM => "$name.pm",
18 OBJECT => '$(O_FILES)',
20 COMPRESS => 'gzip -9f',
22 DIST_DEFAULT => 'all tardist',
25 # OS 390 winges about line numbers > 64K ???
26 XSOPT => '-nolinenumbers',
35 my $x = $self->{'OBJ_EXT'};
36 # Add the table O_FILES
37 foreach my $e (keys %tables)
42 $self->{'O_FILES'} = [sort keys %o];
43 my @files = ("$name.xs");
44 $self->{'C'} = ["$name.c"];
45 $self->{'H'} = [$self->catfile($self->updir,'encode.h')];
47 foreach my $table (keys %tables) {
48 push (@{$self->{'C'}},"$table.c");
49 # Do NOT add $table.h etc. to H_FILES unless we own up as to how they
51 foreach my $ext (qw($(OBJ_EXT) .c .h _def.h .fnm)) {
52 push (@files,$table.$ext);
55 $self->{'XS'} = { "$name.xs" => "$name.c" };
56 $self->{'clean'}{'FILES'} .= join(' ',@files);
57 open(XS,">$name.xs") || die "Cannot open $name.xs:$!";
63 #include "../encode.h"
65 foreach my $table (keys %tables) {
66 print XS qq[#include "${table}.h"\n];
71 Encode_XSEncoding(pTHX_ encode_t *enc)
74 HV *stash = gv_stashpv("Encode::XS", TRUE);
75 SV *sv = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))),stash);
81 const char *name = enc->name[i++];
82 XPUSHs(sv_2mortal(newSVpvn(name,strlen(name))));
85 call_pv("Encode::define_encoding",G_DISCARD);
89 MODULE = Encode::$name PACKAGE = Encode::$name
94 foreach my $table (keys %tables) {
95 print XS qq[#include "${table}_def.h"\n];
99 return "# Built $name.xs\n\n";
105 my $dir = $self->catdir($self->updir,'Encode');
106 my $str = "# $name\$(OBJ_EXT) depends on .h and _def.h files not .c files - but all written by compile\n";
107 $str .= "$name.c : $name.xs ";
108 foreach my $table (keys %tables)
113 $str .= "$name\$(OBJ_EXT) : $name.c\n\n";
115 my $compile = $self->catfile($self->updir,'compile');
116 foreach my $table (keys %tables)
119 my $lengthsofar = length($str);
120 my $continuator = '';
121 $str .= "$table.c : $compile Makefile.PL";
122 foreach my $file (@{$tables{$table}})
124 $str .= $continuator.' '.$self->catfile($dir,$file);
125 if ( length($str)-$lengthsofar > 128*$numlines )
127 $continuator .= " \\\n\t";
133 $str .= $^O eq 'VMS' # In VMS quote to preserve case
134 ? qq{\n\t\$(PERL) $compile -"Q" -o \$\@ -f $table.fnm\n\n}
135 : qq{\n\t\$(PERL) $compile -Q -o \$\@ -f $table.fnm\n\n};
136 open (FILELIST, ">$table.fnm")
137 || die "Could not open $table.fnm: $!";
138 foreach my $file (@{$tables{$table}})
140 print FILELIST $self->catfile($dir,$file) . "\n";