This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: INC handlers and shutdown-time warnings
[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' },
22 MAN3PODS => {},
23 clean => {
24 FILES => "perl$e *$o B.c defsubs.h *~"
a8a597b2 25 }
51a5edaf 26);
a8a597b2 27
4c1f658f
NIS
28package MY;
29
30sub post_constants {
1c74f1bd 31 "\nLIBS = $Config::Config{libs}\n"
485894a1 32}
4c1f658f 33
b7254abc
NC
34sub headerfilefile {
35 push @makefileopts, MAN3PODS => {};
36}
37
38sub headerpath {
39 if ($core) {
40 return File::Spec->catdir(File::Spec->updir,
41 File::Spec->updir);
42 } else {
43 return File::Spec->catdir($Config::Config{archlibexp}, "CORE");
44 }
29fc1735
JH
45}
46
838c087d 47sub MY::postamble {
b7254abc
NC
48 my $headerpath = headerpath();
49 my @headers = map { File::Spec->catfile($headerpath, $_) } qw(op.h cop.h);
838c087d 50 my $noecho = shift->{NOECHO};
b7254abc 51
29fc1735 52"
485894a1 53B\$(OBJ_EXT) : defsubs.h
d19af0aa 54
b7254abc
NC
55defsubs.h :: @headers defsubs_h.PL
56 \$(PERL) -I\$(INST_ARCHLIB) -I\$(INST_LIB) -I\$(PERL_ARCHLIB) -I\$(PERL_LIB) defsubs_h.PL defsubs.h $headerpath
485894a1 57"
a8a597b2 58}
b7254abc
NC
59
60sub MY::processPL {
61 my $text = shift->SUPER::processPL(@_);
62 # Append our extra parameter
63 $text =~ s/^\t.*defsubs_h\.PL.*/$& . ' ' . headerpath()/me;
64 $text;
65}