3 use ExtUtils::MakeMaker;
7 symbol_t => ['symbol.ucm','dingbats.ucm'],
12 NAME => 'Encode::'.$name,
13 VERSION_FROM => "$name.pm",
14 OBJECT => '$(O_FILES)',
16 COMPRESS => 'gzip -9f',
18 DIST_DEFAULT => 'all tardist',
21 # OS 390 winges about line numbers > 64K ???
22 XSOPT => '-nolinenumbers',
31 my $x = $self->{'OBJ_EXT'};
32 # Add the table O_FILES
33 foreach my $e (keys %tables)
38 $self->{'O_FILES'} = [sort keys %o];
39 my @files = ("$name.xs");
40 $self->{'C'} = ["$name.c"];
41 $self->{'H'} = [$self->catfile($self->updir,'encode.h')];
43 foreach my $table (keys %tables) {
44 push (@{$self->{'C'}},"$table.c");
45 # Do NOT add $table.h etc. to H_FILES unless we own up as to how they
47 foreach my $ext (qw($(OBJ_EXT) .c .h _def.h .fnm)) {
48 push (@files,$table.$ext);
51 $self->{'XS'} = { "$name.xs" => "$name.c" };
52 $self->{'clean'}{'FILES'} .= join(' ',@files);
53 open(XS,">$name.xs") || die "Cannot open $name.xs:$!";
59 #include "../encode.h"
61 foreach my $table (keys %tables) {
62 print XS qq[#include "${table}.h"\n];
67 Encode_XSEncoding(pTHX_ encode_t *enc)
70 HV *stash = gv_stashpv("Encode::XS", TRUE);
71 SV *sv = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))),stash);
77 const char *name = enc->name[i++];
78 XPUSHs(sv_2mortal(newSVpvn(name,strlen(name))));
81 call_pv("Encode::define_encoding",G_DISCARD);
85 MODULE = Encode::$name PACKAGE = Encode::$name
90 foreach my $table (keys %tables) {
91 print XS qq[#include "${table}_def.h"\n];
95 return "# Built $name.xs\n\n";
101 my $dir = $self->catdir($self->updir,'Encode');
102 my $str = "# $name\$(OBJ_EXT) depends on .h and _def.h files not .c files - but all written by compile\n";
103 $str .= "$name.c : $name.xs ";
104 foreach my $table (keys %tables)
109 $str .= "$name\$(OBJ_EXT) : $name.c\n\n";
111 my $compile = $self->catfile($self->updir,'compile');
112 foreach my $table (keys %tables)
115 my $lengthsofar = length($str);
116 my $continuator = '';
117 $str .= "$table.c : $compile Makefile.PL";
118 foreach my $file (@{$tables{$table}})
120 $str .= $continuator.' '.$self->catfile($dir,$file);
121 if ( length($str)-$lengthsofar > 128*$numlines )
123 $continuator .= " \\\n\t";
129 $str .= $^O eq 'VMS' # In VMS quote to preserve case
130 ? qq{\n\t\$(PERL) $compile -"Q" -o \$\@ -f $table.fnm\n\n}
131 : qq{\n\t\$(PERL) $compile -Q -o \$\@ -f $table.fnm\n\n};
132 open (FILELIST, ">$table.fnm")
133 || die "Could not open $table.fnm: $!";
134 foreach my $file (@{$tables{$table}})
136 print FILELIST $self->catfile($dir,$file) . "\n";