Integrate changes #12652 and #12653 from maintperl;
[p5sagit/p5-mst-13.2.git] / ext / re / Makefile.PL
CommitLineData
56953603 1use ExtUtils::MakeMaker;
472390e1 2use File::Spec;
8d4151d3 3use Config;
4
5my $object = 're_exec$(OBJ_EXT) re_comp$(OBJ_EXT) re$(OBJ_EXT)';
6
fd3cca25 7my $defines = '-DPERL_EXT_RE_BUILD -DPERL_EXT_RE_DEBUG';
8
9# We need to pretend that DEBUGGING is in effect even if it's
10# not but we need to remember that we pretended so we can avoid
11# linking to things that aren't there.
12
5a772984 13if ( (($Config{'ccflags'} !~ /DEBUGGING/) && $^O ne 'VMS') ||
14 (exists($Config{'usedebugging_perl'}) && $Config{'usedebugging_perl'} ne 'Y') ) {
fd3cca25 15 $defines .= ' -DDEBUGGING -DWAS_NOT_DEBUGGING';
16}
17
56953603 18WriteMakefile(
19 NAME => 're',
20 VERSION_FROM => 're.pm',
69158f75 21 MAN3PODS => {}, # Pods will be built by installman.
56953603 22 XSPROTOARG => '-noprototypes',
8d4151d3 23 OBJECT => $object,
fd3cca25 24 DEFINE => $defines,
782f0963 25 clean => { FILES => '*$(OBJ_EXT) *.c ../../lib/re.pm' },
56953603 26);
27
472390e1 28package MY;
778ddebd 29
472390e1 30sub upupfile {
31 File::Spec->catfile(File::Spec->updir, File::Spec->updir, $_[0]);
32}
778ddebd 33
472390e1 34sub postamble {
35 my $regcomp_c = upupfile('regcomp.c');
36 my $regexec_c = upupfile('regexec.c');
778ddebd 37
472390e1 38 <<EOF;
39re_comp.c : $regcomp_c
40 - \$(RM_F) re_comp.c
41 \$(CP) $regcomp_c re_comp.c
778ddebd 42
472390e1 43re_comp\$(OBJ_EXT) : re_comp.c
778ddebd 44
472390e1 45re_exec.c : $regexec_c
46 - \$(RM_F) re_exec.c
47 \$(CP) $regexec_c re_exec.c
56953603 48
472390e1 49re_exec\$(OBJ_EXT) : re_exec.c
56953603 50
51EOF
52}
b7a20417 53
54sub MY::c_o {
55 my($self) = @_;
56 package MY; # so that "SUPER" works right
57 my $inh = $self->SUPER::c_o(@_);
58 use Config;
59 if ($Config{osname} eq 'aix' && $Config{ccversion} eq '5.0.1.0') {
60 # Known buggy optimizer.
61 my $cccmd = $self->const_cccmd;
62 $cccmd =~ s/^CCCMD\s*=\s*//;
63 $cccmd =~ s/\s\$\(OPTIMIZE\)\s/ /;
64 $inh .= qq{
65
66re_comp\$\(OBJ_EXT\): re_comp.c
67\t$cccmd \$(CCCDLFLAGS) -I\$(PERL_INC) \$(DEFINE) \$*.c
68};
69 }
70 $inh;
71}