1use ExtUtils::MakeMaker; 2use File::Spec; 3use Config; 4 5my $object = 're_exec$(OBJ_EXT) re_comp$(OBJ_EXT) re$(OBJ_EXT)'; 6 7my $defines = '-DPERL_EXT_RE_BUILD -DPERL_EXT_RE_DEBUG -DPERL_EXT'; 8 9my @libs; 10if ($^O eq 'cygwin' && $Config{usequadmath}) { 11 push @libs, qw(quadmath); 12} 13WriteMakefile( 14 NAME => 're', 15 @libs ? ( 'LIBS' => [ join(" ", map { "-l$_" } @libs) ] ) : (), 16 VERSION_FROM => 're.pm', 17 XSPROTOARG => '-noprototypes', 18 OBJECT => $object, 19 DEFINE => $defines, 20 clean => { FILES => '*$(OBJ_EXT) invlist_inline.h *.c ../../lib/re.pm' }, 21); 22 23package MY; 24 25sub upupfile { 26 File::Spec->catfile(File::Spec->updir, File::Spec->updir, $_[0]); 27} 28 29sub postamble { 30 my $regcomp_c = upupfile('regcomp.c'); 31 my $regexec_c = upupfile('regexec.c'); 32 my $dquote_c = upupfile('dquote.c'); 33 my $invlist_inline_h = upupfile('invlist_inline.h'); 34 35 <<EOF; 36re_comp.c : $regcomp_c 37 - \$(RM_F) re_comp.c 38 \$(CP) $regcomp_c re_comp.c 39 40re_comp\$(OBJ_EXT) : re_comp.c dquote.c invlist_inline.h 41 42re_exec.c : $regexec_c 43 - \$(RM_F) re_exec.c 44 \$(CP) $regexec_c re_exec.c 45 46re_exec\$(OBJ_EXT) : re_exec.c invlist_inline.h 47 48dquote.c : $dquote_c 49 - \$(RM_F) dquote.c 50 \$(CP) $dquote_c dquote.c 51 52invlist_inline.h : $invlist_inline_h 53 - \$(RM_F) invlist_inline.h 54 \$(CP) $invlist_inline_h invlist_inline.h 55 56EOF 57} 58 59sub MY::c_o { 60 my($self) = @_; 61 package MY; # so that "SUPER" works right 62 my $inh = $self->SUPER::c_o(@_); 63 use Config; 64 if ($Config{osname} eq 'aix' && $Config{ccversion} eq '5.0.1.0') { 65 # Known buggy optimizer. 66 my $cccmd = $self->const_cccmd; 67 $cccmd =~ s/^CCCMD\s*=\s*//; 68 $cccmd =~ s/\s\$\(OPTIMIZE\)\s/ /; 69 $inh .= qq{ 70 71re_comp\$\(OBJ_EXT\): re_comp.c 72\t$cccmd \$(CCCDLFLAGS) -I\$(PERL_INC) \$(DEFINE) \$*.c 73}; 74 } 75 $inh; 76} 77