1 package ExtUtils::MM_Unix;
3 $VERSION = substr q$Revision: 1.1.1.1 $, 10;
4 # $Id: MM_Unix.pm,v 1.1.1.1 1997/01/11 12:48:52 mbeattie Exp $
8 use File::Basename qw(basename dirname fileparse);
11 Exporter::import('ExtUtils::MakeMaker',
12 qw( $Verbose &neatvalue));
14 $Is_OS2 = $^O =~ m|^os/?2$|i;
15 $Is_Mac = $^O eq "MacOS";
17 if ($Is_VMS = $^O eq 'VMS') {
18 require VMS::Filespec;
19 import VMS::Filespec qw( &vmsify );
24 ExtUtils::MM_Unix - methods used by ExtUtils::MakeMaker
28 C<require ExtUtils::MM_Unix;>
32 The methods provided by this package are designed to be used in
33 conjunction with ExtUtils::MakeMaker. When MakeMaker writes a
34 Makefile, it creates one or more objects that inherit their methods
35 from a package C<MM>. MM itself doesn't provide any methods, but it
36 ISA ExtUtils::MM_Unix class. The inheritance tree of MM lets operating
37 specific packages take the responsibility for all the methods provided
38 by MM_Unix. We are trying to reduce the number of the necessary
39 overrides by defining rather primitive operations within
42 If you are going to write a platform specific MM package, please try
43 to limit the necessary overrides to primitiv methods, and if it is not
44 possible to do so, let's work it out how to achieve that gain.
46 If you are overriding any of these methods in your Makefile.PL (in the
47 MY class), please report that to the makemaker mailing list. We are
48 trying to minimize the necessary method overrides and switch to data
49 driven Makefile.PLs wherever possible. In the long run less methods
50 will be overridable via the MY class.
54 The following description of methods is still under
55 development. Please refer to the code for not suitably documented
56 sections and complain loudly to the makemaker mailing list.
58 Not all of the methods below are overridable in a
59 Makefile.PL. Overridable methods are marked as (o). All methods are
60 overridable by a platform specific MM_*.pm file (See
61 L<ExtUtils::MM_VMS>) and L<ExtUtils::MM_OS2>).
63 =head2 Preloaded methods
69 No physical check on the filesystem, but a logical cleanup of a
70 path. On UNIX eliminated successive slashes and successive "/.".
76 $path =~ s|/+|/|g ; # xx////xx -> xx/xx
77 $path =~ s|(/\.)+/|/|g ; # xx/././xx -> xx/xx
78 $path =~ s|^(\./)+|| unless $path eq "./"; # ./xx -> xx
79 $path =~ s|/$|| unless $path eq "/"; # xx/ -> xx
85 Concatenate two or more directory names to form a complete path ending
86 with a directory. But remove the trailing slash from the resulting
87 string, because it doesn't look good, isn't necessary and confuses
88 OS2. Of course, if this is the root directory, don't cut off the
99 # append a slash to each argument unless it has one there
100 $_ .= "/" unless substr($_,length($_)-1,1) eq "/";
102 my $result = join('', @args);
103 # remove a trailing slash unless we are root
104 substr($result,length($result)-1,1) = ""
105 if length($result) > 1 && substr($result,length($result)-1,1) eq "/";
111 Concatenate one or more directory names and a filename to form a
112 complete path ending with a filename
119 return $file unless @_;
120 my $dir = $self->catdir(@_);
122 $_ .= "/" unless substr($_,length($_)-1,1) eq "/";
129 Returns a string representing of the current directory. "." on UNIX.
139 Returns a string representing of the root directory. "/" on UNIX.
149 Returns a string representing of the parent directory. ".." on UNIX.
157 sub ExtUtils::MM_Unix::c_o ;
158 sub ExtUtils::MM_Unix::clean ;
159 sub ExtUtils::MM_Unix::const_cccmd ;
160 sub ExtUtils::MM_Unix::const_config ;
161 sub ExtUtils::MM_Unix::const_loadlibs ;
162 sub ExtUtils::MM_Unix::constants ;
163 sub ExtUtils::MM_Unix::depend ;
164 sub ExtUtils::MM_Unix::dir_target ;
165 sub ExtUtils::MM_Unix::dist ;
166 sub ExtUtils::MM_Unix::dist_basics ;
167 sub ExtUtils::MM_Unix::dist_ci ;
168 sub ExtUtils::MM_Unix::dist_core ;
169 sub ExtUtils::MM_Unix::dist_dir ;
170 sub ExtUtils::MM_Unix::dist_test ;
171 sub ExtUtils::MM_Unix::dlsyms ;
172 sub ExtUtils::MM_Unix::dynamic ;
173 sub ExtUtils::MM_Unix::dynamic_bs ;
174 sub ExtUtils::MM_Unix::dynamic_lib ;
175 sub ExtUtils::MM_Unix::exescan ;
176 sub ExtUtils::MM_Unix::extliblist ;
177 sub ExtUtils::MM_Unix::file_name_is_absolute ;
178 sub ExtUtils::MM_Unix::find_perl ;
179 sub ExtUtils::MM_Unix::force ;
180 sub ExtUtils::MM_Unix::guess_name ;
181 sub ExtUtils::MM_Unix::has_link_code ;
182 sub ExtUtils::MM_Unix::init_dirscan ;
183 sub ExtUtils::MM_Unix::init_main ;
184 sub ExtUtils::MM_Unix::init_others ;
185 sub ExtUtils::MM_Unix::install ;
186 sub ExtUtils::MM_Unix::installbin ;
187 sub ExtUtils::MM_Unix::libscan ;
188 sub ExtUtils::MM_Unix::linkext ;
189 sub ExtUtils::MM_Unix::lsdir ;
190 sub ExtUtils::MM_Unix::macro ;
191 sub ExtUtils::MM_Unix::makeaperl ;
192 sub ExtUtils::MM_Unix::makefile ;
193 sub ExtUtils::MM_Unix::manifypods ;
194 sub ExtUtils::MM_Unix::maybe_command ;
195 sub ExtUtils::MM_Unix::maybe_command_in_dirs ;
196 sub ExtUtils::MM_Unix::needs_linking ;
197 sub ExtUtils::MM_Unix::nicetext ;
198 sub ExtUtils::MM_Unix::parse_version ;
199 sub ExtUtils::MM_Unix::pasthru ;
200 sub ExtUtils::MM_Unix::path ;
201 sub ExtUtils::MM_Unix::perl_script ;
202 sub ExtUtils::MM_Unix::perldepend ;
203 sub ExtUtils::MM_Unix::pm_to_blib ;
204 sub ExtUtils::MM_Unix::post_constants ;
205 sub ExtUtils::MM_Unix::post_initialize ;
206 sub ExtUtils::MM_Unix::postamble ;
207 sub ExtUtils::MM_Unix::prefixify ;
208 sub ExtUtils::MM_Unix::processPL ;
209 sub ExtUtils::MM_Unix::realclean ;
210 sub ExtUtils::MM_Unix::replace_manpage_separator ;
211 sub ExtUtils::MM_Unix::static ;
212 sub ExtUtils::MM_Unix::static_lib ;
213 sub ExtUtils::MM_Unix::staticmake ;
214 sub ExtUtils::MM_Unix::subdir_x ;
215 sub ExtUtils::MM_Unix::subdirs ;
216 sub ExtUtils::MM_Unix::test ;
217 sub ExtUtils::MM_Unix::test_via_harness ;
218 sub ExtUtils::MM_Unix::test_via_script ;
219 sub ExtUtils::MM_Unix::tool_autosplit ;
220 sub ExtUtils::MM_Unix::tool_xsubpp ;
221 sub ExtUtils::MM_Unix::tools_other ;
222 sub ExtUtils::MM_Unix::top_targets ;
223 sub ExtUtils::MM_Unix::writedoc ;
224 sub ExtUtils::MM_Unix::xs_c ;
225 sub ExtUtils::MM_Unix::xs_o ;
226 sub ExtUtils::MM_Unix::xsubpp_version ;
228 package ExtUtils::MM_Unix;
235 =head2 SelfLoaded methods
239 Defines the suffix rules to compile different flavors of C files to
245 # --- Translation Sections ---
248 return '' unless $self->needs_linking();
252 $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c
255 $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.C
258 $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.cpp
261 $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.cxx
264 $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.cc
271 Does very much the same as the cflags script in the perl
272 distribution. It doesn't return the whole compiler command line, but
273 initializes all of its parts. The const_cccmd method then actually
274 returns the definition of the CCCMD macro which uses these parts.
281 my($self,$libperl)=@_;
282 return $self->{CFLAGS} if $self->{CFLAGS};
283 return '' unless $self->needs_linking();
285 my($prog, $uc, $perltype, %cflags);
286 $libperl ||= $self->{LIBPERL_A} || "libperl$self->{LIB_EXT}" ;
287 $libperl =~ s/\.\$\(A\)$/$self->{LIB_EXT}/;
289 @cflags{qw(cc ccflags optimize large split shellflags)}
290 = @Config{qw(cc ccflags optimize large split shellflags)};
293 $cflags{shellflags} ||= '';
298 DE => '-DDEBUGGING -DEMBED',
299 M => '-DEMBED -DMULTIPLICITY',
300 DM => '-DDEBUGGING -DEMBED -DMULTIPLICITY',
303 if ($libperl =~ /libperl(\w*)\Q$self->{LIB_EXT}/){
306 $uc = ""; # avoid warning
308 $perltype = $map{$uc} ? $map{$uc} : "";
316 ( $name = $self->{NAME} . "_cflags" ) =~ s/:/_/g ;
317 if ($prog = $Config::Config{$name}) {
318 # Expand hints for this extension via the shell
319 print STDOUT "Processing $name hint:\n" if $Verbose;
320 my(@o)=`cc=\"$cflags{cc}\"
321 ccflags=\"$cflags{ccflags}\"
322 optimize=\"$cflags{optimize}\"
323 perltype=\"$cflags{perltype}\"
324 optdebug=\"$cflags{optdebug}\"
325 large=\"$cflags{large}\"
326 split=\"$cflags{'split'}\"
329 echo ccflags=\$ccflags
330 echo optimize=\$optimize
331 echo perltype=\$perltype
332 echo optdebug=\$optdebug
339 if ($line =~ /(.*?)=\s*(.*)\s*$/){
341 print STDOUT " $1 = $2\n" if $Verbose;
343 print STDOUT "Unrecognised result from hint: '$line'\n";
349 $cflags{optimize} = $optdebug;
352 for (qw(ccflags optimize perltype large split)) {
353 $cflags{$_} =~ s/^\s+//;
354 $cflags{$_} =~ s/\s+/ /g;
355 $cflags{$_} =~ s/\s+$//;
356 $self->{uc $_} ||= $cflags{$_}
359 return $self->{CFLAGS} = qq{
360 CCFLAGS = $self->{CCFLAGS}
361 OPTIMIZE = $self->{OPTIMIZE}
362 PERLTYPE = $self->{PERLTYPE}
363 LARGE = $self->{LARGE}
364 SPLIT = $self->{SPLIT}
371 Defines the clean target.
376 # --- Cleanup and Distribution Sections ---
378 my($self, %attribs) = @_;
381 # Delete temporary files but do not touch installed files. We don\'t delete
382 # the Makefile here so a later make realclean still has a makefile to use.
386 # clean subdirectories first
387 for $dir (@{$self->{DIR}}) {
388 push @m, "\t-cd $dir && test -f $self->{MAKEFILE} && \$(MAKE) clean\n";
391 my(@otherfiles) = values %{$self->{XS}}; # .c files from *.xs files
392 push(@otherfiles, $attribs{FILES}) if $attribs{FILES};
393 push(@otherfiles, qw[./blib $(MAKE_APERL_FILE) $(INST_ARCHAUTODIR)/extralibs.all
394 perlmain.c mon.out core so_locations pm_to_blib
395 *~ */*~ */*/*~ *$(OBJ_EXT) *$(LIB_EXT) perl.exe
396 $(BOOTSTRAP) $(BASEEXT).bso $(BASEEXT).def
399 push @m, "\t-$self->{RM_RF} @otherfiles\n";
400 # See realclean and ext/utils/make_ext for usage of Makefile.old
402 "\t-$self->{MV} $self->{MAKEFILE} $self->{MAKEFILE}.old 2>/dev/null\n");
404 "\t$attribs{POSTOP}\n") if $attribs{POSTOP};
408 =item const_cccmd (o)
410 Returns the full compiler call for C programs and stores the
411 definition in CONST_CCCMD.
416 my($self,$libperl)=@_;
417 return $self->{CONST_CCCMD} if $self->{CONST_CCCMD};
418 return '' unless $self->needs_linking();
419 return $self->{CONST_CCCMD} =
420 q{CCCMD = $(CC) -c $(INC) $(CCFLAGS) $(OPTIMIZE) \\
421 $(PERLTYPE) $(LARGE) $(SPLIT) $(DEFINE_VERSION) \\
422 $(XS_DEFINE_VERSION)};
425 =item const_config (o)
427 Defines a couple of constants in the Makefile that are imported from
433 # --- Constants Sections ---
437 push(@m,"\n# These definitions are from config.sh (via $INC{'Config.pm'})\n");
438 push(@m,"\n# They may have been overridden via Makefile.PL or on the command line\n");
440 foreach $m (@{$self->{CONFIG}}){
441 # SITE*EXP macros are defined in &constants; avoid duplicates here
442 next if $once_only{$m} or $m eq 'sitelibexp' or $m eq 'sitearchexp';
443 push @m, "\U$m\E = ".$self->{uc $m}."\n";
449 =item const_loadlibs (o)
451 Defines EXTRALIBS, LDLOADLIBS, BSLOADLIBS, LD_RUN_PATH. See
452 L<ExtUtils::Liblist> for details.
458 return "" unless $self->needs_linking;
461 # $self->{NAME} might depend on some other libraries:
462 # See ExtUtils::Liblist for details
467 EXTRALIBS LDLOADLIBS BSLOADLIBS LD_RUN_PATH
469 next unless defined $self->{$tmp};
470 push @m, "$tmp = $self->{$tmp}\n";
477 Initializes lots of constants and .SUFFIXES and .PHONY
487 AR_STATIC_ARGS NAME DISTNAME NAME_SYM VERSION
488 VERSION_SYM XS_VERSION INST_BIN INST_EXE INST_LIB
489 INST_ARCHLIB INST_SCRIPT PREFIX INSTALLDIRS
490 INSTALLPRIVLIB INSTALLARCHLIB INSTALLSITELIB
491 INSTALLSITEARCH INSTALLBIN INSTALLSCRIPT PERL_LIB
492 PERL_ARCHLIB SITELIBEXP SITEARCHEXP LIBPERL_A MYEXTLIB
493 FIRST_MAKEFILE MAKE_APERL_FILE PERLMAINCC PERL_SRC
494 PERL_INC PERL FULLPERL
497 next unless defined $self->{$tmp};
498 push @m, "$tmp = $self->{$tmp}\n";
502 VERSION_MACRO = VERSION
503 DEFINE_VERSION = -D\$(VERSION_MACRO)=\\\"\$(VERSION)\\\"
504 XS_VERSION_MACRO = XS_VERSION
505 XS_DEFINE_VERSION = -D\$(XS_VERSION_MACRO)=\\\"\$(XS_VERSION)\\\"
509 MAKEMAKER = $INC{'ExtUtils/MakeMaker.pm'}
510 MM_VERSION = $ExtUtils::MakeMaker::VERSION
514 # FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle).
515 # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle)
516 # ROOTEXT = Directory part of FULLEXT with leading slash (eg /DBD) !!! Deprecated from MM 5.32 !!!
517 # PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar)
518 # DLBASE = Basename part of dynamic library. May be just equal BASEEXT.
522 FULLEXT BASEEXT PARENT_NAME DLBASE VERSION_FROM INC DEFINE OBJECT
525 next unless defined $self->{$tmp};
526 push @m, "$tmp = $self->{$tmp}\n";
530 # Handy lists of source code files:
531 XS_FILES= ".join(" \\\n\t", sort keys %{$self->{XS}})."
532 C_FILES = ".join(" \\\n\t", @{$self->{C}})."
533 O_FILES = ".join(" \\\n\t", @{$self->{O_FILES}})."
534 H_FILES = ".join(" \\\n\t", @{$self->{H}})."
535 MAN1PODS = ".join(" \\\n\t", sort keys %{$self->{MAN1PODS}})."
536 MAN3PODS = ".join(" \\\n\t", sort keys %{$self->{MAN3PODS}})."
540 INST_MAN1DIR INSTALLMAN1DIR MAN1EXT INST_MAN3DIR INSTALLMAN3DIR MAN3EXT
542 next unless defined $self->{$tmp};
543 push @m, "$tmp = $self->{$tmp}\n";
547 .NO_CONFIG_REC: Makefile
548 } if $ENV{CLEARCASE_ROOT};
550 # why not q{} ? -- emacs
552 # work around a famous dec-osf make(1) feature(?):
555 .SUFFIXES: .xs .c .C .cpp .cxx .cc \$(OBJ_EXT)
557 # Nick wanted to get rid of .PRECIOUS. I don't remember why. I seem to recall, that
558 # some make implementations will delete the Makefile when we rebuild it. Because
559 # we call false(1) when we rebuild it. So make(1) is not completely wrong when it
560 # does so. Our milage may vary.
561 # .PRECIOUS: Makefile # seems to be not necessary anymore
563 .PHONY: all config static dynamic test linkext manifest
565 # Where is the Config information that we are using/depend on
566 CONFIGDEP = \$(PERL_ARCHLIB)/Config.pm \$(PERL_INC)/config.h
569 my @parentdir = split(/::/, $self->{PARENT_NAME});
571 # Where to put things:
572 INST_LIBDIR = }. $self->catdir('$(INST_LIB)',@parentdir) .q{
573 INST_ARCHLIBDIR = }. $self->catdir('$(INST_ARCHLIB)',@parentdir) .q{
575 INST_AUTODIR = }. $self->catdir('$(INST_LIB)','auto','$(FULLEXT)') .q{
576 INST_ARCHAUTODIR = }. $self->catdir('$(INST_ARCHLIB)','auto','$(FULLEXT)') .q{
579 if ($self->has_link_code()) {
581 INST_STATIC = $(INST_ARCHAUTODIR)/$(BASEEXT)$(LIB_EXT)
582 INST_DYNAMIC = $(INST_ARCHAUTODIR)/$(DLBASE).$(DLEXT)
583 INST_BOOT = $(INST_ARCHAUTODIR)/$(BASEEXT).bs
594 $tmp = "$self->{BASEEXT}.def";
603 $tmp = "\$(PERL_INC)/libperl\$(LIB_EXT)";
612 #INST_PM = }.join(" \\\n\t", sort values %{$self->{PM}}).q{
614 #PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{
618 TO_INST_PM = }.join(" \\\n\t", sort keys %{$self->{PM}}).q{
620 PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{
628 Same as macro for the depend attribute.
633 my($self,%attribs) = @_;
635 while (($key,$val) = each %attribs){
636 last unless defined $key;
637 push @m, "$key: $val\n";
644 Takes an array of directories that need to exist and returns a
645 Makefile entry for a .exists file in these directories. Returns
646 nothing, if the entry has already been processed. We're helpless
647 though, if the same directory comes as $(FOO) _and_ as "bar". Both of
648 them get an entry, that's why we use "::".
653 # --- Make-Directories section (internal method) ---
654 # dir_target(@array) returns a Makefile entry for the file .exists in each
655 # named directory. Returns nothing, if the entry has already been processed.
656 # We're helpless though, if the same directory comes as $(FOO) _and_ as "bar".
657 # Both of them get an entry, that's why we use "::". I chose '$(PERL)' as the
658 # prerequisite, because there has to be one, something that doesn't change
661 my($self,@dirs) = @_;
663 foreach $dir (@dirs) {
664 my($src) = $self->catfile($self->{PERL_INC},'perl.h');
665 my($targ) = $self->catfile($dir,'.exists');
666 my($targdir) = $targ; # Necessary because catfile may have
667 $targdir =~ s:/?.exists$::; # adapted syntax of $dir to target OS
668 next if $self->{DIR_TARGET}{$self}{$targdir}++;
671 $self->{NOECHO}\$(MKPATH) $targdir
672 $self->{NOECHO}\$(EQUALIZE_TIMESTAMP) $src $targ
675 -$self->{NOECHO}\$(CHMOD) 755 $targdir
683 Defines a lot of macros for distribution support.
688 my($self, %attribs) = @_;
691 # VERSION should be sanitised before use as a file name
692 my($version) = $attribs{VERSION} || '$(VERSION)';
693 my($name) = $attribs{NAME} || '$(DISTNAME)';
694 my($tar) = $attribs{TAR} || 'tar'; # eg /usr/bin/gnutar
695 my($tarflags) = $attribs{TARFLAGS} || 'cvf';
696 my($zip) = $attribs{ZIP} || 'zip'; # eg pkzip Yuck!
697 my($zipflags) = $attribs{ZIPFLAGS} || '-r';
698 my($compress) = $attribs{COMPRESS} || 'compress'; # eg gzip
699 my($suffix) = $attribs{SUFFIX} || '.Z'; # eg .gz
700 my($shar) = $attribs{SHAR} || 'shar'; # eg "shar --gzip"
701 my($preop) = $attribs{PREOP} || "$self->{NOECHO}\$(NOOP)"; # eg update MANIFEST
702 my($postop) = $attribs{POSTOP} || "$self->{NOECHO}\$(NOOP)"; # eg remove the distdir
704 my($to_unix) = $attribs{TO_UNIX} || ($Is_OS2
706 . 'test -f tmp.zip && $(RM) tmp.zip;'
707 . ' $(ZIP) -ll -mr tmp.zip $(DISTVNAME) && unzip -o tmp.zip && $(RM) tmp.zip'
708 : "$self->{NOECHO}\$(NOOP)");
710 my($ci) = $attribs{CI} || 'ci -u';
711 my($rcs_label)= $attribs{RCS_LABEL}|| 'rcs -Nv$(VERSION_SYM): -q';
712 my($dist_cp) = $attribs{DIST_CP} || 'best';
713 my($dist_default) = $attribs{DIST_DEFAULT} || 'tardist';
716 DISTVNAME = ${name}-$version
728 RCS_LABEL = $rcs_label
730 DIST_DEFAULT = $dist_default
735 =item dist_basics (o)
737 Defines the targets distclean, distcheck, skipcheck, manifest.
745 distclean :: realclean distcheck
750 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&fullcheck";' \\
756 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&skipcheck";' \\
762 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&mkmanifest";' \\
770 Defines a check in target for RCS.
779 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&maniread";' \\
780 -e '@all = keys %{ maniread() };' \\
781 -e 'print("Executing $(CI) @all\n"); system("$(CI) @all");' \\
782 -e 'print("Executing $(RCS_LABEL) ...\n"); system("$(RCS_LABEL) @all");'
789 Defeines the targets dist, tardist, zipdist, uutardist, shdist
797 dist : $(DIST_DEFAULT)
798 }.$self->{NOECHO}.q{$(PERL) -le 'print "Warning: Makefile possibly out of date with $$vf" if ' \
799 -e '-e ($$vf="$(VERSION_FROM)") and -M $$vf < -M "}.$self->{MAKEFILE}.q{";'
801 tardist : $(DISTVNAME).tar$(SUFFIX)
803 zipdist : $(DISTVNAME).zip
805 $(DISTVNAME).tar$(SUFFIX) : distdir
808 $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME)
809 $(RM_RF) $(DISTVNAME)
810 $(COMPRESS) $(DISTVNAME).tar
813 $(DISTVNAME).zip : distdir
815 $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME)
816 $(RM_RF) $(DISTVNAME)
819 uutardist : $(DISTVNAME).tar$(SUFFIX)
820 uuencode $(DISTVNAME).tar$(SUFFIX) \\
821 $(DISTVNAME).tar$(SUFFIX) > \\
822 $(DISTVNAME).tar$(SUFFIX)_uu
826 $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar
827 $(RM_RF) $(DISTVNAME)
835 Defines the scratch directory target that will hold the distribution
836 before tar-ing (or shar-ing).
845 $(RM_RF) $(DISTVNAME)
846 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=manicopy,maniread \\
847 -e 'manicopy(maniread(),"$(DISTVNAME)", "$(DIST_CP)");'
854 Defines a target that produces the distribution in the
855 scratchdirectory, and runs 'perl Makefile.PL; make ;make test' in that
865 cd $(DISTVNAME) && $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) Makefile.PL
866 cd $(DISTVNAME) && $(MAKE)
867 cd $(DISTVNAME) && $(MAKE) test
874 Used by AIX and VMS to define DL_FUNCS and DL_VARS and write the *.exp
880 my($self,%attribs) = @_;
882 return '' unless ($^O eq 'aix' && $self->needs_linking() );
884 my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
885 my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
889 dynamic :: $self->{BASEEXT}.exp
891 ") unless $self->{SKIPHASH}{'dynamic'}; # dynamic and static are subs, so...
894 static :: $self->{BASEEXT}.exp
896 ") unless $self->{SKIPHASH}{'static'}; # we avoid a warning if we tick them
899 $self->{BASEEXT}.exp: Makefile.PL
900 ",' $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e \'use ExtUtils::Mksymlists; \\
901 Mksymlists("NAME" => "',$self->{NAME},'", "DL_FUNCS" => ',
902 neatvalue($funcs),', "DL_VARS" => ', neatvalue($vars), ');\'
910 Defines the dynamic target.
915 # --- Dynamic Loading Sections ---
919 ## $(INST_PM) has been moved to the all: target.
920 ## It remains here for awhile to allow for old usage: "make dynamic"
921 #dynamic :: '.$self->{MAKEFILE}.' $(INST_DYNAMIC) $(INST_BOOT) $(INST_PM)
922 dynamic :: '.$self->{MAKEFILE}.' $(INST_DYNAMIC) $(INST_BOOT)
923 '.$self->{NOECHO}.'$(NOOP)
929 Defines targets for bootstrap files.
934 my($self, %attribs) = @_;
937 ' unless $self->has_link_code();
940 BOOTSTRAP = '."$self->{BASEEXT}.bs".'
942 # As Mkbootstrap might not write a file (if none is required)
943 # we use touch to prevent make continually trying to remake it.
944 # The DynaLoader only reads a non-empty file.
945 $(BOOTSTRAP): '."$self->{MAKEFILE} $self->{BOOTDEP}".' $(INST_ARCHAUTODIR)/.exists
946 '.$self->{NOECHO}.'echo "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))"
947 '.$self->{NOECHO}.'$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" \
948 -e \'use ExtUtils::Mkbootstrap;\' \
949 -e \'Mkbootstrap("$(BASEEXT)","$(BSLOADLIBS)");\'
950 '.$self->{NOECHO}.'$(TOUCH) $(BOOTSTRAP)
953 $(INST_BOOT): $(BOOTSTRAP) $(INST_ARCHAUTODIR)/.exists
954 '."$self->{NOECHO}$self->{RM_RF}".' $(INST_BOOT)
955 -'.$self->{CP}.' $(BOOTSTRAP) $(INST_BOOT)
960 =item dynamic_lib (o)
962 Defines how to produce the *.so (or equivalent) files.
967 my($self, %attribs) = @_;
968 return '' unless $self->needs_linking(); #might be because of a subdir
970 return '' unless $self->has_link_code;
972 my($otherldflags) = $attribs{OTHERLDFLAGS} || "";
973 my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || "";
974 my($armaybe) = $attribs{ARMAYBE} || $self->{ARMAYBE} || ":";
975 my($ldfrom) = '$(LDFROM)';
976 $armaybe = 'ar' if ($^O eq 'dec_osf' and $armaybe eq ':');
979 # This section creates the dynamically loadable $(INST_DYNAMIC)
980 # from $(OBJECT) and possibly $(MYEXTLIB).
981 ARMAYBE = '.$armaybe.'
982 OTHERLDFLAGS = '.$otherldflags.'
983 INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'
985 $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)/.exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
987 if ($armaybe ne ':'){
988 $ldfrom = 'tmp$(LIB_EXT)';
989 push(@m,' $(ARMAYBE) cr '.$ldfrom.' $(OBJECT)'."\n");
990 push(@m,' $(RANLIB) '."$ldfrom\n");
992 $ldfrom = "-all $ldfrom -none" if ($^O eq 'dec_osf');
993 push(@m,' LD_RUN_PATH="$(LD_RUN_PATH)" $(LD) -o $@ $(LDDLFLAGS) '.$ldfrom.
994 ' $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) $(EXPORT_LIST)');
999 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
1005 Deprecated method. Use libscan instead.
1010 my($self,$path) = @_;
1016 Called by init_others, and calls ext ExtUtils::Liblist. See
1017 L<ExtUtils::Liblist> for details.
1022 my($self,$libs) = @_;
1023 require ExtUtils::Liblist;
1024 $self->ext($libs, $Verbose);
1027 =item file_name_is_absolute
1029 Takes as argument a path and returns true, it it is an absolute path.
1033 sub file_name_is_absolute {
1034 my($self,$file) = @_;
1040 Finds the executables PERL and FULLPERL
1045 my($self, $ver, $names, $dirs, $trace) = @_;
1048 print "Looking for perl $ver by these names:
1054 foreach $dir (@$dirs){
1055 next unless defined $dir; # $self->{PERL_SRC} may be undefined
1056 foreach $name (@$names){
1058 if ($self->file_name_is_absolute($name)) { # /foo/bar
1060 } elsif ($self->canonpath($name) eq $self->canonpath(basename($name))) { # foo
1061 $abs = $self->catfile($dir, $name);
1063 $abs = $self->canonpath($self->catfile($self->curdir, $name));
1065 print "Checking $abs\n" if ($trace >= 2);
1066 next unless $self->maybe_command($abs);
1067 print "Executing $abs\n" if ($trace >= 2);
1068 if (`$abs -e 'require $ver; print "VER_OK\n" ' 2>&1` =~ /VER_OK/) {
1069 print "Using PERL=$abs\n" if $trace;
1074 print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n";
1075 0; # false and not empty
1078 =head2 Methods to actually produce chunks of text for the Makefile
1080 The methods here are called in the order specified by
1081 @ExtUtils::MakeMaker::MM_Sections. This manpage reflects the order as
1082 well as possible. Some methods call each other, so in doubt refer to
1093 '# Phony target to force checking subdirectories.
1100 Guess the name of this package by examining the working directory's
1101 name. MakeMaker calls this only if the developer has not supplied a
1111 my $name = basename(cwd());
1112 $name =~ s|[\-_][\d\.\-]+$||; # this is new with MM 5.00, we
1113 # strip minus or underline
1114 # followed by a float or some such
1115 print "Warning: Guessing NAME [$name] from current directory name.\n";
1121 Returns true if C, XS, MYEXTLIB or similar objects exist within this
1122 object that need a compiler. Does not descend into subdirectories as
1123 needs_linking() does.
1129 return $self->{HAS_LINK_CODE} if defined $self->{HAS_LINK_CODE};
1130 if ($self->{OBJECT} or @{$self->{C} || []} or $self->{MYEXTLIB}){
1131 $self->{HAS_LINK_CODE} = 1;
1134 return $self->{HAS_LINK_CODE} = 0;
1139 Initializes DIR, XS, PM, C, O_FILES, H, PL_FILES, MAN*PODS, EXE_FILES.
1143 sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc)
1145 my($name, %dir, %xs, %c, %h, %ignore, %pl_files, %manifypods);
1146 local(%pm); #the sub in find() has to see this hash
1147 $ignore{'test.pl'} = 1;
1148 $ignore{'makefile.pl'} = 1 if $Is_VMS;
1149 foreach $name ($self->lsdir($self->curdir)){
1150 next if $name eq $self->curdir or $name eq $self->updir or $ignore{$name};
1151 next unless $self->libscan($name);
1153 next if -l $name; # We do not support symlinks at all
1154 $dir{$name} = $name if (-f $self->catfile($name,"Makefile.PL"));
1155 } elsif ($name =~ /\.xs$/){
1156 my($c); ($c = $name) =~ s/\.xs$/.c/;
1159 } elsif ($name =~ /\.c(pp|xx|c)?$/i){ # .c .C .cpp .cxx .cc
1161 unless $name =~ m/perlmain\.c/; # See MAP_TARGET
1162 } elsif ($name =~ /\.h$/i){
1164 } elsif ($name =~ /\.(p[ml]|pod)$/){
1165 $pm{$name} = $self->catfile('$(INST_LIBDIR)',$name);
1166 } elsif ($name =~ /\.PL$/ && $name ne "Makefile.PL") {
1167 ($pl_files{$name} = $name) =~ s/\.PL$// ;
1168 } elsif ($Is_VMS && $name =~ /\.pl$/ && $name ne 'makefile.pl' &&
1169 $name ne 'test.pl') { # case-insensitive filesystem
1170 ($pl_files{$name} = $name) =~ s/\.pl$// ;
1174 # Some larger extensions often wish to install a number of *.pm/pl
1175 # files into the library in various locations.
1177 # The attribute PMLIBDIRS holds an array reference which lists
1178 # subdirectories which we should search for library files to
1179 # install. PMLIBDIRS defaults to [ 'lib', $self->{BASEEXT} ]. We
1180 # recursively search through the named directories (skipping any
1181 # which don't exist or contain Makefile.PL files).
1183 # For each *.pm or *.pl file found $self->libscan() is called with
1184 # the default installation path in $_[1]. The return value of
1185 # libscan defines the actual installation location. The default
1186 # libscan function simply returns the path. The file is skipped
1187 # if libscan returns false.
1189 # The default installation location passed to libscan in $_[1] is:
1191 # ./*.pm => $(INST_LIBDIR)/*.pm
1192 # ./xyz/... => $(INST_LIBDIR)/xyz/...
1193 # ./lib/... => $(INST_LIB)/...
1195 # In this way the 'lib' directory is seen as the root of the actual
1196 # perl library whereas the others are relative to INST_LIBDIR
1197 # (which includes PARENT_NAME). This is a subtle distinction but one
1198 # that's important for nested modules.
1200 $self->{PMLIBDIRS} = ['lib', $self->{BASEEXT}]
1201 unless $self->{PMLIBDIRS};
1203 #only existing directories that aren't in $dir are allowed
1205 # Avoid $_ wherever possible:
1206 # @{$self->{PMLIBDIRS}} = grep -d && !$dir{$_}, @{$self->{PMLIBDIRS}};
1207 my (@pmlibdirs) = @{$self->{PMLIBDIRS}};
1209 @{$self->{PMLIBDIRS}} = ();
1210 foreach $pmlibdir (@pmlibdirs) {
1211 -d $pmlibdir && !$dir{$pmlibdir} && push @{$self->{PMLIBDIRS}}, $pmlibdir;
1214 if (@{$self->{PMLIBDIRS}}){
1215 print "Searching PMLIBDIRS: @{$self->{PMLIBDIRS}}\n"
1218 File::Find::find(sub {
1220 if ($_ eq "CVS" || $_ eq "RCS"){
1221 $File::Find::prune = 1;
1225 my($path, $prefix) = ($File::Find::name, '$(INST_LIBDIR)');
1226 my($striplibpath,$striplibname);
1227 $prefix = '$(INST_LIB)' if (($striplibpath = $path) =~ s:^(\W*)lib\W:$1:);
1228 ($striplibname,$striplibpath) = fileparse($striplibpath);
1229 my($inst) = $self->catfile($prefix,$striplibpath,$striplibname);
1230 local($_) = $inst; # for backwards compatibility
1231 $inst = $self->libscan($inst);
1232 print "libscan($path) => '$inst'\n" if ($Verbose >= 2);
1233 return unless $inst;
1235 }, @{$self->{PMLIBDIRS}});
1238 $self->{DIR} = [sort keys %dir] unless $self->{DIR};
1239 $self->{XS} = \%xs unless $self->{XS};
1240 $self->{PM} = \%pm unless $self->{PM};
1241 $self->{C} = [sort keys %c] unless $self->{C};
1242 my(@o_files) = @{$self->{C}};
1243 $self->{O_FILES} = [grep s/\.c(pp|xx|c)?$/$self->{OBJ_EXT}/i, @o_files] ;
1244 $self->{H} = [sort keys %h] unless $self->{H};
1245 $self->{PL_FILES} = \%pl_files unless $self->{PL_FILES};
1247 # Set up names of manual pages to generate from pods
1248 if ($self->{MAN1PODS}) {
1249 } elsif ( $self->{INST_MAN1DIR} =~ /^(none|\s*)$/ ) {
1250 $self->{MAN1PODS} = {};
1252 my %manifypods = ();
1253 if ( exists $self->{EXE_FILES} ) {
1254 foreach $name (@{$self->{EXE_FILES}}) {
1255 # use FileHandle ();
1256 # my $fh = new FileHandle;
1259 # one day test, if $/ can be set to '' safely (is the bug fixed that was in 5.001m?)
1260 # if ($fh->open("<$name")) {
1261 if (open(FH,"<$name")) {
1264 if (/^=head1\s+\w+/) {
1272 # If it doesn't exist yet, we assume, it has pods in it
1276 $manifypods{$name} = $self->catfile('$(INST_MAN1DIR)',basename($name).'.$(MAN1EXT)');
1280 $self->{MAN1PODS} = \%manifypods;
1282 if ($self->{MAN3PODS}) {
1283 } elsif ( $self->{INST_MAN3DIR} =~ /^(none|\s*)$/ ) {
1284 $self->{MAN3PODS} = {};
1286 my %manifypods = (); # we collect the keys first, i.e. the files
1287 # we have to convert to pod
1288 foreach $name (keys %{$self->{PM}}) {
1289 if ($name =~ /\.pod$/ ) {
1290 $manifypods{$name} = $self->{PM}{$name};
1291 } elsif ($name =~ /\.p[ml]$/ ) {
1292 # use FileHandle ();
1293 # my $fh = new FileHandle;
1296 # $fh->open("<$name");
1297 if (open(FH,"<$name")) {
1300 if (/^=head1\s+\w+/) {
1311 $manifypods{$name} = $self->{PM}{$name};
1316 # Remove "Configure.pm" and similar, if it's not the only pod listed
1317 # To force inclusion, just name it "Configure.pod", or override MAN3PODS
1318 foreach $name (keys %manifypods) {
1319 if ($name =~ /(config|setup).*\.pm/i) {
1320 delete $manifypods{$name};
1323 my($manpagename) = $name;
1324 unless ($manpagename =~ s!^\W*lib\W+!!) { # everything below lib is ok
1325 $manpagename = $self->catfile(split(/::/,$self->{PARENT_NAME}),$manpagename);
1327 $manpagename =~ s/\.p(od|m|l)$//;
1328 $manpagename = $self->replace_manpage_separator($manpagename);
1329 $manifypods{$name} = $self->catfile("\$(INST_MAN3DIR)","$manpagename.\$(MAN3EXT)");
1331 $self->{MAN3PODS} = \%manifypods;
1337 Initializes NAME, FULLEXT, BASEEXT, PARENT_NAME, DLBASE, PERL_SRC,
1338 PERL_LIB, PERL_ARCHLIB, PERL_INC, INSTALLDIRS, INST_*, INSTALL*,
1339 PREFIX, CONFIG, AR, AR_STATIC_ARGS, LD, OBJ_EXT, LIB_EXT, MAP_TARGET,
1340 LIBPERL_A, VERSION_FROM, VERSION, DISTNAME, VERSION_SYM.
1347 # --- Initialize Module Name and Paths
1349 # NAME = Foo::Bar::Oracle
1350 # FULLEXT = Foo/Bar/Oracle
1352 # ROOTEXT = Directory part of FULLEXT with leading /. !!! Deprecated from MM 5.32 !!!
1353 # PARENT_NAME = Foo::Bar
1355 ### ($self->{FULLEXT} =
1356 ### $self->{NAME}) =~ s!::!/!g ; #eg. BSD/Foo/Socket
1357 $self->{FULLEXT} = $self->catdir(split /::/, $self->{NAME});
1360 # Copied from DynaLoader:
1362 my(@modparts) = split(/::/,$self->{NAME});
1363 my($modfname) = $modparts[-1];
1365 # Some systems have restrictions on files names for DLL's etc.
1366 # mod2fname returns appropriate file base name (typically truncated)
1367 # It may also edit @modparts if required.
1368 if (defined &DynaLoader::mod2fname) {
1369 $modfname = &DynaLoader::mod2fname(\@modparts);
1370 } elsif ($Is_OS2) { # Need manual correction if run with miniperl:-(
1371 $modfname = substr($modfname, 0, 7) . '_';
1375 ($self->{PARENT_NAME}, $self->{BASEEXT}) = $self->{NAME} =~ m!([\w:]+::)?(\w+)$! ;
1377 if (defined &DynaLoader::mod2fname or $Is_OS2) {
1378 # As of 5.001m, dl_os2 appends '_'
1379 $self->{DLBASE} = $modfname;
1381 $self->{DLBASE} = '$(BASEEXT)';
1385 ### ROOTEXT deprecated from MM 5.32
1386 ### ($self->{ROOTEXT} =
1387 ### $self->{FULLEXT}) =~ s#/?\Q$self->{BASEEXT}\E$## ; #eg. /BSD/Foo
1388 ### $self->{ROOTEXT} = ($Is_VMS ? '' : '/') . $self->{ROOTEXT} if $self->{ROOTEXT};
1391 # --- Initialize PERL_LIB, INST_LIB, PERL_SRC
1393 # *Real* information: where did we get these two from? ...
1394 my $inc_config_dir = dirname($INC{'Config.pm'});
1395 my $inc_carp_dir = dirname($INC{'Carp.pm'});
1397 unless ($self->{PERL_SRC}){
1399 foreach $dir ($self->updir(),$self->catdir($self->updir(),$self->updir()),$self->catdir($self->updir(),$self->updir(),$self->updir())){
1401 -f $self->catfile($dir,"config.sh")
1403 -f $self->catfile($dir,"perl.h")
1405 -f $self->catfile($dir,"lib","Exporter.pm")
1407 $self->{PERL_SRC}=$dir ;
1412 if ($self->{PERL_SRC}){
1413 $self->{PERL_LIB} ||= $self->catdir("$self->{PERL_SRC}","lib");
1414 $self->{PERL_ARCHLIB} = $self->{PERL_LIB};
1415 $self->{PERL_INC} = $self->{PERL_SRC};
1416 # catch a situation that has occurred a few times in the past:
1418 warn <<EOM unless (-s $self->catfile($self->{PERL_SRC},'cflags') or $Is_VMS && -s $self->catfile($self->{PERL_SRC},'perlshr_attr.opt') or $Is_Mac);
1419 You cannot build extensions below the perl source tree after executing
1420 a 'make clean' in the perl source tree.
1422 To rebuild extensions distributed with the perl source you should
1423 simply Configure (to include those extensions) and then build perl as
1424 normal. After installing perl the source tree can be deleted. It is
1425 not needed for building extensions by running 'perl Makefile.PL'
1426 usually without extra arguments.
1428 It is recommended that you unpack and build additional extensions away
1429 from the perl source tree.
1432 # we should also consider $ENV{PERL5LIB} here
1433 $self->{PERL_LIB} ||= $Config::Config{privlibexp};
1434 $self->{PERL_ARCHLIB} ||= $Config::Config{archlibexp};
1435 $self->{PERL_INC} = $self->catdir("$self->{PERL_ARCHLIB}","CORE"); # wild guess for now
1437 die <<EOM unless (-f ($perl_h = $self->catfile($self->{PERL_INC},"perl.h")));
1438 Error: Unable to locate installed Perl libraries or Perl source code.
1440 It is recommended that you install perl in a standard location before
1441 building extensions. You can say:
1443 $^X Makefile.PL PERL_SRC=/path/to/perl/source/directory
1445 if you have not yet installed perl but still want to build this
1447 (You get this message, because MakeMaker could not find "$perl_h")
1450 # print STDOUT "Using header files found in $self->{PERL_INC}\n"
1451 # if $Verbose && $self->needs_linking();
1455 # We get SITELIBEXP and SITEARCHEXP directly via
1456 # Get_from_Config. When we are running standard modules, these
1457 # won't matter, we will set INSTALLDIRS to "perl". Otherwise we
1458 # set it to "site". I prefer that INSTALLDIRS be set from outside
1460 $self->{INSTALLDIRS} ||= "site";
1462 # INST_LIB typically pre-set if building an extension after
1463 # perl has been built and installed. Setting INST_LIB allows
1464 # you to build directly into, say $Config::Config{privlibexp}.
1465 unless ($self->{INST_LIB}){
1468 ##### XXXXX We have to change this nonsense
1470 if (defined $self->{PERL_SRC} and $self->{INSTALLDIRS} eq "perl") {
1471 $self->{INST_LIB} = $self->{INST_ARCHLIB} = $self->{PERL_LIB};
1473 $self->{INST_LIB} = $self->catdir($self->curdir,"blib","lib");
1476 $self->{INST_ARCHLIB} ||= $self->catdir($self->curdir,"blib","arch");
1477 $self->{INST_BIN} ||= $self->catdir($self->curdir,'blib','bin');
1479 # INST_EXE is deprecated, should go away March '97
1480 $self->{INST_EXE} ||= $self->catdir($self->curdir,'blib','script');
1481 $self->{INST_SCRIPT} ||= $self->catdir($self->curdir,'blib','script');
1483 # The user who requests an installation directory explicitly
1484 # should not have to tell us a architecture installation directory
1485 # as well We look if a directory exists that is named after the
1486 # architecture. If not we take it as a sign that it should be the
1487 # same as the requested installation directory. Otherwise we take
1489 # We do the same thing twice: for privlib/archlib and for sitelib/sitearch
1491 for $libpair ({l=>"privlib", a=>"archlib"}, {l=>"sitelib", a=>"sitearch"}) {
1492 my $lib = "install$libpair->{l}";
1494 my $Arch = uc "install$libpair->{a}";
1495 if( $self->{$Lib} && ! $self->{$Arch} ){
1496 my($ilib) = $Config{$lib};
1497 $ilib = VMS::Filespec::unixify($ilib) if $Is_VMS;
1499 $self->prefixify($Arch,$ilib,$self->{$Lib});
1501 unless (-d $self->{$Arch}) {
1502 print STDOUT "Directory $self->{$Arch} not found, thusly\n" if $Verbose;
1503 $self->{$Arch} = $self->{$Lib};
1505 print STDOUT "Defaulting $Arch to $self->{$Arch}\n" if $Verbose;
1509 # we have to look at the relation between $Config{prefix} and the
1510 # requested values. We're going to set the $Config{prefix} part of
1511 # all the installation path variables to literally $(PREFIX), so
1512 # the user can still say make PREFIX=foo
1513 my($prefix) = $Config{'prefix'};
1514 $prefix = VMS::Filespec::unixify($prefix) if $Is_VMS;
1515 unless ($self->{PREFIX}){
1516 $self->{PREFIX} = $prefix;
1518 my($install_variable);
1519 for $install_variable (qw/
1521 INSTALLPRIVLIB INSTALLARCHLIB INSTALLBIN
1522 INSTALLMAN1DIR INSTALLMAN3DIR INSTALLSCRIPT
1523 INSTALLSITELIB INSTALLSITEARCH
1526 $self->prefixify($install_variable,$prefix,q[$(PREFIX)]);
1530 # Now we head at the manpages. Maybe they DO NOT want manpages
1532 $self->{INSTALLMAN1DIR} = $Config::Config{installman1dir}
1533 unless defined $self->{INSTALLMAN1DIR};
1534 unless (defined $self->{INST_MAN1DIR}){
1535 if ($self->{INSTALLMAN1DIR} =~ /^(none|\s*)$/){
1536 $self->{INST_MAN1DIR} = $self->{INSTALLMAN1DIR};
1538 $self->{INST_MAN1DIR} = $self->catdir($self->curdir,'blib','man1');
1541 $self->{MAN1EXT} ||= $Config::Config{man1ext};
1543 $self->{INSTALLMAN3DIR} = $Config::Config{installman3dir}
1544 unless defined $self->{INSTALLMAN3DIR};
1545 unless (defined $self->{INST_MAN3DIR}){
1546 if ($self->{INSTALLMAN3DIR} =~ /^(none|\s*)$/){
1547 $self->{INST_MAN3DIR} = $self->{INSTALLMAN3DIR};
1549 $self->{INST_MAN3DIR} = $self->catdir($self->curdir,'blib','man3');
1552 $self->{MAN3EXT} ||= $Config::Config{man3ext};
1555 # Get some stuff out of %Config if we haven't yet done so
1556 print STDOUT "CONFIG must be an array ref\n"
1557 if ($self->{CONFIG} and ref $self->{CONFIG} ne 'ARRAY');
1558 $self->{CONFIG} = [] unless (ref $self->{CONFIG});
1559 push(@{$self->{CONFIG}}, @ExtUtils::MakeMaker::Get_from_Config);
1560 push(@{$self->{CONFIG}}, 'shellflags') if $Config::Config{shellflags};
1562 foreach $m (@{$self->{CONFIG}}){
1563 next if $once_only{$m};
1564 print STDOUT "CONFIG key '$m' does not exist in Config.pm\n"
1565 unless exists $Config::Config{$m};
1566 $self->{uc $m} ||= $Config::Config{$m};
1570 # This is too dangerous:
1571 # if ($^O eq "next") {
1572 # $self->{AR} = "libtool";
1573 # $self->{AR_STATIC_ARGS} = "-o";
1575 # But I leave it as a placeholder
1577 $self->{AR_STATIC_ARGS} ||= "cr";
1579 # These should never be needed
1580 $self->{LD} ||= 'ld';
1581 $self->{OBJ_EXT} ||= '.o';
1582 $self->{LIB_EXT} ||= '.a';
1584 $self->{MAP_TARGET} ||= "perl";
1586 $self->{LIBPERL_A} ||= "libperl$self->{LIB_EXT}";
1588 # make a simple check if we find Exporter
1589 warn "Warning: PERL_LIB ($self->{PERL_LIB}) seems not to be a perl library directory
1590 (Exporter.pm not found)"
1591 unless -f $self->catfile("$self->{PERL_LIB}","Exporter.pm") ||
1592 $self->{NAME} eq "ExtUtils::MakeMaker";
1594 # Determine VERSION and VERSION_FROM
1595 ($self->{DISTNAME}=$self->{NAME}) =~ s#(::)#-#g unless $self->{DISTNAME};
1596 if ($self->{VERSION_FROM}){
1597 $self->{VERSION} = $self->parse_version($self->{VERSION_FROM}) or
1598 Carp::carp "WARNING: Setting VERSION via file '$self->{VERSION_FROM}' failed\n"
1602 if ($self->{VERSION}) {
1603 $self->{VERSION} =~ s/^\s+//;
1604 $self->{VERSION} =~ s/\s+$//;
1607 $self->{VERSION} ||= "0.10";
1608 ($self->{VERSION_SYM} = $self->{VERSION}) =~ s/\W/_/g;
1611 # Graham Barr and Paul Marquess had some ideas how to ensure
1612 # version compatibility between the *.pm file and the
1613 # corresponding *.xs file. The bottomline was, that we need an
1614 # XS_VERSION macro that defaults to VERSION:
1615 $self->{XS_VERSION} ||= $self->{VERSION};
1617 # --- Initialize Perl Binary Locations
1619 # Find Perl 5. The only contract here is that both 'PERL' and 'FULLPERL'
1620 # will be working versions of perl 5. miniperl has priority over perl
1621 # for PERL to ensure that $(PERL) is usable while building ./ext/*
1622 my ($component,@defpath);
1623 foreach $component ($self->{PERL_SRC}, $self->path(), $Config::Config{binexp}) {
1624 push @defpath, $component if defined $component;
1627 $self->find_perl(5.0, [ $^X, 'miniperl','perl','perl5',"perl$]" ],
1628 \@defpath, $Verbose ) unless ($self->{PERL});
1629 # don't check if perl is executable, maybe they have decided to
1630 # supply switches with perl
1632 # Define 'FULLPERL' to be a non-miniperl (used in test: target)
1633 ($self->{FULLPERL} = $self->{PERL}) =~ s/miniperl/perl/i
1634 unless ($self->{FULLPERL});
1639 Initializes EXTRALIBS, BSLOADLIBS, LDLOADLIBS, LIBS, LD_RUN_PATH,
1640 OBJECT, BOOTDEP, PERLMAINCC, LDFROM, LINKTYPE, NOOP, FIRST_MAKEFILE,
1641 MAKEFILE, NOECHO, RM_F, RM_RF, TOUCH, CP, MV, CHMOD, UMASK_NULL
1645 sub init_others { # --- Initialize Other Attributes
1648 # Compute EXTRALIBS, BSLOADLIBS and LDLOADLIBS from $self->{LIBS}
1649 # Lets look at $self->{LIBS} carefully: It may be an anon array, a string or
1650 # undefined. In any case we turn it into an anon array:
1652 # May check $Config{libs} too, thus not empty.
1653 $self->{LIBS}=[''] unless $self->{LIBS};
1655 $self->{LIBS}=[$self->{LIBS}] if ref \$self->{LIBS} eq SCALAR;
1656 $self->{LD_RUN_PATH} = "";
1658 foreach $libs ( @{$self->{LIBS}} ){
1659 $libs =~ s/^\s*(.*\S)\s*$/$1/; # remove leading and trailing whitespace
1660 my(@libs) = $self->extliblist($libs);
1661 if ($libs[0] or $libs[1] or $libs[2]){
1662 # LD_RUN_PATH now computed by ExtUtils::Liblist
1663 ($self->{EXTRALIBS}, $self->{BSLOADLIBS}, $self->{LDLOADLIBS}, $self->{LD_RUN_PATH}) = @libs;
1668 if ( $self->{OBJECT} ) {
1669 $self->{OBJECT} =~ s!\.o(bj)?\b!\$(OBJ_EXT)!g;
1671 # init_dirscan should have found out, if we have C files
1672 $self->{OBJECT} = "";
1673 $self->{OBJECT} = '$(BASEEXT)$(OBJ_EXT)' if @{$self->{C}||[]};
1675 $self->{OBJECT} =~ s/\n+/ \\\n\t/g;
1676 $self->{BOOTDEP} = (-f "$self->{BASEEXT}_BS") ? "$self->{BASEEXT}_BS" : "";
1677 $self->{PERLMAINCC} ||= '$(CC)';
1678 $self->{LDFROM} = '$(OBJECT)' unless $self->{LDFROM};
1680 # Sanity check: don't define LINKTYPE = dynamic if we're skipping
1681 # the 'dynamic' section of MM. We don't have this problem with
1682 # 'static', since we either must use it (%Config says we can't
1683 # use dynamic loading) or the caller asked for it explicitly.
1684 if (!$self->{LINKTYPE}) {
1685 $self->{LINKTYPE} = $self->{SKIPHASH}{'dynamic'}
1687 : ($Config::Config{usedl} ? 'dynamic' : 'static');
1690 # These get overridden for VMS and maybe some other systems
1691 $self->{NOOP} ||= "sh -c true";
1692 $self->{FIRST_MAKEFILE} ||= "Makefile";
1693 $self->{MAKEFILE} ||= $self->{FIRST_MAKEFILE};
1694 $self->{MAKE_APERL_FILE} ||= "Makefile.aperl";
1695 $self->{NOECHO} = '@' unless defined $self->{NOECHO};
1696 $self->{RM_F} ||= "rm -f";
1697 $self->{RM_RF} ||= "rm -rf";
1698 $self->{TOUCH} ||= "touch";
1699 $self->{CP} ||= "cp";
1700 $self->{MV} ||= "mv";
1701 $self->{CHMOD} ||= "chmod";
1702 $self->{UMASK_NULL} ||= "umask 0";
1707 Defines the install target.
1712 my($self, %attribs) = @_;
1716 install :: all pure_install doc_install
1718 install_perl :: all pure_perl_install doc_perl_install
1720 install_site :: all pure_site_install doc_site_install
1722 install_ :: install_site
1723 @echo INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
1725 pure_install :: pure_$(INSTALLDIRS)_install
1727 doc_install :: doc_$(INSTALLDIRS)_install
1728 }.$self->{NOECHO}.q{echo Appending installation info to $(INSTALLARCHLIB)/perllocal.pod
1730 pure__install : pure_site_install
1731 @echo INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
1733 doc__install : doc_site_install
1734 @echo INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
1736 pure_perl_install ::
1737 }.$self->{NOECHO}.q{$(MOD_INSTALL) \
1738 read }.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{ \
1739 write }.$self->catfile('$(INSTALLARCHLIB)','auto','$(FULLEXT)','.packlist').q{ \
1740 $(INST_LIB) $(INSTALLPRIVLIB) \
1741 $(INST_ARCHLIB) $(INSTALLARCHLIB) \
1742 $(INST_BIN) $(INSTALLBIN) \
1743 $(INST_SCRIPT) $(INSTALLSCRIPT) \
1744 $(INST_MAN1DIR) $(INSTALLMAN1DIR) \
1745 $(INST_MAN3DIR) $(INSTALLMAN3DIR)
1746 }.$self->{NOECHO}.q{$(WARN_IF_OLD_PACKLIST) \
1747 }.$self->catdir('$(SITEARCHEXP)','auto','$(FULLEXT)').q{
1750 pure_site_install ::
1751 }.$self->{NOECHO}.q{$(MOD_INSTALL) \
1752 read }.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{ \
1753 write }.$self->catfile('$(INSTALLSITEARCH)','auto','$(FULLEXT)','.packlist').q{ \
1754 $(INST_LIB) $(INSTALLSITELIB) \
1755 $(INST_ARCHLIB) $(INSTALLSITEARCH) \
1756 $(INST_BIN) $(INSTALLBIN) \
1757 $(INST_SCRIPT) $(INSTALLSCRIPT) \
1758 $(INST_MAN1DIR) $(INSTALLMAN1DIR) \
1759 $(INST_MAN3DIR) $(INSTALLMAN3DIR)
1760 }.$self->{NOECHO}.q{$(WARN_IF_OLD_PACKLIST) \
1761 }.$self->catdir('$(PERL_ARCHLIB)','auto','$(FULLEXT)').q{
1764 }.$self->{NOECHO}.q{$(DOC_INSTALL) \
1766 "installed into" "$(INSTALLPRIVLIB)" \
1767 LINKTYPE "$(LINKTYPE)" \
1768 VERSION "$(VERSION)" \
1769 EXE_FILES "$(EXE_FILES)" \
1770 >> }.$self->catfile('$(INSTALLARCHLIB)','perllocal.pod').q{
1773 }.$self->{NOECHO}.q{$(DOC_INSTALL) \
1775 "installed into" "$(INSTALLSITELIB)" \
1776 LINKTYPE "$(LINKTYPE)" \
1777 VERSION "$(VERSION)" \
1778 EXE_FILES "$(EXE_FILES)" \
1779 >> }.$self->catfile('$(INSTALLARCHLIB)','perllocal.pod').q{
1784 uninstall :: uninstall_from_$(INSTALLDIRS)dirs
1786 uninstall_from_perldirs ::
1788 q{$(UNINSTALL) }.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{
1790 uninstall_from_sitedirs ::
1792 q{$(UNINSTALL) }.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{
1798 =item installbin (o)
1800 Defines targets to install EXE_FILES.
1806 return "" unless $self->{EXE_FILES} && ref $self->{EXE_FILES} eq "ARRAY";
1807 return "" unless @{$self->{EXE_FILES}};
1808 my(@m, $from, $to, %fromto, @to);
1809 push @m, $self->dir_target(qw[$(INST_SCRIPT)]);
1810 for $from (@{$self->{EXE_FILES}}) {
1811 my($path)= $self->catfile('$(INST_SCRIPT)', basename($from));
1812 local($_) = $path; # for backwards compatibility
1813 $to = $self->libscan($path);
1814 print "libscan($from) => '$to'\n" if ($Verbose >=2);
1817 @to = values %fromto;
1819 EXE_FILES = @{$self->{EXE_FILES}}
1827 while (($from,$to) = each %fromto) {
1828 last unless defined $from;
1829 my $todir = dirname($to);
1831 $to: $from $self->{MAKEFILE} $todir/.exists
1832 $self->{NOECHO}$self->{RM_F} $to
1833 $self->{CP} $from $to
1841 Takes a path to a file that is found by init_dirscan and returns false
1842 if we don't want to include this file in the library. Mainly used to
1843 exclude RCS, CVS, and SCCS directories from installation.
1850 my($self,$path) = @_;
1851 return '' if $path =~ m:\b(RCS|CVS|SCCS)\b: ;
1857 Defines the linkext target which in turn defines the LINKTYPE.
1862 my($self, %attribs) = @_;
1863 # LINKTYPE => static or dynamic or ''
1864 my($linktype) = defined $attribs{LINKTYPE} ?
1865 $attribs{LINKTYPE} : '$(LINKTYPE)';
1867 linkext :: $linktype
1868 $self->{NOECHO}\$(NOOP)
1874 Takes as arguments a directory name and a regular expression. Returns
1875 all entries in the directory that match the regular expression.
1881 my($dir, $regex) = @_;
1883 my $dh = new DirHandle;
1884 $dh->open($dir || ".") or return ();
1887 @ls = grep(/$regex/, @ls) if $regex;
1893 Simple subroutine to insert the macros defined by the macro attribute
1899 my($self,%attribs) = @_;
1901 while (($key,$val) = each %attribs){
1902 last unless defined $key;
1903 push @m, "$key = $val\n";
1910 Called by staticmake. Defines how to write the Makefile to produce a
1916 my($self, %attribs) = @_;
1917 my($makefilename, $searchdirs, $static, $extra, $perlinc, $target, $tmp, $libperl) =
1918 @attribs{qw(MAKE DIRS STAT EXTRA INCL TARGET TMP LIBPERL)};
1921 # --- MakeMaker makeaperl section ---
1922 MAP_TARGET = $target
1923 FULLPERL = $self->{FULLPERL}
1925 return join '', @m if $self->{PARENT};
1927 my($dir) = join ":", @{$self->{DIR}};
1929 unless ($self->{MAKEAPERL}) {
1931 $(MAP_TARGET) :: static $(MAKE_APERL_FILE)
1932 $(MAKE) -f $(MAKE_APERL_FILE) $@
1934 $(MAKE_APERL_FILE) : $(FIRST_MAKEFILE)
1935 }.$self->{NOECHO}.q{echo Writing \"$(MAKE_APERL_FILE)\" for this $(MAP_TARGET)
1936 }.$self->{NOECHO}.q{$(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \
1937 Makefile.PL DIR=}, $dir, q{ \
1938 MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \
1939 MAKEAPERL=1 NORECURS=1 CCCDLFLAGS=};
1945 push @m, " \\\n\t\t$_";
1947 # push @m, map( " \\\n\t\t$_", @ARGV );
1955 my($cccmd, $linkcmd, $lperl);
1958 $cccmd = $self->const_cccmd($libperl);
1959 $cccmd =~ s/^CCCMD\s*=\s*//;
1960 $cccmd =~ s/\$\(INC\)/ -I$self->{PERL_INC} /;
1961 $cccmd .= " $Config::Config{cccdlflags}" if ($Config::Config{d_shrplib});
1962 $cccmd =~ s/\(CC\)/\(PERLMAINCC\)/;
1964 # The front matter of the linkcommand...
1965 $linkcmd = join ' ', "\$(CC)",
1966 grep($_, @Config{qw(large split ldflags ccdlflags)});
1967 $linkcmd =~ s/\s+/ /g;
1969 # Which *.a files could we make use of...
1972 File::Find::find(sub {
1973 return unless m/\Q$self->{LIB_EXT}\E$/;
1974 return if m/^libperl/;
1976 if( exists $self->{INCLUDE_EXT} ){
1981 ($xx = $File::Find::name) =~ s,.*?/auto/,,;
1985 # Throw away anything not explicitly marked for inclusion.
1986 # DynaLoader is implied.
1987 foreach $incl ((@{$self->{INCLUDE_EXT}},'DynaLoader')){
1993 return unless $found;
1995 elsif( exists $self->{EXCLUDE_EXT} ){
1999 ($xx = $File::Find::name) =~ s,.*?/auto/,,;
2003 # Throw away anything explicitly marked for exclusion
2004 foreach $excl (@{$self->{EXCLUDE_EXT}}){
2005 return if( $xx eq $excl );
2009 # don't include the installed version of this extension. I
2010 # leave this line here, although it is not necessary anymore:
2011 # I patched minimod.PL instead, so that Miniperl.pm won't
2012 # enclude duplicates
2014 # Once the patch to minimod.PL is in the distribution, I can
2016 return if $File::Find::name =~ m:auto/$self->{FULLEXT}/$self->{BASEEXT}$self->{LIB_EXT}$:;
2018 $static{cwd() . "/" . $_}++;
2019 }, grep( -d $_, @{$searchdirs || []}) );
2021 # We trust that what has been handed in as argument, will be buildable
2022 $static = [] unless $static;
2023 @static{@{$static}} = (1) x @{$static};
2025 $extra = [] unless $extra && ref $extra eq 'ARRAY';
2026 for (sort keys %static) {
2027 next unless /\Q$self->{LIB_EXT}\E$/;
2028 $_ = dirname($_) . "/extralibs.ld";
2032 grep(s/^/-I/, @{$perlinc || []});
2034 $target = "perl" unless $target;
2035 $tmp = "." unless $tmp;
2037 # MAP_STATIC doesn't look into subdirs yet. Once "all" is made and we
2038 # regenerate the Makefiles, MAP_STATIC and the dependencies for
2039 # extralibs.all are computed correctly
2041 MAP_LINKCMD = $linkcmd
2042 MAP_PERLINC = @{$perlinc || []}
2044 join(" \\\n\t", reverse sort keys %static), "
2046 MAP_PRELIBS = $Config::Config{libs} $Config::Config{cryptlib}
2049 if (defined $libperl) {
2050 ($lperl = $libperl) =~ s/\$\(A\)/$self->{LIB_EXT}/;
2052 unless ($libperl && -f $lperl) { # Ilya's code...
2053 my $dir = $self->{PERL_SRC} || "$self->{PERL_ARCHLIB}/CORE";
2054 $libperl ||= "libperl$self->{LIB_EXT}";
2055 $libperl = "$dir/$libperl";
2056 $lperl ||= "libperl$self->{LIB_EXT}";
2057 $lperl = "$dir/$lperl";
2058 print STDOUT "Warning: $libperl not found
2059 If you're going to build a static perl binary, make sure perl is installed
2060 otherwise ignore this warning\n"
2061 unless (-f $lperl || defined($self->{PERL_SRC}));
2065 MAP_LIBPERL = $libperl
2069 \$(INST_ARCHAUTODIR)/extralibs.all: \$(INST_ARCHAUTODIR)/.exists ".join(" \\\n\t", @$extra)."
2070 $self->{NOECHO}$self->{RM_F} \$\@
2071 $self->{NOECHO}\$(TOUCH) \$\@
2075 foreach $catfile (@$extra){
2076 push @m, "\tcat $catfile >> \$\@\n";
2080 \$(MAP_TARGET) :: $tmp/perlmain\$(OBJ_EXT) \$(MAP_LIBPERL) \$(MAP_STATIC) \$(INST_ARCHAUTODIR)/extralibs.all
2081 \$(MAP_LINKCMD) -o \$\@ \$(OPTIMIZE) $tmp/perlmain\$(OBJ_EXT) \$(MAP_LIBPERL) \$(MAP_STATIC) `cat \$(INST_ARCHAUTODIR)/extralibs.all` \$(MAP_PRELIBS)
2082 $self->{NOECHO}echo 'To install the new \"\$(MAP_TARGET)\" binary, call'
2083 $self->{NOECHO}echo ' make -f $makefilename inst_perl MAP_TARGET=\$(MAP_TARGET)'
2084 $self->{NOECHO}echo 'To remove the intermediate files say'
2085 $self->{NOECHO}echo ' make -f $makefilename map_clean'
2087 $tmp/perlmain\$(OBJ_EXT): $tmp/perlmain.c
2089 push @m, "\tcd $tmp && $cccmd -I\$(PERL_INC) perlmain.c\n";
2092 $tmp/perlmain.c: $makefilename}, q{
2093 }.$self->{NOECHO}.q{echo Writing $@
2094 }.$self->{NOECHO}.q{$(PERL) $(MAP_PERLINC) -e 'use ExtUtils::Miniperl; \\
2095 writemain(grep s#.*/auto/##, qw|$(MAP_STATIC)|)' > $@.tmp && mv $@.tmp $@
2101 }.$self->{NOECHO}.q{echo Appending installation info to $(INSTALLARCHLIB)/perllocal.pod
2102 }.$self->{NOECHO}.q{$(DOC_INSTALL) \
2103 "Perl binary $(MAP_TARGET)" \
2104 MAP_STATIC "$(MAP_STATIC)" \
2105 MAP_EXTRA "`cat $(INST_ARCHAUTODIR)/extralibs.all`" \
2106 MAP_LIBPERL "$(MAP_LIBPERL)" \
2107 >> }.$self->catfile('$(INSTALLARCHLIB)','perllocal.pod').q{
2112 inst_perl: pure_inst_perl doc_inst_perl
2114 pure_inst_perl: $(MAP_TARGET)
2115 }.$self->{CP}.q{ $(MAP_TARGET) }.$self->catfile('$(INSTALLBIN)','$(MAP_TARGET)').q{
2120 }.$self->{RM_F}.qq{ $tmp/perlmain\$(OBJ_EXT) $tmp/perlmain.c \$(MAP_TARGET) $makefilename \$(INST_ARCHAUTODIR)/extralibs.all
2128 Defines how to rewrite the Makefile.
2135 # We do not know what target was originally specified so we
2136 # must force a manual rerun to be sure. But as it should only
2137 # happen very rarely it is not a significant problem.
2139 $(OBJECT) : $(FIRST_MAKEFILE)
2140 ' if $self->{OBJECT};
2143 # We take a very conservative approach here, but it\'s worth it.
2144 # We move Makefile to Makefile.old here to avoid gnu make looping.
2145 }.$self->{MAKEFILE}.q{ : Makefile.PL $(CONFIGDEP)
2146 }.$self->{NOECHO}.q{echo "Makefile out-of-date with respect to $?"
2147 }.$self->{NOECHO}.q{echo "Cleaning current config before rebuilding Makefile..."
2148 -}.$self->{NOECHO}.q{mv }."$self->{MAKEFILE} $self->{MAKEFILE}.old".q{
2149 -$(MAKE) -f }.$self->{MAKEFILE}.q{.old clean >/dev/null 2>&1 || true
2150 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" Makefile.PL }.join(" ",map(qq["$_"],@ARGV)).q{
2151 }.$self->{NOECHO}.q{echo ">>> Your Makefile has been rebuilt. <<<"
2152 }.$self->{NOECHO}.q{echo ">>> Please rerun the make command. <<<"; false
2154 # To change behavior to :: would be nice, but would break Tk b9.02
2155 # so you find such a warning below the dist target.
2156 #}.$self->{MAKEFILE}.q{ :: $(VERSION_FROM)
2157 # }.$self->{NOECHO}.q{echo "Warning: Makefile possibly out of date with $(VERSION_FROM)"
2163 =item manifypods (o)
2165 Defines targets and routines to translate the pods into manpages and
2166 put them into the INST_* directories.
2171 my($self, %attribs) = @_;
2172 return "\nmanifypods :\n\t$self->{NOECHO}\$(NOOP)\n" unless %{$self->{MAN3PODS}} or %{$self->{MAN1PODS}};
2175 if (defined $self->{PERL_SRC}) {
2176 $pod2man_exe = $self->catfile($self->{PERL_SRC},'pod','pod2man');
2178 $pod2man_exe = $self->catfile($Config{scriptdirexp},'pod2man');
2180 unless ($self->perl_script($pod2man_exe)) {
2181 # No pod2man but some MAN3PODS to be installed
2184 Warning: I could not locate your pod2man program. Please make sure,
2185 your pod2man program is in your PATH before you execute 'make'
2188 $pod2man_exe = "-S pod2man";
2192 qq[POD2MAN_EXE = $pod2man_exe\n],
2193 q[POD2MAN = $(PERL) -we '%m=@ARGV;for (keys %m){' \\
2194 -e 'next if -e $$m{$$_} && -M $$m{$$_} < -M $$_ && -M $$m{$$_} < -M "].$self->{MAKEFILE}.q[";' \\
2195 -e 'print "Manifying $$m{$$_}\n";' \\
2196 -e 'system(qq[$$^X ].q["-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" $(POD2MAN_EXE) ].qq[$$_>$$m{$$_}])==0 or warn "Couldn\\047t install $$m{$$_}\n";' \\
2197 -e 'chmod 0644, $$m{$$_} or warn "chmod 644 $$m{$$_}: $$!\n";}'
2199 push @m, "\nmanifypods : ";
2200 push @m, join " \\\n\t", keys %{$self->{MAN1PODS}}, keys %{$self->{MAN3PODS}};
2203 if (%{$self->{MAN1PODS}} || %{$self->{MAN3PODS}}) {
2204 push @m, "\t$self->{NOECHO}\$(POD2MAN) \\\n\t";
2205 push @m, join " \\\n\t", %{$self->{MAN1PODS}}, %{$self->{MAN3PODS}};
2212 Returns true, if the argument is likely to be a command.
2217 my($self,$file) = @_;
2218 return $file if -x $file && ! -d $file;
2222 =item maybe_command_in_dirs
2224 method under development. Not yet used. Ask Ilya :-)
2228 sub maybe_command_in_dirs { # $ver is optional argument if looking for perl
2229 # Ilya's suggestion. Not yet used, want to understand it first, but at least the code is here
2230 my($self, $names, $dirs, $trace, $ver) = @_;
2232 foreach $dir (@$dirs){
2233 next unless defined $dir; # $self->{PERL_SRC} may be undefined
2234 foreach $name (@$names){
2236 if ($self->file_name_is_absolute($name)) { # /foo/bar
2238 } elsif ($self->canonpath($name) eq $self->canonpath(basename($name))) { # bar
2239 $abs = $self->catfile($dir, $name);
2241 $abs = $self->catfile($self->curdir, $name);
2243 print "Checking $abs for $name\n" if ($trace >= 2);
2244 next unless $tryabs = $self->maybe_command($abs);
2245 print "Substituting $tryabs instead of $abs\n"
2246 if ($trace >= 2 and $tryabs ne $abs);
2249 print "Executing $abs\n" if ($trace >= 2);
2250 if (`$abs -e 'require $ver; print "VER_OK\n" ' 2>&1` =~ /VER_OK/) {
2251 print "Using PERL=$abs\n" if $trace;
2254 } else { # Do not look for perl
2261 =item needs_linking (o)
2263 Does this module need linking? Looks into subdirectory objects (see
2264 also has_link_code())
2271 $caller = (caller(0))[3];
2272 Carp::confess("Needs_linking called too early") if $caller =~ /^ExtUtils::MakeMaker::/;
2273 return $self->{NEEDS_LINKING} if defined $self->{NEEDS_LINKING};
2274 if ($self->has_link_code or $self->{MAKEAPERL}){
2275 $self->{NEEDS_LINKING} = 1;
2278 foreach $child (keys %{$self->{CHILDREN}}) {
2279 if ($self->{CHILDREN}->{$child}->needs_linking) {
2280 $self->{NEEDS_LINKING} = 1;
2284 return $self->{NEEDS_LINKING} = 0;
2289 misnamed method (will have to be changed). The MM_Unix method just
2290 returns the argument without further processing.
2292 On VMS used to insure that colons marking targets are preceded by
2293 space - most Unix Makes don't need this, but it's necessary under VMS
2294 to distinguish the target delimiter from a colon appearing as part of
2300 my($self,$text) = @_;
2306 parse a file and return what you think is $VERSION in this file set to
2311 my($self,$parsefile) = @_;
2315 open(FH,$parsefile) or die "Could not open '$parsefile': $!";
2318 $inpod = /^=(?!cut)/ ? 1 : /^=cut/ ? 0 : $inpod;
2321 next unless /\$(([\w\:\']*)\bVERSION)\b.*\=/;
2322 local $ExtUtils::MakeMaker::module_version_variable = $1;
2323 my($thispackage) = $2 || $current_package;
2324 $thispackage =~ s/:+$//;
2327 die "Could not eval '$eval' in $parsefile: $@" if $@;
2328 $result = $ {$ExtUtils::MakeMaker::module_version_variable} || 0;
2338 Defines the string that is passed to recursive make calls in
2349 foreach $key (qw(LIBPERL_A LINKTYPE PREFIX OPTIMIZE)){
2350 push @pasthru, "$key=\"\$($key)\"";
2353 push @m, "\nPASTHRU = ", join ("\\\n\t", @pasthru), "\n";
2359 Takes no argument, returns the environment variable PATH as an array.
2365 my $path_sep = $Is_OS2 ? ";" : ":";
2366 my $path = $ENV{PATH};
2367 $path =~ s:\\:/:g if $Is_OS2;
2368 my @path = split $path_sep, $path;
2373 Takes one argument, a file name, and returns the file name, if the
2374 argument is likely to be a perl script. On MM_Unix this is true for
2375 any ordinary, readable file.
2380 my($self,$file) = @_;
2381 return $file if -r $file && -f _;
2385 =item perldepend (o)
2387 Defines the dependency from all *.h files that come with the perl
2396 # Check for unpropogated config.sh changes. Should never happen.
2397 # We do NOT just update config.h because that is not sufficient.
2398 # An out of date config.h is not fatal but complains loudly!
2399 $(PERL_INC)/config.h: $(PERL_SRC)/config.sh
2400 -}.$self->{NOECHO}.q{echo "Warning: $(PERL_INC)/config.h out of date with $(PERL_SRC)/config.sh"; false
2402 $(PERL_ARCHLIB)/Config.pm: $(PERL_SRC)/config.sh
2403 }.$self->{NOECHO}.q{echo "Warning: $(PERL_ARCHLIB)/Config.pm may be out of date with $(PERL_SRC)/config.sh"
2404 cd $(PERL_SRC) && $(MAKE) lib/Config.pm
2405 } if $self->{PERL_SRC};
2407 return join "", @m unless $self->needs_linking;
2411 $(PERL_INC)/EXTERN.h $(PERL_INC)/gv.h $(PERL_INC)/pp.h \
2412 $(PERL_INC)/INTERN.h $(PERL_INC)/handy.h $(PERL_INC)/proto.h \
2413 $(PERL_INC)/XSUB.h $(PERL_INC)/hv.h $(PERL_INC)/regcomp.h \
2414 $(PERL_INC)/av.h $(PERL_INC)/keywords.h $(PERL_INC)/regexp.h \
2415 $(PERL_INC)/config.h $(PERL_INC)/mg.h $(PERL_INC)/scope.h \
2416 $(PERL_INC)/cop.h $(PERL_INC)/op.h $(PERL_INC)/sv.h \
2417 $(PERL_INC)/cv.h $(PERL_INC)/opcode.h $(PERL_INC)/unixish.h \
2418 $(PERL_INC)/dosish.h $(PERL_INC)/patchlevel.h $(PERL_INC)/util.h \
2419 $(PERL_INC)/embed.h $(PERL_INC)/perl.h \
2420 $(PERL_INC)/form.h $(PERL_INC)/perly.h
2422 $(OBJECT) : $(PERL_HDRS)
2423 } if $self->{OBJECT};
2425 push @m, join(" ", values %{$self->{XS}})." : \$(XSUBPPDEPS)\n" if %{$self->{XS}};
2432 Defines target that copies all files in the hash PM to their
2433 destination and autosplits them. See L<ExtUtils::Install/pm_to_blib>
2439 my($autodir) = $self->catdir('$(INST_LIB)','auto');
2441 pm_to_blib: $(TO_INST_PM)
2442 }.$self->{NOECHO}.q{$(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" \
2443 "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Install \
2444 -e 'pm_to_blib({qw{$(PM_TO_BLIB)}},"}.$autodir.q{")'
2445 }.$self->{NOECHO}.q{$(TOUCH) $@
2449 =item post_constants (o)
2451 Returns an empty string per default. Dedicated to overrides from
2452 within Makefile.PL after all constants have been defined.
2461 =item post_initialize (o)
2463 Returns an ampty string per default. Used in Makefile.PLs to add some
2464 chunk of text to the Makefile after the object is initialized.
2468 sub post_initialize {
2475 Returns an empty string. Can be used in Makefile.PLs to write some
2476 text to the Makefile at the end.
2487 Check a path variable in $self from %Config, if it contains a prefix,
2488 and replace it with another one.
2490 Takes as arguments an attribute name, a search prefix and a
2491 replacement prefix. Changes the attribute in the object.
2496 my($self,$var,$sprefix,$rprefix) = @_;
2497 $self->{uc $var} ||= $Config{lc $var};
2498 $self->{uc $var} = VMS::Filespec::unixpath($self->{uc $var}) if $Is_VMS;
2499 $self->{uc $var} =~ s/\Q$sprefix\E/$rprefix/;
2504 Defines targets to run *.PL files.
2510 return "" unless $self->{PL_FILES};
2512 foreach $plfile (sort keys %{$self->{PL_FILES}}) {
2514 all :: $self->{PL_FILES}->{$plfile}
2516 $self->{PL_FILES}->{$plfile} :: $plfile
2517 \$(PERL) -I\$(INST_ARCHLIB) -I\$(INST_LIB) -I\$(PERL_ARCHLIB) -I\$(PERL_LIB) $plfile
2525 Defines the realclean target.
2530 my($self, %attribs) = @_;
2533 # Delete temporary files (via clean) and also delete installed files
2534 realclean purge :: clean
2536 # realclean subdirectories first (already cleaned)
2537 my $sub = "\t-cd %s && test -f %s && \$(MAKE) %s realclean\n";
2538 foreach(@{$self->{DIR}}){
2539 push(@m, sprintf($sub,$_,"$self->{MAKEFILE}.old","-f $self->{MAKEFILE}.old"));
2540 push(@m, sprintf($sub,$_,"$self->{MAKEFILE}",''));
2542 push(@m, " $self->{RM_RF} \$(INST_AUTODIR) \$(INST_ARCHAUTODIR)\n");
2543 if( $self->has_link_code ){
2544 push(@m, " $self->{RM_F} \$(INST_DYNAMIC) \$(INST_BOOT)\n");
2545 push(@m, " $self->{RM_F} \$(INST_STATIC)\n");
2547 push(@m, " $self->{RM_F} " . join(" ", values %{$self->{PM}}) . "\n");
2548 my(@otherfiles) = ($self->{MAKEFILE},
2549 "$self->{MAKEFILE}.old"); # Makefiles last
2550 push(@otherfiles, $attribs{FILES}) if $attribs{FILES};
2551 push(@m, " $self->{RM_RF} @otherfiles\n") if @otherfiles;
2552 push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP};
2556 =item replace_manpage_separator
2558 Takes the name of a package, which may be a nested package, in the
2559 form Foo/Bar and replaces the slash with C<::>. Returns the replacement.
2563 sub replace_manpage_separator {
2564 my($self,$man) = @_;
2571 Defines the static target.
2576 # --- Static Loading Sections ---
2580 ## $(INST_PM) has been moved to the all: target.
2581 ## It remains here for awhile to allow for old usage: "make static"
2582 #static :: '.$self->{MAKEFILE}.' $(INST_STATIC) $(INST_PM)
2583 static :: '.$self->{MAKEFILE}.' $(INST_STATIC)
2584 '.$self->{NOECHO}.'$(NOOP)
2588 =item static_lib (o)
2590 Defines how to produce the *.a (or equivalent) files.
2596 # Come to think of it, if there are subdirs with linkcode, we still have no INST_STATIC
2597 # return '' unless $self->needs_linking(); #might be because of a subdir
2599 return '' unless $self->has_link_code;
2603 $(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)/.exists
2606 # If this extension has it's own library (eg SDBM_File)
2607 # then copy that to $(INST_STATIC) and add $(OBJECT) into it.
2608 push(@m, "\t$self->{CP} \$(MYEXTLIB) \$\@\n") if $self->{MYEXTLIB};
2611 q{ $(AR) $(AR_STATIC_ARGS) $@ $(OBJECT) && $(RANLIB) $@
2612 }.$self->{NOECHO}.q{echo "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)/extralibs.ld
2616 # Old mechanism - still available:
2618 push @m, "\t$self->{NOECHO}".q{echo "$(EXTRALIBS)" >> $(PERL_SRC)/ext.libs}."\n\n"
2619 if $self->{PERL_SRC};
2621 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
2625 =item staticmake (o)
2632 my($self, %attribs) = @_;
2635 my(@searchdirs)=($self->{PERL_ARCHLIB}, $self->{SITEARCHEXP}, $self->{INST_ARCHLIB});
2637 # And as it's not yet built, we add the current extension
2638 # but only if it has some C code (or XS code, which implies C code)
2639 if (@{$self->{C}}) {
2640 @static = $self->catfile($self->{INST_ARCHLIB},
2643 "$self->{BASEEXT}$self->{LIB_EXT}"
2647 # Either we determine now, which libraries we will produce in the
2648 # subdirectories or we do it at runtime of the make.
2650 # We could ask all subdir objects, but I cannot imagine, why it
2651 # would be necessary.
2653 # Instead we determine all libraries for the new perl at
2655 my(@perlinc) = ($self->{INST_ARCHLIB}, $self->{INST_LIB}, $self->{PERL_ARCHLIB}, $self->{PERL_LIB});
2657 $self->makeaperl(MAKE => $self->{MAKEFILE},
2658 DIRS => \@searchdirs,
2661 TARGET => $self->{MAP_TARGET},
2663 LIBPERL => $self->{LIBPERL_A}
2669 Helper subroutine for subdirs
2674 my($self, $subdir) = @_;
2679 $self->{NOECHO}cd $subdir && \$(MAKE) all \$(PASTHRU)
2686 Defines targets to process subdirectories.
2691 # --- Sub-directory Sections ---
2694 # This method provides a mechanism to automatically deal with
2695 # subdirectories containing further Makefile.PL scripts.
2696 # It calls the subdir_x() method for each subdirectory.
2697 foreach $dir (@{$self->{DIR}}){
2698 push(@m, $self->subdir_x($dir));
2699 #### print "Including $dir subdirectory\n";
2703 # The default clean, realclean and test targets in this Makefile
2704 # have automatically been given entries for each subdir.
2708 push(@m, "\n# none")
2715 Defines the test targets.
2720 # --- Test and Installation Sections ---
2722 my($self, %attribs) = @_;
2723 my($tests) = $attribs{TESTS} || (-d "t" ? "t/*.t" : "");
2727 TEST_TYPE=test_\$(LINKTYPE)
2731 testdb :: testdb_\$(LINKTYPE)
2733 test :: \$(TEST_TYPE)
2735 push(@m, map("\t$self->{NOECHO}cd $_ && test -f $self->{MAKEFILE} && \$(MAKE) test \$(PASTHRU)\n",
2737 push(@m, "\t$self->{NOECHO}echo 'No tests defined for \$(NAME) extension.'\n")
2738 unless $tests or -f "test.pl" or @{$self->{DIR}};
2741 push(@m, "test_dynamic :: pure_all\n");
2742 push(@m, $self->test_via_harness('$(FULLPERL)', $tests)) if $tests;
2743 push(@m, $self->test_via_script('$(FULLPERL)', 'test.pl')) if -f "test.pl";
2746 push(@m, "testdb_dynamic :: pure_all\n");
2747 push(@m, $self->test_via_script('$(FULLPERL) $(TESTDB_SW)', '$(TEST_FILE)'));
2750 # Occasionally we may face this degenerate target:
2751 push @m, "test_ : test_dynamic\n\n";
2753 if ($self->needs_linking()) {
2754 push(@m, "test_static :: pure_all \$(MAP_TARGET)\n");
2755 push(@m, $self->test_via_harness('./$(MAP_TARGET)', $tests)) if $tests;
2756 push(@m, $self->test_via_script('./$(MAP_TARGET)', 'test.pl')) if -f "test.pl";
2758 push(@m, "testdb_static :: pure_all \$(MAP_TARGET)\n");
2759 push(@m, $self->test_via_script('./$(MAP_TARGET) $(TESTDB_SW)', '$(TEST_FILE)'));
2762 push @m, "test_static :: test_dynamic\n";
2763 push @m, "testdb_static :: testdb_dynamic\n";
2768 =item test_via_harness (o)
2770 Helper method to write the test targets
2774 sub test_via_harness {
2775 my($self, $perl, $tests) = @_;
2776 "\tPERL_DL_NONLAZY=1 $perl".q! -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use Test::Harness qw(&runtests $$verbose); $$verbose=$(TEST_VERBOSE); runtests @ARGV;' !."$tests\n";
2779 =item test_via_script (o)
2781 Other helper method for test.
2785 sub test_via_script {
2786 my($self, $perl, $script) = @_;
2787 qq{\tPERL_DL_NONLAZY=1 $perl}.q{ -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) }.qq{$script
2791 =item tool_autosplit (o)
2793 Defines a simple perl call that runs autosplit. May be deprecated by
2798 sub tool_autosplit {
2799 # --- Tool Sections ---
2801 my($self, %attribs) = @_;
2803 $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN};
2805 # Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
2806 AUTOSPLITFILE = $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e 'use AutoSplit;}.$asl.q{autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1) ;'
2810 =item tools_other (o)
2812 Defines SHELL, LD, TOUCH, CP, MV, RM_F, RM_RF, CHMOD, UMASK_NULL in
2813 the Makefile. Also defines the perl programs MKPATH,
2814 WARN_IF_OLD_PACKLIST, MOD_INSTALL. DOC_INSTALL, and UNINSTALL.
2821 my $bin_sh = $Config{sh} || '/bin/sh';
2826 for (qw/ CHMOD CP LD MV NOOP RM_F RM_RF TOUCH UMASK_NULL / ) {
2827 push @m, "$_ = $self->{$_}\n";
2832 # The following is a portable way to say mkdir -p
2833 # To see which directories are created, change the if 0 to if 1
2834 MKPATH = $(PERL) -wle '$$"="/"; foreach $$p (@ARGV){' \\
2835 -e 'next if -d $$p; my(@p); foreach(split(/\//,$$p)){' \\
2836 -e 'push(@p,$$_); next if -d "@p/"; print "mkdir @p" if 0;' \\
2837 -e 'mkdir("@p",0777)||die $$! } } exit 0;'
2839 # This helps us to minimize the effect of the .exists files A yet
2840 # better solution would be to have a stable file in the perl
2841 # distribution with a timestamp of zero. But this solution doesn't
2842 # need any changes to the core distribution and works with older perls
2843 EQUALIZE_TIMESTAMP = $(PERL) -we 'open F, ">$$ARGV[1]"; close F;' \\
2844 -e 'utime ((stat("$$ARGV[0]"))[8,9], $$ARGV[1])'
2847 return join "", @m if $self->{PARENT};
2850 # Here we warn users that an old packlist file was found somewhere,
2851 # and that they should call some uninstall routine
2852 WARN_IF_OLD_PACKLIST = $(PERL) -we 'exit unless -f $$ARGV[0];' \\
2853 -e 'print "WARNING: I have found an old package in\n";' \\
2854 -e 'print "\t$$ARGV[0].\n";' \\
2855 -e 'print "Please make sure the two installations are not conflicting\n";'
2860 MOD_INSTALL = $(PERL) -I$(INST_LIB) -I$(PERL_LIB) -MExtUtils::Install \
2861 -e 'install({@ARGV},"$(VERBINST)",0,"$(UNINST)");'
2863 DOC_INSTALL = $(PERL) -e '$$\="\n\n";print "=head3 ", scalar(localtime), ": C<", shift, ">";' \
2864 -e 'print "=over 4";' \
2865 -e 'while (defined($$key = shift) and defined($$val = shift)){print "=item *";print "C<$$key: $$val>";}' \
2868 UNINSTALL = $(PERL) -MExtUtils::Install \
2869 -e 'uninstall($$ARGV[0],1);'
2876 =item tool_xsubpp (o)
2878 Determines typemaps, xsubpp version, prototype behaviour.
2884 return "" unless $self->needs_linking;
2885 my($xsdir) = $self->catdir($self->{PERL_LIB},"ExtUtils");
2886 my(@tmdeps) = $self->catdir('$(XSUBPPDIR)','typemap');
2887 if( $self->{TYPEMAPS} ){
2889 foreach $typemap (@{$self->{TYPEMAPS}}){
2890 if( ! -f $typemap ){
2891 warn "Typemap $typemap not found.\n";
2894 push(@tmdeps, $typemap);
2898 push(@tmdeps, "typemap") if -f "typemap";
2899 my(@tmargs) = map("-typemap $_", @tmdeps);
2900 if( exists $self->{XSOPT} ){
2901 unshift( @tmargs, $self->{XSOPT} );
2905 my $xsubpp_version = $self->xsubpp_version($self->catfile($xsdir,"xsubpp"));
2907 # What are the correct thresholds for version 1 && 2 Paul?
2908 if ( $xsubpp_version > 1.923 ){
2909 $self->{XSPROTOARG} = "" unless defined $self->{XSPROTOARG};
2911 if (defined $self->{XSPROTOARG} && $self->{XSPROTOARG} =~ /\-prototypes/) {
2912 print STDOUT qq{Warning: This extension wants to pass the switch "-prototypes" to xsubpp.
2913 Your version of xsubpp is $xsubpp_version and cannot handle this.
2914 Please upgrade to a more recent version of xsubpp.
2917 $self->{XSPROTOARG} = "";
2923 XSUBPP = \$(XSUBPPDIR)/xsubpp
2924 XSPROTOARG = $self->{XSPROTOARG}
2925 XSUBPPDEPS = @tmdeps
2926 XSUBPPARGS = @tmargs
2932 my($self,$xsubpp) = @_;
2933 return $Xsubpp_Version if defined $Xsubpp_Version; # global variable
2937 # try to figure out the version number of the xsubpp on the system
2939 # first try the -v flag, introduced in 1.921 & 2.000a2
2941 return "" unless $self->needs_linking;
2943 my $command = "$self->{PERL} -I$self->{PERL_LIB} $xsubpp -v 2>&1";
2944 print "Running $command\n" if $Verbose >= 2;
2945 $version = `$command` ;
2946 warn "Running '$command' exits with status " . ($?>>8) if $?;
2949 return $Xsubpp_Version = $1 if $version =~ /^xsubpp version (.*)/ ;
2951 # nope, then try something else
2953 my $counter = '000';
2954 my ($file) = 'temp' ;
2955 $counter++ while -e "$file$counter"; # don't overwrite anything
2958 open(F, ">$file") or die "Cannot open file '$file': $!\n" ;
2960 MODULE = fred PACKAGE = fred
2969 $command = "$self->{PERL} $xsubpp $file 2>&1";
2970 print "Running $command\n" if $Verbose >= 2;
2971 my $text = `$command` ;
2972 warn "Running '$command' exits with status " . ($?>>8) if $?;
2975 # gets 1.2 -> 1.92 and 2.000a1
2976 return $Xsubpp_Version = $1 if $text =~ /automatically by xsubpp version ([\S]+)\s*/ ;
2978 # it is either 1.0 or 1.1
2979 return $Xsubpp_Version = 1.1 if $text =~ /^Warning: ignored semicolon/ ;
2981 # none of the above, so 1.0
2982 return $Xsubpp_Version = "1.0" ;
2985 =item top_targets (o)
2987 Defines the targets all, subdirs, config, and O_FILES
2992 # --- Target Sections ---
2997 #all :: config $(INST_PM) subdirs linkext manifypods
2999 all :: pure_all manifypods
3000 '.$self->{NOECHO}.'$(NOOP)
3002 pure_all :: config pm_to_blib subdirs linkext
3003 '.$self->{NOECHO}.'$(NOOP)
3005 subdirs :: $(MYEXTLIB)
3006 '.$self->{NOECHO}.'$(NOOP)
3008 config :: '.$self->{MAKEFILE}.' $(INST_LIBDIR)/.exists
3009 '.$self->{NOECHO}.'$(NOOP)
3011 config :: $(INST_ARCHAUTODIR)/.exists
3012 '.$self->{NOECHO}.'$(NOOP)
3014 config :: $(INST_AUTODIR)/.exists
3015 '.$self->{NOECHO}.'$(NOOP)
3019 config :: Version_check
3020 $self->{NOECHO}\$(NOOP)
3022 } unless $self->{PARENT} or ($self->{PERL_SRC} && $self->{INSTALLDIRS} eq "perl") or $self->{NO_VC};
3024 push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]);
3026 if (%{$self->{MAN1PODS}}) {
3028 config :: \$(INST_MAN1DIR)/.exists
3029 $self->{NOECHO}\$(NOOP)
3032 push @m, $self->dir_target(qw[$(INST_MAN1DIR)]);
3034 if (%{$self->{MAN3PODS}}) {
3036 config :: \$(INST_MAN3DIR)/.exists
3037 $self->{NOECHO}\$(NOOP)
3040 push @m, $self->dir_target(qw[$(INST_MAN3DIR)]);
3044 $(O_FILES): $(H_FILES)
3045 ' if @{$self->{O_FILES} || []} && @{$self->{H} || []};
3049 perldoc ExtUtils::MakeMaker
3054 }.$self->{NOECHO}.q{$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \
3055 -MExtUtils::MakeMaker=Version_check \
3056 -e 'Version_check("$(MM_VERSION)")'
3064 Obsolete, depecated method. Not used since Version 5.21.
3069 # --- perllocal.pod section ---
3070 my($self,$what,$name,@attribs)=@_;
3071 my $time = localtime;
3072 print "=head2 $time: $what C<$name>\n\n=over 4\n\n=item *\n\n";
3073 print join "\n\n=item *\n\n", map("C<$_>",@attribs);
3074 print "\n\n=back\n\n";
3079 Defines the suffix rules to compile XS files to C.
3085 return '' unless $self->needs_linking();
3088 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs >$*.tc && mv $*.tc $@
3094 Defines suffix rules to go from XS to object files directly. This is
3095 only intended for broken make implementations.
3099 sub xs_o { # many makes are too dumb to use xs_c then c_o
3101 return '' unless $self->needs_linking();
3104 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs >xstmp.c && mv xstmp.c $*.c
3105 $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c
3114 L<ExtUtils::MakeMaker>