1 package ExtUtils::MM_Unix;
5 use File::Basename qw(basename dirname fileparse);
8 use vars qw($VERSION $Is_Mac $Is_OS2 $Is_VMS);
10 $VERSION = substr q$Revision: 1.107 $, 10;
11 # $Id: MM_Unix.pm,v 1.107 1996/09/03 20:53:39 k Exp $
13 Exporter::import('ExtUtils::MakeMaker',
14 qw( $Verbose &neatvalue));
16 $Is_OS2 = $^O =~ m|^os/?2$|i;
17 $Is_Mac = $^O eq "MacOS";
19 if ($Is_VMS = $^O eq 'VMS') {
20 require VMS::Filespec;
21 import VMS::Filespec qw( &vmsify );
26 ExtUtils::MM_Unix - methods used by ExtUtils::MakeMaker
30 C<require ExtUtils::MM_Unix;>
34 The methods provided by this package are designed to be used in
35 conjunction with ExtUtils::MakeMaker. When MakeMaker writes a
36 Makefile, it creates one or more objects that inherit their methods
37 from a package C<MM>. MM itself doesn't provide any methods, but it
38 ISA ExtUtils::MM_Unix class. The inheritance tree of MM lets operating
39 specific packages take the responsibility for all the methods provided
40 by MM_Unix. We are trying to reduce the number of the necessary
41 overrides by defining rather primitive operations within
44 If you are going to write a platform specific MM package, please try
45 to limit the necessary overrides to primitive methods, and if it is not
46 possible to do so, let's work out how to achieve that gain.
48 If you are overriding any of these methods in your Makefile.PL (in the
49 MY class), please report that to the makemaker mailing list. We are
50 trying to minimize the necessary method overrides and switch to data
51 driven Makefile.PLs wherever possible. In the long run less methods
52 will be overridable via the MY class.
56 The following description of methods is still under
57 development. Please refer to the code for not suitably documented
58 sections and complain loudly to the makemaker mailing list.
60 Not all of the methods below are overridable in a
61 Makefile.PL. Overridable methods are marked as (o). All methods are
62 overridable by a platform specific MM_*.pm file (See
63 L<ExtUtils::MM_VMS> and L<ExtUtils::MM_OS2>).
65 =head2 Preloaded methods
71 No physical check on the filesystem, but a logical cleanup of a
72 path. On UNIX eliminated successive slashes and successive "/.".
78 $path =~ s|/+|/|g ; # xx////xx -> xx/xx
79 $path =~ s|(/\.)+/|/|g ; # xx/././xx -> xx/xx
80 $path =~ s|^(\./)+|| unless $path eq "./"; # ./xx -> xx
81 $path =~ s|/$|| unless $path eq "/"; # xx/ -> xx
87 Concatenate two or more directory names to form a complete path ending
88 with a directory. But remove the trailing slash from the resulting
89 string, because it doesn't look good, isn't necessary and confuses
90 OS2. Of course, if this is the root directory, don't cut off the
101 # append a slash to each argument unless it has one there
102 $_ .= "/" if $_ eq '' or substr($_,-1) ne "/";
104 my $result = join('', @args);
105 # remove a trailing slash unless we are root
106 substr($result,-1) = ""
107 if length($result) > 1 && substr($result,-1) eq "/";
113 Concatenate one or more directory names and a filename to form a
114 complete path ending with a filename
121 return $file unless @_;
122 my $dir = $self->catdir(@_);
124 $_ .= "/" unless substr($_,length($_)-1,1) eq "/";
131 Returns a string representing of the current directory. "." on UNIX.
141 Returns a string representing of the root directory. "/" on UNIX.
151 Returns a string representing of the parent directory. ".." on UNIX.
159 sub ExtUtils::MM_Unix::c_o ;
160 sub ExtUtils::MM_Unix::clean ;
161 sub ExtUtils::MM_Unix::const_cccmd ;
162 sub ExtUtils::MM_Unix::const_config ;
163 sub ExtUtils::MM_Unix::const_loadlibs ;
164 sub ExtUtils::MM_Unix::constants ;
165 sub ExtUtils::MM_Unix::depend ;
166 sub ExtUtils::MM_Unix::dir_target ;
167 sub ExtUtils::MM_Unix::dist ;
168 sub ExtUtils::MM_Unix::dist_basics ;
169 sub ExtUtils::MM_Unix::dist_ci ;
170 sub ExtUtils::MM_Unix::dist_core ;
171 sub ExtUtils::MM_Unix::dist_dir ;
172 sub ExtUtils::MM_Unix::dist_test ;
173 sub ExtUtils::MM_Unix::dlsyms ;
174 sub ExtUtils::MM_Unix::dynamic ;
175 sub ExtUtils::MM_Unix::dynamic_bs ;
176 sub ExtUtils::MM_Unix::dynamic_lib ;
177 sub ExtUtils::MM_Unix::exescan ;
178 sub ExtUtils::MM_Unix::extliblist ;
179 sub ExtUtils::MM_Unix::file_name_is_absolute ;
180 sub ExtUtils::MM_Unix::find_perl ;
181 sub ExtUtils::MM_Unix::force ;
182 sub ExtUtils::MM_Unix::guess_name ;
183 sub ExtUtils::MM_Unix::has_link_code ;
184 sub ExtUtils::MM_Unix::init_dirscan ;
185 sub ExtUtils::MM_Unix::init_main ;
186 sub ExtUtils::MM_Unix::init_others ;
187 sub ExtUtils::MM_Unix::install ;
188 sub ExtUtils::MM_Unix::installbin ;
189 sub ExtUtils::MM_Unix::libscan ;
190 sub ExtUtils::MM_Unix::linkext ;
191 sub ExtUtils::MM_Unix::lsdir ;
192 sub ExtUtils::MM_Unix::macro ;
193 sub ExtUtils::MM_Unix::makeaperl ;
194 sub ExtUtils::MM_Unix::makefile ;
195 sub ExtUtils::MM_Unix::manifypods ;
196 sub ExtUtils::MM_Unix::maybe_command ;
197 sub ExtUtils::MM_Unix::maybe_command_in_dirs ;
198 sub ExtUtils::MM_Unix::needs_linking ;
199 sub ExtUtils::MM_Unix::nicetext ;
200 sub ExtUtils::MM_Unix::parse_version ;
201 sub ExtUtils::MM_Unix::pasthru ;
202 sub ExtUtils::MM_Unix::path ;
203 sub ExtUtils::MM_Unix::perl_script ;
204 sub ExtUtils::MM_Unix::perldepend ;
205 sub ExtUtils::MM_Unix::pm_to_blib ;
206 sub ExtUtils::MM_Unix::post_constants ;
207 sub ExtUtils::MM_Unix::post_initialize ;
208 sub ExtUtils::MM_Unix::postamble ;
209 sub ExtUtils::MM_Unix::prefixify ;
210 sub ExtUtils::MM_Unix::processPL ;
211 sub ExtUtils::MM_Unix::realclean ;
212 sub ExtUtils::MM_Unix::replace_manpage_separator ;
213 sub ExtUtils::MM_Unix::static ;
214 sub ExtUtils::MM_Unix::static_lib ;
215 sub ExtUtils::MM_Unix::staticmake ;
216 sub ExtUtils::MM_Unix::subdir_x ;
217 sub ExtUtils::MM_Unix::subdirs ;
218 sub ExtUtils::MM_Unix::test ;
219 sub ExtUtils::MM_Unix::test_via_harness ;
220 sub ExtUtils::MM_Unix::test_via_script ;
221 sub ExtUtils::MM_Unix::tool_autosplit ;
222 sub ExtUtils::MM_Unix::tool_xsubpp ;
223 sub ExtUtils::MM_Unix::tools_other ;
224 sub ExtUtils::MM_Unix::top_targets ;
225 sub ExtUtils::MM_Unix::writedoc ;
226 sub ExtUtils::MM_Unix::xs_c ;
227 sub ExtUtils::MM_Unix::xs_o ;
228 sub ExtUtils::MM_Unix::xsubpp_version ;
230 package ExtUtils::MM_Unix;
238 =head2 SelfLoaded methods
242 Defines the suffix rules to compile different flavors of C files to
248 # --- Translation Sections ---
251 return '' unless $self->needs_linking();
255 $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c
259 $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.C
260 ' if $^O ne 'os2'; # Case-specific
263 $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.cpp
266 $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.cxx
269 $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.cc
276 Does very much the same as the cflags script in the perl
277 distribution. It doesn't return the whole compiler command line, but
278 initializes all of its parts. The const_cccmd method then actually
279 returns the definition of the CCCMD macro which uses these parts.
286 my($self,$libperl)=@_;
287 return $self->{CFLAGS} if $self->{CFLAGS};
288 return '' unless $self->needs_linking();
290 my($prog, $uc, $perltype, %cflags);
291 $libperl ||= $self->{LIBPERL_A} || "libperl$self->{LIB_EXT}" ;
292 $libperl =~ s/\.\$\(A\)$/$self->{LIB_EXT}/;
294 @cflags{qw(cc ccflags optimize large split shellflags)}
295 = @Config{qw(cc ccflags optimize large split shellflags)};
298 $cflags{shellflags} ||= '';
303 DE => '-DDEBUGGING -DEMBED',
304 M => '-DEMBED -DMULTIPLICITY',
305 DM => '-DDEBUGGING -DEMBED -DMULTIPLICITY',
308 if ($libperl =~ /libperl(\w*)\Q$self->{LIB_EXT}/){
311 $uc = ""; # avoid warning
313 $perltype = $map{$uc} ? $map{$uc} : "";
321 ( $name = $self->{NAME} . "_cflags" ) =~ s/:/_/g ;
322 if ($prog = $Config::Config{$name}) {
323 # Expand hints for this extension via the shell
324 print STDOUT "Processing $name hint:\n" if $Verbose;
325 my(@o)=`cc=\"$cflags{cc}\"
326 ccflags=\"$cflags{ccflags}\"
327 optimize=\"$cflags{optimize}\"
328 perltype=\"$cflags{perltype}\"
329 optdebug=\"$cflags{optdebug}\"
330 large=\"$cflags{large}\"
331 split=\"$cflags{'split'}\"
334 echo ccflags=\$ccflags
335 echo optimize=\$optimize
336 echo perltype=\$perltype
337 echo optdebug=\$optdebug
344 if ($line =~ /(.*?)=\s*(.*)\s*$/){
346 print STDOUT " $1 = $2\n" if $Verbose;
348 print STDOUT "Unrecognised result from hint: '$line'\n";
354 $cflags{optimize} = $optdebug;
357 for (qw(ccflags optimize perltype large split)) {
358 $cflags{$_} =~ s/^\s+//;
359 $cflags{$_} =~ s/\s+/ /g;
360 $cflags{$_} =~ s/\s+$//;
361 $self->{uc $_} ||= $cflags{$_}
364 return $self->{CFLAGS} = qq{
365 CCFLAGS = $self->{CCFLAGS}
366 OPTIMIZE = $self->{OPTIMIZE}
367 PERLTYPE = $self->{PERLTYPE}
368 LARGE = $self->{LARGE}
369 SPLIT = $self->{SPLIT}
376 Defines the clean target.
381 # --- Cleanup and Distribution Sections ---
383 my($self, %attribs) = @_;
386 # Delete temporary files but do not touch installed files. We don\'t delete
387 # the Makefile here so a later make realclean still has a makefile to use.
391 # clean subdirectories first
392 for $dir (@{$self->{DIR}}) {
393 push @m, "\t-cd $dir && test -f $self->{MAKEFILE} && \$(MAKE) clean\n";
396 my(@otherfiles) = values %{$self->{XS}}; # .c files from *.xs files
397 push(@otherfiles, $attribs{FILES}) if $attribs{FILES};
398 push(@otherfiles, qw[./blib $(MAKE_APERL_FILE) $(INST_ARCHAUTODIR)/extralibs.all
399 perlmain.c mon.out core so_locations pm_to_blib
400 *~ */*~ */*/*~ *$(OBJ_EXT) *$(LIB_EXT) perl.exe
401 $(BOOTSTRAP) $(BASEEXT).bso $(BASEEXT).def
404 push @m, "\t-$self->{RM_RF} @otherfiles\n";
405 # See realclean and ext/utils/make_ext for usage of Makefile.old
407 "\t-$self->{MV} $self->{MAKEFILE} $self->{MAKEFILE}.old 2>/dev/null\n");
409 "\t$attribs{POSTOP}\n") if $attribs{POSTOP};
413 =item const_cccmd (o)
415 Returns the full compiler call for C programs and stores the
416 definition in CONST_CCCMD.
421 my($self,$libperl)=@_;
422 return $self->{CONST_CCCMD} if $self->{CONST_CCCMD};
423 return '' unless $self->needs_linking();
424 return $self->{CONST_CCCMD} =
425 q{CCCMD = $(CC) -c $(INC) $(CCFLAGS) $(OPTIMIZE) \\
426 $(PERLTYPE) $(LARGE) $(SPLIT) $(DEFINE_VERSION) \\
427 $(XS_DEFINE_VERSION)};
430 =item const_config (o)
432 Defines a couple of constants in the Makefile that are imported from
438 # --- Constants Sections ---
442 push(@m,"\n# These definitions are from config.sh (via $INC{'Config.pm'})\n");
443 push(@m,"\n# They may have been overridden via Makefile.PL or on the command line\n");
445 foreach $m (@{$self->{CONFIG}}){
446 # SITE*EXP macros are defined in &constants; avoid duplicates here
447 next if $once_only{$m} or $m eq 'sitelibexp' or $m eq 'sitearchexp';
448 push @m, "\U$m\E = ".$self->{uc $m}."\n";
454 =item const_loadlibs (o)
456 Defines EXTRALIBS, LDLOADLIBS, BSLOADLIBS, LD_RUN_PATH. See
457 L<ExtUtils::Liblist> for details.
463 return "" unless $self->needs_linking;
466 # $self->{NAME} might depend on some other libraries:
467 # See ExtUtils::Liblist for details
472 EXTRALIBS LDLOADLIBS BSLOADLIBS LD_RUN_PATH
474 next unless defined $self->{$tmp};
475 push @m, "$tmp = $self->{$tmp}\n";
482 Initializes lots of constants and .SUFFIXES and .PHONY
492 AR_STATIC_ARGS NAME DISTNAME NAME_SYM VERSION
493 VERSION_SYM XS_VERSION INST_BIN INST_EXE INST_LIB
494 INST_ARCHLIB INST_SCRIPT PREFIX INSTALLDIRS
495 INSTALLPRIVLIB INSTALLARCHLIB INSTALLSITELIB
496 INSTALLSITEARCH INSTALLBIN INSTALLSCRIPT PERL_LIB
497 PERL_ARCHLIB SITELIBEXP SITEARCHEXP LIBPERL_A MYEXTLIB
498 FIRST_MAKEFILE MAKE_APERL_FILE PERLMAINCC PERL_SRC
499 PERL_INC PERL FULLPERL
502 next unless defined $self->{$tmp};
503 push @m, "$tmp = $self->{$tmp}\n";
507 VERSION_MACRO = VERSION
508 DEFINE_VERSION = -D\$(VERSION_MACRO)=\\\"\$(VERSION)\\\"
509 XS_VERSION_MACRO = XS_VERSION
510 XS_DEFINE_VERSION = -D\$(XS_VERSION_MACRO)=\\\"\$(XS_VERSION)\\\"
514 MAKEMAKER = $INC{'ExtUtils/MakeMaker.pm'}
515 MM_VERSION = $ExtUtils::MakeMaker::VERSION
519 # FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle).
520 # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle)
521 # ROOTEXT = Directory part of FULLEXT with leading slash (eg /DBD) !!! Deprecated from MM 5.32 !!!
522 # PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar)
523 # DLBASE = Basename part of dynamic library. May be just equal BASEEXT.
527 FULLEXT BASEEXT PARENT_NAME DLBASE VERSION_FROM INC DEFINE OBJECT
530 next unless defined $self->{$tmp};
531 push @m, "$tmp = $self->{$tmp}\n";
535 # Handy lists of source code files:
536 XS_FILES= ".join(" \\\n\t", sort keys %{$self->{XS}})."
537 C_FILES = ".join(" \\\n\t", @{$self->{C}})."
538 O_FILES = ".join(" \\\n\t", @{$self->{O_FILES}})."
539 H_FILES = ".join(" \\\n\t", @{$self->{H}})."
540 MAN1PODS = ".join(" \\\n\t", sort keys %{$self->{MAN1PODS}})."
541 MAN3PODS = ".join(" \\\n\t", sort keys %{$self->{MAN3PODS}})."
545 INST_MAN1DIR INSTALLMAN1DIR MAN1EXT INST_MAN3DIR INSTALLMAN3DIR MAN3EXT
547 next unless defined $self->{$tmp};
548 push @m, "$tmp = $self->{$tmp}\n";
552 .NO_CONFIG_REC: Makefile
553 } if $ENV{CLEARCASE_ROOT};
555 # why not q{} ? -- emacs
557 # work around a famous dec-osf make(1) feature(?):
560 .SUFFIXES: .xs .c .C .cpp .cxx .cc \$(OBJ_EXT)
562 # Nick wanted to get rid of .PRECIOUS. I don't remember why. I seem to recall, that
563 # some make implementations will delete the Makefile when we rebuild it. Because
564 # we call false(1) when we rebuild it. So make(1) is not completely wrong when it
565 # does so. Our milage may vary.
566 # .PRECIOUS: Makefile # seems to be not necessary anymore
568 .PHONY: all config static dynamic test linkext manifest
570 # Where is the Config information that we are using/depend on
571 CONFIGDEP = \$(PERL_ARCHLIB)/Config.pm \$(PERL_INC)/config.h
574 my @parentdir = split(/::/, $self->{PARENT_NAME});
576 # Where to put things:
577 INST_LIBDIR = }. $self->catdir('$(INST_LIB)',@parentdir) .q{
578 INST_ARCHLIBDIR = }. $self->catdir('$(INST_ARCHLIB)',@parentdir) .q{
580 INST_AUTODIR = }. $self->catdir('$(INST_LIB)','auto','$(FULLEXT)') .q{
581 INST_ARCHAUTODIR = }. $self->catdir('$(INST_ARCHLIB)','auto','$(FULLEXT)') .q{
584 if ($self->has_link_code()) {
586 INST_STATIC = $(INST_ARCHAUTODIR)/$(BASEEXT)$(LIB_EXT)
587 INST_DYNAMIC = $(INST_ARCHAUTODIR)/$(DLBASE).$(DLEXT)
588 INST_BOOT = $(INST_ARCHAUTODIR)/$(BASEEXT).bs
599 $tmp = "$self->{BASEEXT}.def";
608 $tmp = "\$(PERL_INC)/libperl\$(LIB_EXT)";
617 #INST_PM = }.join(" \\\n\t", sort values %{$self->{PM}}).q{
619 #PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{
623 TO_INST_PM = }.join(" \\\n\t", sort keys %{$self->{PM}}).q{
625 PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{
633 Same as macro for the depend attribute.
638 my($self,%attribs) = @_;
640 while (($key,$val) = each %attribs){
641 last unless defined $key;
642 push @m, "$key: $val\n";
649 Takes an array of directories that need to exist and returns a
650 Makefile entry for a .exists file in these directories. Returns
651 nothing, if the entry has already been processed. We're helpless
652 though, if the same directory comes as $(FOO) _and_ as "bar". Both of
653 them get an entry, that's why we use "::".
658 # --- Make-Directories section (internal method) ---
659 # dir_target(@array) returns a Makefile entry for the file .exists in each
660 # named directory. Returns nothing, if the entry has already been processed.
661 # We're helpless though, if the same directory comes as $(FOO) _and_ as "bar".
662 # Both of them get an entry, that's why we use "::". I chose '$(PERL)' as the
663 # prerequisite, because there has to be one, something that doesn't change
666 my($self,@dirs) = @_;
668 foreach $dir (@dirs) {
669 my($src) = $self->catfile($self->{PERL_INC},'perl.h');
670 my($targ) = $self->catfile($dir,'.exists');
671 my($targdir) = $targ; # Necessary because catfile may have
672 $targdir =~ s:/?.exists$::; # adapted syntax of $dir to target OS
673 next if $self->{DIR_TARGET}{$self}{$targdir}++;
676 $self->{NOECHO}\$(MKPATH) $targdir
677 $self->{NOECHO}\$(EQUALIZE_TIMESTAMP) $src $targ
680 -$self->{NOECHO}\$(CHMOD) 755 $targdir
688 Defines a lot of macros for distribution support.
693 my($self, %attribs) = @_;
696 # VERSION should be sanitised before use as a file name
697 my($version) = $attribs{VERSION} || '$(VERSION)';
698 my($name) = $attribs{NAME} || '$(DISTNAME)';
699 my($tar) = $attribs{TAR} || 'tar'; # eg /usr/bin/gnutar
700 my($tarflags) = $attribs{TARFLAGS} || 'cvf';
701 my($zip) = $attribs{ZIP} || 'zip'; # eg pkzip Yuck!
702 my($zipflags) = $attribs{ZIPFLAGS} || '-r';
703 my($compress) = $attribs{COMPRESS} || 'compress'; # eg gzip
704 my($suffix) = $attribs{SUFFIX} || '.Z'; # eg .gz
705 my($shar) = $attribs{SHAR} || 'shar'; # eg "shar --gzip"
706 my($preop) = $attribs{PREOP} || "$self->{NOECHO}\$(NOOP)"; # eg update MANIFEST
707 my($postop) = $attribs{POSTOP} || "$self->{NOECHO}\$(NOOP)"; # eg remove the distdir
709 my($to_unix) = $attribs{TO_UNIX} || ($Is_OS2
711 . 'test -f tmp.zip && $(RM) tmp.zip;'
712 . ' $(ZIP) -ll -mr tmp.zip $(DISTVNAME) && unzip -o tmp.zip && $(RM) tmp.zip'
713 : "$self->{NOECHO}\$(NOOP)");
715 my($ci) = $attribs{CI} || 'ci -u';
716 my($rcs_label)= $attribs{RCS_LABEL}|| 'rcs -Nv$(VERSION_SYM): -q';
717 my($dist_cp) = $attribs{DIST_CP} || 'best';
718 my($dist_default) = $attribs{DIST_DEFAULT} || 'tardist';
721 DISTVNAME = ${name}-$version
733 RCS_LABEL = $rcs_label
735 DIST_DEFAULT = $dist_default
740 =item dist_basics (o)
742 Defines the targets distclean, distcheck, skipcheck, manifest.
750 distclean :: realclean distcheck
755 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&fullcheck";' \\
761 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&skipcheck";' \\
767 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&mkmanifest";' \\
775 Defines a check in target for RCS.
784 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&maniread";' \\
785 -e '@all = keys %{ maniread() };' \\
786 -e 'print("Executing $(CI) @all\n"); system("$(CI) @all");' \\
787 -e 'print("Executing $(RCS_LABEL) ...\n"); system("$(RCS_LABEL) @all");'
794 Defeines the targets dist, tardist, zipdist, uutardist, shdist
802 dist : $(DIST_DEFAULT)
803 }.$self->{NOECHO}.q{$(PERL) -le 'print "Warning: Makefile possibly out of date with $$vf" if ' \
804 -e '-e ($$vf="$(VERSION_FROM)") and -M $$vf < -M "}.$self->{MAKEFILE}.q{";'
806 tardist : $(DISTVNAME).tar$(SUFFIX)
808 zipdist : $(DISTVNAME).zip
810 $(DISTVNAME).tar$(SUFFIX) : distdir
813 $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME)
814 $(RM_RF) $(DISTVNAME)
815 $(COMPRESS) $(DISTVNAME).tar
818 $(DISTVNAME).zip : distdir
820 $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME)
821 $(RM_RF) $(DISTVNAME)
824 uutardist : $(DISTVNAME).tar$(SUFFIX)
825 uuencode $(DISTVNAME).tar$(SUFFIX) \\
826 $(DISTVNAME).tar$(SUFFIX) > \\
827 $(DISTVNAME).tar$(SUFFIX)_uu
831 $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar
832 $(RM_RF) $(DISTVNAME)
840 Defines the scratch directory target that will hold the distribution
841 before tar-ing (or shar-ing).
850 $(RM_RF) $(DISTVNAME)
851 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=manicopy,maniread \\
852 -e 'manicopy(maniread(),"$(DISTVNAME)", "$(DIST_CP)");'
859 Defines a target that produces the distribution in the
860 scratchdirectory, and runs 'perl Makefile.PL; make ;make test' in that
870 cd $(DISTVNAME) && $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) Makefile.PL
871 cd $(DISTVNAME) && $(MAKE)
872 cd $(DISTVNAME) && $(MAKE) test
879 Used by AIX and VMS to define DL_FUNCS and DL_VARS and write the *.exp
885 my($self,%attribs) = @_;
887 return '' unless ($^O eq 'aix' && $self->needs_linking() );
889 my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
890 my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
894 dynamic :: $self->{BASEEXT}.exp
896 ") unless $self->{SKIPHASH}{'dynamic'}; # dynamic and static are subs, so...
899 static :: $self->{BASEEXT}.exp
901 ") unless $self->{SKIPHASH}{'static'}; # we avoid a warning if we tick them
904 $self->{BASEEXT}.exp: Makefile.PL
905 ",' $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e \'use ExtUtils::Mksymlists; \\
906 Mksymlists("NAME" => "',$self->{NAME},'", "DL_FUNCS" => ',
907 neatvalue($funcs),', "DL_VARS" => ', neatvalue($vars), ');\'
915 Defines the dynamic target.
920 # --- Dynamic Loading Sections ---
924 ## $(INST_PM) has been moved to the all: target.
925 ## It remains here for awhile to allow for old usage: "make dynamic"
926 #dynamic :: '.$self->{MAKEFILE}.' $(INST_DYNAMIC) $(INST_BOOT) $(INST_PM)
927 dynamic :: '.$self->{MAKEFILE}.' $(INST_DYNAMIC) $(INST_BOOT)
928 '.$self->{NOECHO}.'$(NOOP)
934 Defines targets for bootstrap files.
939 my($self, %attribs) = @_;
942 ' unless $self->has_link_code();
945 BOOTSTRAP = '."$self->{BASEEXT}.bs".'
947 # As Mkbootstrap might not write a file (if none is required)
948 # we use touch to prevent make continually trying to remake it.
949 # The DynaLoader only reads a non-empty file.
950 $(BOOTSTRAP): '."$self->{MAKEFILE} $self->{BOOTDEP}".' $(INST_ARCHAUTODIR)/.exists
951 '.$self->{NOECHO}.'echo "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))"
952 '.$self->{NOECHO}.'$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" \
953 -e \'use ExtUtils::Mkbootstrap;\' \
954 -e \'Mkbootstrap("$(BASEEXT)","$(BSLOADLIBS)");\'
955 '.$self->{NOECHO}.'$(TOUCH) $(BOOTSTRAP)
958 $(INST_BOOT): $(BOOTSTRAP) $(INST_ARCHAUTODIR)/.exists
959 '."$self->{NOECHO}$self->{RM_RF}".' $(INST_BOOT)
960 -'.$self->{CP}.' $(BOOTSTRAP) $(INST_BOOT)
965 =item dynamic_lib (o)
967 Defines how to produce the *.so (or equivalent) files.
972 my($self, %attribs) = @_;
973 return '' unless $self->needs_linking(); #might be because of a subdir
975 return '' unless $self->has_link_code;
977 my($otherldflags) = $attribs{OTHERLDFLAGS} || "";
978 my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || "";
979 my($armaybe) = $attribs{ARMAYBE} || $self->{ARMAYBE} || ":";
980 my($ldfrom) = '$(LDFROM)';
981 $armaybe = 'ar' if ($^O eq 'dec_osf' and $armaybe eq ':');
984 # This section creates the dynamically loadable $(INST_DYNAMIC)
985 # from $(OBJECT) and possibly $(MYEXTLIB).
986 ARMAYBE = '.$armaybe.'
987 OTHERLDFLAGS = '.$otherldflags.'
988 INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'
990 $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)/.exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
992 if ($armaybe ne ':'){
993 $ldfrom = 'tmp$(LIB_EXT)';
994 push(@m,' $(ARMAYBE) cr '.$ldfrom.' $(OBJECT)'."\n");
995 push(@m,' $(RANLIB) '."$ldfrom\n");
997 $ldfrom = "-all $ldfrom -none" if ($^O eq 'dec_osf');
998 push(@m,' LD_RUN_PATH="$(LD_RUN_PATH)" $(LD) -o $@ $(LDDLFLAGS) '.$ldfrom.
999 ' $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) $(EXPORT_LIST)');
1004 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
1010 Deprecated method. Use libscan instead.
1015 my($self,$path) = @_;
1021 Called by init_others, and calls ext ExtUtils::Liblist. See
1022 L<ExtUtils::Liblist> for details.
1027 my($self,$libs) = @_;
1028 require ExtUtils::Liblist;
1029 $self->ext($libs, $Verbose);
1032 =item file_name_is_absolute
1034 Takes as argument a path and returns true, if it is an absolute path.
1038 sub file_name_is_absolute {
1039 my($self,$file) = @_;
1045 Finds the executables PERL and FULLPERL
1050 my($self, $ver, $names, $dirs, $trace) = @_;
1053 print "Looking for perl $ver by these names:
1059 foreach $dir (@$dirs){
1060 next unless defined $dir; # $self->{PERL_SRC} may be undefined
1061 foreach $name (@$names){
1063 if ($self->file_name_is_absolute($name)) { # /foo/bar
1065 } elsif ($self->canonpath($name) eq $self->canonpath(basename($name))) { # foo
1066 $abs = $self->catfile($dir, $name);
1068 $abs = $self->canonpath($self->catfile($self->curdir, $name));
1070 print "Checking $abs\n" if ($trace >= 2);
1071 next unless $self->maybe_command($abs);
1072 print "Executing $abs\n" if ($trace >= 2);
1073 if (`$abs -e 'require $ver; print "VER_OK\n" ' 2>&1` =~ /VER_OK/) {
1074 print "Using PERL=$abs\n" if $trace;
1079 print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n";
1080 0; # false and not empty
1083 =head2 Methods to actually produce chunks of text for the Makefile
1085 The methods here are called in the order specified by
1086 @ExtUtils::MakeMaker::MM_Sections. This manpage reflects the order as
1087 well as possible. Some methods call each other, so in doubt refer to
1098 '# Phony target to force checking subdirectories.
1105 Guess the name of this package by examining the working directory's
1106 name. MakeMaker calls this only if the developer has not supplied a
1116 my $name = basename(cwd());
1117 $name =~ s|[\-_][\d\.\-]+$||; # this is new with MM 5.00, we
1118 # strip minus or underline
1119 # followed by a float or some such
1120 print "Warning: Guessing NAME [$name] from current directory name.\n";
1126 Returns true if C, XS, MYEXTLIB or similar objects exist within this
1127 object that need a compiler. Does not descend into subdirectories as
1128 needs_linking() does.
1134 return $self->{HAS_LINK_CODE} if defined $self->{HAS_LINK_CODE};
1135 if ($self->{OBJECT} or @{$self->{C} || []} or $self->{MYEXTLIB}){
1136 $self->{HAS_LINK_CODE} = 1;
1139 return $self->{HAS_LINK_CODE} = 0;
1144 Initializes DIR, XS, PM, C, O_FILES, H, PL_FILES, MAN*PODS, EXE_FILES.
1148 sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc)
1150 my($name, %dir, %xs, %c, %h, %ignore, %pl_files, %manifypods);
1151 local(%pm); #the sub in find() has to see this hash
1152 $ignore{'test.pl'} = 1;
1153 $ignore{'makefile.pl'} = 1 if $Is_VMS;
1154 foreach $name ($self->lsdir($self->curdir)){
1155 next if $name eq $self->curdir or $name eq $self->updir or $ignore{$name};
1156 next unless $self->libscan($name);
1158 next if -l $name; # We do not support symlinks at all
1159 $dir{$name} = $name if (-f $self->catfile($name,"Makefile.PL"));
1160 } elsif ($name =~ /\.xs$/){
1161 my($c); ($c = $name) =~ s/\.xs$/.c/;
1164 } elsif ($name =~ /\.c(pp|xx|c)?$/i){ # .c .C .cpp .cxx .cc
1166 unless $name =~ m/perlmain\.c/; # See MAP_TARGET
1167 } elsif ($name =~ /\.h$/i){
1169 } elsif ($name =~ /\.(p[ml]|pod)$/){
1170 $pm{$name} = $self->catfile('$(INST_LIBDIR)',$name);
1171 } elsif ($name =~ /\.PL$/ && $name ne "Makefile.PL") {
1172 ($pl_files{$name} = $name) =~ s/\.PL$// ;
1173 } elsif ($Is_VMS && $name =~ /\.pl$/ && $name ne 'makefile.pl' &&
1174 $name ne 'test.pl') { # case-insensitive filesystem
1175 ($pl_files{$name} = $name) =~ s/\.pl$// ;
1179 # Some larger extensions often wish to install a number of *.pm/pl
1180 # files into the library in various locations.
1182 # The attribute PMLIBDIRS holds an array reference which lists
1183 # subdirectories which we should search for library files to
1184 # install. PMLIBDIRS defaults to [ 'lib', $self->{BASEEXT} ]. We
1185 # recursively search through the named directories (skipping any
1186 # which don't exist or contain Makefile.PL files).
1188 # For each *.pm or *.pl file found $self->libscan() is called with
1189 # the default installation path in $_[1]. The return value of
1190 # libscan defines the actual installation location. The default
1191 # libscan function simply returns the path. The file is skipped
1192 # if libscan returns false.
1194 # The default installation location passed to libscan in $_[1] is:
1196 # ./*.pm => $(INST_LIBDIR)/*.pm
1197 # ./xyz/... => $(INST_LIBDIR)/xyz/...
1198 # ./lib/... => $(INST_LIB)/...
1200 # In this way the 'lib' directory is seen as the root of the actual
1201 # perl library whereas the others are relative to INST_LIBDIR
1202 # (which includes PARENT_NAME). This is a subtle distinction but one
1203 # that's important for nested modules.
1205 $self->{PMLIBDIRS} = ['lib', $self->{BASEEXT}]
1206 unless $self->{PMLIBDIRS};
1208 #only existing directories that aren't in $dir are allowed
1210 # Avoid $_ wherever possible:
1211 # @{$self->{PMLIBDIRS}} = grep -d && !$dir{$_}, @{$self->{PMLIBDIRS}};
1212 my (@pmlibdirs) = @{$self->{PMLIBDIRS}};
1214 @{$self->{PMLIBDIRS}} = ();
1215 foreach $pmlibdir (@pmlibdirs) {
1216 -d $pmlibdir && !$dir{$pmlibdir} && push @{$self->{PMLIBDIRS}}, $pmlibdir;
1219 if (@{$self->{PMLIBDIRS}}){
1220 print "Searching PMLIBDIRS: @{$self->{PMLIBDIRS}}\n"
1223 File::Find::find(sub {
1225 if ($_ eq "CVS" || $_ eq "RCS"){
1226 $File::Find::prune = 1;
1230 my($path, $prefix) = ($File::Find::name, '$(INST_LIBDIR)');
1231 my($striplibpath,$striplibname);
1232 $prefix = '$(INST_LIB)' if (($striplibpath = $path) =~ s:^(\W*)lib\W:$1:i);
1233 ($striplibname,$striplibpath) = fileparse($striplibpath);
1234 my($inst) = $self->catfile($prefix,$striplibpath,$striplibname);
1235 local($_) = $inst; # for backwards compatibility
1236 $inst = $self->libscan($inst);
1237 print "libscan($path) => '$inst'\n" if ($Verbose >= 2);
1238 return unless $inst;
1240 }, @{$self->{PMLIBDIRS}});
1243 $self->{DIR} = [sort keys %dir] unless $self->{DIR};
1244 $self->{XS} = \%xs unless $self->{XS};
1245 $self->{PM} = \%pm unless $self->{PM};
1246 $self->{C} = [sort keys %c] unless $self->{C};
1247 my(@o_files) = @{$self->{C}};
1248 $self->{O_FILES} = [grep s/\.c(pp|xx|c)?$/$self->{OBJ_EXT}/i, @o_files] ;
1249 $self->{H} = [sort keys %h] unless $self->{H};
1250 $self->{PL_FILES} = \%pl_files unless $self->{PL_FILES};
1252 # Set up names of manual pages to generate from pods
1253 if ($self->{MAN1PODS}) {
1254 } elsif ( $self->{INST_MAN1DIR} =~ /^(none|\s*)$/ ) {
1255 $self->{MAN1PODS} = {};
1257 my %manifypods = ();
1258 if ( exists $self->{EXE_FILES} ) {
1259 foreach $name (@{$self->{EXE_FILES}}) {
1260 # use FileHandle ();
1261 # my $fh = new FileHandle;
1264 # one day test, if $/ can be set to '' safely (is the bug fixed that was in 5.001m?)
1265 # if ($fh->open("<$name")) {
1266 if (open(FH,"<$name")) {
1269 if (/^=head1\s+\w+/) {
1277 # If it doesn't exist yet, we assume, it has pods in it
1281 $manifypods{$name} = $self->catfile('$(INST_MAN1DIR)',basename($name).'.$(MAN1EXT)');
1285 $self->{MAN1PODS} = \%manifypods;
1287 if ($self->{MAN3PODS}) {
1288 } elsif ( $self->{INST_MAN3DIR} =~ /^(none|\s*)$/ ) {
1289 $self->{MAN3PODS} = {};
1291 my %manifypods = (); # we collect the keys first, i.e. the files
1292 # we have to convert to pod
1293 foreach $name (keys %{$self->{PM}}) {
1294 if ($name =~ /\.pod$/ ) {
1295 $manifypods{$name} = $self->{PM}{$name};
1296 } elsif ($name =~ /\.p[ml]$/ ) {
1297 # use FileHandle ();
1298 # my $fh = new FileHandle;
1301 # $fh->open("<$name");
1302 if (open(FH,"<$name")) {
1305 if (/^=head1\s+\w+/) {
1316 $manifypods{$name} = $self->{PM}{$name};
1321 # Remove "Configure.pm" and similar, if it's not the only pod listed
1322 # To force inclusion, just name it "Configure.pod", or override MAN3PODS
1323 foreach $name (keys %manifypods) {
1324 if ($name =~ /(config|setup).*\.pm/i) {
1325 delete $manifypods{$name};
1328 my($manpagename) = $name;
1329 unless ($manpagename =~ s!^\W*lib\W+!!) { # everything below lib is ok
1330 $manpagename = $self->catfile(split(/::/,$self->{PARENT_NAME}),$manpagename);
1332 $manpagename =~ s/\.p(od|m|l)$//;
1333 $manpagename = $self->replace_manpage_separator($manpagename);
1334 $manifypods{$name} = $self->catfile("\$(INST_MAN3DIR)","$manpagename.\$(MAN3EXT)");
1336 $self->{MAN3PODS} = \%manifypods;
1342 Initializes NAME, FULLEXT, BASEEXT, PARENT_NAME, DLBASE, PERL_SRC,
1343 PERL_LIB, PERL_ARCHLIB, PERL_INC, INSTALLDIRS, INST_*, INSTALL*,
1344 PREFIX, CONFIG, AR, AR_STATIC_ARGS, LD, OBJ_EXT, LIB_EXT, MAP_TARGET,
1345 LIBPERL_A, VERSION_FROM, VERSION, DISTNAME, VERSION_SYM.
1352 # --- Initialize Module Name and Paths
1354 # NAME = Foo::Bar::Oracle
1355 # FULLEXT = Foo/Bar/Oracle
1357 # ROOTEXT = Directory part of FULLEXT with leading /. !!! Deprecated from MM 5.32 !!!
1358 # PARENT_NAME = Foo::Bar
1360 ### ($self->{FULLEXT} =
1361 ### $self->{NAME}) =~ s!::!/!g ; #eg. BSD/Foo/Socket
1362 $self->{FULLEXT} = $self->catdir(split /::/, $self->{NAME});
1365 # Copied from DynaLoader:
1367 my(@modparts) = split(/::/,$self->{NAME});
1368 my($modfname) = $modparts[-1];
1370 # Some systems have restrictions on files names for DLL's etc.
1371 # mod2fname returns appropriate file base name (typically truncated)
1372 # It may also edit @modparts if required.
1373 if (defined &DynaLoader::mod2fname) {
1374 $modfname = &DynaLoader::mod2fname(\@modparts);
1377 ($self->{PARENT_NAME}, $self->{BASEEXT}) = $self->{NAME} =~ m!([\w:]+::)?(\w+)$! ;
1379 if (defined &DynaLoader::mod2fname) {
1380 # As of 5.001m, dl_os2 appends '_'
1381 $self->{DLBASE} = $modfname;
1383 $self->{DLBASE} = '$(BASEEXT)';
1387 ### ROOTEXT deprecated from MM 5.32
1388 ### ($self->{ROOTEXT} =
1389 ### $self->{FULLEXT}) =~ s#/?\Q$self->{BASEEXT}\E$## ; #eg. /BSD/Foo
1390 ### $self->{ROOTEXT} = ($Is_VMS ? '' : '/') . $self->{ROOTEXT} if $self->{ROOTEXT};
1393 # --- Initialize PERL_LIB, INST_LIB, PERL_SRC
1395 # *Real* information: where did we get these two from? ...
1396 my $inc_config_dir = dirname($INC{'Config.pm'});
1397 my $inc_carp_dir = dirname($INC{'Carp.pm'});
1399 unless ($self->{PERL_SRC}){
1401 foreach $dir ($self->updir(),$self->catdir($self->updir(),$self->updir()),$self->catdir($self->updir(),$self->updir(),$self->updir())){
1403 -f $self->catfile($dir,"config.sh")
1405 -f $self->catfile($dir,"perl.h")
1407 -f $self->catfile($dir,"lib","Exporter.pm")
1409 $self->{PERL_SRC}=$dir ;
1414 if ($self->{PERL_SRC}){
1415 $self->{PERL_LIB} ||= $self->catdir("$self->{PERL_SRC}","lib");
1416 $self->{PERL_ARCHLIB} = $self->{PERL_LIB};
1417 $self->{PERL_INC} = $self->{PERL_SRC};
1418 # catch a situation that has occurred a few times in the past:
1420 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);
1421 You cannot build extensions below the perl source tree after executing
1422 a 'make clean' in the perl source tree.
1424 To rebuild extensions distributed with the perl source you should
1425 simply Configure (to include those extensions) and then build perl as
1426 normal. After installing perl the source tree can be deleted. It is
1427 not needed for building extensions by running 'perl Makefile.PL'
1428 usually without extra arguments.
1430 It is recommended that you unpack and build additional extensions away
1431 from the perl source tree.
1434 # we should also consider $ENV{PERL5LIB} here
1435 $self->{PERL_LIB} ||= $Config::Config{privlibexp};
1436 $self->{PERL_ARCHLIB} ||= $Config::Config{archlibexp};
1437 $self->{PERL_INC} = $self->catdir("$self->{PERL_ARCHLIB}","CORE"); # wild guess for now
1439 die <<EOM unless (-f ($perl_h = $self->catfile($self->{PERL_INC},"perl.h")));
1440 Error: Unable to locate installed Perl libraries or Perl source code.
1442 It is recommended that you install perl in a standard location before
1443 building extensions. You can say:
1445 $^X Makefile.PL PERL_SRC=/path/to/perl/source/directory
1447 if you have not yet installed perl but still want to build this
1449 (You get this message, because MakeMaker could not find "$perl_h")
1452 # print STDOUT "Using header files found in $self->{PERL_INC}\n"
1453 # if $Verbose && $self->needs_linking();
1457 # We get SITELIBEXP and SITEARCHEXP directly via
1458 # Get_from_Config. When we are running standard modules, these
1459 # won't matter, we will set INSTALLDIRS to "perl". Otherwise we
1460 # set it to "site". I prefer that INSTALLDIRS be set from outside
1462 $self->{INSTALLDIRS} ||= "site";
1464 # INST_LIB typically pre-set if building an extension after
1465 # perl has been built and installed. Setting INST_LIB allows
1466 # you to build directly into, say $Config::Config{privlibexp}.
1467 unless ($self->{INST_LIB}){
1470 ##### XXXXX We have to change this nonsense
1472 if (defined $self->{PERL_SRC} and $self->{INSTALLDIRS} eq "perl") {
1473 $self->{INST_LIB} = $self->{INST_ARCHLIB} = $self->{PERL_LIB};
1475 $self->{INST_LIB} = $self->catdir($self->curdir,"blib","lib");
1478 $self->{INST_ARCHLIB} ||= $self->catdir($self->curdir,"blib","arch");
1479 $self->{INST_BIN} ||= $self->catdir($self->curdir,'blib','bin');
1481 # We need to set up INST_LIBDIR before init_libscan() for VMS
1482 my @parentdir = split(/::/, $self->{PARENT_NAME});
1483 $self->{INST_LIBDIR} = $self->catdir('$(INST_LIB)',@parentdir);
1484 $self->{INST_ARCHLIBDIR} = $self->catdir('$(INST_ARCHLIB)',@parentdir);
1485 $self->{INST_AUTODIR} = $self->catdir('$(INST_LIB)','auto','$(FULLEXT)');
1486 $self->{INST_ARCHAUTODIR} = $self->catdir('$(INST_ARCHLIB)','auto','$(FULLEXT)');
1488 # INST_EXE is deprecated, should go away March '97
1489 $self->{INST_EXE} ||= $self->catdir($self->curdir,'blib','script');
1490 $self->{INST_SCRIPT} ||= $self->catdir($self->curdir,'blib','script');
1492 # The user who requests an installation directory explicitly
1493 # should not have to tell us a architecture installation directory
1494 # as well We look if a directory exists that is named after the
1495 # architecture. If not we take it as a sign that it should be the
1496 # same as the requested installation directory. Otherwise we take
1498 # We do the same thing twice: for privlib/archlib and for sitelib/sitearch
1500 for $libpair ({l=>"privlib", a=>"archlib"}, {l=>"sitelib", a=>"sitearch"}) {
1501 my $lib = "install$libpair->{l}";
1503 my $Arch = uc "install$libpair->{a}";
1504 if( $self->{$Lib} && ! $self->{$Arch} ){
1505 my($ilib) = $Config{$lib};
1506 $ilib = VMS::Filespec::unixify($ilib) if $Is_VMS;
1508 $self->prefixify($Arch,$ilib,$self->{$Lib});
1510 unless (-d $self->{$Arch}) {
1511 print STDOUT "Directory $self->{$Arch} not found, thusly\n" if $Verbose;
1512 $self->{$Arch} = $self->{$Lib};
1514 print STDOUT "Defaulting $Arch to $self->{$Arch}\n" if $Verbose;
1518 # we have to look at the relation between $Config{prefix} and the
1519 # requested values. We're going to set the $Config{prefix} part of
1520 # all the installation path variables to literally $(PREFIX), so
1521 # the user can still say make PREFIX=foo
1522 my($prefix) = $Config{'prefix'};
1523 $prefix = VMS::Filespec::unixify($prefix) if $Is_VMS;
1524 unless ($self->{PREFIX}){
1525 $self->{PREFIX} = $prefix;
1527 my($install_variable);
1528 for $install_variable (qw/
1530 INSTALLPRIVLIB INSTALLARCHLIB INSTALLBIN
1531 INSTALLMAN1DIR INSTALLMAN3DIR INSTALLSCRIPT
1532 INSTALLSITELIB INSTALLSITEARCH
1535 $self->prefixify($install_variable,$prefix,q[$(PREFIX)]);
1539 # Now we head at the manpages. Maybe they DO NOT want manpages
1541 $self->{INSTALLMAN1DIR} = $Config::Config{installman1dir}
1542 unless defined $self->{INSTALLMAN1DIR};
1543 unless (defined $self->{INST_MAN1DIR}){
1544 if ($self->{INSTALLMAN1DIR} =~ /^(none|\s*)$/){
1545 $self->{INST_MAN1DIR} = $self->{INSTALLMAN1DIR};
1547 $self->{INST_MAN1DIR} = $self->catdir($self->curdir,'blib','man1');
1550 $self->{MAN1EXT} ||= $Config::Config{man1ext};
1552 $self->{INSTALLMAN3DIR} = $Config::Config{installman3dir}
1553 unless defined $self->{INSTALLMAN3DIR};
1554 unless (defined $self->{INST_MAN3DIR}){
1555 if ($self->{INSTALLMAN3DIR} =~ /^(none|\s*)$/){
1556 $self->{INST_MAN3DIR} = $self->{INSTALLMAN3DIR};
1558 $self->{INST_MAN3DIR} = $self->catdir($self->curdir,'blib','man3');
1561 $self->{MAN3EXT} ||= $Config::Config{man3ext};
1564 # Get some stuff out of %Config if we haven't yet done so
1565 print STDOUT "CONFIG must be an array ref\n"
1566 if ($self->{CONFIG} and ref $self->{CONFIG} ne 'ARRAY');
1567 $self->{CONFIG} = [] unless (ref $self->{CONFIG});
1568 push(@{$self->{CONFIG}}, @ExtUtils::MakeMaker::Get_from_Config);
1569 push(@{$self->{CONFIG}}, 'shellflags') if $Config::Config{shellflags};
1571 foreach $m (@{$self->{CONFIG}}){
1572 next if $once_only{$m};
1573 print STDOUT "CONFIG key '$m' does not exist in Config.pm\n"
1574 unless exists $Config::Config{$m};
1575 $self->{uc $m} ||= $Config::Config{$m};
1579 # This is too dangerous:
1580 # if ($^O eq "next") {
1581 # $self->{AR} = "libtool";
1582 # $self->{AR_STATIC_ARGS} = "-o";
1584 # But I leave it as a placeholder
1586 $self->{AR_STATIC_ARGS} ||= "cr";
1588 # These should never be needed
1589 $self->{LD} ||= 'ld';
1590 $self->{OBJ_EXT} ||= '.o';
1591 $self->{LIB_EXT} ||= '.a';
1593 $self->{MAP_TARGET} ||= "perl";
1595 $self->{LIBPERL_A} ||= "libperl$self->{LIB_EXT}";
1597 # make a simple check if we find Exporter
1598 warn "Warning: PERL_LIB ($self->{PERL_LIB}) seems not to be a perl library directory
1599 (Exporter.pm not found)"
1600 unless -f $self->catfile("$self->{PERL_LIB}","Exporter.pm") ||
1601 $self->{NAME} eq "ExtUtils::MakeMaker";
1603 # Determine VERSION and VERSION_FROM
1604 ($self->{DISTNAME}=$self->{NAME}) =~ s#(::)#-#g unless $self->{DISTNAME};
1605 if ($self->{VERSION_FROM}){
1606 $self->{VERSION} = $self->parse_version($self->{VERSION_FROM}) or
1607 Carp::carp "WARNING: Setting VERSION via file '$self->{VERSION_FROM}' failed\n"
1611 if ($self->{VERSION}) {
1612 $self->{VERSION} =~ s/^\s+//;
1613 $self->{VERSION} =~ s/\s+$//;
1616 $self->{VERSION} ||= "0.10";
1617 ($self->{VERSION_SYM} = $self->{VERSION}) =~ s/\W/_/g;
1620 # Graham Barr and Paul Marquess had some ideas how to ensure
1621 # version compatibility between the *.pm file and the
1622 # corresponding *.xs file. The bottomline was, that we need an
1623 # XS_VERSION macro that defaults to VERSION:
1624 $self->{XS_VERSION} ||= $self->{VERSION};
1626 # --- Initialize Perl Binary Locations
1628 # Find Perl 5. The only contract here is that both 'PERL' and 'FULLPERL'
1629 # will be working versions of perl 5. miniperl has priority over perl
1630 # for PERL to ensure that $(PERL) is usable while building ./ext/*
1631 my ($component,@defpath);
1632 foreach $component ($self->{PERL_SRC}, $self->path(), $Config::Config{binexp}) {
1633 push @defpath, $component if defined $component;
1636 $self->find_perl(5.0, [ $^X, 'miniperl','perl','perl5',"perl$]" ],
1637 \@defpath, $Verbose ) unless ($self->{PERL});
1638 # don't check if perl is executable, maybe they have decided to
1639 # supply switches with perl
1641 # Define 'FULLPERL' to be a non-miniperl (used in test: target)
1642 ($self->{FULLPERL} = $self->{PERL}) =~ s/miniperl/perl/i
1643 unless ($self->{FULLPERL});
1648 Initializes EXTRALIBS, BSLOADLIBS, LDLOADLIBS, LIBS, LD_RUN_PATH,
1649 OBJECT, BOOTDEP, PERLMAINCC, LDFROM, LINKTYPE, NOOP, FIRST_MAKEFILE,
1650 MAKEFILE, NOECHO, RM_F, RM_RF, TOUCH, CP, MV, CHMOD, UMASK_NULL
1654 sub init_others { # --- Initialize Other Attributes
1657 # Compute EXTRALIBS, BSLOADLIBS and LDLOADLIBS from $self->{LIBS}
1658 # Lets look at $self->{LIBS} carefully: It may be an anon array, a string or
1659 # undefined. In any case we turn it into an anon array:
1661 # May check $Config{libs} too, thus not empty.
1662 $self->{LIBS}=[''] unless $self->{LIBS};
1664 $self->{LIBS}=[$self->{LIBS}] if ref \$self->{LIBS} eq SCALAR;
1665 $self->{LD_RUN_PATH} = "";
1667 foreach $libs ( @{$self->{LIBS}} ){
1668 $libs =~ s/^\s*(.*\S)\s*$/$1/; # remove leading and trailing whitespace
1669 my(@libs) = $self->extliblist($libs);
1670 if ($libs[0] or $libs[1] or $libs[2]){
1671 # LD_RUN_PATH now computed by ExtUtils::Liblist
1672 ($self->{EXTRALIBS}, $self->{BSLOADLIBS}, $self->{LDLOADLIBS}, $self->{LD_RUN_PATH}) = @libs;
1677 if ( $self->{OBJECT} ) {
1678 $self->{OBJECT} =~ s!\.o(bj)?\b!\$(OBJ_EXT)!g;
1680 # init_dirscan should have found out, if we have C files
1681 $self->{OBJECT} = "";
1682 $self->{OBJECT} = '$(BASEEXT)$(OBJ_EXT)' if @{$self->{C}||[]};
1684 $self->{OBJECT} =~ s/\n+/ \\\n\t/g;
1685 $self->{BOOTDEP} = (-f "$self->{BASEEXT}_BS") ? "$self->{BASEEXT}_BS" : "";
1686 $self->{PERLMAINCC} ||= '$(CC)';
1687 $self->{LDFROM} = '$(OBJECT)' unless $self->{LDFROM};
1689 # Sanity check: don't define LINKTYPE = dynamic if we're skipping
1690 # the 'dynamic' section of MM. We don't have this problem with
1691 # 'static', since we either must use it (%Config says we can't
1692 # use dynamic loading) or the caller asked for it explicitly.
1693 if (!$self->{LINKTYPE}) {
1694 $self->{LINKTYPE} = $self->{SKIPHASH}{'dynamic'}
1696 : ($Config::Config{usedl} ? 'dynamic' : 'static');
1699 # These get overridden for VMS and maybe some other systems
1700 $self->{NOOP} ||= "sh -c true";
1701 $self->{FIRST_MAKEFILE} ||= "Makefile";
1702 $self->{MAKEFILE} ||= $self->{FIRST_MAKEFILE};
1703 $self->{MAKE_APERL_FILE} ||= "Makefile.aperl";
1704 $self->{NOECHO} = '@' unless defined $self->{NOECHO};
1705 $self->{RM_F} ||= "rm -f";
1706 $self->{RM_RF} ||= "rm -rf";
1707 $self->{TOUCH} ||= "touch";
1708 $self->{CP} ||= "cp";
1709 $self->{MV} ||= "mv";
1710 $self->{CHMOD} ||= "chmod";
1711 $self->{UMASK_NULL} ||= "umask 0";
1716 Defines the install target.
1721 my($self, %attribs) = @_;
1725 install :: all pure_install doc_install
1727 install_perl :: all pure_perl_install doc_perl_install
1729 install_site :: all pure_site_install doc_site_install
1731 install_ :: install_site
1732 @echo INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
1734 pure_install :: pure_$(INSTALLDIRS)_install
1736 doc_install :: doc_$(INSTALLDIRS)_install
1737 }.$self->{NOECHO}.q{echo Appending installation info to $(INSTALLARCHLIB)/perllocal.pod
1739 pure__install : pure_site_install
1740 @echo INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
1742 doc__install : doc_site_install
1743 @echo INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
1745 pure_perl_install ::
1746 }.$self->{NOECHO}.q{$(MOD_INSTALL) \
1747 read }.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{ \
1748 write }.$self->catfile('$(INSTALLARCHLIB)','auto','$(FULLEXT)','.packlist').q{ \
1749 $(INST_LIB) $(INSTALLPRIVLIB) \
1750 $(INST_ARCHLIB) $(INSTALLARCHLIB) \
1751 $(INST_BIN) $(INSTALLBIN) \
1752 $(INST_SCRIPT) $(INSTALLSCRIPT) \
1753 $(INST_MAN1DIR) $(INSTALLMAN1DIR) \
1754 $(INST_MAN3DIR) $(INSTALLMAN3DIR)
1755 }.$self->{NOECHO}.q{$(WARN_IF_OLD_PACKLIST) \
1756 }.$self->catdir('$(SITEARCHEXP)','auto','$(FULLEXT)').q{
1759 pure_site_install ::
1760 }.$self->{NOECHO}.q{$(MOD_INSTALL) \
1761 read }.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{ \
1762 write }.$self->catfile('$(INSTALLSITEARCH)','auto','$(FULLEXT)','.packlist').q{ \
1763 $(INST_LIB) $(INSTALLSITELIB) \
1764 $(INST_ARCHLIB) $(INSTALLSITEARCH) \
1765 $(INST_BIN) $(INSTALLBIN) \
1766 $(INST_SCRIPT) $(INSTALLSCRIPT) \
1767 $(INST_MAN1DIR) $(INSTALLMAN1DIR) \
1768 $(INST_MAN3DIR) $(INSTALLMAN3DIR)
1769 }.$self->{NOECHO}.q{$(WARN_IF_OLD_PACKLIST) \
1770 }.$self->catdir('$(PERL_ARCHLIB)','auto','$(FULLEXT)').q{
1773 }.$self->{NOECHO}.q{$(DOC_INSTALL) \
1774 "Module" "$(NAME)" \
1775 "installed into" "$(INSTALLPRIVLIB)" \
1776 LINKTYPE "$(LINKTYPE)" \
1777 VERSION "$(VERSION)" \
1778 EXE_FILES "$(EXE_FILES)" \
1779 >> }.$self->catfile('$(INSTALLARCHLIB)','perllocal.pod').q{
1782 }.$self->{NOECHO}.q{$(DOC_INSTALL) \
1783 "Module" "$(NAME)" \
1784 "installed into" "$(INSTALLSITELIB)" \
1785 LINKTYPE "$(LINKTYPE)" \
1786 VERSION "$(VERSION)" \
1787 EXE_FILES "$(EXE_FILES)" \
1788 >> }.$self->catfile('$(INSTALLARCHLIB)','perllocal.pod').q{
1793 uninstall :: uninstall_from_$(INSTALLDIRS)dirs
1795 uninstall_from_perldirs ::
1797 q{$(UNINSTALL) }.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{
1799 uninstall_from_sitedirs ::
1801 q{$(UNINSTALL) }.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{
1807 =item installbin (o)
1809 Defines targets to install EXE_FILES.
1815 return "" unless $self->{EXE_FILES} && ref $self->{EXE_FILES} eq "ARRAY";
1816 return "" unless @{$self->{EXE_FILES}};
1817 my(@m, $from, $to, %fromto, @to);
1818 push @m, $self->dir_target(qw[$(INST_SCRIPT)]);
1819 for $from (@{$self->{EXE_FILES}}) {
1820 my($path)= $self->catfile('$(INST_SCRIPT)', basename($from));
1821 local($_) = $path; # for backwards compatibility
1822 $to = $self->libscan($path);
1823 print "libscan($from) => '$to'\n" if ($Verbose >=2);
1826 @to = values %fromto;
1828 EXE_FILES = @{$self->{EXE_FILES}}
1836 while (($from,$to) = each %fromto) {
1837 last unless defined $from;
1838 my $todir = dirname($to);
1840 $to: $from $self->{MAKEFILE} $todir/.exists
1841 $self->{NOECHO}$self->{RM_F} $to
1842 $self->{CP} $from $to
1850 Takes a path to a file that is found by init_dirscan and returns false
1851 if we don't want to include this file in the library. Mainly used to
1852 exclude RCS, CVS, and SCCS directories from installation.
1859 my($self,$path) = @_;
1860 return '' if $path =~ m:\b(RCS|CVS|SCCS)\b: ;
1866 Defines the linkext target which in turn defines the LINKTYPE.
1871 my($self, %attribs) = @_;
1872 # LINKTYPE => static or dynamic or ''
1873 my($linktype) = defined $attribs{LINKTYPE} ?
1874 $attribs{LINKTYPE} : '$(LINKTYPE)';
1876 linkext :: $linktype
1877 $self->{NOECHO}\$(NOOP)
1883 Takes as arguments a directory name and a regular expression. Returns
1884 all entries in the directory that match the regular expression.
1890 my($dir, $regex) = @_;
1892 my $dh = new DirHandle;
1893 $dh->open($dir || ".") or return ();
1896 @ls = grep(/$regex/, @ls) if $regex;
1902 Simple subroutine to insert the macros defined by the macro attribute
1908 my($self,%attribs) = @_;
1910 while (($key,$val) = each %attribs){
1911 last unless defined $key;
1912 push @m, "$key = $val\n";
1919 Called by staticmake. Defines how to write the Makefile to produce a
1925 my($self, %attribs) = @_;
1926 my($makefilename, $searchdirs, $static, $extra, $perlinc, $target, $tmp, $libperl) =
1927 @attribs{qw(MAKE DIRS STAT EXTRA INCL TARGET TMP LIBPERL)};
1930 # --- MakeMaker makeaperl section ---
1931 MAP_TARGET = $target
1932 FULLPERL = $self->{FULLPERL}
1934 return join '', @m if $self->{PARENT};
1936 my($dir) = join ":", @{$self->{DIR}};
1938 unless ($self->{MAKEAPERL}) {
1940 $(MAP_TARGET) :: static $(MAKE_APERL_FILE)
1941 $(MAKE) -f $(MAKE_APERL_FILE) $@
1943 $(MAKE_APERL_FILE) : $(FIRST_MAKEFILE)
1944 }.$self->{NOECHO}.q{echo Writing \"$(MAKE_APERL_FILE)\" for this $(MAP_TARGET)
1945 }.$self->{NOECHO}.q{$(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \
1946 Makefile.PL DIR=}, $dir, q{ \
1947 MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \
1948 MAKEAPERL=1 NORECURS=1 CCCDLFLAGS=};
1954 push @m, " \\\n\t\t$_";
1956 # push @m, map( " \\\n\t\t$_", @ARGV );
1964 my($cccmd, $linkcmd, $lperl);
1967 $cccmd = $self->const_cccmd($libperl);
1968 $cccmd =~ s/^CCCMD\s*=\s*//;
1969 $cccmd =~ s/\$\(INC\)/ -I$self->{PERL_INC} /;
1970 $cccmd .= " $Config::Config{cccdlflags}"
1971 if ($Config::Config{useshrplib} eq 'true');
1972 $cccmd =~ s/\(CC\)/\(PERLMAINCC\)/;
1974 # The front matter of the linkcommand...
1975 $linkcmd = join ' ', "\$(CC)",
1976 grep($_, @Config{qw(large split ldflags ccdlflags)});
1977 $linkcmd =~ s/\s+/ /g;
1978 $linkcmd =~ s,(perl\.exp),\$(PERL_INC)/$1,;
1980 # Which *.a files could we make use of...
1983 File::Find::find(sub {
1984 return unless m/\Q$self->{LIB_EXT}\E$/;
1985 return if m/^libperl/;
1987 if( exists $self->{INCLUDE_EXT} ){
1992 ($xx = $File::Find::name) =~ s,.*?/auto/,,;
1996 # Throw away anything not explicitly marked for inclusion.
1997 # DynaLoader is implied.
1998 foreach $incl ((@{$self->{INCLUDE_EXT}},'DynaLoader')){
2004 return unless $found;
2006 elsif( exists $self->{EXCLUDE_EXT} ){
2010 ($xx = $File::Find::name) =~ s,.*?/auto/,,;
2014 # Throw away anything explicitly marked for exclusion
2015 foreach $excl (@{$self->{EXCLUDE_EXT}}){
2016 return if( $xx eq $excl );
2020 # don't include the installed version of this extension. I
2021 # leave this line here, although it is not necessary anymore:
2022 # I patched minimod.PL instead, so that Miniperl.pm won't
2023 # enclude duplicates
2025 # Once the patch to minimod.PL is in the distribution, I can
2027 return if $File::Find::name =~ m:auto/$self->{FULLEXT}/$self->{BASEEXT}$self->{LIB_EXT}$:;
2029 $static{cwd() . "/" . $_}++;
2030 }, grep( -d $_, @{$searchdirs || []}) );
2032 # We trust that what has been handed in as argument, will be buildable
2033 $static = [] unless $static;
2034 @static{@{$static}} = (1) x @{$static};
2036 $extra = [] unless $extra && ref $extra eq 'ARRAY';
2037 for (sort keys %static) {
2038 next unless /\Q$self->{LIB_EXT}\E$/;
2039 $_ = dirname($_) . "/extralibs.ld";
2043 grep(s/^/-I/, @{$perlinc || []});
2045 $target = "perl" unless $target;
2046 $tmp = "." unless $tmp;
2048 # MAP_STATIC doesn't look into subdirs yet. Once "all" is made and we
2049 # regenerate the Makefiles, MAP_STATIC and the dependencies for
2050 # extralibs.all are computed correctly
2052 MAP_LINKCMD = $linkcmd
2053 MAP_PERLINC = @{$perlinc || []}
2055 join(" \\\n\t", reverse sort keys %static), "
2057 MAP_PRELIBS = $Config::Config{libs} $Config::Config{cryptlib}
2060 if (defined $libperl) {
2061 ($lperl = $libperl) =~ s/\$\(A\)/$self->{LIB_EXT}/;
2063 unless ($libperl && -f $lperl) { # Ilya's code...
2064 my $dir = $self->{PERL_SRC} || "$self->{PERL_ARCHLIB}/CORE";
2065 $libperl ||= "libperl$self->{LIB_EXT}";
2066 $libperl = "$dir/$libperl";
2067 $lperl ||= "libperl$self->{LIB_EXT}";
2068 $lperl = "$dir/$lperl";
2069 print STDOUT "Warning: $libperl not found
2070 If you're going to build a static perl binary, make sure perl is installed
2071 otherwise ignore this warning\n"
2072 unless (-f $lperl || defined($self->{PERL_SRC}));
2076 MAP_LIBPERL = $libperl
2080 \$(INST_ARCHAUTODIR)/extralibs.all: \$(INST_ARCHAUTODIR)/.exists ".join(" \\\n\t", @$extra)."
2081 $self->{NOECHO}$self->{RM_F} \$\@
2082 $self->{NOECHO}\$(TOUCH) \$\@
2086 foreach $catfile (@$extra){
2087 push @m, "\tcat $catfile >> \$\@\n";
2091 \$(MAP_TARGET) :: $tmp/perlmain\$(OBJ_EXT) \$(MAP_LIBPERL) \$(MAP_STATIC) \$(INST_ARCHAUTODIR)/extralibs.all
2092 \$(MAP_LINKCMD) -o \$\@ \$(OPTIMIZE) $tmp/perlmain\$(OBJ_EXT) \$(MAP_LIBPERL) \$(MAP_STATIC) `cat \$(INST_ARCHAUTODIR)/extralibs.all` \$(MAP_PRELIBS)
2093 $self->{NOECHO}echo 'To install the new \"\$(MAP_TARGET)\" binary, call'
2094 $self->{NOECHO}echo ' make -f $makefilename inst_perl MAP_TARGET=\$(MAP_TARGET)'
2095 $self->{NOECHO}echo 'To remove the intermediate files say'
2096 $self->{NOECHO}echo ' make -f $makefilename map_clean'
2098 $tmp/perlmain\$(OBJ_EXT): $tmp/perlmain.c
2100 push @m, "\tcd $tmp && $cccmd -I\$(PERL_INC) perlmain.c\n";
2103 $tmp/perlmain.c: $makefilename}, q{
2104 }.$self->{NOECHO}.q{echo Writing $@
2105 }.$self->{NOECHO}.q{$(PERL) $(MAP_PERLINC) -e 'use ExtUtils::Miniperl; \\
2106 writemain(grep s#.*/auto/##, qw|$(MAP_STATIC)|)' > $@.tmp && mv $@.tmp $@
2112 }.$self->{NOECHO}.q{echo Appending installation info to $(INSTALLARCHLIB)/perllocal.pod
2113 }.$self->{NOECHO}.q{$(DOC_INSTALL) \
2114 "Perl binary" "$(MAP_TARGET)" \
2115 MAP_STATIC "$(MAP_STATIC)" \
2116 MAP_EXTRA "`cat $(INST_ARCHAUTODIR)/extralibs.all`" \
2117 MAP_LIBPERL "$(MAP_LIBPERL)" \
2118 >> }.$self->catfile('$(INSTALLARCHLIB)','perllocal.pod').q{
2123 inst_perl: pure_inst_perl doc_inst_perl
2125 pure_inst_perl: $(MAP_TARGET)
2126 }.$self->{CP}.q{ $(MAP_TARGET) }.$self->catfile('$(INSTALLBIN)','$(MAP_TARGET)').q{
2131 }.$self->{RM_F}.qq{ $tmp/perlmain\$(OBJ_EXT) $tmp/perlmain.c \$(MAP_TARGET) $makefilename \$(INST_ARCHAUTODIR)/extralibs.all
2139 Defines how to rewrite the Makefile.
2146 # We do not know what target was originally specified so we
2147 # must force a manual rerun to be sure. But as it should only
2148 # happen very rarely it is not a significant problem.
2150 $(OBJECT) : $(FIRST_MAKEFILE)
2151 ' if $self->{OBJECT};
2154 # We take a very conservative approach here, but it\'s worth it.
2155 # We move Makefile to Makefile.old here to avoid gnu make looping.
2156 }.$self->{MAKEFILE}.q{ : Makefile.PL $(CONFIGDEP)
2157 }.$self->{NOECHO}.q{echo "Makefile out-of-date with respect to $?"
2158 }.$self->{NOECHO}.q{echo "Cleaning current config before rebuilding Makefile..."
2159 -}.$self->{NOECHO}.q{mv }."$self->{MAKEFILE} $self->{MAKEFILE}.old".q{
2160 -$(MAKE) -f }.$self->{MAKEFILE}.q{.old clean >/dev/null 2>&1 || true
2161 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" Makefile.PL }.join(" ",map(qq["$_"],@ARGV)).q{
2162 }.$self->{NOECHO}.q{echo ">>> Your Makefile has been rebuilt. <<<"
2163 }.$self->{NOECHO}.q{echo ">>> Please rerun the make command. <<<"; false
2165 # To change behavior to :: would be nice, but would break Tk b9.02
2166 # so you find such a warning below the dist target.
2167 #}.$self->{MAKEFILE}.q{ :: $(VERSION_FROM)
2168 # }.$self->{NOECHO}.q{echo "Warning: Makefile possibly out of date with $(VERSION_FROM)"
2174 =item manifypods (o)
2176 Defines targets and routines to translate the pods into manpages and
2177 put them into the INST_* directories.
2182 my($self, %attribs) = @_;
2183 return "\nmanifypods :\n\t$self->{NOECHO}\$(NOOP)\n" unless %{$self->{MAN3PODS}} or %{$self->{MAN1PODS}};
2186 if (defined $self->{PERL_SRC}) {
2187 $pod2man_exe = $self->catfile($self->{PERL_SRC},'pod','pod2man');
2189 $pod2man_exe = $self->catfile($Config{scriptdirexp},'pod2man');
2191 unless ($self->perl_script($pod2man_exe)) {
2192 # No pod2man but some MAN3PODS to be installed
2195 Warning: I could not locate your pod2man program. Please make sure,
2196 your pod2man program is in your PATH before you execute 'make'
2199 $pod2man_exe = "-S pod2man";
2203 qq[POD2MAN_EXE = $pod2man_exe\n],
2204 q[POD2MAN = $(PERL) -we '%m=@ARGV;for (keys %m){' \\
2205 -e 'next if -e $$m{$$_} && -M $$m{$$_} < -M $$_ && -M $$m{$$_} < -M "].$self->{MAKEFILE}.q[";' \\
2206 -e 'print "Manifying $$m{$$_}\n";' \\
2207 -e 'system(qq[$$^X ].q["-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" $(POD2MAN_EXE) ].qq[$$_>$$m{$$_}])==0 or warn "Couldn\\047t install $$m{$$_}\n";' \\
2208 -e 'chmod 0644, $$m{$$_} or warn "chmod 644 $$m{$$_}: $$!\n";}'
2210 push @m, "\nmanifypods : ";
2211 push @m, join " \\\n\t", keys %{$self->{MAN1PODS}}, keys %{$self->{MAN3PODS}};
2214 if (%{$self->{MAN1PODS}} || %{$self->{MAN3PODS}}) {
2215 push @m, "\t$self->{NOECHO}\$(POD2MAN) \\\n\t";
2216 push @m, join " \\\n\t", %{$self->{MAN1PODS}}, %{$self->{MAN3PODS}};
2223 Returns true, if the argument is likely to be a command.
2228 my($self,$file) = @_;
2229 return $file if -x $file && ! -d $file;
2233 =item maybe_command_in_dirs
2235 method under development. Not yet used. Ask Ilya :-)
2239 sub maybe_command_in_dirs { # $ver is optional argument if looking for perl
2240 # Ilya's suggestion. Not yet used, want to understand it first, but at least the code is here
2241 my($self, $names, $dirs, $trace, $ver) = @_;
2243 foreach $dir (@$dirs){
2244 next unless defined $dir; # $self->{PERL_SRC} may be undefined
2245 foreach $name (@$names){
2247 if ($self->file_name_is_absolute($name)) { # /foo/bar
2249 } elsif ($self->canonpath($name) eq $self->canonpath(basename($name))) { # bar
2250 $abs = $self->catfile($dir, $name);
2252 $abs = $self->catfile($self->curdir, $name);
2254 print "Checking $abs for $name\n" if ($trace >= 2);
2255 next unless $tryabs = $self->maybe_command($abs);
2256 print "Substituting $tryabs instead of $abs\n"
2257 if ($trace >= 2 and $tryabs ne $abs);
2260 print "Executing $abs\n" if ($trace >= 2);
2261 if (`$abs -e 'require $ver; print "VER_OK\n" ' 2>&1` =~ /VER_OK/) {
2262 print "Using PERL=$abs\n" if $trace;
2265 } else { # Do not look for perl
2272 =item needs_linking (o)
2274 Does this module need linking? Looks into subdirectory objects (see
2275 also has_link_code())
2282 $caller = (caller(0))[3];
2283 Carp::confess("Needs_linking called too early") if $caller =~ /^ExtUtils::MakeMaker::/;
2284 return $self->{NEEDS_LINKING} if defined $self->{NEEDS_LINKING};
2285 if ($self->has_link_code or $self->{MAKEAPERL}){
2286 $self->{NEEDS_LINKING} = 1;
2289 foreach $child (keys %{$self->{CHILDREN}}) {
2290 if ($self->{CHILDREN}->{$child}->needs_linking) {
2291 $self->{NEEDS_LINKING} = 1;
2295 return $self->{NEEDS_LINKING} = 0;
2300 misnamed method (will have to be changed). The MM_Unix method just
2301 returns the argument without further processing.
2303 On VMS used to insure that colons marking targets are preceded by
2304 space - most Unix Makes don't need this, but it's necessary under VMS
2305 to distinguish the target delimiter from a colon appearing as part of
2311 my($self,$text) = @_;
2317 parse a file and return what you think is $VERSION in this file set to
2322 my($self,$parsefile) = @_;
2326 open(FH,$parsefile) or die "Could not open '$parsefile': $!";
2329 $inpod = /^=(?!cut)/ ? 1 : /^=cut/ ? 0 : $inpod;
2332 next unless /\$(([\w\:\']*)\bVERSION)\b.*\=/;
2334 package ExtUtils::MakeMaker::_version;
2340 $result = eval($eval) || 0;
2341 die "Could not eval '$eval' in $parsefile: $@" if $@;
2351 Defines the string that is passed to recursive make calls in
2362 foreach $key (qw(LIBPERL_A LINKTYPE PREFIX OPTIMIZE)){
2363 push @pasthru, "$key=\"\$($key)\"";
2366 push @m, "\nPASTHRU = ", join ("\\\n\t", @pasthru), "\n";
2372 Takes no argument, returns the environment variable PATH as an array.
2378 my $path_sep = $Is_OS2 ? ";" : ":";
2379 my $path = $ENV{PATH};
2380 $path =~ s:\\:/:g if $Is_OS2;
2381 my @path = split $path_sep, $path;
2382 foreach(@path) { $_ = '.' if $_ eq '' }
2388 Takes one argument, a file name, and returns the file name, if the
2389 argument is likely to be a perl script. On MM_Unix this is true for
2390 any ordinary, readable file.
2395 my($self,$file) = @_;
2396 return $file if -r $file && -f _;
2400 =item perldepend (o)
2402 Defines the dependency from all *.h files that come with the perl
2411 # Check for unpropogated config.sh changes. Should never happen.
2412 # We do NOT just update config.h because that is not sufficient.
2413 # An out of date config.h is not fatal but complains loudly!
2414 $(PERL_INC)/config.h: $(PERL_SRC)/config.sh
2415 -}.$self->{NOECHO}.q{echo "Warning: $(PERL_INC)/config.h out of date with $(PERL_SRC)/config.sh"; false
2417 $(PERL_ARCHLIB)/Config.pm: $(PERL_SRC)/config.sh
2418 }.$self->{NOECHO}.q{echo "Warning: $(PERL_ARCHLIB)/Config.pm may be out of date with $(PERL_SRC)/config.sh"
2419 cd $(PERL_SRC) && $(MAKE) lib/Config.pm
2420 } if $self->{PERL_SRC};
2422 return join "", @m unless $self->needs_linking;
2426 $(PERL_INC)/EXTERN.h $(PERL_INC)/gv.h $(PERL_INC)/pp.h \
2427 $(PERL_INC)/INTERN.h $(PERL_INC)/handy.h $(PERL_INC)/proto.h \
2428 $(PERL_INC)/XSUB.h $(PERL_INC)/hv.h $(PERL_INC)/regcomp.h \
2429 $(PERL_INC)/av.h $(PERL_INC)/keywords.h $(PERL_INC)/regexp.h \
2430 $(PERL_INC)/config.h $(PERL_INC)/mg.h $(PERL_INC)/scope.h \
2431 $(PERL_INC)/cop.h $(PERL_INC)/op.h $(PERL_INC)/sv.h \
2432 $(PERL_INC)/cv.h $(PERL_INC)/opcode.h $(PERL_INC)/unixish.h \
2433 $(PERL_INC)/dosish.h $(PERL_INC)/patchlevel.h $(PERL_INC)/util.h \
2434 $(PERL_INC)/embed.h $(PERL_INC)/perl.h \
2435 $(PERL_INC)/form.h $(PERL_INC)/perly.h
2437 $(OBJECT) : $(PERL_HDRS)
2438 } if $self->{OBJECT};
2440 push @m, join(" ", values %{$self->{XS}})." : \$(XSUBPPDEPS)\n" if %{$self->{XS}};
2447 Defines target that copies all files in the hash PM to their
2448 destination and autosplits them. See L<ExtUtils::Install/pm_to_blib>
2454 my($autodir) = $self->catdir('$(INST_LIB)','auto');
2456 pm_to_blib: $(TO_INST_PM)
2457 }.$self->{NOECHO}.q{$(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" \
2458 "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Install \
2459 -e 'pm_to_blib({qw{$(PM_TO_BLIB)}},"}.$autodir.q{")'
2460 }.$self->{NOECHO}.q{$(TOUCH) $@
2464 =item post_constants (o)
2466 Returns an empty string per default. Dedicated to overrides from
2467 within Makefile.PL after all constants have been defined.
2476 =item post_initialize (o)
2478 Returns an empty string per default. Used in Makefile.PLs to add some
2479 chunk of text to the Makefile after the object is initialized.
2483 sub post_initialize {
2490 Returns an empty string. Can be used in Makefile.PLs to write some
2491 text to the Makefile at the end.
2502 Check a path variable in $self from %Config, if it contains a prefix,
2503 and replace it with another one.
2505 Takes as arguments an attribute name, a search prefix and a
2506 replacement prefix. Changes the attribute in the object.
2511 my($self,$var,$sprefix,$rprefix) = @_;
2512 $self->{uc $var} ||= $Config{lc $var};
2513 $self->{uc $var} = VMS::Filespec::unixpath($self->{uc $var}) if $Is_VMS;
2514 $self->{uc $var} =~ s/\Q$sprefix\E/$rprefix/;
2519 Defines targets to run *.PL files.
2525 return "" unless $self->{PL_FILES};
2527 foreach $plfile (sort keys %{$self->{PL_FILES}}) {
2529 all :: $self->{PL_FILES}->{$plfile}
2531 $self->{PL_FILES}->{$plfile} :: $plfile
2532 \$(PERL) -I\$(INST_ARCHLIB) -I\$(INST_LIB) -I\$(PERL_ARCHLIB) -I\$(PERL_LIB) $plfile
2540 Defines the realclean target.
2545 my($self, %attribs) = @_;
2548 # Delete temporary files (via clean) and also delete installed files
2549 realclean purge :: clean
2551 # realclean subdirectories first (already cleaned)
2552 my $sub = "\t-cd %s && test -f %s && \$(MAKE) %s realclean\n";
2553 foreach(@{$self->{DIR}}){
2554 push(@m, sprintf($sub,$_,"$self->{MAKEFILE}.old","-f $self->{MAKEFILE}.old"));
2555 push(@m, sprintf($sub,$_,"$self->{MAKEFILE}",''));
2557 push(@m, " $self->{RM_RF} \$(INST_AUTODIR) \$(INST_ARCHAUTODIR)\n");
2558 if( $self->has_link_code ){
2559 push(@m, " $self->{RM_F} \$(INST_DYNAMIC) \$(INST_BOOT)\n");
2560 push(@m, " $self->{RM_F} \$(INST_STATIC)\n");
2562 push(@m, " $self->{RM_F} " . join(" ", values %{$self->{PM}}) . "\n");
2563 my(@otherfiles) = ($self->{MAKEFILE},
2564 "$self->{MAKEFILE}.old"); # Makefiles last
2565 push(@otherfiles, $attribs{FILES}) if $attribs{FILES};
2566 push(@m, " $self->{RM_RF} @otherfiles\n") if @otherfiles;
2567 push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP};
2571 =item replace_manpage_separator
2573 Takes the name of a package, which may be a nested package, in the
2574 form Foo/Bar and replaces the slash with C<::>. Returns the replacement.
2578 sub replace_manpage_separator {
2579 my($self,$man) = @_;
2586 Defines the static target.
2591 # --- Static Loading Sections ---
2595 ## $(INST_PM) has been moved to the all: target.
2596 ## It remains here for awhile to allow for old usage: "make static"
2597 #static :: '.$self->{MAKEFILE}.' $(INST_STATIC) $(INST_PM)
2598 static :: '.$self->{MAKEFILE}.' $(INST_STATIC)
2599 '.$self->{NOECHO}.'$(NOOP)
2603 =item static_lib (o)
2605 Defines how to produce the *.a (or equivalent) files.
2611 # Come to think of it, if there are subdirs with linkcode, we still have no INST_STATIC
2612 # return '' unless $self->needs_linking(); #might be because of a subdir
2614 return '' unless $self->has_link_code;
2618 $(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)/.exists
2621 # If this extension has it's own library (eg SDBM_File)
2622 # then copy that to $(INST_STATIC) and add $(OBJECT) into it.
2623 push(@m, "\t$self->{CP} \$(MYEXTLIB) \$\@\n") if $self->{MYEXTLIB};
2626 q{ $(AR) $(AR_STATIC_ARGS) $@ $(OBJECT) && $(RANLIB) $@
2627 }.$self->{NOECHO}.q{echo "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)/extralibs.ld
2631 # Old mechanism - still available:
2633 push @m, "\t$self->{NOECHO}".q{echo "$(EXTRALIBS)" >> $(PERL_SRC)/ext.libs}."\n\n"
2634 if $self->{PERL_SRC};
2636 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
2640 =item staticmake (o)
2647 my($self, %attribs) = @_;
2650 my(@searchdirs)=($self->{PERL_ARCHLIB}, $self->{SITEARCHEXP}, $self->{INST_ARCHLIB});
2652 # And as it's not yet built, we add the current extension
2653 # but only if it has some C code (or XS code, which implies C code)
2654 if (@{$self->{C}}) {
2655 @static = $self->catfile($self->{INST_ARCHLIB},
2658 "$self->{BASEEXT}$self->{LIB_EXT}"
2662 # Either we determine now, which libraries we will produce in the
2663 # subdirectories or we do it at runtime of the make.
2665 # We could ask all subdir objects, but I cannot imagine, why it
2666 # would be necessary.
2668 # Instead we determine all libraries for the new perl at
2670 my(@perlinc) = ($self->{INST_ARCHLIB}, $self->{INST_LIB}, $self->{PERL_ARCHLIB}, $self->{PERL_LIB});
2672 $self->makeaperl(MAKE => $self->{MAKEFILE},
2673 DIRS => \@searchdirs,
2676 TARGET => $self->{MAP_TARGET},
2678 LIBPERL => $self->{LIBPERL_A}
2684 Helper subroutine for subdirs
2689 my($self, $subdir) = @_;
2694 $self->{NOECHO}cd $subdir && \$(MAKE) all \$(PASTHRU)
2701 Defines targets to process subdirectories.
2706 # --- Sub-directory Sections ---
2709 # This method provides a mechanism to automatically deal with
2710 # subdirectories containing further Makefile.PL scripts.
2711 # It calls the subdir_x() method for each subdirectory.
2712 foreach $dir (@{$self->{DIR}}){
2713 push(@m, $self->subdir_x($dir));
2714 #### print "Including $dir subdirectory\n";
2718 # The default clean, realclean and test targets in this Makefile
2719 # have automatically been given entries for each subdir.
2723 push(@m, "\n# none")
2730 Defines the test targets.
2735 # --- Test and Installation Sections ---
2737 my($self, %attribs) = @_;
2738 my($tests) = $attribs{TESTS} || (-d "t" ? "t/*.t" : "");
2742 TEST_TYPE=test_\$(LINKTYPE)
2746 testdb :: testdb_\$(LINKTYPE)
2748 test :: \$(TEST_TYPE)
2750 push(@m, map("\t$self->{NOECHO}cd $_ && test -f $self->{MAKEFILE} && \$(MAKE) test \$(PASTHRU)\n",
2752 push(@m, "\t$self->{NOECHO}echo 'No tests defined for \$(NAME) extension.'\n")
2753 unless $tests or -f "test.pl" or @{$self->{DIR}};
2756 push(@m, "test_dynamic :: pure_all\n");
2757 push(@m, $self->test_via_harness('$(FULLPERL)', $tests)) if $tests;
2758 push(@m, $self->test_via_script('$(FULLPERL)', 'test.pl')) if -f "test.pl";
2761 push(@m, "testdb_dynamic :: pure_all\n");
2762 push(@m, $self->test_via_script('$(FULLPERL) $(TESTDB_SW)', '$(TEST_FILE)'));
2765 # Occasionally we may face this degenerate target:
2766 push @m, "test_ : test_dynamic\n\n";
2768 if ($self->needs_linking()) {
2769 push(@m, "test_static :: pure_all \$(MAP_TARGET)\n");
2770 push(@m, $self->test_via_harness('./$(MAP_TARGET)', $tests)) if $tests;
2771 push(@m, $self->test_via_script('./$(MAP_TARGET)', 'test.pl')) if -f "test.pl";
2773 push(@m, "testdb_static :: pure_all \$(MAP_TARGET)\n");
2774 push(@m, $self->test_via_script('./$(MAP_TARGET) $(TESTDB_SW)', '$(TEST_FILE)'));
2777 push @m, "test_static :: test_dynamic\n";
2778 push @m, "testdb_static :: testdb_dynamic\n";
2783 =item test_via_harness (o)
2785 Helper method to write the test targets
2789 sub test_via_harness {
2790 my($self, $perl, $tests) = @_;
2791 "\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";
2794 =item test_via_script (o)
2796 Other helper method for test.
2800 sub test_via_script {
2801 my($self, $perl, $script) = @_;
2802 qq{\tPERL_DL_NONLAZY=1 $perl}.q{ -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) }.qq{$script
2806 =item tool_autosplit (o)
2808 Defines a simple perl call that runs autosplit. May be deprecated by
2813 sub tool_autosplit {
2814 # --- Tool Sections ---
2816 my($self, %attribs) = @_;
2818 $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN};
2820 # Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
2821 AUTOSPLITFILE = $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e 'use AutoSplit;}.$asl.q{autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1) ;'
2825 =item tools_other (o)
2827 Defines SHELL, LD, TOUCH, CP, MV, RM_F, RM_RF, CHMOD, UMASK_NULL in
2828 the Makefile. Also defines the perl programs MKPATH,
2829 WARN_IF_OLD_PACKLIST, MOD_INSTALL. DOC_INSTALL, and UNINSTALL.
2836 my $bin_sh = $Config{sh} || '/bin/sh';
2841 for (qw/ CHMOD CP LD MV NOOP RM_F RM_RF TOUCH UMASK_NULL / ) {
2842 push @m, "$_ = $self->{$_}\n";
2847 # The following is a portable way to say mkdir -p
2848 # To see which directories are created, change the if 0 to if 1
2849 MKPATH = $(PERL) -wle '$$"="/"; foreach $$p (@ARGV){' \\
2850 -e 'next if -d $$p; my(@p); foreach(split(/\//,$$p)){' \\
2851 -e 'push(@p,$$_); next if -d "@p/"; print "mkdir @p" if 0;' \\
2852 -e 'mkdir("@p",0777)||die $$! } } exit 0;'
2854 # This helps us to minimize the effect of the .exists files A yet
2855 # better solution would be to have a stable file in the perl
2856 # distribution with a timestamp of zero. But this solution doesn't
2857 # need any changes to the core distribution and works with older perls
2858 EQUALIZE_TIMESTAMP = $(PERL) -we 'open F, ">$$ARGV[1]"; close F;' \\
2859 -e 'utime ((stat("$$ARGV[0]"))[8,9], $$ARGV[1])'
2862 return join "", @m if $self->{PARENT};
2865 # Here we warn users that an old packlist file was found somewhere,
2866 # and that they should call some uninstall routine
2867 WARN_IF_OLD_PACKLIST = $(PERL) -we 'exit unless -f $$ARGV[0];' \\
2868 -e 'print "WARNING: I have found an old package in\n";' \\
2869 -e 'print "\t$$ARGV[0].\n";' \\
2870 -e 'print "Please make sure the two installations are not conflicting\n";'
2875 MOD_INSTALL = $(PERL) -I$(INST_LIB) -I$(PERL_LIB) -MExtUtils::Install \
2876 -e 'install({@ARGV},"$(VERBINST)",0,"$(UNINST)");'
2878 DOC_INSTALL = $(PERL) -e '$$\="\n\n";' \
2879 -e 'print "=head2 ", scalar(localtime), ": C<", shift, ">", " L<", shift, ">";' \
2880 -e 'print "=over 4";' \
2881 -e 'while (defined($$key = shift) and defined($$val = shift)){print "=item *";print "C<$$key: $$val>";}' \
2884 UNINSTALL = $(PERL) -MExtUtils::Install \
2885 -e 'uninstall($$ARGV[0],1);'
2892 =item tool_xsubpp (o)
2894 Determines typemaps, xsubpp version, prototype behaviour.
2900 return "" unless $self->needs_linking;
2901 my($xsdir) = $self->catdir($self->{PERL_LIB},"ExtUtils");
2902 my(@tmdeps) = $self->catdir('$(XSUBPPDIR)','typemap');
2903 if( $self->{TYPEMAPS} ){
2905 foreach $typemap (@{$self->{TYPEMAPS}}){
2906 if( ! -f $typemap ){
2907 warn "Typemap $typemap not found.\n";
2910 push(@tmdeps, $typemap);
2914 push(@tmdeps, "typemap") if -f "typemap";
2915 my(@tmargs) = map("-typemap $_", @tmdeps);
2916 if( exists $self->{XSOPT} ){
2917 unshift( @tmargs, $self->{XSOPT} );
2921 my $xsubpp_version = $self->xsubpp_version($self->catfile($xsdir,"xsubpp"));
2923 # What are the correct thresholds for version 1 && 2 Paul?
2924 if ( $xsubpp_version > 1.923 ){
2925 $self->{XSPROTOARG} = "" unless defined $self->{XSPROTOARG};
2927 if (defined $self->{XSPROTOARG} && $self->{XSPROTOARG} =~ /\-prototypes/) {
2928 print STDOUT qq{Warning: This extension wants to pass the switch "-prototypes" to xsubpp.
2929 Your version of xsubpp is $xsubpp_version and cannot handle this.
2930 Please upgrade to a more recent version of xsubpp.
2933 $self->{XSPROTOARG} = "";
2939 XSUBPP = \$(XSUBPPDIR)/xsubpp
2940 XSPROTOARG = $self->{XSPROTOARG}
2941 XSUBPPDEPS = @tmdeps
2942 XSUBPPARGS = @tmargs
2948 my($self,$xsubpp) = @_;
2949 return $Xsubpp_Version if defined $Xsubpp_Version; # global variable
2953 # try to figure out the version number of the xsubpp on the system
2955 # first try the -v flag, introduced in 1.921 & 2.000a2
2957 return "" unless $self->needs_linking;
2959 my $command = "$self->{PERL} -I$self->{PERL_LIB} $xsubpp -v 2>&1";
2960 print "Running $command\n" if $Verbose >= 2;
2961 $version = `$command` ;
2962 warn "Running '$command' exits with status " . ($?>>8) if $?;
2965 return $Xsubpp_Version = $1 if $version =~ /^xsubpp version (.*)/ ;
2967 # nope, then try something else
2969 my $counter = '000';
2970 my ($file) = 'temp' ;
2971 $counter++ while -e "$file$counter"; # don't overwrite anything
2974 open(F, ">$file") or die "Cannot open file '$file': $!\n" ;
2976 MODULE = fred PACKAGE = fred
2985 $command = "$self->{PERL} $xsubpp $file 2>&1";
2986 print "Running $command\n" if $Verbose >= 2;
2987 my $text = `$command` ;
2988 warn "Running '$command' exits with status " . ($?>>8) if $?;
2991 # gets 1.2 -> 1.92 and 2.000a1
2992 return $Xsubpp_Version = $1 if $text =~ /automatically by xsubpp version ([\S]+)\s*/ ;
2994 # it is either 1.0 or 1.1
2995 return $Xsubpp_Version = 1.1 if $text =~ /^Warning: ignored semicolon/ ;
2997 # none of the above, so 1.0
2998 return $Xsubpp_Version = "1.0" ;
3001 =item top_targets (o)
3003 Defines the targets all, subdirs, config, and O_FILES
3008 # --- Target Sections ---
3013 #all :: config $(INST_PM) subdirs linkext manifypods
3015 all :: pure_all manifypods
3016 '.$self->{NOECHO}.'$(NOOP)
3018 pure_all :: config pm_to_blib subdirs linkext
3019 '.$self->{NOECHO}.'$(NOOP)
3021 subdirs :: $(MYEXTLIB)
3022 '.$self->{NOECHO}.'$(NOOP)
3024 config :: '.$self->{MAKEFILE}.' $(INST_LIBDIR)/.exists
3025 '.$self->{NOECHO}.'$(NOOP)
3027 config :: $(INST_ARCHAUTODIR)/.exists
3028 '.$self->{NOECHO}.'$(NOOP)
3030 config :: $(INST_AUTODIR)/.exists
3031 '.$self->{NOECHO}.'$(NOOP)
3035 config :: Version_check
3036 $self->{NOECHO}\$(NOOP)
3038 } unless $self->{PARENT} or ($self->{PERL_SRC} && $self->{INSTALLDIRS} eq "perl") or $self->{NO_VC};
3040 push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]);
3042 if (%{$self->{MAN1PODS}}) {
3044 config :: \$(INST_MAN1DIR)/.exists
3045 $self->{NOECHO}\$(NOOP)
3048 push @m, $self->dir_target(qw[$(INST_MAN1DIR)]);
3050 if (%{$self->{MAN3PODS}}) {
3052 config :: \$(INST_MAN3DIR)/.exists
3053 $self->{NOECHO}\$(NOOP)
3056 push @m, $self->dir_target(qw[$(INST_MAN3DIR)]);
3060 $(O_FILES): $(H_FILES)
3061 ' if @{$self->{O_FILES} || []} && @{$self->{H} || []};
3065 perldoc ExtUtils::MakeMaker
3070 }.$self->{NOECHO}.q{$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \
3071 -MExtUtils::MakeMaker=Version_check \
3072 -e 'Version_check("$(MM_VERSION)")'
3080 Obsolete, depecated method. Not used since Version 5.21.
3085 # --- perllocal.pod section ---
3086 my($self,$what,$name,@attribs)=@_;
3087 my $time = localtime;
3088 print "=head2 $time: $what C<$name>\n\n=over 4\n\n=item *\n\n";
3089 print join "\n\n=item *\n\n", map("C<$_>",@attribs);
3090 print "\n\n=back\n\n";
3095 Defines the suffix rules to compile XS files to C.
3101 return '' unless $self->needs_linking();
3104 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs >$*.tc && mv $*.tc $@
3110 Defines suffix rules to go from XS to object files directly. This is
3111 only intended for broken make implementations.
3115 sub xs_o { # many makes are too dumb to use xs_c then c_o
3117 return '' unless $self->needs_linking();
3120 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs >xstmp.c && mv xstmp.c $*.c
3121 $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c
3130 L<ExtUtils::MakeMaker>