3 use ExtUtils::MakeMaker;
5 my %tables = (EUC_JP => ['euc-jp.ucm'],
6 JIS0208 => ['jis0208.enc'],
7 JIS0212 => ['jis0212.enc'],
8 SHIFTJIS => ['shiftjis.enc'],
14 NAME => "Encode::Japanese",
15 VERSION_FROM => 'Japanese.pm',
16 OBJECT => '$(O_FILES)',
18 COMPRESS => 'gzip -9f',
20 DIST_DEFAULT => 'all tardist',
23 # OS 390 winges about line numbers > 64K ???
24 XSOPT => '-nolinenumbers',
34 my $x = $self->{'OBJ_EXT'};
35 # Add the table O_FILES
36 foreach my $e (keys %tables)
41 $self->{'O_FILES'} = [sort keys %o];
42 my @files = ('Japanese.xs');
44 foreach my $table (keys %tables) {
45 foreach my $ext (qw($(OBJ_EXT) .c .h _def.h .fnm)) {
46 push (@files,$table.$ext);
49 $self->{'XS_FILES'} = { 'Japanese.xs' => 'Japanese.c' };
50 $self->{'clean'}{'FILES'} .= join(' ',@files);
51 open(XS,">Japanese.xs") || die "Cannot open Japanese.xs:$!";
57 #include "../encode.h"
59 foreach my $table (keys %tables) {
60 print XS qq[#include "${table}.h"\n];
65 Encode_XSEncoding(pTHX_ encode_t *enc)
68 HV *stash = gv_stashpv("Encode::XS", TRUE);
69 SV *sv = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))),stash);
75 const char *name = enc->name[i++];
76 XPUSHs(sv_2mortal(newSVpvn(name,strlen(name))));
79 call_pv("Encode::define_encoding",G_DISCARD);
83 MODULE = Encode::Japanese PACKAGE = Encode::Japanese
87 foreach my $table (keys %tables) {
88 print XS qq[#include "${table}_def.h"\n];
98 my $dir = $self->catdir($self->updir,'Encode');
99 my $str = "# Japanese\$(OBJ_EXT) depends on .h and _def.h files not .c files - but all written by compile\n";
100 $str .= 'Japanese$(OBJ_EXT) :';
101 $str .= ' Japanese.xs';
102 foreach my $table (keys %tables)
107 my $compile = $self->catfile($self->updir,'compile');
108 foreach my $table (keys %tables)
111 my $lengthsofar = length($str);
112 my $continuator = '';
113 $str .= "$table.c : $compile Makefile.PL";
114 foreach my $file (@{$tables{$table}})
116 $str .= $continuator.' '.$self->catfile($dir,$file);
117 if ( length($str)-$lengthsofar > 128*$numlines )
119 $continuator .= " \\\n\t";
125 $str .= "\n\t\$(PERL) $compile -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";