1 package ExtUtils::MM_Unix;
3 $VERSION = substr q$Revision: 1.105 $, 10;
4 # $Id: MM_Unix.pm,v 1.105 1996/07/08 20:51:18 k Exp k $
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 $_ .= "/" if $_ eq '' or substr($_,-1) ne "/";
102 my $result = join('', @args);
103 # remove a trailing slash unless we are root
104 substr($result,-1) = ""
105 if length($result) > 1 && substr($result,-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;
236 =head2 SelfLoaded methods
240 Defines the suffix rules to compile different flavors of C files to
246 # --- Translation Sections ---
249 return '' unless $self->needs_linking();
253 $(CCCMD) $(MAB) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c
256 $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.C
259 $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.cpp
262 $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.cxx
265 $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.cc
272 Does very much the same as the cflags script in the perl
273 distribution. It doesn't return the whole compiler command line, but
274 initializes all of its parts. The const_cccmd method then actually
275 returns the definition of the CCCMD macro which uses these parts.
282 my($self,$libperl)=@_;
283 return $self->{CFLAGS} if $self->{CFLAGS};
284 return '' unless $self->needs_linking();
286 my($prog, $uc, $perltype, %cflags);
287 $libperl ||= $self->{LIBPERL_A} || "libperl$self->{LIB_EXT}" ;
288 $libperl =~ s/\.\$\(A\)$/$self->{LIB_EXT}/;
290 @cflags{qw(cc ccflags optimize large split shellflags)}
291 = @Config{qw(cc ccflags optimize large split shellflags)};
294 $cflags{shellflags} ||= '';
299 DE => '-DDEBUGGING -DEMBED',
300 M => '-DEMBED -DMULTIPLICITY',
301 DM => '-DDEBUGGING -DEMBED -DMULTIPLICITY',
304 if ($libperl =~ /libperl(\w*)\Q$self->{LIB_EXT}/){
307 $uc = ""; # avoid warning
309 $perltype = $map{$uc} ? $map{$uc} : "";
317 ( $name = $self->{NAME} . "_cflags" ) =~ s/:/_/g ;
318 if ($prog = $Config::Config{$name}) {
319 # Expand hints for this extension via the shell
320 print STDOUT "Processing $name hint:\n" if $Verbose;
321 my(@o)=`cc=\"$cflags{cc}\"
322 ccflags=\"$cflags{ccflags}\"
323 optimize=\"$cflags{optimize}\"
324 perltype=\"$cflags{perltype}\"
325 optdebug=\"$cflags{optdebug}\"
326 large=\"$cflags{large}\"
327 split=\"$cflags{'split'}\"
330 echo ccflags=\$ccflags
331 echo optimize=\$optimize
332 echo perltype=\$perltype
333 echo optdebug=\$optdebug
340 if ($line =~ /(.*?)=\s*(.*)\s*$/){
342 print STDOUT " $1 = $2\n" if $Verbose;
344 print STDOUT "Unrecognised result from hint: '$line'\n";
350 $cflags{optimize} = $optdebug;
353 for (qw(ccflags optimize perltype large split)) {
354 $cflags{$_} =~ s/^\s+//;
355 $cflags{$_} =~ s/\s+/ /g;
356 $cflags{$_} =~ s/\s+$//;
357 $self->{uc $_} ||= $cflags{$_}
360 return $self->{CFLAGS} = qq{
361 CCFLAGS = $self->{CCFLAGS}
362 OPTIMIZE = $self->{OPTIMIZE}
363 PERLTYPE = $self->{PERLTYPE}
364 LARGE = $self->{LARGE}
365 SPLIT = $self->{SPLIT}
372 Defines the clean target.
377 # --- Cleanup and Distribution Sections ---
379 my($self, %attribs) = @_;
382 # Delete temporary files but do not touch installed files. We don\'t delete
383 # the Makefile here so a later make realclean still has a makefile to use.
387 # clean subdirectories first
388 for $dir (@{$self->{DIR}}) {
389 push @m, "\t-cd $dir && test -f $self->{MAKEFILE} && \$(MAKE) clean\n";
392 my(@otherfiles) = values %{$self->{XS}}; # .c files from *.xs files
393 push(@otherfiles, $attribs{FILES}) if $attribs{FILES};
394 push(@otherfiles, qw[./blib $(MAKE_APERL_FILE) $(INST_ARCHAUTODIR)/extralibs.all
395 perlmain.c mon.out core so_locations pm_to_blib
396 *~ */*~ */*/*~ *$(OBJ_EXT) *$(LIB_EXT) perl.exe
397 $(BOOTSTRAP) $(BASEEXT).bso $(BASEEXT).def
400 push @m, "\t-$self->{RM_RF} @otherfiles\n";
401 # See realclean and ext/utils/make_ext for usage of Makefile.old
403 "\t-$self->{MV} $self->{MAKEFILE} $self->{MAKEFILE}.old 2>/dev/null\n");
405 "\t$attribs{POSTOP}\n") if $attribs{POSTOP};
409 =item const_cccmd (o)
411 Returns the full compiler call for C programs and stores the
412 definition in CONST_CCCMD.
417 my($self,$libperl)=@_;
418 return $self->{CONST_CCCMD} if $self->{CONST_CCCMD};
419 return '' unless $self->needs_linking();
420 return $self->{CONST_CCCMD} =
421 q{CCCMD = $(CC) -c $(INC) $(CCFLAGS) $(OPTIMIZE) \\
422 $(PERLTYPE) $(LARGE) $(SPLIT) $(DEFINE_VERSION) \\
423 $(XS_DEFINE_VERSION)};
426 =item const_config (o)
428 Defines a couple of constants in the Makefile that are imported from
434 # --- Constants Sections ---
438 push(@m,"\n# These definitions are from config.sh (via $INC{'Config.pm'})\n");
439 push(@m,"\n# They may have been overridden via Makefile.PL or on the command line\n");
441 foreach $m (@{$self->{CONFIG}}){
442 # SITE*EXP macros are defined in &constants; avoid duplicates here
443 next if $once_only{$m} or $m eq 'sitelibexp' or $m eq 'sitearchexp';
444 push @m, "\U$m\E = ".$self->{uc $m}."\n";
450 =item const_loadlibs (o)
452 Defines EXTRALIBS, LDLOADLIBS, BSLOADLIBS, LD_RUN_PATH. See
453 L<ExtUtils::Liblist> for details.
459 return "" unless $self->needs_linking;
462 # $self->{NAME} might depend on some other libraries:
463 # See ExtUtils::Liblist for details
468 EXTRALIBS LDLOADLIBS BSLOADLIBS LD_RUN_PATH
470 next unless defined $self->{$tmp};
471 push @m, "$tmp = $self->{$tmp}\n";
478 Initializes lots of constants and .SUFFIXES and .PHONY
488 AR_STATIC_ARGS NAME DISTNAME NAME_SYM VERSION
489 VERSION_SYM XS_VERSION INST_BIN INST_EXE INST_LIB
490 INST_ARCHLIB INST_SCRIPT PREFIX INSTALLDIRS
491 INSTALLPRIVLIB INSTALLARCHLIB INSTALLSITELIB
492 INSTALLSITEARCH INSTALLBIN INSTALLSCRIPT PERL_LIB
493 PERL_ARCHLIB SITELIBEXP SITEARCHEXP LIBPERL_A MYEXTLIB
494 FIRST_MAKEFILE MAKE_APERL_FILE PERLMAINCC PERL_SRC
495 PERL_INC PERL FULLPERL
498 next unless defined $self->{$tmp};
499 push @m, "$tmp = $self->{$tmp}\n";
503 VERSION_MACRO = VERSION
504 DEFINE_VERSION = -D\$(VERSION_MACRO)=\\\"\$(VERSION)\\\"
505 XS_VERSION_MACRO = XS_VERSION
506 XS_DEFINE_VERSION = -D\$(XS_VERSION_MACRO)=\\\"\$(XS_VERSION)\\\"
510 MAKEMAKER = $INC{'ExtUtils/MakeMaker.pm'}
511 MM_VERSION = $ExtUtils::MakeMaker::VERSION
515 # FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle).
516 # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle)
517 # ROOTEXT = Directory part of FULLEXT with leading slash (eg /DBD) !!! Deprecated from MM 5.32 !!!
518 # PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar)
519 # DLBASE = Basename part of dynamic library. May be just equal BASEEXT.
523 FULLEXT BASEEXT PARENT_NAME DLBASE VERSION_FROM INC DEFINE OBJECT
526 next unless defined $self->{$tmp};
527 push @m, "$tmp = $self->{$tmp}\n";
531 # Handy lists of source code files:
532 XS_FILES= ".join(" \\\n\t", sort keys %{$self->{XS}})."
533 C_FILES = ".join(" \\\n\t", @{$self->{C}})."
534 O_FILES = ".join(" \\\n\t", @{$self->{O_FILES}})."
535 H_FILES = ".join(" \\\n\t", @{$self->{H}})."
536 MAN1PODS = ".join(" \\\n\t", sort keys %{$self->{MAN1PODS}})."
537 MAN3PODS = ".join(" \\\n\t", sort keys %{$self->{MAN3PODS}})."
541 INST_MAN1DIR INSTALLMAN1DIR MAN1EXT INST_MAN3DIR INSTALLMAN3DIR MAN3EXT
543 next unless defined $self->{$tmp};
544 push @m, "$tmp = $self->{$tmp}\n";
548 .NO_CONFIG_REC: Makefile
549 } if $ENV{CLEARCASE_ROOT};
551 # why not q{} ? -- emacs
553 # work around a famous dec-osf make(1) feature(?):
556 .SUFFIXES: .xs .c .C .cpp .cxx .cc \$(OBJ_EXT)
558 # Nick wanted to get rid of .PRECIOUS. I don't remember why. I seem to recall, that
559 # some make implementations will delete the Makefile when we rebuild it. Because
560 # we call false(1) when we rebuild it. So make(1) is not completely wrong when it
561 # does so. Our milage may vary.
562 # .PRECIOUS: Makefile # seems to be not necessary anymore
564 .PHONY: all config static dynamic test linkext manifest
566 # Where is the Config information that we are using/depend on
567 CONFIGDEP = \$(PERL_ARCHLIB)/Config.pm \$(PERL_INC)/config.h
569 # Where to put things:
570 INST_LIBDIR = $self->{INST_LIBDIR}
571 INST_ARCHLIBDIR = $self->{INST_ARCHLIBDIR}
573 INST_AUTODIR = $self->{INST_AUTODIR}
574 INST_ARCHAUTODIR = $self->{INST_ARCHAUTODIR}
577 if ($self->has_link_code()) {
579 INST_STATIC = $(INST_ARCHAUTODIR)/$(BASEEXT)$(LIB_EXT)
580 INST_DYNAMIC = $(INST_ARCHAUTODIR)/$(DLBASE).$(DLEXT)
581 INST_BOOT = $(INST_ARCHAUTODIR)/$(BASEEXT).bs
592 $tmp = "$self->{BASEEXT}.def";
601 $tmp = "\$(PERL_INC)/libperl\$(LIB_EXT)";
610 #INST_PM = }.join(" \\\n\t", sort values %{$self->{PM}}).q{
612 #PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{
616 TO_INST_PM = }.join(" \\\n\t", sort keys %{$self->{PM}}).q{
618 PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{
626 Same as macro for the depend attribute.
631 my($self,%attribs) = @_;
633 while (($key,$val) = each %attribs){
634 last unless defined $key;
635 push @m, "$key: $val\n";
642 Takes an array of directories that need to exist and returns a
643 Makefile entry for a .exists file in these directories. Returns
644 nothing, if the entry has already been processed. We're helpless
645 though, if the same directory comes as $(FOO) _and_ as "bar". Both of
646 them get an entry, that's why we use "::".
651 # --- Make-Directories section (internal method) ---
652 # dir_target(@array) returns a Makefile entry for the file .exists in each
653 # named directory. Returns nothing, if the entry has already been processed.
654 # We're helpless though, if the same directory comes as $(FOO) _and_ as "bar".
655 # Both of them get an entry, that's why we use "::". I chose '$(PERL)' as the
656 # prerequisite, because there has to be one, something that doesn't change
659 my($self,@dirs) = @_;
661 foreach $dir (@dirs) {
662 my($src) = $self->catfile($self->{PERL_INC},'perl.h');
663 my($targ) = $self->catfile($dir,'.exists');
664 my($targdir) = $targ; # Necessary because catfile may have
665 $targdir =~ s:/?.exists$::; # adapted syntax of $dir to target OS
666 next if $self->{DIR_TARGET}{$self}{$targdir}++;
669 $self->{NOECHO}\$(MKPATH) $targdir
670 $self->{NOECHO}\$(EQUALIZE_TIMESTAMP) $src $targ
673 -$self->{NOECHO}\$(CHMOD) 755 $targdir
681 Defines a lot of macros for distribution support.
686 my($self, %attribs) = @_;
689 # VERSION should be sanitised before use as a file name
690 my($version) = $attribs{VERSION} || '$(VERSION)';
691 my($name) = $attribs{NAME} || '$(DISTNAME)';
692 my($tar) = $attribs{TAR} || 'tar'; # eg /usr/bin/gnutar
693 my($tarflags) = $attribs{TARFLAGS} || 'cvf';
694 my($zip) = $attribs{ZIP} || 'zip'; # eg pkzip Yuck!
695 my($zipflags) = $attribs{ZIPFLAGS} || '-r';
696 my($compress) = $attribs{COMPRESS} || 'compress'; # eg gzip
697 my($suffix) = $attribs{SUFFIX} || '.Z'; # eg .gz
698 my($shar) = $attribs{SHAR} || 'shar'; # eg "shar --gzip"
699 my($preop) = $attribs{PREOP} || "$self->{NOECHO}\$(NOOP)"; # eg update MANIFEST
700 my($postop) = $attribs{POSTOP} || "$self->{NOECHO}\$(NOOP)"; # eg remove the distdir
702 my($to_unix) = $attribs{TO_UNIX} || ($Is_OS2
704 . 'test -f tmp.zip && $(RM) tmp.zip;'
705 . ' $(ZIP) -ll -mr tmp.zip $(DISTVNAME) && unzip -o tmp.zip && $(RM) tmp.zip'
706 : "$self->{NOECHO}\$(NOOP)");
708 my($ci) = $attribs{CI} || 'ci -u';
709 my($rcs_label)= $attribs{RCS_LABEL}|| 'rcs -Nv$(VERSION_SYM): -q';
710 my($dist_cp) = $attribs{DIST_CP} || 'best';
711 my($dist_default) = $attribs{DIST_DEFAULT} || 'tardist';
714 DISTVNAME = ${name}-$version
726 RCS_LABEL = $rcs_label
728 DIST_DEFAULT = $dist_default
733 =item dist_basics (o)
735 Defines the targets distclean, distcheck, skipcheck, manifest.
743 distclean :: realclean distcheck
748 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&fullcheck";' \\
754 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&skipcheck";' \\
760 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&mkmanifest";' \\
768 Defines a check in target for RCS.
777 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&maniread";' \\
778 -e '@all = keys %{ maniread() };' \\
779 -e 'print("Executing $(CI) @all\n"); system("$(CI) @all");' \\
780 -e 'print("Executing $(RCS_LABEL) ...\n"); system("$(RCS_LABEL) @all");'
787 Defeines the targets dist, tardist, zipdist, uutardist, shdist
795 dist : $(DIST_DEFAULT)
796 }.$self->{NOECHO}.q{$(PERL) -le 'print "Warning: Makefile possibly out of date with $$vf" if ' \
797 -e '-e ($$vf="$(VERSION_FROM)") and -M $$vf < -M "}.$self->{MAKEFILE}.q{";'
799 tardist : $(DISTVNAME).tar$(SUFFIX)
801 zipdist : $(DISTVNAME).zip
803 $(DISTVNAME).tar$(SUFFIX) : distdir
806 $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME)
807 $(RM_RF) $(DISTVNAME)
808 $(COMPRESS) $(DISTVNAME).tar
811 $(DISTVNAME).zip : distdir
813 $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME)
814 $(RM_RF) $(DISTVNAME)
817 uutardist : $(DISTVNAME).tar$(SUFFIX)
818 uuencode $(DISTVNAME).tar$(SUFFIX) \\
819 $(DISTVNAME).tar$(SUFFIX) > \\
820 $(DISTVNAME).tar$(SUFFIX)_uu
824 $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar
825 $(RM_RF) $(DISTVNAME)
833 Defines the scratch directory target that will hold the distribution
834 before tar-ing (or shar-ing).
843 $(RM_RF) $(DISTVNAME)
844 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=manicopy,maniread \\
845 -e 'manicopy(maniread(),"$(DISTVNAME)", "$(DIST_CP)");'
852 Defines a target that produces the distribution in the
853 scratchdirectory, and runs 'perl Makefile.PL; make ;make test' in that
863 cd $(DISTVNAME) && $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) Makefile.PL
864 cd $(DISTVNAME) && $(MAKE)
865 cd $(DISTVNAME) && $(MAKE) test
872 Used by AIX and VMS to define DL_FUNCS and DL_VARS and write the *.exp
878 my($self,%attribs) = @_;
880 return '' unless ($^O eq 'aix' && $self->needs_linking() );
882 my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
883 my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
887 dynamic :: $self->{BASEEXT}.exp
889 ") unless $self->{SKIPHASH}{'dynamic'}; # dynamic and static are subs, so...
892 static :: $self->{BASEEXT}.exp
894 ") unless $self->{SKIPHASH}{'static'}; # we avoid a warning if we tick them
897 $self->{BASEEXT}.exp: Makefile.PL
898 ",' $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e \'use ExtUtils::Mksymlists; \\
899 Mksymlists("NAME" => "',$self->{NAME},'", "DL_FUNCS" => ',
900 neatvalue($funcs),', "DL_VARS" => ', neatvalue($vars), ');\'
908 Defines the dynamic target.
913 # --- Dynamic Loading Sections ---
917 ## $(INST_PM) has been moved to the all: target.
918 ## It remains here for awhile to allow for old usage: "make dynamic"
919 #dynamic :: '.$self->{MAKEFILE}.' $(INST_DYNAMIC) $(INST_BOOT) $(INST_PM)
920 dynamic :: '.$self->{MAKEFILE}.' $(INST_DYNAMIC) $(INST_BOOT)
921 '.$self->{NOECHO}.'$(NOOP)
927 Defines targets for bootstrap files.
932 my($self, %attribs) = @_;
935 ' unless $self->has_link_code();
938 BOOTSTRAP = '."$self->{BASEEXT}.bs".'
940 # As Mkbootstrap might not write a file (if none is required)
941 # we use touch to prevent make continually trying to remake it.
942 # The DynaLoader only reads a non-empty file.
943 $(BOOTSTRAP): '."$self->{MAKEFILE} $self->{BOOTDEP}".' $(INST_ARCHAUTODIR)/.exists
944 '.$self->{NOECHO}.'echo "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))"
945 '.$self->{NOECHO}.'$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" \
946 -e \'use ExtUtils::Mkbootstrap;\' \
947 -e \'Mkbootstrap("$(BASEEXT)","$(BSLOADLIBS)");\'
948 '.$self->{NOECHO}.'$(TOUCH) $(BOOTSTRAP)
951 $(INST_BOOT): $(BOOTSTRAP) $(INST_ARCHAUTODIR)/.exists
952 '."$self->{NOECHO}$self->{RM_RF}".' $(INST_BOOT)
953 -'.$self->{CP}.' $(BOOTSTRAP) $(INST_BOOT)
958 =item dynamic_lib (o)
960 Defines how to produce the *.so (or equivalent) files.
965 my($self, %attribs) = @_;
966 return '' unless $self->needs_linking(); #might be because of a subdir
968 return '' unless $self->has_link_code;
970 my($otherldflags) = $attribs{OTHERLDFLAGS} || "";
971 my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || "";
972 my($armaybe) = $attribs{ARMAYBE} || $self->{ARMAYBE} || ":";
973 my($ldfrom) = '$(LDFROM)';
974 $armaybe = 'ar' if ($^O eq 'dec_osf' and $armaybe eq ':');
977 # This section creates the dynamically loadable $(INST_DYNAMIC)
978 # from $(OBJECT) and possibly $(MYEXTLIB).
979 ARMAYBE = '.$armaybe.'
980 OTHERLDFLAGS = '.$otherldflags.'
981 INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'
983 $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)/.exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
985 if ($armaybe ne ':'){
986 $ldfrom = 'tmp$(LIB_EXT)';
987 push(@m,' $(ARMAYBE) cr '.$ldfrom.' $(OBJECT)'."\n");
988 push(@m,' $(RANLIB) '."$ldfrom\n");
990 $ldfrom = "-all $ldfrom -none" if ($^O eq 'dec_osf');
991 push(@m,' LD_RUN_PATH="$(LD_RUN_PATH)" $(LD) -o $@ $(LDDLFLAGS) '.$ldfrom.
992 ' $(OTHERLDFLAGS) $(MAB) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) $(EXPORT_LIST)');
997 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
1003 Deprecated method. Use libscan instead.
1008 my($self,$path) = @_;
1014 Called by init_others, and calls ext ExtUtils::Liblist. See
1015 L<ExtUtils::Liblist> for details.
1020 my($self,$libs) = @_;
1021 require ExtUtils::Liblist;
1022 $self->ext($libs, $Verbose);
1025 =item file_name_is_absolute
1027 Takes as argument a path and returns true, it it is an absolute path.
1031 sub file_name_is_absolute {
1032 my($self,$file) = @_;
1038 Finds the executables PERL and FULLPERL
1043 my($self, $ver, $names, $dirs, $trace) = @_;
1046 print "Looking for perl $ver by these names:
1052 foreach $dir (@$dirs){
1053 next unless defined $dir; # $self->{PERL_SRC} may be undefined
1054 foreach $name (@$names){
1056 if ($self->file_name_is_absolute($name)) { # /foo/bar
1058 } elsif ($self->canonpath($name) eq $self->canonpath(basename($name))) { # foo
1059 $abs = $self->catfile($dir, $name);
1061 $abs = $self->canonpath($self->catfile($self->curdir, $name));
1063 print "Checking $abs\n" if ($trace >= 2);
1064 next unless $self->maybe_command($abs);
1065 print "Executing $abs\n" if ($trace >= 2);
1066 if (`$abs -e 'require $ver; print "VER_OK\n" ' 2>&1` =~ /VER_OK/) {
1067 print "Using PERL=$abs\n" if $trace;
1072 print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n";
1073 0; # false and not empty
1076 =head2 Methods to actually produce chunks of text for the Makefile
1078 The methods here are called in the order specified by
1079 @ExtUtils::MakeMaker::MM_Sections. This manpage reflects the order as
1080 well as possible. Some methods call each other, so in doubt refer to
1091 '# Phony target to force checking subdirectories.
1098 Guess the name of this package by examining the working directory's
1099 name. MakeMaker calls this only if the developer has not supplied a
1109 my $name = basename(cwd());
1110 $name =~ s|[\-_][\d\.\-]+$||; # this is new with MM 5.00, we
1111 # strip minus or underline
1112 # followed by a float or some such
1113 print "Warning: Guessing NAME [$name] from current directory name.\n";
1119 Returns true if C, XS, MYEXTLIB or similar objects exist within this
1120 object that need a compiler. Does not descend into subdirectories as
1121 needs_linking() does.
1127 return $self->{HAS_LINK_CODE} if defined $self->{HAS_LINK_CODE};
1128 if ($self->{OBJECT} or @{$self->{C} || []} or $self->{MYEXTLIB}){
1129 $self->{HAS_LINK_CODE} = 1;
1132 return $self->{HAS_LINK_CODE} = 0;
1137 Initializes DIR, XS, PM, C, O_FILES, H, PL_FILES, MAN*PODS, EXE_FILES.
1141 sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc)
1143 my($name, %dir, %xs, %c, %h, %ignore, %pl_files, %manifypods);
1144 local(%pm); #the sub in find() has to see this hash
1145 $ignore{'test.pl'} = 1;
1146 $ignore{'makefile.pl'} = 1 if $Is_VMS;
1147 foreach $name ($self->lsdir($self->curdir)){
1148 next if $name eq $self->curdir or $name eq $self->updir or $ignore{$name};
1149 next unless $self->libscan($name);
1151 next if -l $name; # We do not support symlinks at all
1152 $dir{$name} = $name if (-f $self->catfile($name,"Makefile.PL"));
1153 } elsif ($name =~ /\.xs$/){
1154 my($c); ($c = $name) =~ s/\.xs$/.c/;
1157 } elsif ($name =~ /\.c(pp|xx|c)?$/i){ # .c .C .cpp .cxx .cc
1159 unless $name =~ m/perlmain\.c/; # See MAP_TARGET
1160 } elsif ($name =~ /\.h$/i){
1162 } elsif ($name =~ /\.(p[ml]|pod)$/){
1163 $pm{$name} = $self->catfile('$(INST_LIBDIR)',$name);
1164 } elsif ($name =~ /\.PL$/ && $name ne "Makefile.PL") {
1165 ($pl_files{$name} = $name) =~ s/\.PL$// ;
1166 } elsif ($Is_VMS && $name =~ /\.pl$/ && $name ne 'makefile.pl' &&
1167 $name ne 'test.pl') { # case-insensitive filesystem
1168 ($pl_files{$name} = $name) =~ s/\.pl$// ;
1172 # Some larger extensions often wish to install a number of *.pm/pl
1173 # files into the library in various locations.
1175 # The attribute PMLIBDIRS holds an array reference which lists
1176 # subdirectories which we should search for library files to
1177 # install. PMLIBDIRS defaults to [ 'lib', $self->{BASEEXT} ]. We
1178 # recursively search through the named directories (skipping any
1179 # which don't exist or contain Makefile.PL files).
1181 # For each *.pm or *.pl file found $self->libscan() is called with
1182 # the default installation path in $_[1]. The return value of
1183 # libscan defines the actual installation location. The default
1184 # libscan function simply returns the path. The file is skipped
1185 # if libscan returns false.
1187 # The default installation location passed to libscan in $_[1] is:
1189 # ./*.pm => $(INST_LIBDIR)/*.pm
1190 # ./xyz/... => $(INST_LIBDIR)/xyz/...
1191 # ./lib/... => $(INST_LIB)/...
1193 # In this way the 'lib' directory is seen as the root of the actual
1194 # perl library whereas the others are relative to INST_LIBDIR
1195 # (which includes PARENT_NAME). This is a subtle distinction but one
1196 # that's important for nested modules.
1198 $self->{PMLIBDIRS} = ['lib', $self->{BASEEXT}]
1199 unless $self->{PMLIBDIRS};
1201 #only existing directories that aren't in $dir are allowed
1203 # Avoid $_ wherever possible:
1204 # @{$self->{PMLIBDIRS}} = grep -d && !$dir{$_}, @{$self->{PMLIBDIRS}};
1205 my (@pmlibdirs) = @{$self->{PMLIBDIRS}};
1207 @{$self->{PMLIBDIRS}} = ();
1208 foreach $pmlibdir (@pmlibdirs) {
1209 -d $pmlibdir && !$dir{$pmlibdir} && push @{$self->{PMLIBDIRS}}, $pmlibdir;
1212 if (@{$self->{PMLIBDIRS}}){
1213 print "Searching PMLIBDIRS: @{$self->{PMLIBDIRS}}\n"
1216 File::Find::find(sub {
1218 if ($_ eq "CVS" || $_ eq "RCS"){
1219 $File::Find::prune = 1;
1223 my($path, $prefix) = ($File::Find::name, '$(INST_LIBDIR)');
1224 my($striplibpath,$striplibname);
1225 $prefix = '$(INST_LIB)' if (($striplibpath = $path) =~ s:^(\W*)lib\W:$1:i);
1226 ($striplibname,$striplibpath) = fileparse($striplibpath);
1227 my($inst) = $self->catfile($prefix,$striplibpath,$striplibname);
1228 local($_) = $inst; # for backwards compatibility
1229 $inst = $self->libscan($inst);
1230 print "libscan($path) => '$inst'\n" if ($Verbose >= 2);
1231 return unless $inst;
1233 }, @{$self->{PMLIBDIRS}});
1236 $self->{DIR} = [sort keys %dir] unless $self->{DIR};
1237 $self->{XS} = \%xs unless $self->{XS};
1238 $self->{PM} = \%pm unless $self->{PM};
1239 $self->{C} = [sort keys %c] unless $self->{C};
1240 my(@o_files) = @{$self->{C}};
1241 $self->{O_FILES} = [grep s/\.c(pp|xx|c)?$/$self->{OBJ_EXT}/i, @o_files] ;
1242 $self->{H} = [sort keys %h] unless $self->{H};
1243 $self->{PL_FILES} = \%pl_files unless $self->{PL_FILES};
1245 # Set up names of manual pages to generate from pods
1246 if ($self->{MAN1PODS}) {
1247 } elsif ( $self->{INST_MAN1DIR} =~ /^(none|\s*)$/ ) {
1248 $self->{MAN1PODS} = {};
1250 my %manifypods = ();
1251 if ( exists $self->{EXE_FILES} ) {
1252 foreach $name (@{$self->{EXE_FILES}}) {
1253 # use FileHandle ();
1254 # my $fh = new FileHandle;
1257 # one day test, if $/ can be set to '' safely (is the bug fixed that was in 5.001m?)
1258 # if ($fh->open("<$name")) {
1259 if (open(FH,"<$name")) {
1262 if (/^=head1\s+\w+/) {
1270 # If it doesn't exist yet, we assume, it has pods in it
1274 $manifypods{$name} = $self->catfile('$(INST_MAN1DIR)',basename($name).'.$(MAN1EXT)');
1278 $self->{MAN1PODS} = \%manifypods;
1280 if ($self->{MAN3PODS}) {
1281 } elsif ( $self->{INST_MAN3DIR} =~ /^(none|\s*)$/ ) {
1282 $self->{MAN3PODS} = {};
1284 my %manifypods = (); # we collect the keys first, i.e. the files
1285 # we have to convert to pod
1286 foreach $name (keys %{$self->{PM}}) {
1287 if ($name =~ /\.pod$/ ) {
1288 $manifypods{$name} = $self->{PM}{$name};
1289 } elsif ($name =~ /\.p[ml]$/ ) {
1290 # use FileHandle ();
1291 # my $fh = new FileHandle;
1294 # $fh->open("<$name");
1295 if (open(FH,"<$name")) {
1298 if (/^=head1\s+\w+/) {
1309 $manifypods{$name} = $self->{PM}{$name};
1314 # Remove "Configure.pm" and similar, if it's not the only pod listed
1315 # To force inclusion, just name it "Configure.pod", or override MAN3PODS
1316 foreach $name (keys %manifypods) {
1317 if ($name =~ /(config|setup).*\.pm/i) {
1318 delete $manifypods{$name};
1321 my($manpagename) = $name;
1322 unless ($manpagename =~ s!^\W*lib\W+!!) { # everything below lib is ok
1323 $manpagename = $self->catfile(split(/::/,$self->{PARENT_NAME}),$manpagename);
1325 $manpagename =~ s/\.p(od|m|l)$//;
1326 $manpagename = $self->replace_manpage_separator($manpagename);
1327 $manifypods{$name} = $self->catfile("\$(INST_MAN3DIR)","$manpagename.\$(MAN3EXT)");
1329 $self->{MAN3PODS} = \%manifypods;
1335 Initializes NAME, FULLEXT, BASEEXT, PARENT_NAME, DLBASE, PERL_SRC,
1336 PERL_LIB, PERL_ARCHLIB, PERL_INC, INSTALLDIRS, INST_*, INSTALL*,
1337 PREFIX, CONFIG, AR, AR_STATIC_ARGS, LD, OBJ_EXT, LIB_EXT, MAP_TARGET,
1338 LIBPERL_A, VERSION_FROM, VERSION, DISTNAME, VERSION_SYM.
1345 # --- Initialize Module Name and Paths
1347 # NAME = Foo::Bar::Oracle
1348 # FULLEXT = Foo/Bar/Oracle
1350 # ROOTEXT = Directory part of FULLEXT with leading /. !!! Deprecated from MM 5.32 !!!
1351 # PARENT_NAME = Foo::Bar
1353 ### ($self->{FULLEXT} =
1354 ### $self->{NAME}) =~ s!::!/!g ; #eg. BSD/Foo/Socket
1355 $self->{FULLEXT} = $self->catdir(split /::/, $self->{NAME});
1358 # Copied from DynaLoader:
1360 my(@modparts) = split(/::/,$self->{NAME});
1361 my($modfname) = $modparts[-1];
1363 # Some systems have restrictions on files names for DLL's etc.
1364 # mod2fname returns appropriate file base name (typically truncated)
1365 # It may also edit @modparts if required.
1366 if (defined &DynaLoader::mod2fname) {
1367 $modfname = &DynaLoader::mod2fname(\@modparts);
1370 ($self->{PARENT_NAME}, $self->{BASEEXT}) = $self->{NAME} =~ m!([\w:]+::)?(\w+)$! ;
1372 if (defined &DynaLoader::mod2fname) {
1373 # As of 5.001m, dl_os2 appends '_'
1374 $self->{DLBASE} = $modfname;
1376 $self->{DLBASE} = '$(BASEEXT)';
1380 ### ROOTEXT deprecated from MM 5.32
1381 ### ($self->{ROOTEXT} =
1382 ### $self->{FULLEXT}) =~ s#/?\Q$self->{BASEEXT}\E$## ; #eg. /BSD/Foo
1383 ### $self->{ROOTEXT} = ($Is_VMS ? '' : '/') . $self->{ROOTEXT} if $self->{ROOTEXT};
1386 # --- Initialize PERL_LIB, INST_LIB, PERL_SRC
1388 # *Real* information: where did we get these two from? ...
1389 my $inc_config_dir = dirname($INC{'Config.pm'});
1390 my $inc_carp_dir = dirname($INC{'Carp.pm'});
1392 unless ($self->{PERL_SRC}){
1394 foreach $dir ($self->updir(),$self->catdir($self->updir(),$self->updir()),$self->catdir($self->updir(),$self->updir(),$self->updir())){
1396 -f $self->catfile($dir,"config.sh")
1398 -f $self->catfile($dir,"perl.h")
1400 -f $self->catfile($dir,"lib","Exporter.pm")
1402 $self->{PERL_SRC}=$dir ;
1407 if ($self->{PERL_SRC}){
1408 $self->{PERL_LIB} ||= $self->catdir("$self->{PERL_SRC}","lib");
1409 $self->{PERL_ARCHLIB} = $self->{PERL_LIB};
1410 $self->{PERL_INC} = $self->{PERL_SRC};
1411 # catch a situation that has occurred a few times in the past:
1413 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);
1414 You cannot build extensions below the perl source tree after executing
1415 a 'make clean' in the perl source tree.
1417 To rebuild extensions distributed with the perl source you should
1418 simply Configure (to include those extensions) and then build perl as
1419 normal. After installing perl the source tree can be deleted. It is
1420 not needed for building extensions by running 'perl Makefile.PL'
1421 usually without extra arguments.
1423 It is recommended that you unpack and build additional extensions away
1424 from the perl source tree.
1427 # we should also consider $ENV{PERL5LIB} here
1428 $self->{PERL_LIB} ||= $Config::Config{privlibexp};
1429 $self->{PERL_ARCHLIB} ||= $Config::Config{archlibexp};
1430 $self->{PERL_INC} = $self->catdir("$self->{PERL_ARCHLIB}","CORE"); # wild guess for now
1432 die <<EOM unless (-f ($perl_h = $self->catfile($self->{PERL_INC},"perl.h")));
1433 Error: Unable to locate installed Perl libraries or Perl source code.
1435 It is recommended that you install perl in a standard location before
1436 building extensions. You can say:
1438 $^X Makefile.PL PERL_SRC=/path/to/perl/source/directory
1440 if you have not yet installed perl but still want to build this
1442 (You get this message, because MakeMaker could not find "$perl_h")
1445 # print STDOUT "Using header files found in $self->{PERL_INC}\n"
1446 # if $Verbose && $self->needs_linking();
1450 # We get SITELIBEXP and SITEARCHEXP directly via
1451 # Get_from_Config. When we are running standard modules, these
1452 # won't matter, we will set INSTALLDIRS to "perl". Otherwise we
1453 # set it to "site". I prefer that INSTALLDIRS be set from outside
1455 $self->{INSTALLDIRS} ||= "site";
1457 # INST_LIB typically pre-set if building an extension after
1458 # perl has been built and installed. Setting INST_LIB allows
1459 # you to build directly into, say $Config::Config{privlibexp}.
1460 unless ($self->{INST_LIB}){
1463 ##### XXXXX We have to change this nonsense
1465 if (defined $self->{PERL_SRC} and $self->{INSTALLDIRS} eq "perl") {
1466 $self->{INST_LIB} = $self->{INST_ARCHLIB} = $self->{PERL_LIB};
1468 $self->{INST_LIB} = $self->catdir($self->curdir,"blib","lib");
1471 $self->{INST_ARCHLIB} ||= $self->catdir($self->curdir,"blib","arch");
1472 $self->{INST_BIN} ||= $self->catdir($self->curdir,'blib','bin');
1474 # We need to set up INST_LIBDIR before init_libscan() for VMS
1475 my @parentdir = split(/::/, $self->{PARENT_NAME});
1476 $self->{INST_LIBDIR} = $self->catdir('$(INST_LIB)',@parentdir);
1477 $self->{INST_ARCHLIBDIR} = $self->catdir('$(INST_ARCHLIB)',@parentdir);
1478 $self->{INST_AUTODIR} = $self->catdir('$(INST_LIB)','auto','$(FULLEXT)');
1479 $self->{INST_ARCHAUTODIR} = $self->catdir('$(INST_ARCHLIB)','auto','$(FULLEXT)');
1481 # INST_EXE is deprecated, should go away March '97
1482 $self->{INST_EXE} ||= $self->catdir($self->curdir,'blib','script');
1483 $self->{INST_SCRIPT} ||= $self->catdir($self->curdir,'blib','script');
1485 # The user who requests an installation directory explicitly
1486 # should not have to tell us a architecture installation directory
1487 # as well We look if a directory exists that is named after the
1488 # architecture. If not we take it as a sign that it should be the
1489 # same as the requested installation directory. Otherwise we take
1491 # We do the same thing twice: for privlib/archlib and for sitelib/sitearch
1493 for $libpair ({l=>"privlib", a=>"archlib"}, {l=>"sitelib", a=>"sitearch"}) {
1494 my $lib = "install$libpair->{l}";
1496 my $Arch = uc "install$libpair->{a}";
1497 if( $self->{$Lib} && ! $self->{$Arch} ){
1498 my($ilib) = $Config{$lib};
1499 $ilib = VMS::Filespec::unixify($ilib) if $Is_VMS;
1501 $self->prefixify($Arch,$ilib,$self->{$Lib});
1503 unless (-d $self->{$Arch}) {
1504 print STDOUT "Directory $self->{$Arch} not found, thusly\n" if $Verbose;
1505 $self->{$Arch} = $self->{$Lib};
1507 print STDOUT "Defaulting $Arch to $self->{$Arch}\n" if $Verbose;
1511 # we have to look at the relation between $Config{prefix} and the
1512 # requested values. We're going to set the $Config{prefix} part of
1513 # all the installation path variables to literally $(PREFIX), so
1514 # the user can still say make PREFIX=foo
1515 my($prefix) = $Config{'prefix'};
1516 $prefix = VMS::Filespec::unixify($prefix) if $Is_VMS;
1517 unless ($self->{PREFIX}){
1518 $self->{PREFIX} = $prefix;
1520 my($install_variable);
1521 for $install_variable (qw/
1523 INSTALLPRIVLIB INSTALLARCHLIB INSTALLBIN
1524 INSTALLMAN1DIR INSTALLMAN3DIR INSTALLSCRIPT
1525 INSTALLSITELIB INSTALLSITEARCH
1528 $self->prefixify($install_variable,$prefix,q[$(PREFIX)]);
1532 # Now we head at the manpages. Maybe they DO NOT want manpages
1534 $self->{INSTALLMAN1DIR} = $Config::Config{installman1dir}
1535 unless defined $self->{INSTALLMAN1DIR};
1536 unless (defined $self->{INST_MAN1DIR}){
1537 if ($self->{INSTALLMAN1DIR} =~ /^(none|\s*)$/){
1538 $self->{INST_MAN1DIR} = $self->{INSTALLMAN1DIR};
1540 $self->{INST_MAN1DIR} = $self->catdir($self->curdir,'blib','man1');
1543 $self->{MAN1EXT} ||= $Config::Config{man1ext};
1545 $self->{INSTALLMAN3DIR} = $Config::Config{installman3dir}
1546 unless defined $self->{INSTALLMAN3DIR};
1547 unless (defined $self->{INST_MAN3DIR}){
1548 if ($self->{INSTALLMAN3DIR} =~ /^(none|\s*)$/){
1549 $self->{INST_MAN3DIR} = $self->{INSTALLMAN3DIR};
1551 $self->{INST_MAN3DIR} = $self->catdir($self->curdir,'blib','man3');
1554 $self->{MAN3EXT} ||= $Config::Config{man3ext};
1557 # Get some stuff out of %Config if we haven't yet done so
1558 print STDOUT "CONFIG must be an array ref\n"
1559 if ($self->{CONFIG} and ref $self->{CONFIG} ne 'ARRAY');
1560 $self->{CONFIG} = [] unless (ref $self->{CONFIG});
1561 push(@{$self->{CONFIG}}, @ExtUtils::MakeMaker::Get_from_Config);
1562 push(@{$self->{CONFIG}}, 'shellflags') if $Config::Config{shellflags};
1564 foreach $m (@{$self->{CONFIG}}){
1565 next if $once_only{$m};
1566 print STDOUT "CONFIG key '$m' does not exist in Config.pm\n"
1567 unless exists $Config::Config{$m};
1568 $self->{uc $m} ||= $Config::Config{$m};
1572 # This is too dangerous:
1573 # if ($^O eq "next") {
1574 # $self->{AR} = "libtool";
1575 # $self->{AR_STATIC_ARGS} = "-o";
1577 # But I leave it as a placeholder
1579 $self->{AR_STATIC_ARGS} ||= "cr";
1581 # These should never be needed
1582 $self->{LD} ||= 'ld';
1583 $self->{OBJ_EXT} ||= '.o';
1584 $self->{LIB_EXT} ||= '.a';
1586 $self->{MAP_TARGET} ||= "perl";
1588 $self->{LIBPERL_A} ||= "libperl$self->{LIB_EXT}";
1590 # make a simple check if we find Exporter
1591 warn "Warning: PERL_LIB ($self->{PERL_LIB}) seems not to be a perl library directory
1592 (Exporter.pm not found)"
1593 unless -f $self->catfile("$self->{PERL_LIB}","Exporter.pm") ||
1594 $self->{NAME} eq "ExtUtils::MakeMaker";
1596 # Determine VERSION and VERSION_FROM
1597 ($self->{DISTNAME}=$self->{NAME}) =~ s#(::)#-#g unless $self->{DISTNAME};
1598 if ($self->{VERSION_FROM}){
1599 $self->{VERSION} = $self->parse_version($self->{VERSION_FROM}) or
1600 Carp::carp "WARNING: Setting VERSION via file '$self->{VERSION_FROM}' failed\n"
1604 if ($self->{VERSION}) {
1605 $self->{VERSION} =~ s/^\s+//;
1606 $self->{VERSION} =~ s/\s+$//;
1609 $self->{VERSION} ||= "0.10";
1610 ($self->{VERSION_SYM} = $self->{VERSION}) =~ s/\W/_/g;
1613 # Graham Barr and Paul Marquess had some ideas how to ensure
1614 # version compatibility between the *.pm file and the
1615 # corresponding *.xs file. The bottomline was, that we need an
1616 # XS_VERSION macro that defaults to VERSION:
1617 $self->{XS_VERSION} ||= $self->{VERSION};
1619 # --- Initialize Perl Binary Locations
1621 # Find Perl 5. The only contract here is that both 'PERL' and 'FULLPERL'
1622 # will be working versions of perl 5. miniperl has priority over perl
1623 # for PERL to ensure that $(PERL) is usable while building ./ext/*
1624 my ($component,@defpath);
1625 foreach $component ($self->{PERL_SRC}, $self->path(), $Config::Config{binexp}) {
1626 push @defpath, $component if defined $component;
1629 $self->find_perl(5.0, [ $^X, 'miniperl','perl','perl5',"perl$]" ],
1630 \@defpath, $Verbose ) unless ($self->{PERL});
1631 # don't check if perl is executable, maybe they have decided to
1632 # supply switches with perl
1634 # Define 'FULLPERL' to be a non-miniperl (used in test: target)
1635 ($self->{FULLPERL} = $self->{PERL}) =~ s/miniperl/perl/i
1636 unless ($self->{FULLPERL});
1641 Initializes EXTRALIBS, BSLOADLIBS, LDLOADLIBS, LIBS, LD_RUN_PATH,
1642 OBJECT, BOOTDEP, PERLMAINCC, LDFROM, LINKTYPE, NOOP, FIRST_MAKEFILE,
1643 MAKEFILE, NOECHO, RM_F, RM_RF, TOUCH, CP, MV, CHMOD, UMASK_NULL
1647 sub init_others { # --- Initialize Other Attributes
1650 # Compute EXTRALIBS, BSLOADLIBS and LDLOADLIBS from $self->{LIBS}
1651 # Lets look at $self->{LIBS} carefully: It may be an anon array, a string or
1652 # undefined. In any case we turn it into an anon array:
1654 # May check $Config{libs} too, thus not empty.
1655 $self->{LIBS}=[''] unless $self->{LIBS};
1657 $self->{LIBS}=[$self->{LIBS}] if ref \$self->{LIBS} eq SCALAR;
1658 $self->{LD_RUN_PATH} = "";
1660 foreach $libs ( @{$self->{LIBS}} ){
1661 $libs =~ s/^\s*(.*\S)\s*$/$1/; # remove leading and trailing whitespace
1662 my(@libs) = $self->extliblist($libs);
1663 if ($libs[0] or $libs[1] or $libs[2]){
1664 # LD_RUN_PATH now computed by ExtUtils::Liblist
1665 ($self->{EXTRALIBS}, $self->{BSLOADLIBS}, $self->{LDLOADLIBS}, $self->{LD_RUN_PATH}) = @libs;
1670 if ( $self->{OBJECT} ) {
1671 $self->{OBJECT} =~ s!\.o(bj)?\b!\$(OBJ_EXT)!g;
1673 # init_dirscan should have found out, if we have C files
1674 $self->{OBJECT} = "";
1675 $self->{OBJECT} = '$(BASEEXT)$(OBJ_EXT)' if @{$self->{C}||[]};
1677 $self->{OBJECT} =~ s/\n+/ \\\n\t/g;
1678 $self->{BOOTDEP} = (-f "$self->{BASEEXT}_BS") ? "$self->{BASEEXT}_BS" : "";
1679 $self->{PERLMAINCC} ||= '$(CC)';
1680 $self->{LDFROM} = '$(OBJECT)' unless $self->{LDFROM};
1682 # Sanity check: don't define LINKTYPE = dynamic if we're skipping
1683 # the 'dynamic' section of MM. We don't have this problem with
1684 # 'static', since we either must use it (%Config says we can't
1685 # use dynamic loading) or the caller asked for it explicitly.
1686 if (!$self->{LINKTYPE}) {
1687 $self->{LINKTYPE} = $self->{SKIPHASH}{'dynamic'}
1689 : ($Config::Config{usedl} ? 'dynamic' : 'static');
1692 # These get overridden for VMS and maybe some other systems
1693 $self->{NOOP} ||= "sh -c true";
1694 $self->{FIRST_MAKEFILE} ||= "Makefile";
1695 $self->{MAKEFILE} ||= $self->{FIRST_MAKEFILE};
1696 $self->{MAKE_APERL_FILE} ||= "Makefile.aperl";
1697 $self->{NOECHO} = '@' unless defined $self->{NOECHO};
1698 $self->{RM_F} ||= "rm -f";
1699 $self->{RM_RF} ||= "rm -rf";
1700 $self->{TOUCH} ||= "touch";
1701 $self->{CP} ||= "cp";
1702 $self->{MV} ||= "mv";
1703 $self->{CHMOD} ||= "chmod";
1704 $self->{UMASK_NULL} ||= "umask 0";
1709 Defines the install target.
1714 my($self, %attribs) = @_;
1718 install :: all pure_install doc_install
1720 install_perl :: all pure_perl_install doc_perl_install
1722 install_site :: all pure_site_install doc_site_install
1724 install_ :: install_site
1725 @echo INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
1727 pure_install :: pure_$(INSTALLDIRS)_install
1729 doc_install :: doc_$(INSTALLDIRS)_install
1730 }.$self->{NOECHO}.q{echo Appending installation info to $(INSTALLARCHLIB)/perllocal.pod
1732 pure__install : pure_site_install
1733 @echo INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
1735 doc__install : doc_site_install
1736 @echo INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
1738 pure_perl_install ::
1739 }.$self->{NOECHO}.q{$(MOD_INSTALL) \
1740 read }.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{ \
1741 write }.$self->catfile('$(INSTALLARCHLIB)','auto','$(FULLEXT)','.packlist').q{ \
1742 $(INST_LIB) $(INSTALLPRIVLIB) \
1743 $(INST_ARCHLIB) $(INSTALLARCHLIB) \
1744 $(INST_BIN) $(INSTALLBIN) \
1745 $(INST_SCRIPT) $(INSTALLSCRIPT) \
1746 $(INST_MAN1DIR) $(INSTALLMAN1DIR) \
1747 $(INST_MAN3DIR) $(INSTALLMAN3DIR)
1748 }.$self->{NOECHO}.q{$(WARN_IF_OLD_PACKLIST) \
1749 }.$self->catdir('$(SITEARCHEXP)','auto','$(FULLEXT)').q{
1752 pure_site_install ::
1753 }.$self->{NOECHO}.q{$(MOD_INSTALL) \
1754 read }.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{ \
1755 write }.$self->catfile('$(INSTALLSITEARCH)','auto','$(FULLEXT)','.packlist').q{ \
1756 $(INST_LIB) $(INSTALLSITELIB) \
1757 $(INST_ARCHLIB) $(INSTALLSITEARCH) \
1758 $(INST_BIN) $(INSTALLBIN) \
1759 $(INST_SCRIPT) $(INSTALLSCRIPT) \
1760 $(INST_MAN1DIR) $(INSTALLMAN1DIR) \
1761 $(INST_MAN3DIR) $(INSTALLMAN3DIR)
1762 }.$self->{NOECHO}.q{$(WARN_IF_OLD_PACKLIST) \
1763 }.$self->catdir('$(PERL_ARCHLIB)','auto','$(FULLEXT)').q{
1766 }.$self->{NOECHO}.q{$(DOC_INSTALL) \
1768 "installed into" "$(INSTALLPRIVLIB)" \
1769 LINKTYPE "$(LINKTYPE)" \
1770 VERSION "$(VERSION)" \
1771 EXE_FILES "$(EXE_FILES)" \
1772 >> }.$self->catfile('$(INSTALLARCHLIB)','perllocal.pod').q{
1775 }.$self->{NOECHO}.q{$(DOC_INSTALL) \
1777 "installed into" "$(INSTALLSITELIB)" \
1778 LINKTYPE "$(LINKTYPE)" \
1779 VERSION "$(VERSION)" \
1780 EXE_FILES "$(EXE_FILES)" \
1781 >> }.$self->catfile('$(INSTALLARCHLIB)','perllocal.pod').q{
1786 uninstall :: uninstall_from_$(INSTALLDIRS)dirs
1788 uninstall_from_perldirs ::
1790 q{$(UNINSTALL) }.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{
1792 uninstall_from_sitedirs ::
1794 q{$(UNINSTALL) }.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{
1800 =item installbin (o)
1802 Defines targets to install EXE_FILES.
1808 return "" unless $self->{EXE_FILES} && ref $self->{EXE_FILES} eq "ARRAY";
1809 return "" unless @{$self->{EXE_FILES}};
1810 my(@m, $from, $to, %fromto, @to);
1811 push @m, $self->dir_target(qw[$(INST_SCRIPT)]);
1812 for $from (@{$self->{EXE_FILES}}) {
1813 my($path)= $self->catfile('$(INST_SCRIPT)', basename($from));
1814 local($_) = $path; # for backwards compatibility
1815 $to = $self->libscan($path);
1816 print "libscan($from) => '$to'\n" if ($Verbose >=2);
1819 @to = values %fromto;
1821 EXE_FILES = @{$self->{EXE_FILES}}
1829 while (($from,$to) = each %fromto) {
1830 last unless defined $from;
1831 my $todir = dirname($to);
1833 $to: $from $self->{MAKEFILE} $todir/.exists
1834 $self->{NOECHO}$self->{RM_F} $to
1835 $self->{CP} $from $to
1843 Takes a path to a file that is found by init_dirscan and returns false
1844 if we don't want to include this file in the library. Mainly used to
1845 exclude RCS, CVS, and SCCS directories from installation.
1852 my($self,$path) = @_;
1853 return '' if $path =~ m:\b(RCS|CVS|SCCS)\b: ;
1859 Defines the linkext target which in turn defines the LINKTYPE.
1864 my($self, %attribs) = @_;
1865 # LINKTYPE => static or dynamic or ''
1866 my($linktype) = defined $attribs{LINKTYPE} ?
1867 $attribs{LINKTYPE} : '$(LINKTYPE)';
1869 linkext :: $linktype
1870 $self->{NOECHO}\$(NOOP)
1876 Takes as arguments a directory name and a regular expression. Returns
1877 all entries in the directory that match the regular expression.
1883 my($dir, $regex) = @_;
1885 my $dh = new DirHandle;
1886 $dh->open($dir || ".") or return ();
1889 @ls = grep(/$regex/, @ls) if $regex;
1895 Simple subroutine to insert the macros defined by the macro attribute
1901 my($self,%attribs) = @_;
1903 while (($key,$val) = each %attribs){
1904 last unless defined $key;
1905 push @m, "$key = $val\n";
1912 Called by staticmake. Defines how to write the Makefile to produce a
1918 my($self, %attribs) = @_;
1919 my($makefilename, $searchdirs, $static, $extra, $perlinc, $target, $tmp, $libperl) =
1920 @attribs{qw(MAKE DIRS STAT EXTRA INCL TARGET TMP LIBPERL)};
1923 # --- MakeMaker makeaperl section ---
1924 MAP_TARGET = $target
1925 FULLPERL = $self->{FULLPERL}
1927 return join '', @m if $self->{PARENT};
1929 my($dir) = join ":", @{$self->{DIR}};
1931 unless ($self->{MAKEAPERL}) {
1933 $(MAP_TARGET) :: static $(MAKE_APERL_FILE)
1934 $(MAKE) -f $(MAKE_APERL_FILE) $@
1936 $(MAKE_APERL_FILE) : $(FIRST_MAKEFILE)
1937 }.$self->{NOECHO}.q{echo Writing \"$(MAKE_APERL_FILE)\" for this $(MAP_TARGET)
1938 }.$self->{NOECHO}.q{$(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \
1939 Makefile.PL DIR=}, $dir, q{ \
1940 MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \
1941 MAKEAPERL=1 NORECURS=1 CCCDLFLAGS=};
1947 push @m, " \\\n\t\t$_";
1949 # push @m, map( " \\\n\t\t$_", @ARGV );
1957 my($cccmd, $linkcmd, $lperl);
1960 $cccmd = $self->const_cccmd($libperl);
1961 $cccmd =~ s/^CCCMD\s*=\s*//;
1962 $cccmd =~ s/\$\(INC\)/ -I$self->{PERL_INC} /;
1963 $cccmd .= " $Config::Config{cccdlflags}" if ($Config::Config{d_shrplib});
1964 $cccmd =~ s/\(CC\)/\(PERLMAINCC\)/;
1966 # The front matter of the linkcommand...
1967 $linkcmd = join ' ', "\$(CC)",
1968 grep($_, @Config{qw(large split ldflags ccdlflags)});
1969 $linkcmd =~ s/\s+/ /g;
1970 $linkcmd =~ s,(perl\.exp),\$(PERL_INC)/$1,;
1972 # Which *.a files could we make use of...
1975 File::Find::find(sub {
1976 return unless m/\Q$self->{LIB_EXT}\E$/;
1977 return if m/^libperl/;
1979 if( exists $self->{INCLUDE_EXT} ){
1984 ($xx = $File::Find::name) =~ s,.*?/auto/,,;
1988 # Throw away anything not explicitly marked for inclusion.
1989 # DynaLoader is implied.
1990 foreach $incl ((@{$self->{INCLUDE_EXT}},'DynaLoader')){
1996 return unless $found;
1998 elsif( exists $self->{EXCLUDE_EXT} ){
2002 ($xx = $File::Find::name) =~ s,.*?/auto/,,;
2006 # Throw away anything explicitly marked for exclusion
2007 foreach $excl (@{$self->{EXCLUDE_EXT}}){
2008 return if( $xx eq $excl );
2012 # don't include the installed version of this extension. I
2013 # leave this line here, although it is not necessary anymore:
2014 # I patched minimod.PL instead, so that Miniperl.pm won't
2015 # enclude duplicates
2017 # Once the patch to minimod.PL is in the distribution, I can
2019 return if $File::Find::name =~ m:auto/$self->{FULLEXT}/$self->{BASEEXT}$self->{LIB_EXT}$:;
2021 $static{cwd() . "/" . $_}++;
2022 }, grep( -d $_, @{$searchdirs || []}) );
2024 # We trust that what has been handed in as argument, will be buildable
2025 $static = [] unless $static;
2026 @static{@{$static}} = (1) x @{$static};
2028 $extra = [] unless $extra && ref $extra eq 'ARRAY';
2029 for (sort keys %static) {
2030 next unless /\Q$self->{LIB_EXT}\E$/;
2031 $_ = dirname($_) . "/extralibs.ld";
2035 grep(s/^/-I/, @{$perlinc || []});
2037 $target = "perl" unless $target;
2038 $tmp = "." unless $tmp;
2040 # MAP_STATIC doesn't look into subdirs yet. Once "all" is made and we
2041 # regenerate the Makefiles, MAP_STATIC and the dependencies for
2042 # extralibs.all are computed correctly
2044 MAP_LINKCMD = $linkcmd
2045 MAP_PERLINC = @{$perlinc || []}
2047 join(" \\\n\t", reverse sort keys %static), "
2049 MAP_PRELIBS = $Config::Config{libs} $Config::Config{cryptlib}
2052 if (defined $libperl) {
2053 ($lperl = $libperl) =~ s/\$\(A\)/$self->{LIB_EXT}/;
2055 unless ($libperl && -f $lperl) { # Ilya's code...
2056 my $dir = $self->{PERL_SRC} || "$self->{PERL_ARCHLIB}/CORE";
2057 $libperl ||= "libperl$self->{LIB_EXT}";
2058 $libperl = "$dir/$libperl";
2059 $lperl ||= "libperl$self->{LIB_EXT}";
2060 $lperl = "$dir/$lperl";
2061 print STDOUT "Warning: $libperl not found
2062 If you're going to build a static perl binary, make sure perl is installed
2063 otherwise ignore this warning\n"
2064 unless (-f $lperl || defined($self->{PERL_SRC}));
2068 MAP_LIBPERL = $libperl
2072 \$(INST_ARCHAUTODIR)/extralibs.all: \$(INST_ARCHAUTODIR)/.exists ".join(" \\\n\t", @$extra)."
2073 $self->{NOECHO}$self->{RM_F} \$\@
2074 $self->{NOECHO}\$(TOUCH) \$\@
2078 foreach $catfile (@$extra){
2079 push @m, "\tcat $catfile >> \$\@\n";
2083 \$(MAP_TARGET) :: $tmp/perlmain\$(OBJ_EXT) \$(MAP_LIBPERL) \$(MAP_STATIC) \$(INST_ARCHAUTODIR)/extralibs.all
2084 \$(MAP_LINKCMD) -o \$\@ \$(OPTIMIZE) $tmp/perlmain\$(OBJ_EXT) \$(MAP_LIBPERL) \$(MAP_STATIC) `cat \$(INST_ARCHAUTODIR)/extralibs.all` \$(MAP_PRELIBS)
2085 $self->{NOECHO}echo 'To install the new \"\$(MAP_TARGET)\" binary, call'
2086 $self->{NOECHO}echo ' make -f $makefilename inst_perl MAP_TARGET=\$(MAP_TARGET)'
2087 $self->{NOECHO}echo 'To remove the intermediate files say'
2088 $self->{NOECHO}echo ' make -f $makefilename map_clean'
2090 $tmp/perlmain\$(OBJ_EXT): $tmp/perlmain.c
2092 push @m, "\tcd $tmp && $cccmd -I\$(PERL_INC) perlmain.c\n";
2095 $tmp/perlmain.c: $makefilename}, q{
2096 }.$self->{NOECHO}.q{echo Writing $@
2097 }.$self->{NOECHO}.q{$(PERL) $(MAP_PERLINC) -e 'use ExtUtils::Miniperl; \\
2098 writemain(grep s#.*/auto/##, qw|$(MAP_STATIC)|)' > $@.tmp && mv $@.tmp $@
2104 }.$self->{NOECHO}.q{echo Appending installation info to $(INSTALLARCHLIB)/perllocal.pod
2105 }.$self->{NOECHO}.q{$(DOC_INSTALL) \
2106 "Perl binary $(MAP_TARGET)" \
2107 MAP_STATIC "$(MAP_STATIC)" \
2108 MAP_EXTRA "`cat $(INST_ARCHAUTODIR)/extralibs.all`" \
2109 MAP_LIBPERL "$(MAP_LIBPERL)" \
2110 >> }.$self->catfile('$(INSTALLARCHLIB)','perllocal.pod').q{
2115 inst_perl: pure_inst_perl doc_inst_perl
2117 pure_inst_perl: $(MAP_TARGET)
2118 }.$self->{CP}.q{ $(MAP_TARGET) }.$self->catfile('$(INSTALLBIN)','$(MAP_TARGET)').q{
2123 }.$self->{RM_F}.qq{ $tmp/perlmain\$(OBJ_EXT) $tmp/perlmain.c \$(MAP_TARGET) $makefilename \$(INST_ARCHAUTODIR)/extralibs.all
2131 Defines how to rewrite the Makefile.
2138 # We do not know what target was originally specified so we
2139 # must force a manual rerun to be sure. But as it should only
2140 # happen very rarely it is not a significant problem.
2142 $(OBJECT) : $(FIRST_MAKEFILE)
2143 ' if $self->{OBJECT};
2146 # We take a very conservative approach here, but it\'s worth it.
2147 # We move Makefile to Makefile.old here to avoid gnu make looping.
2148 }.$self->{MAKEFILE}.q{ : Makefile.PL $(CONFIGDEP)
2149 }.$self->{NOECHO}.q{echo "Makefile out-of-date with respect to $?"
2150 }.$self->{NOECHO}.q{echo "Cleaning current config before rebuilding Makefile..."
2151 -}.$self->{NOECHO}.q{mv }."$self->{MAKEFILE} $self->{MAKEFILE}.old".q{
2152 -$(MAKE) -f }.$self->{MAKEFILE}.q{.old clean >/dev/null 2>&1 || true
2153 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" Makefile.PL }.join(" ",map(qq["$_"],@ARGV)).q{
2154 }.$self->{NOECHO}.q{echo ">>> Your Makefile has been rebuilt. <<<"
2155 }.$self->{NOECHO}.q{echo ">>> Please rerun the make command. <<<"; false
2157 # To change behavior to :: would be nice, but would break Tk b9.02
2158 # so you find such a warning below the dist target.
2159 #}.$self->{MAKEFILE}.q{ :: $(VERSION_FROM)
2160 # }.$self->{NOECHO}.q{echo "Warning: Makefile possibly out of date with $(VERSION_FROM)"
2166 =item manifypods (o)
2168 Defines targets and routines to translate the pods into manpages and
2169 put them into the INST_* directories.
2174 my($self, %attribs) = @_;
2175 return "\nmanifypods :\n\t$self->{NOECHO}\$(NOOP)\n" unless %{$self->{MAN3PODS}} or %{$self->{MAN1PODS}};
2178 if (defined $self->{PERL_SRC}) {
2179 $pod2man_exe = $self->catfile($self->{PERL_SRC},'pod','pod2man');
2181 $pod2man_exe = $self->catfile($Config{scriptdirexp},'pod2man');
2183 unless ($self->perl_script($pod2man_exe)) {
2184 # No pod2man but some MAN3PODS to be installed
2187 Warning: I could not locate your pod2man program. Please make sure,
2188 your pod2man program is in your PATH before you execute 'make'
2191 $pod2man_exe = "-S pod2man";
2195 qq[POD2MAN_EXE = $pod2man_exe\n],
2196 q[POD2MAN = $(PERL) -we '%m=@ARGV;for (keys %m){' \\
2197 -e 'next if -e $$m{$$_} && -M $$m{$$_} < -M $$_ && -M $$m{$$_} < -M "].$self->{MAKEFILE}.q[";' \\
2198 -e 'print "Manifying $$m{$$_}\n";' \\
2199 -e 'system(qq[$$^X ].q["-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" $(POD2MAN_EXE) ].qq[$$_>$$m{$$_}])==0 or warn "Couldn\\047t install $$m{$$_}\n";' \\
2200 -e 'chmod 0644, $$m{$$_} or warn "chmod 644 $$m{$$_}: $$!\n";}'
2202 push @m, "\nmanifypods : ";
2203 push @m, join " \\\n\t", keys %{$self->{MAN1PODS}}, keys %{$self->{MAN3PODS}};
2206 if (%{$self->{MAN1PODS}} || %{$self->{MAN3PODS}}) {
2207 push @m, "\t$self->{NOECHO}\$(POD2MAN) \\\n\t";
2208 push @m, join " \\\n\t", %{$self->{MAN1PODS}}, %{$self->{MAN3PODS}};
2215 Returns true, if the argument is likely to be a command.
2220 my($self,$file) = @_;
2221 return $file if -x $file && ! -d $file;
2225 =item maybe_command_in_dirs
2227 method under development. Not yet used. Ask Ilya :-)
2231 sub maybe_command_in_dirs { # $ver is optional argument if looking for perl
2232 # Ilya's suggestion. Not yet used, want to understand it first, but at least the code is here
2233 my($self, $names, $dirs, $trace, $ver) = @_;
2235 foreach $dir (@$dirs){
2236 next unless defined $dir; # $self->{PERL_SRC} may be undefined
2237 foreach $name (@$names){
2239 if ($self->file_name_is_absolute($name)) { # /foo/bar
2241 } elsif ($self->canonpath($name) eq $self->canonpath(basename($name))) { # bar
2242 $abs = $self->catfile($dir, $name);
2244 $abs = $self->catfile($self->curdir, $name);
2246 print "Checking $abs for $name\n" if ($trace >= 2);
2247 next unless $tryabs = $self->maybe_command($abs);
2248 print "Substituting $tryabs instead of $abs\n"
2249 if ($trace >= 2 and $tryabs ne $abs);
2252 print "Executing $abs\n" if ($trace >= 2);
2253 if (`$abs -e 'require $ver; print "VER_OK\n" ' 2>&1` =~ /VER_OK/) {
2254 print "Using PERL=$abs\n" if $trace;
2257 } else { # Do not look for perl
2264 =item needs_linking (o)
2266 Does this module need linking? Looks into subdirectory objects (see
2267 also has_link_code())
2274 $caller = (caller(0))[3];
2275 Carp::confess("Needs_linking called too early") if $caller =~ /^ExtUtils::MakeMaker::/;
2276 return $self->{NEEDS_LINKING} if defined $self->{NEEDS_LINKING};
2277 if ($self->has_link_code or $self->{MAKEAPERL}){
2278 $self->{NEEDS_LINKING} = 1;
2281 foreach $child (keys %{$self->{CHILDREN}}) {
2282 if ($self->{CHILDREN}->{$child}->needs_linking) {
2283 $self->{NEEDS_LINKING} = 1;
2287 return $self->{NEEDS_LINKING} = 0;
2292 misnamed method (will have to be changed). The MM_Unix method just
2293 returns the argument without further processing.
2295 On VMS used to insure that colons marking targets are preceded by
2296 space - most Unix Makes don't need this, but it's necessary under VMS
2297 to distinguish the target delimiter from a colon appearing as part of
2303 my($self,$text) = @_;
2309 parse a file and return what you think is $VERSION in this file set to
2314 my($self,$parsefile) = @_;
2318 open(FH,$parsefile) or die "Could not open '$parsefile': $!";
2321 $inpod = /^=(?!cut)/ ? 1 : /^=cut/ ? 0 : $inpod;
2324 next unless /\$(([\w\:\']*)\bVERSION)\b.*\=/;
2325 local $ExtUtils::MakeMaker::module_version_variable = $1;
2326 my($thispackage) = $2 || $current_package;
2327 $thispackage =~ s/:+$//;
2330 die "Could not eval '$eval' in $parsefile: $@" if $@;
2331 $result = $ {$ExtUtils::MakeMaker::module_version_variable} || 0;
2341 Defines the string that is passed to recursive make calls in
2352 foreach $key (qw(LIBPERL_A LINKTYPE PREFIX OPTIMIZE)){
2353 push @pasthru, "$key=\"\$($key)\"";
2356 push @m, "\nPASTHRU = ", join ("\\\n\t", @pasthru), "\n";
2362 Takes no argument, returns the environment variable PATH as an array.
2368 my $path_sep = $Is_OS2 ? ";" : ":";
2369 my $path = $ENV{PATH};
2370 $path =~ s:\\:/:g if $Is_OS2;
2371 my @path = split $path_sep, $path;
2372 foreach(@path) { $_ = '.' if $_ eq '' }
2378 Takes one argument, a file name, and returns the file name, if the
2379 argument is likely to be a perl script. On MM_Unix this is true for
2380 any ordinary, readable file.
2385 my($self,$file) = @_;
2386 return $file if -r $file && -f _;
2390 =item perldepend (o)
2392 Defines the dependency from all *.h files that come with the perl
2401 # Check for unpropogated config.sh changes. Should never happen.
2402 # We do NOT just update config.h because that is not sufficient.
2403 # An out of date config.h is not fatal but complains loudly!
2404 $(PERL_INC)/config.h: $(PERL_SRC)/config.sh
2405 -}.$self->{NOECHO}.q{echo "Warning: $(PERL_INC)/config.h out of date with $(PERL_SRC)/config.sh"; false
2407 $(PERL_ARCHLIB)/Config.pm: $(PERL_SRC)/config.sh
2408 }.$self->{NOECHO}.q{echo "Warning: $(PERL_ARCHLIB)/Config.pm may be out of date with $(PERL_SRC)/config.sh"
2409 cd $(PERL_SRC) && $(MAKE) lib/Config.pm
2410 } if $self->{PERL_SRC};
2412 return join "", @m unless $self->needs_linking;
2416 $(PERL_INC)/EXTERN.h $(PERL_INC)/gv.h $(PERL_INC)/pp.h \
2417 $(PERL_INC)/INTERN.h $(PERL_INC)/handy.h $(PERL_INC)/proto.h \
2418 $(PERL_INC)/XSUB.h $(PERL_INC)/hv.h $(PERL_INC)/regcomp.h \
2419 $(PERL_INC)/av.h $(PERL_INC)/keywords.h $(PERL_INC)/regexp.h \
2420 $(PERL_INC)/config.h $(PERL_INC)/mg.h $(PERL_INC)/scope.h \
2421 $(PERL_INC)/cop.h $(PERL_INC)/op.h $(PERL_INC)/sv.h \
2422 $(PERL_INC)/cv.h $(PERL_INC)/opcode.h $(PERL_INC)/unixish.h \
2423 $(PERL_INC)/dosish.h $(PERL_INC)/patchlevel.h $(PERL_INC)/util.h \
2424 $(PERL_INC)/embed.h $(PERL_INC)/perl.h \
2425 $(PERL_INC)/form.h $(PERL_INC)/perly.h
2427 $(OBJECT) : $(PERL_HDRS)
2428 } if $self->{OBJECT};
2430 push @m, join(" ", values %{$self->{XS}})." : \$(XSUBPPDEPS)\n" if %{$self->{XS}};
2437 Defines target that copies all files in the hash PM to their
2438 destination and autosplits them. See L<ExtUtils::Install/pm_to_blib>
2444 my($autodir) = $self->catdir('$(INST_LIB)','auto');
2446 pm_to_blib: $(TO_INST_PM)
2447 }.$self->{NOECHO}.q{$(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" \
2448 "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Install \
2449 -e 'pm_to_blib({qw{$(PM_TO_BLIB)}},"}.$autodir.q{")'
2450 }.$self->{NOECHO}.q{$(TOUCH) $@
2454 =item post_constants (o)
2456 Returns an empty string per default. Dedicated to overrides from
2457 within Makefile.PL after all constants have been defined.
2466 =item post_initialize (o)
2468 Returns an ampty string per default. Used in Makefile.PLs to add some
2469 chunk of text to the Makefile after the object is initialized.
2473 sub post_initialize {
2480 Returns an empty string. Can be used in Makefile.PLs to write some
2481 text to the Makefile at the end.
2492 Check a path variable in $self from %Config, if it contains a prefix,
2493 and replace it with another one.
2495 Takes as arguments an attribute name, a search prefix and a
2496 replacement prefix. Changes the attribute in the object.
2501 my($self,$var,$sprefix,$rprefix) = @_;
2502 $self->{uc $var} ||= $Config{lc $var};
2503 $self->{uc $var} = VMS::Filespec::unixpath($self->{uc $var}) if $Is_VMS;
2504 $self->{uc $var} =~ s/\Q$sprefix\E/$rprefix/;
2509 Defines targets to run *.PL files.
2515 return "" unless $self->{PL_FILES};
2517 foreach $plfile (sort keys %{$self->{PL_FILES}}) {
2519 all :: $self->{PL_FILES}->{$plfile}
2521 $self->{PL_FILES}->{$plfile} :: $plfile
2522 \$(PERL) -I\$(INST_ARCHLIB) -I\$(INST_LIB) -I\$(PERL_ARCHLIB) -I\$(PERL_LIB) $plfile
2530 Defines the realclean target.
2535 my($self, %attribs) = @_;
2538 # Delete temporary files (via clean) and also delete installed files
2539 realclean purge :: clean
2541 # realclean subdirectories first (already cleaned)
2542 my $sub = "\t-cd %s && test -f %s && \$(MAKE) %s realclean\n";
2543 foreach(@{$self->{DIR}}){
2544 push(@m, sprintf($sub,$_,"$self->{MAKEFILE}.old","-f $self->{MAKEFILE}.old"));
2545 push(@m, sprintf($sub,$_,"$self->{MAKEFILE}",''));
2547 push(@m, " $self->{RM_RF} \$(INST_AUTODIR) \$(INST_ARCHAUTODIR)\n");
2548 if( $self->has_link_code ){
2549 push(@m, " $self->{RM_F} \$(INST_DYNAMIC) \$(INST_BOOT)\n");
2550 push(@m, " $self->{RM_F} \$(INST_STATIC)\n");
2552 push(@m, " $self->{RM_F} " . join(" ", values %{$self->{PM}}) . "\n");
2553 my(@otherfiles) = ($self->{MAKEFILE},
2554 "$self->{MAKEFILE}.old"); # Makefiles last
2555 push(@otherfiles, $attribs{FILES}) if $attribs{FILES};
2556 push(@m, " $self->{RM_RF} @otherfiles\n") if @otherfiles;
2557 push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP};
2561 =item replace_manpage_separator
2563 Takes the name of a package, which may be a nested package, in the
2564 form Foo/Bar and replaces the slash with C<::>. Returns the replacement.
2568 sub replace_manpage_separator {
2569 my($self,$man) = @_;
2576 Defines the static target.
2581 # --- Static Loading Sections ---
2585 ## $(INST_PM) has been moved to the all: target.
2586 ## It remains here for awhile to allow for old usage: "make static"
2587 #static :: '.$self->{MAKEFILE}.' $(INST_STATIC) $(INST_PM)
2588 static :: '.$self->{MAKEFILE}.' $(INST_STATIC)
2589 '.$self->{NOECHO}.'$(NOOP)
2593 =item static_lib (o)
2595 Defines how to produce the *.a (or equivalent) files.
2601 # Come to think of it, if there are subdirs with linkcode, we still have no INST_STATIC
2602 # return '' unless $self->needs_linking(); #might be because of a subdir
2604 return '' unless $self->has_link_code;
2608 $(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)/.exists
2611 # If this extension has it's own library (eg SDBM_File)
2612 # then copy that to $(INST_STATIC) and add $(OBJECT) into it.
2613 push(@m, "\t$self->{CP} \$(MYEXTLIB) \$\@\n") if $self->{MYEXTLIB};
2616 q{ $(AR) $(AR_STATIC_ARGS) $@ $(OBJECT) && $(RANLIB) $@
2617 }.$self->{NOECHO}.q{echo "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)/extralibs.ld
2621 # Old mechanism - still available:
2623 push @m, "\t$self->{NOECHO}".q{echo "$(EXTRALIBS)" >> $(PERL_SRC)/ext.libs}."\n\n"
2624 if $self->{PERL_SRC};
2626 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
2630 =item staticmake (o)
2637 my($self, %attribs) = @_;
2640 my(@searchdirs)=($self->{PERL_ARCHLIB}, $self->{SITEARCHEXP}, $self->{INST_ARCHLIB});
2642 # And as it's not yet built, we add the current extension
2643 # but only if it has some C code (or XS code, which implies C code)
2644 if (@{$self->{C}}) {
2645 @static = $self->catfile($self->{INST_ARCHLIB},
2648 "$self->{BASEEXT}$self->{LIB_EXT}"
2652 # Either we determine now, which libraries we will produce in the
2653 # subdirectories or we do it at runtime of the make.
2655 # We could ask all subdir objects, but I cannot imagine, why it
2656 # would be necessary.
2658 # Instead we determine all libraries for the new perl at
2660 my(@perlinc) = ($self->{INST_ARCHLIB}, $self->{INST_LIB}, $self->{PERL_ARCHLIB}, $self->{PERL_LIB});
2662 $self->makeaperl(MAKE => $self->{MAKEFILE},
2663 DIRS => \@searchdirs,
2666 TARGET => $self->{MAP_TARGET},
2668 LIBPERL => $self->{LIBPERL_A}
2674 Helper subroutine for subdirs
2679 my($self, $subdir) = @_;
2684 $self->{NOECHO}cd $subdir && \$(MAKE) all \$(PASTHRU)
2691 Defines targets to process subdirectories.
2696 # --- Sub-directory Sections ---
2699 # This method provides a mechanism to automatically deal with
2700 # subdirectories containing further Makefile.PL scripts.
2701 # It calls the subdir_x() method for each subdirectory.
2702 foreach $dir (@{$self->{DIR}}){
2703 push(@m, $self->subdir_x($dir));
2704 #### print "Including $dir subdirectory\n";
2708 # The default clean, realclean and test targets in this Makefile
2709 # have automatically been given entries for each subdir.
2713 push(@m, "\n# none")
2720 Defines the test targets.
2725 # --- Test and Installation Sections ---
2727 my($self, %attribs) = @_;
2728 my($tests) = $attribs{TESTS} || (-d "t" ? "t/*.t" : "");
2732 TEST_TYPE=test_\$(LINKTYPE)
2736 testdb :: testdb_\$(LINKTYPE)
2738 test :: \$(TEST_TYPE)
2740 push(@m, map("\t$self->{NOECHO}cd $_ && test -f $self->{MAKEFILE} && \$(MAKE) test \$(PASTHRU)\n",
2742 push(@m, "\t$self->{NOECHO}echo 'No tests defined for \$(NAME) extension.'\n")
2743 unless $tests or -f "test.pl" or @{$self->{DIR}};
2746 push(@m, "test_dynamic :: pure_all\n");
2747 push(@m, $self->test_via_harness('$(FULLPERL)', $tests)) if $tests;
2748 push(@m, $self->test_via_script('$(FULLPERL)', 'test.pl')) if -f "test.pl";
2751 push(@m, "testdb_dynamic :: pure_all\n");
2752 push(@m, $self->test_via_script('$(FULLPERL) $(TESTDB_SW)', '$(TEST_FILE)'));
2755 # Occasionally we may face this degenerate target:
2756 push @m, "test_ : test_dynamic\n\n";
2758 if ($self->needs_linking()) {
2759 push(@m, "test_static :: pure_all \$(MAP_TARGET)\n");
2760 push(@m, $self->test_via_harness('./$(MAP_TARGET)', $tests)) if $tests;
2761 push(@m, $self->test_via_script('./$(MAP_TARGET)', 'test.pl')) if -f "test.pl";
2763 push(@m, "testdb_static :: pure_all \$(MAP_TARGET)\n");
2764 push(@m, $self->test_via_script('./$(MAP_TARGET) $(TESTDB_SW)', '$(TEST_FILE)'));
2767 push @m, "test_static :: test_dynamic\n";
2768 push @m, "testdb_static :: testdb_dynamic\n";
2773 =item test_via_harness (o)
2775 Helper method to write the test targets
2779 sub test_via_harness {
2780 my($self, $perl, $tests) = @_;
2781 "\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";
2784 =item test_via_script (o)
2786 Other helper method for test.
2790 sub test_via_script {
2791 my($self, $perl, $script) = @_;
2792 qq{\tPERL_DL_NONLAZY=1 $perl}.q{ -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) }.qq{$script
2796 =item tool_autosplit (o)
2798 Defines a simple perl call that runs autosplit. May be deprecated by
2803 sub tool_autosplit {
2804 # --- Tool Sections ---
2806 my($self, %attribs) = @_;
2808 $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN};
2810 # Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
2811 AUTOSPLITFILE = $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e 'use AutoSplit;}.$asl.q{autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1) ;'
2815 =item tools_other (o)
2817 Defines SHELL, LD, TOUCH, CP, MV, RM_F, RM_RF, CHMOD, UMASK_NULL in
2818 the Makefile. Also defines the perl programs MKPATH,
2819 WARN_IF_OLD_PACKLIST, MOD_INSTALL. DOC_INSTALL, and UNINSTALL.
2826 my $bin_sh = $Config{sh} || '/bin/sh';
2831 for (qw/ CHMOD CP LD MV NOOP RM_F RM_RF TOUCH UMASK_NULL / ) {
2832 push @m, "$_ = $self->{$_}\n";
2837 # The following is a portable way to say mkdir -p
2838 # To see which directories are created, change the if 0 to if 1
2839 MKPATH = $(PERL) -wle '$$"="/"; foreach $$p (@ARGV){' \\
2840 -e 'next if -d $$p; my(@p); foreach(split(/\//,$$p)){' \\
2841 -e 'push(@p,$$_); next if -d "@p/"; print "mkdir @p" if 0;' \\
2842 -e 'mkdir("@p",0777)||die $$! } } exit 0;'
2844 # This helps us to minimize the effect of the .exists files A yet
2845 # better solution would be to have a stable file in the perl
2846 # distribution with a timestamp of zero. But this solution doesn't
2847 # need any changes to the core distribution and works with older perls
2848 EQUALIZE_TIMESTAMP = $(PERL) -we 'open F, ">$$ARGV[1]"; close F;' \\
2849 -e 'utime ((stat("$$ARGV[0]"))[8,9], $$ARGV[1])'
2852 return join "", @m if $self->{PARENT};
2855 # Here we warn users that an old packlist file was found somewhere,
2856 # and that they should call some uninstall routine
2857 WARN_IF_OLD_PACKLIST = $(PERL) -we 'exit unless -f $$ARGV[0];' \\
2858 -e 'print "WARNING: I have found an old package in\n";' \\
2859 -e 'print "\t$$ARGV[0].\n";' \\
2860 -e 'print "Please make sure the two installations are not conflicting\n";'
2865 MOD_INSTALL = $(PERL) -I$(INST_LIB) -I$(PERL_LIB) -MExtUtils::Install \
2866 -e 'install({@ARGV},"$(VERBINST)",0,"$(UNINST)");'
2868 DOC_INSTALL = $(PERL) -e '$$\="\n\n";print "=head3 ", scalar(localtime), ": C<", shift, ">";' \
2869 -e 'print "=over 4";' \
2870 -e 'while (defined($$key = shift) and defined($$val = shift)){print "=item *";print "C<$$key: $$val>";}' \
2873 UNINSTALL = $(PERL) -MExtUtils::Install \
2874 -e 'uninstall($$ARGV[0],1);'
2881 =item tool_xsubpp (o)
2883 Determines typemaps, xsubpp version, prototype behaviour.
2889 return "" unless $self->needs_linking;
2890 my($xsdir) = $self->catdir($self->{PERL_LIB},"ExtUtils");
2891 my(@tmdeps) = $self->catdir('$(XSUBPPDIR)','typemap');
2892 if( $self->{TYPEMAPS} ){
2894 foreach $typemap (@{$self->{TYPEMAPS}}){
2895 if( ! -f $typemap ){
2896 warn "Typemap $typemap not found.\n";
2899 push(@tmdeps, $typemap);
2903 push(@tmdeps, "typemap") if -f "typemap";
2904 my(@tmargs) = map("-typemap $_", @tmdeps);
2905 if( exists $self->{XSOPT} ){
2906 unshift( @tmargs, $self->{XSOPT} );
2910 my $xsubpp_version = $self->xsubpp_version($self->catfile($xsdir,"xsubpp"));
2912 # What are the correct thresholds for version 1 && 2 Paul?
2913 if ( $xsubpp_version > 1.923 ){
2914 $self->{XSPROTOARG} = "" unless defined $self->{XSPROTOARG};
2916 if (defined $self->{XSPROTOARG} && $self->{XSPROTOARG} =~ /\-prototypes/) {
2917 print STDOUT qq{Warning: This extension wants to pass the switch "-prototypes" to xsubpp.
2918 Your version of xsubpp is $xsubpp_version and cannot handle this.
2919 Please upgrade to a more recent version of xsubpp.
2922 $self->{XSPROTOARG} = "";
2928 XSUBPP = \$(XSUBPPDIR)/xsubpp
2929 XSPROTOARG = $self->{XSPROTOARG}
2930 XSUBPPDEPS = @tmdeps
2931 XSUBPPARGS = @tmargs
2937 my($self,$xsubpp) = @_;
2938 return $Xsubpp_Version if defined $Xsubpp_Version; # global variable
2942 # try to figure out the version number of the xsubpp on the system
2944 # first try the -v flag, introduced in 1.921 & 2.000a2
2946 return "" unless $self->needs_linking;
2948 my $command = "$self->{PERL} -I$self->{PERL_LIB} $xsubpp -v 2>&1";
2949 print "Running $command\n" if $Verbose >= 2;
2950 $version = `$command` ;
2951 warn "Running '$command' exits with status " . ($?>>8) if $?;
2954 return $Xsubpp_Version = $1 if $version =~ /^xsubpp version (.*)/ ;
2956 # nope, then try something else
2958 my $counter = '000';
2959 my ($file) = 'temp' ;
2960 $counter++ while -e "$file$counter"; # don't overwrite anything
2963 open(F, ">$file") or die "Cannot open file '$file': $!\n" ;
2965 MODULE = fred PACKAGE = fred
2974 $command = "$self->{PERL} $xsubpp $file 2>&1";
2975 print "Running $command\n" if $Verbose >= 2;
2976 my $text = `$command` ;
2977 warn "Running '$command' exits with status " . ($?>>8) if $?;
2980 # gets 1.2 -> 1.92 and 2.000a1
2981 return $Xsubpp_Version = $1 if $text =~ /automatically by xsubpp version ([\S]+)\s*/ ;
2983 # it is either 1.0 or 1.1
2984 return $Xsubpp_Version = 1.1 if $text =~ /^Warning: ignored semicolon/ ;
2986 # none of the above, so 1.0
2987 return $Xsubpp_Version = "1.0" ;
2990 =item top_targets (o)
2992 Defines the targets all, subdirs, config, and O_FILES
2997 # --- Target Sections ---
3002 #all :: config $(INST_PM) subdirs linkext manifypods
3004 all :: pure_all manifypods
3005 '.$self->{NOECHO}.'$(NOOP)
3007 pure_all :: config pm_to_blib subdirs linkext
3008 '.$self->{NOECHO}.'$(NOOP)
3010 subdirs :: $(MYEXTLIB)
3011 '.$self->{NOECHO}.'$(NOOP)
3013 config :: '.$self->{MAKEFILE}.' $(INST_LIBDIR)/.exists
3014 '.$self->{NOECHO}.'$(NOOP)
3016 config :: $(INST_ARCHAUTODIR)/.exists
3017 '.$self->{NOECHO}.'$(NOOP)
3019 config :: $(INST_AUTODIR)/.exists
3020 '.$self->{NOECHO}.'$(NOOP)
3024 config :: Version_check
3025 $self->{NOECHO}\$(NOOP)
3027 } unless $self->{PARENT} or ($self->{PERL_SRC} && $self->{INSTALLDIRS} eq "perl") or $self->{NO_VC};
3029 push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]);
3031 if (%{$self->{MAN1PODS}}) {
3033 config :: \$(INST_MAN1DIR)/.exists
3034 $self->{NOECHO}\$(NOOP)
3037 push @m, $self->dir_target(qw[$(INST_MAN1DIR)]);
3039 if (%{$self->{MAN3PODS}}) {
3041 config :: \$(INST_MAN3DIR)/.exists
3042 $self->{NOECHO}\$(NOOP)
3045 push @m, $self->dir_target(qw[$(INST_MAN3DIR)]);
3049 $(O_FILES): $(H_FILES)
3050 ' if @{$self->{O_FILES} || []} && @{$self->{H} || []};
3054 perldoc ExtUtils::MakeMaker
3059 }.$self->{NOECHO}.q{$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \
3060 -MExtUtils::MakeMaker=Version_check \
3061 -e 'Version_check("$(MM_VERSION)")'
3069 Obsolete, depecated method. Not used since Version 5.21.
3074 # --- perllocal.pod section ---
3075 my($self,$what,$name,@attribs)=@_;
3076 my $time = localtime;
3077 print "=head2 $time: $what C<$name>\n\n=over 4\n\n=item *\n\n";
3078 print join "\n\n=item *\n\n", map("C<$_>",@attribs);
3079 print "\n\n=back\n\n";
3084 Defines the suffix rules to compile XS files to C.
3090 return '' unless $self->needs_linking();
3093 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs >$*.tc && mv $*.tc $@
3099 Defines suffix rules to go from XS to object files directly. This is
3100 only intended for broken make implementations.
3104 sub xs_o { # many makes are too dumb to use xs_c then c_o
3106 return '' unless $self->needs_linking();
3109 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs >xstmp.c && mv xstmp.c $*.c
3110 $(CCCMD) $(MAB) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c
3119 L<ExtUtils::MakeMaker>