Commit | Line | Data |
a8a597b2 |
1 | use ExtUtils::MakeMaker; |
2 | use Config; |
29fc1735 |
3 | use File::Spec; |
a8a597b2 |
4 | |
5 | my $e = $Config{'exe_ext'}; |
6 | my $o = $Config{'obj_ext'}; |
7 | my $exeout_flag = '-o '; |
b7254abc |
8 | my $core = grep { $_ eq 'PERL_CORE=1' } @ARGV; |
a8a597b2 |
9 | if ($^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 | |
18 | WriteMakefile( |
51a5edaf |
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 |
28 | package MY; |
29 | |
30 | sub post_constants { |
1c74f1bd |
31 | "\nLIBS = $Config::Config{libs}\n" |
485894a1 |
32 | } |
4c1f658f |
33 | |
b7254abc |
34 | sub headerfilefile { |
35 | push @makefileopts, MAN3PODS => {}; |
36 | } |
37 | |
38 | sub 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 |
45 | } |
46 | |
838c087d |
47 | sub MY::postamble { |
b7254abc |
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 |
53 | B\$(OBJ_EXT) : defsubs.h |
d19af0aa |
54 | |
b7254abc |
55 | defsubs.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 |
59 | |
60 | sub 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 | } |