2 # MakeMaker default methods for MacOS
3 # This package is inserted into @ISA of MakeMaker's MM before the
4 # built-in ExtUtils::MM_Unix methods if MakeMaker.pm is run under MacOS.
6 # Author: Matthias Neeracher <neeracher@mac.com>
7 # Maintainer: Chris Nandor <pudge@pobox.com>
9 package ExtUtils::MM_MacOS;
10 require ExtUtils::MM_Any;
11 require ExtUtils::MM_Unix;
12 @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix );
14 use vars qw($VERSION);
22 use vars qw(%make_data);
24 my $Mac_FS = eval { require Mac::FileSpec::Unixish };
26 use ExtUtils::MakeMaker qw($Verbose &neatvalue);
30 ExtUtils::MM_MacOS - methods to override UN*X behaviour in ExtUtils::MakeMaker
34 use ExtUtils::MM_MacOS; # Done internally by ExtUtils::MakeMaker if needed
38 MM_MacOS currently only produces an approximation to the correct Makefile.
43 my($class,$self) = @_;
47 print STDOUT "Mac MakeMaker (v$ExtUtils::MakeMaker::VERSION)\n" if $Verbose;
48 if (-f "MANIFEST" && ! -f "Makefile.mk"){
49 ExtUtils::MakeMaker::check_manifest();
52 mkdir("Obj", 0777) unless -d "Obj";
54 $self = {} unless (defined $self);
58 my(%initial_att) = %$self; # record initial attributes
60 if (defined $self->{CONFIGURE}) {
61 if (ref $self->{CONFIGURE} eq 'CODE') {
62 $self = { %$self, %{&{$self->{CONFIGURE}}}};
64 Carp::croak "Attribute 'CONFIGURE' to WriteMakefile() not a code reference\n";
68 my $newclass = ++$ExtUtils::MakeMaker::PACKNAME;
69 local @ExtUtils::MakeMaker::Parent = @ExtUtils::MakeMaker::Parent; # Protect against non-local exits
72 print "Blessing Object into class [$newclass]\n" if $Verbose>=2;
73 ExtUtils::MakeMaker::mv_all_methods("MY",$newclass);
74 bless $self, $newclass;
77 @{"$newclass\:\:ISA"} = 'MM';
80 $ExtUtils::MakeMaker::Recognized_Att_Keys{$_} = 1
81 for map { $_ . 'Optimize' } qw(MWC MWCPPC MWC68K MPW MRC MRC SC);
83 if (defined $ExtUtils::MakeMaker::Parent[-2]){
84 $self->{PARENT} = $ExtUtils::MakeMaker::Parent[-2];
86 for $key (@ExtUtils::MakeMaker::Prepend_parent) {
87 next unless defined $self->{PARENT}{$key};
88 $self->{$key} = $self->{PARENT}{$key};
89 unless ($^O eq 'VMS' && $key =~ /PERL$/) {
90 $self->{$key} = $self->catdir("..",$self->{$key})
91 unless $self->file_name_is_absolute($self->{$key});
93 # PERL or FULLPERL will be a command verb or even a
94 # command with an argument instead of a full file
95 # specification under VMS. So, don't turn the command
96 # into a filespec, but do add a level to the path of
97 # the argument if not already absolute.
98 my @cmd = split /\s+/, $self->{$key};
99 $cmd[1] = $self->catfile('[-]',$cmd[1])
100 unless (@cmd < 2) || $self->file_name_is_absolute($cmd[1]);
101 $self->{$key} = join(' ', @cmd);
104 if ($self->{PARENT}) {
105 $self->{PARENT}->{CHILDREN}->{$newclass} = $self;
106 foreach my $opt (qw(POLLUTE PERL_CORE)) {
107 if (exists $self->{PARENT}->{$opt}
108 and not exists $self->{$opt})
110 # inherit, but only if already unspecified
111 $self->{$opt} = $self->{PARENT}->{$opt};
115 my @fm = grep /^FIRST_MAKEFILE=/, @ARGV;
116 $self->parse_args(@fm) if @fm;
118 $self->parse_args(split(' ', $ENV{PERL_MM_OPT} || ''),@ARGV);
121 $self->{NAME} ||= $self->guess_name;
123 ($self->{NAME_SYM} = $self->{NAME}) =~ s/\W+/_/g;
126 $self->init_dirscan();
127 $self->init_others();
129 push @{$self->{RESULT}}, <<END;
130 # This Makefile is for the $self->{NAME} extension to perl.
132 # It was generated automatically by MakeMaker version
133 # $VERSION (Revision: $Revision) from the contents of
134 # Makefile.PL. Don't edit this file, edit Makefile.PL instead.
136 # ANY CHANGES MADE HERE WILL BE LOST!
138 # MakeMaker Parameters:
141 foreach $key (sort keys %initial_att){
142 my($v) = neatvalue($initial_att{$key});
143 $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/;
145 push @{$self->{RESULT}}, "# $key => $v";
148 # turn the SKIP array into a SKIPHASH hash
150 for $skip (@{$self->{SKIP} || []}) {
151 $self->{SKIPHASH}{$skip} = 1;
153 delete $self->{SKIP}; # free memory
155 # We skip many sections for MacOS, but we don't say anything about it in the Makefile
156 for (qw/ const_config tool_autosplit
157 tool_xsubpp tools_other dist macro depend post_constants
158 pasthru c_o xs_c xs_o top_targets linkext
159 dynamic_bs dynamic_lib static_lib manifypods
160 installbin subdirs dist_basics dist_core
161 dist_dir dist_test dist_ci install force perldepend makefile
162 staticmake test pm_to_blib selfdocument
163 const_loadlibs const_cccmd
166 $self->{SKIPHASH}{$_} = 2;
168 push @ExtUtils::MakeMaker::MM_Sections, "rulez"
169 unless grep /rulez/, @ExtUtils::MakeMaker::MM_Sections;
171 if ($self->{PARENT}) {
172 for (qw/install dist dist_basics dist_core dist_dir dist_test dist_ci/) {
173 $self->{SKIPHASH}{$_} = 1;
177 # We run all the subdirectories now. They don't have much to query
178 # from the parent, but the parent has to query them: if they need linking!
179 unless ($self->{NORECURS}) {
180 $self->eval_in_subdirs if @{$self->{DIR}};
184 foreach $section ( @ExtUtils::MakeMaker::MM_Sections ){
185 next if ($self->{SKIPHASH}{$section} == 2);
186 print "Processing Makefile '$section' section\n" if ($Verbose >= 2);
187 $self->{ABSTRACT_FROM} = macify($self->{ABSTRACT_FROM})
188 if $self->{ABSTRACT_FROM};
189 my($skipit) = $self->skipcheck($section);
191 push @{$self->{RESULT}}, "\n# --- MakeMaker $section section $skipit.";
193 my(%a) = %{$self->{$section} || {}};
194 push @{$self->{RESULT}}, "\n# --- MakeMaker $section section:";
195 push @{$self->{RESULT}}, "# " . join ", ", %a if $Verbose && %a;
196 push @{$self->{RESULT}}, $self->nicetext($self->$section( %a ));
200 push @{$self->{RESULT}}, "\n# End.";
203 $ExtUtils::MM_MacOS::make_data{$cwd} = $self;
210 return 'skipped' if $self->{SKIPHASH}{$section};
216 Returns true, if the argument is likely to be a command.
221 my($self,$file) = @_;
222 return $file if ! -d $file;
228 Guess the name of this package by examining the working directory's
229 name. MakeMaker calls this only if the developer has not supplied a
237 $name =~ s/.*:// unless ($name =~ s/^.*:ext://);
239 $name =~ s#[\-_][\d.\-]+$##; # this is new with MM 5.00
245 Translate relative path names into Mac names.
253 foreach (split(/[ \t\n]+/, $unix)) {
255 if ($Mac_FS) { # should always be true
256 $_ = Mac::FileSpec::Unixish::nativize($_);
271 Translate to Mac names & patterns
279 foreach (split(/[ \t\n]+/, $unix)) {
284 $_ = "'$_'" if /[?Å]/;
294 Initializes some of NAME, FULLEXT, BASEEXT, ROOTEXT, DLBASE, PERL_SRC,
295 PERL_LIB, PERL_ARCHLIB, PERL_INC, INSTALLDIRS, INST_*, INSTALL*,
296 PREFIX, CONFIG, AR, AR_STATIC_ARGS, LD, OBJ_EXT, LIB_EXT, MAP_TARGET,
297 LIBPERL_A, VERSION_FROM, VERSION, DISTNAME, VERSION_SYM.
304 # --- Initialize Module Name and Paths
306 # NAME = The perl module name for this extension (eg DBD::Oracle).
307 # FULLEXT = Pathname for extension directory (eg DBD/Oracle).
308 # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT.
309 # ROOTEXT = Directory part of FULLEXT with trailing :.
311 $self->{NAME}) =~ s!::!:!g ; #eg. BSD:Foo:Socket
313 $self->{NAME}) =~ s!.*::!! ; #eg. Socket
315 $self->{FULLEXT}) =~ s#:?\Q$self->{BASEEXT}\E$## ; #eg. BSD:Foo
316 $self->{ROOTEXT} .= ":" if ($self->{ROOTEXT});
318 # --- Initialize PERL_LIB, INST_LIB, PERL_SRC
320 # *Real* information: where did we get these two from? ...
321 my $inc_config_dir = dirname($INC{'Config.pm'});
322 my $inc_carp_dir = dirname($INC{'Carp.pm'});
324 unless ($self->{PERL_SRC}){
326 foreach $dir (qw(:: ::: :::: ::::: ::::::)){
327 if (-f "${dir}perl.h") {
328 $self->{PERL_SRC}=$dir ;
332 if (!$self->{PERL_SRC} && -f "$ENV{MACPERL}CORE:perl:perl.h") {
333 # Mac pathnames may be very nasty, so we'll install symlinks
334 unlink(":PerlCore", ":PerlLib");
335 symlink("$ENV{MACPERL}CORE:", "PerlCore");
336 symlink("$ENV{MACPERL}lib:", "PerlLib");
337 $self->{PERL_SRC} = ":PerlCore:perl:" ;
338 $self->{PERL_LIB} = ":PerlLib:";
341 if ($self->{PERL_SRC}){
342 $self->{MACPERL_SRC} = File::Spec->catdir("$self->{PERL_SRC}","macos:");
343 $self->{MACPERL_LIB} ||= File::Spec->catdir("$self->{MACPERL_SRC}","lib");
344 $self->{PERL_LIB} ||= File::Spec->catdir("$self->{PERL_SRC}","lib");
345 $self->{PERL_ARCHLIB} = $self->{PERL_LIB};
346 $self->{PERL_INC} = $self->{PERL_SRC};
347 $self->{MACPERL_INC} = $self->{MACPERL_SRC};
350 $self->{PERL_LIB} ||= "$ENV{MACPERL}site_perl";
351 $self->{PERL_ARCHLIB} = $self->{PERL_LIB};
352 $self->{PERL_INC} = $ENV{MACPERL};
354 #On MacOS, we need to build under the Perl source directory or have the MacPerl SDK
355 #installed in the MacPerl folder.
359 $self->{INSTALLDIRS} = "perl";
360 $self->{INST_LIB} = $self->{INST_ARCHLIB} = $self->{PERL_LIB};
361 $self->{INST_MAN1DIR} = $self->{INSTALLMAN1DIR} = "none";
362 $self->{MAN1EXT} ||= $Config::Config{man1ext};
363 $self->{INST_MAN3DIR} = $self->{INSTALLMAN3DIR} = "none";
364 $self->{MAN3EXT} ||= $Config::Config{man3ext};
365 $self->{MAP_TARGET} ||= "perl";
367 # make a simple check if we find Exporter
368 # hm ... do we really care? at all?
369 # warn "Warning: PERL_LIB ($self->{PERL_LIB}) seems not to be a perl library directory
370 # (Exporter.pm not found)"
371 # unless -f File::Spec->catfile("$self->{PERL_LIB}","Exporter.pm") ||
372 # $self->{NAME} eq "ExtUtils::MakeMaker";
374 # Determine VERSION and VERSION_FROM
375 ($self->{DISTNAME}=$self->{NAME}) =~ s#(::)#-#g unless $self->{DISTNAME};
376 if ($self->{VERSION_FROM}){
378 open(FH,macify($self->{VERSION_FROM})) or
379 die "Could not open '$self->{VERSION_FROM}' (attribute VERSION_FROM): $!";
382 next unless /\$([\w:]*\bVERSION)\b.*=/;
383 local $ExtUtils::MakeMaker::module_version_variable = $1;
386 die "Could not eval '$eval': $@" if $@;
387 if ($self->{VERSION} = $ {$ExtUtils::MakeMaker::module_version_variable}){
388 print "$self->{NAME} VERSION is $self->{VERSION} (from $self->{VERSION_FROM})\n" if $Verbose;
390 # XXX this should probably croak
391 print "WARNING: Setting VERSION via file '$self->{VERSION_FROM}' failed\n";
398 if ($self->{VERSION}) {
399 $self->{VERSION} =~ s/^\s+//;
400 $self->{VERSION} =~ s/\s+$//;
403 $self->{VERSION} = "0.10" unless $self->{VERSION};
404 ($self->{VERSION_SYM} = $self->{VERSION}) =~ s/\W/_/g;
407 # Graham Barr and Paul Marquess had some ideas how to ensure
408 # version compatibility between the *.pm file and the
409 # corresponding *.xs file. The bottomline was, that we need an
410 # XS_VERSION macro that defaults to VERSION:
411 $self->{XS_VERSION} ||= $self->{VERSION};
413 # --- Initialize Perl Binary Locations
415 # Find Perl 5. The only contract here is that both 'PERL' and 'FULLPERL'
416 # will be working versions of perl 5. miniperl has priority over perl
417 # for PERL to ensure that $(PERL) is usable while building ./ext/*
418 my ($component,@defpath);
419 foreach $component ($self->{PERL_SRC}, File::Spec->path(), $Config::Config{binexp}) {
420 push @defpath, $component if defined $component;
422 $self->{PERL} = "$self->{PERL_SRC}miniperl";
423 $self->{FULLPERL} = "$self->{PERL_SRC}perl";
424 $self->{MAKEFILE} = "Makefile.mk";
429 Initializes LDLOADLIBS, LIBS
433 sub init_others { # --- Initialize Other Attributes
436 if ( !$self->{OBJECT} ) {
437 # init_dirscan should have found out, if we have C files
438 $self->{OBJECT} = "";
439 $self->{OBJECT} = "$self->{BASEEXT}.c" if @{$self->{C}||[]};
441 $self->{OBJECT} =~ s/\$\(O_FILES\)/@{$self->{C}||[]}/;
444 foreach (split(/[ \t\n]+/, $self->{OBJECT})) {
445 if (/^$self->{BASEEXT}\.o(bj)?$/) {
446 $src .= " $self->{BASEEXT}.c";
447 } elsif (/^(.*\..*)\.o$/) {
449 } elsif (/^(.*)(\.o(bj)?|\$\(OBJ_EXT\))$/) {
459 $self->{SOURCE} = $src;
465 Initializes DIR, XS, PM, C, O_FILES, H, PL_FILES, MAN*PODS, EXE_FILES.
469 sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc)
471 my($name, %dir, %xs, %c, %h, %ignore, %pl_files, %manifypods);
472 local(%pm); #the sub in find() has to see this hash
474 # in case we don't find it below!
475 if ($self->{VERSION_FROM}) {
476 my $version_from = macify($self->{VERSION_FROM});
477 $pm{$version_from} = File::Spec->catfile('$(INST_LIBDIR)',
481 $ignore{'test.pl'} = 1;
482 foreach $name ($self->lsdir(":")){
483 next if ($name =~ /^\./ or $ignore{$name});
484 next unless $self->libscan($name);
486 $dir{$name} = $name if (-f ":$name:Makefile.PL");
487 } elsif ($name =~ /\.xs$/){
488 my($c); ($c = $name) =~ s/\.xs$/.c/;
491 } elsif ($name =~ /\.c(p|pp|xx|c)?$/i){ # .c .C .cpp .cxx .cc .cp
493 unless $name =~ m/perlmain\.c/; # See MAP_TARGET
494 } elsif ($name =~ /\.h$/i){
496 } elsif ($name =~ /\.(p[ml]|pod)$/){
497 $pm{$name} = File::Spec->catfile('$(INST_LIBDIR)',$name);
498 } elsif ($name =~ /\.PL$/ && $name ne "Makefile.PL") {
499 ($pl_files{$name} = $name) =~ s/\.PL$// ;
503 # Some larger extensions often wish to install a number of *.pm/pl
504 # files into the library in various locations.
506 # The attribute PMLIBDIRS holds an array reference which lists
507 # subdirectories which we should search for library files to
508 # install. PMLIBDIRS defaults to [ 'lib', $self->{BASEEXT} ]. We
509 # recursively search through the named directories (skipping any
510 # which don't exist or contain Makefile.PL files).
512 # For each *.pm or *.pl file found $self->libscan() is called with
513 # the default installation path in $_[1]. The return value of
514 # libscan defines the actual installation location. The default
515 # libscan function simply returns the path. The file is skipped
516 # if libscan returns false.
518 # The default installation location passed to libscan in $_[1] is:
520 # ./*.pm => $(INST_LIBDIR)/*.pm
521 # ./xyz/... => $(INST_LIBDIR)/xyz/...
522 # ./lib/... => $(INST_LIB)/...
524 # In this way the 'lib' directory is seen as the root of the actual
525 # perl library whereas the others are relative to INST_LIBDIR
526 # (which includes ROOTEXT). This is a subtle distinction but one
527 # that's important for nested modules.
529 $self->{PMLIBDIRS} = ['lib', $self->{BASEEXT}]
530 unless $self->{PMLIBDIRS};
532 #only existing directories that aren't in $dir are allowed
534 my (@pmlibdirs) = map { macify ($_) } @{$self->{PMLIBDIRS}};
536 @{$self->{PMLIBDIRS}} = ();
537 foreach $pmlibdir (@pmlibdirs) {
538 -d $pmlibdir && !$dir{$pmlibdir} && push @{$self->{PMLIBDIRS}}, $pmlibdir;
541 if (@{$self->{PMLIBDIRS}}){
542 print "Searching PMLIBDIRS: @{$self->{PMLIBDIRS}}\n"
545 File::Find::find(sub {
547 if ($_ eq "CVS" || $_ eq "RCS"){
548 $File::Find::prune = 1;
552 my($path, $prefix) = ($File::Find::name, '$(INST_LIBDIR)');
553 my($striplibpath,$striplibname);
554 $prefix = '$(INST_LIB)' if (($striplibpath = $path) =~ s:^(\W*)lib\W:$1:);
555 ($striplibname,$striplibpath) = fileparse($striplibpath);
556 my($inst) = File::Spec->catfile($prefix,$striplibpath,$striplibname);
557 local($_) = $inst; # for backwards compatibility
558 $inst = $self->libscan($inst);
559 print "libscan($path) => '$inst'\n" if ($Verbose >= 2);
562 }, @{$self->{PMLIBDIRS}});
565 $self->{DIR} = [sort keys %dir] unless $self->{DIR};
566 $self->{XS} = \%xs unless $self->{XS};
567 $self->{PM} = \%pm unless $self->{PM};
568 $self->{C} = [sort keys %c] unless $self->{C};
569 $self->{H} = [sort keys %h] unless $self->{H};
570 $self->{PL_FILES} = \%pl_files unless $self->{PL_FILES};
572 # Set up names of manual pages to generate from pods
573 unless ($self->{MAN1PODS}) {
574 $self->{MAN1PODS} = {};
576 unless ($self->{MAN3PODS}) {
577 $self->{MAN3PODS} = {};
583 Takes a path to a file that is found by init_dirscan and returns false
584 if we don't want to include this file in the library. Mainly used to
585 exclude RCS, CVS, and SCCS directories from installation.
592 my($self,$path) = @_;
593 return '' if $path =~ m/:(RCS|CVS|SCCS):/ ;
599 Initializes lots of constants and .SUFFIXES and .PHONY
608 NAME DISTNAME NAME_SYM VERSION VERSION_SYM XS_VERSION
609 INST_LIB INST_ARCHLIB PERL_LIB PERL_SRC MACPERL_SRC MACPERL_LIB PERL FULLPERL
610 XSPROTOARG MACLIBS_68K MACLIBS_PPC MACLIBS_SC MACLIBS_MRC MACLIBS_ALL_68K MACLIBS_ALL_PPC MACLIBS_SHARED SOURCE TYPEMAPS
612 next unless defined $self->{$tmp};
613 if ($tmp eq 'TYPEMAPS' && ref $self->{$tmp}) {
614 push @m, sprintf "$tmp = %s\n", join " ", @{$self->{$tmp}};
616 push @m, "$tmp = $self->{$tmp}\n";
621 MODULES = }.join(" \\\n\t", sort keys %{$self->{PM}})."\n";
622 push @m, "PMLIBDIRS = @{$self->{PMLIBDIRS}}\n" if @{$self->{PMLIBDIRS}};
626 .INCLUDE : $(MACPERL_SRC)BuildRules.mk
631 VERSION_MACRO = VERSION
632 DEFINE_VERSION = -d \$(VERSION_MACRO)="¶"\$(VERSION)¶""
633 XS_VERSION_MACRO = XS_VERSION
634 XS_DEFINE_VERSION = -d \$(XS_VERSION_MACRO)="¶"\$(XS_VERSION)¶""
637 $self->{DEFINE} .= " \$(XS_DEFINE_VERSION) \$(DEFINE_VERSION)";
640 MAKEMAKER = $INC{'ExtUtils/MakeMaker.pm'}
641 MM_VERSION = $ExtUtils::MakeMaker::VERSION
645 # FULLEXT = Pathname for extension directory (eg DBD:Oracle).
646 # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT.
647 # ROOTEXT = Directory part of FULLEXT (eg DBD)
648 # DLBASE = Basename part of dynamic library. May be just equal BASEEXT.
651 if ($self->{DEFINE}) {
652 $self->{DEFINE} =~ s/-D/-d /g; # Preprocessor definitions may be useful
653 $self->{DEFINE} =~ s/-I\S+/_include($1)/eg; # UN*X includes probably are not useful
656 $self->{INC} =~ s/-I(\S+)/_include($1)/eg; # UN*X includes probably are not useful
659 FULLEXT BASEEXT ROOTEXT DEFINE INC
661 next unless defined $self->{$tmp};
662 push @m, "$tmp = $self->{$tmp}\n";
666 # Handy lists of source code files:
667 XS_FILES= ".join(" \\\n\t", sort keys %{$self->{XS}})."
668 C_FILES = ".join(" \\\n\t", @{$self->{C}})."
669 H_FILES = ".join(" \\\n\t", @{$self->{H}})."
674 .INCLUDE : $(MACPERL_SRC)ExtBuildRules.mk
682 Defines the static target.
687 # --- Static Loading Sections ---
690 my($extlib) = $self->{MYEXTLIB} ? "\nstatic :: myextlib\n" : "";
694 install :: do_install_static
696 install_static :: do_install_static
702 Used by MacOS to define DL_FUNCS and DL_VARS and write the *.exp
708 my($self,%attribs) = @_;
710 return '' unless !$self->{SKIPHASH}{'dynamic'};
712 my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
713 my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
717 dynamic :: $self->{BASEEXT}.exp
719 ") unless $self->{SKIPHASH}{'dynamic'};
721 my($extlib) = $self->{MYEXTLIB} ? " myextlib" : "";
724 $self->{BASEEXT}.exp: Makefile.PL$extlib
725 ", qq[\t\$(PERL) "-I\$(PERL_LIB)" -e 'use ExtUtils::Mksymlists; ],
726 'Mksymlists("NAME" => "',$self->{NAME},'", "DL_FUNCS" => ',
727 neatvalue($funcs),', "DL_VARS" => ', neatvalue($vars), ');\'
735 Defines the dynamic target.
740 # --- dynamic Loading Sections ---
746 install :: do_install_dynamic
748 install_dynamic :: do_install_dynamic
755 Defines the clean target.
760 # --- Cleanup and Distribution Sections ---
762 my($self, %attribs) = @_;
765 # Delete temporary files but do not touch installed files. We don\'t delete
766 # the Makefile here so a later make realclean still has a makefile to use.
770 # clean subdirectories first
771 for $dir (@{$self->{DIR}}) {
773 " Set OldEcho \{Echo\}
776 If \"\`Exists -f $self->{MAKEFILE}\`\" != \"\"
783 my(@otherfiles) = values %{$self->{XS}}; # .c files from *.xs files
784 push(@otherfiles, patternify($attribs{FILES})) if $attribs{FILES};
785 push @m, "\t\$(RM_RF) @otherfiles\n";
786 # See realclean and ext/utils/make_ext for usage of Makefile.old
788 "\t\$(MV) $self->{MAKEFILE} $self->{MAKEFILE}.old\n");
790 "\t$attribs{POSTOP}\n") if $attribs{POSTOP};
796 Defines the realclean target.
801 my($self, %attribs) = @_;
804 # Delete temporary files (via clean) and also delete installed files
805 realclean purge :: clean
807 # realclean subdirectories first (already cleaned)
809 " Set OldEcho \{Echo\}
812 If \"\`Exists -f %s\`\" != \"\"
817 foreach(@{$self->{DIR}}){
818 push(@m, sprintf($sub,$_,"$self->{MAKEFILE}.old","-f $self->{MAKEFILE}.old"));
819 push(@m, sprintf($sub,$_,"$self->{MAKEFILE}",''));
821 my(@otherfiles) = ($self->{MAKEFILE},
822 "$self->{MAKEFILE}.old"); # Makefiles last
823 push(@otherfiles, patternify($attribs{FILES})) if $attribs{FILES};
824 push(@m, "\t\$(RM_RF) @otherfiles\n") if @otherfiles;
825 push(@m, "\t$attribs{POSTOP}\n") if $attribs{POSTOP};
836 install install_static install_dynamic ::
837 \t\$(MACPERL_SRC)PerlInstall -l \$(PERL_LIB)
839 .INCLUDE : \$(MACPERL_SRC)BulkBuildRules.mk
845 return $ExtUtils::MakeMaker::Version;
851 Defines targets to run *.PL files.
857 return "" unless $self->{PL_FILES};
859 foreach $plfile (sort keys %{$self->{PL_FILES}}) {
860 my $list = ref($self->{PL_FILES}->{$plfile})
861 ? $self->{PL_FILES}->{$plfile}
862 : [$self->{PL_FILES}->{$plfile}];
863 foreach $target (@$list) {
866 \t$self->{NOECHO}\$(NOOP)
869 \t\$(PERL) -I\$(MACPERL_LIB) -I\$(PERL_LIB) $plfile $target
877 my($self,$libperl) = @_;
880 for (map { $_ . "Optimize" } qw(MWC MWCPPC MWC68K MPW MRC MRC SC)) {
881 $optimize .= "$_ = $self->{$_}" if exists $self->{$_};
884 return $self->{CFLAGS} = $optimize;
887 sub _include { # for Unix-style includes, with -I instead of -i
889 require File::Spec::Unix;
891 # allow only relative paths
892 if (File::Spec::Unix->file_name_is_absolute($inc)) {
895 return '-i ' . macify($inc);
899 # yes, these are just copies of the same routines in
900 # MakeMaker.pm, but with paths changed.
903 # We allow extension-specific hints files.
905 return unless -d ":hints";
907 # First we look for the best hintsfile we have
908 my($hint)="${^O}_$Config{osvers}";
913 # Also try without trailing minor version numbers.
915 last if -f ":hints:$hint.pl"; # found
917 last unless $hint =~ s/_[^_]*$//; # nothing to cut off
919 my $hint_file = ":hints:$hint.pl";
921 return unless -f $hint_file; # really there
923 _run_hintfile($self, $hint_file);
928 local($self) = shift; # make $self available to the hint file.
929 my($hint_file) = shift;
932 print STDERR "Processing hints file $hint_file\n";
933 my $ret = do $hint_file;
934 unless( defined $ret ) {
935 print STDERR $@ if $@;