This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
create perl5132delta
[perl5.git] / ext / B / Makefile.PL
CommitLineData
a8a597b2
MB
1use ExtUtils::MakeMaker;
2use Config;
29fc1735 3use File::Spec;
a8a597b2
MB
4
5my $e = $Config{'exe_ext'};
6my $o = $Config{'obj_ext'};
7my $exeout_flag = '-o ';
b7254abc 8my $core = grep { $_ eq 'PERL_CORE=1' } @ARGV;
a8a597b2
MB
9if ($^O eq 'MSWin32') {
10 if ($Config{'cc'} =~ /^cl/i) {
11 $exeout_flag = '-Fe';
12 }
13 elsif ($Config{'cc'} =~ /^bcc/i) {
14 $exeout_flag = '-e';
15 }
16}
17
18WriteMakefile(
51a5edaf
RGS
19 NAME => "B",
20 VERSION_FROM => "B.pm",
21 PL_FILES => { 'defsubs_h.PL' => 'defsubs.h' },
51a5edaf
RGS
22 clean => {
23 FILES => "perl$e *$o B.c defsubs.h *~"
a8a597b2 24 }
51a5edaf 25);
a8a597b2 26
4c1f658f
NIS
27package MY;
28
29sub post_constants {
1c74f1bd 30 "\nLIBS = $Config::Config{libs}\n"
485894a1 31}
4c1f658f 32
b7254abc
NC
33sub headerpath {
34 if ($core) {
35 return File::Spec->catdir(File::Spec->updir,
36 File::Spec->updir);
37 } else {
38 return File::Spec->catdir($Config::Config{archlibexp}, "CORE");
39 }
29fc1735
JH
40}
41
838c087d 42sub MY::postamble {
b7254abc
NC
43 my $headerpath = headerpath();
44 my @headers = map { File::Spec->catfile($headerpath, $_) } qw(op.h cop.h);
838c087d 45 my $noecho = shift->{NOECHO};
b7254abc 46
29fc1735 47"
485894a1 48B\$(OBJ_EXT) : defsubs.h
d19af0aa 49
b7254abc
NC
50defsubs.h :: @headers defsubs_h.PL
51 \$(PERL) -I\$(INST_ARCHLIB) -I\$(INST_LIB) -I\$(PERL_ARCHLIB) -I\$(PERL_LIB) defsubs_h.PL defsubs.h $headerpath
485894a1 52"
a8a597b2 53}
b7254abc
NC
54
55sub MY::processPL {
56 my $text = shift->SUPER::processPL(@_);
57 # Append our extra parameter
58 $text =~ s/^\t.*defsubs_h\.PL.*/$& . ' ' . headerpath()/me;
59 $text;
60}