bcc8baa242fa78704ba09d76cebb2c78efce1b6f
[p5sagit/p5-mst-13.2.git] / ext / B / Makefile.PL
1 use ExtUtils::MakeMaker;
2 use Config;
3
4 my $e = $Config{'exe_ext'};
5 my $o = $Config{'obj_ext'};
6 my $exeout_flag = '-o ';
7 if ($^O eq 'MSWin32') {
8     if ($Config{'cc'} =~ /^cl/i) {
9         $exeout_flag = '-Fe';
10     }
11     elsif ($Config{'cc'} =~ /^bcc/i) {
12         $exeout_flag = '-e';
13     }
14 }
15
16 WriteMakefile(
17     NAME        => "B",
18     VERSION     => "a5",
19     OBJECT      => "B$o byterun$o",
20     depend      => {
21         "B$o"           => "B.c bytecode.h byterun.h",
22     },
23     clean       => {
24         FILES           => "perl byteperl$e btest$e btest.c *$o B.c *~"
25     }
26 );
27
28 sub MY::post_constants {
29     "\nLIBS = $Config{libs}\n"
30 }
31
32 sub MY::top_targets {
33     my $self = shift;
34     my $targets = $self->MM::top_targets();
35     $targets =~ s/^(all ::.*)$/$1 byteperl$e/m;
36     return <<"EOT" . $targets;
37 #
38 # byterun.h, byterun.c and Asmdata.pm are auto-generated. If any of the
39 # files are missing or if you change bytecode.pl (which is what generates
40 # them all) then you can "make regen_headers" to regenerate them.
41 #
42 regen_headers:
43         \$(PERL) bytecode.pl
44         \$(MV) Asmdata.pm B
45 #
46 # byteperl is *not* a standard perl+XSUB executable. It's a special
47 # program for running standalone bytecode executables. It isn't an XSUB
48 # at the moment because a standlone Perl program needs to set up curpad
49 # which is overwritten on exit from an XSUB.
50 #
51 byteperl$e : byteperl$o B$o byterun$o
52         \$(CC) ${exeout_flag}byteperl$e byteperl$o B$o byterun$o \$(LDFLAGS) \$(PERL_ARCHLIB)/CORE/$Config{libperl} \$(LIBS)
53 EOT
54 }