1 package ExtUtils::MM_NW5;
7 ExtUtils::MM_NW5 - methods to override UN*X behaviour in ExtUtils::MakeMaker
11 use ExtUtils::MM_NW5; # Done internally by ExtUtils::MakeMaker if needed
15 See ExtUtils::MM_Unix for a documentation of the methods provided
16 there. This package overrides the implementation of these methods, not
28 Exporter::import('ExtUtils::MakeMaker',
29 qw( $Verbose &neatvalue));
31 $ENV{EMXSHELL} = 'sh'; # to run `commands`
32 unshift @MM::ISA, 'ExtUtils::MM_NW5';
34 $BORLAND = 1 if $Config{'cc'} =~ /^bcc/i;
35 $GCC = 1 if $Config{'cc'} =~ /^gcc/i;
36 $DMAKE = 1 if $Config{'make'} =~ /^dmake/i;
37 $NMAKE = 1 if $Config{'make'} =~ /^nmake/i;
38 $PERLMAKE = 1 if $Config{'make'} =~ /^pmake/i;
40 # a few workarounds for command.com (very basic)
42 package ExtUtils::MM_Win95;
44 # the $^O test may be overkill, but we want to be sure Win32::IsWin95()
45 # exists before we try it
47 unshift @MM::ISA, 'ExtUtils::MM_Win95'
48 if ($^O =~ /Win32/ && Win32::IsWin95());
52 return '' unless $self->needs_linking();
55 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) \\
56 $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c
62 return '' unless $self->needs_linking();
65 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) \\
66 $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.cpp
70 # many makes are too dumb to use xs_c then c_o
73 return '' unless $self->needs_linking();
76 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) \\
77 $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c
78 $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c
81 } # end of command.com workarounds
84 my($self,%attribs) = @_;
86 my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
87 my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
88 my($funclist) = $attribs{FUNCLIST} || $self->{FUNCLIST} || [];
89 my($imports) = $attribs{IMPORTS} || $self->{IMPORTS} || {};
91 (my $boot = $self->{NAME}) =~ s/:/_/g;
93 if (not $self->{SKIPHASH}{'dynamic'}) {
95 $self->{BASEEXT}.def: Makefile.PL
97 q! $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Mksymlists \\
98 -e "Mksymlists('NAME' => '!, $self->{NAME},
99 q!', 'DLBASE' => '!,$self->{DLBASE},
100 q!', 'DL_FUNCS' => !,neatvalue($funcs),
101 q!, 'FUNCLIST' => !,neatvalue($funclist),
102 q!, 'IMPORTS' => !,neatvalue($imports),
103 q!, 'DL_VARS' => !, neatvalue($vars), q!);"
109 sub replace_manpage_separator {
116 my($self,$file) = @_;
117 my @e = exists($ENV{'PATHEXT'})
118 ? split(/;/, $ENV{PATHEXT})
119 : qw(.com .exe .bat .cmd);
121 for (@e) { $e .= "\Q$_\E|" }
123 # see if file ends in one of the known extensions
124 if ($file =~ /($e)$/i) {
125 return $file if -e $file;
129 return "$file$_" if -e "$file$_";
135 sub file_name_is_absolute {
136 my($self,$file) = @_;
137 $file =~ m{^([a-z]:)?[\\/]}i ;
141 my($self, $ver, $names, $dirs, $trace) = @_;
144 print "Looking for perl $ver by these names:
150 foreach $dir (@$dirs){
151 next unless defined $dir; # $self->{PERL_SRC} may be undefined
152 foreach $name (@$names){
154 if ($self->file_name_is_absolute($name)) { # /foo/bar
156 } elsif ($self->canonpath($name) eq $self->canonpath(basename($name))) { # foo
157 $abs = $self->catfile($dir, $name);
159 $abs = $self->canonpath($self->catfile($self->curdir, $name));
161 print "Checking $abs\n" if ($trace >= 2);
162 next unless $self->maybe_command($abs);
163 print "Executing $abs\n" if ($trace >= 2);
164 $val = `$abs -e "require $ver;" 2>&1`;
166 print "Using PERL=$abs\n" if $trace;
168 } elsif ($trace >= 2) {
169 print "Result: `$val'\n";
173 print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n";
174 0; # false and not empty
181 # append a slash to each argument unless it has one there
182 $_ .= "\\" if $_ eq '' or substr($_,-1) ne "\\";
184 my $result = $self->canonpath(join('', @args));
190 Concatenate one or more directory names and a filename to form a
191 complete path ending with a filename
198 return $file unless @_;
199 my $dir = $self->catdir(@_);
201 $dir .= "\\" unless substr($dir,length($dir)-1,1) eq "\\";
208 &ExtUtils::MM_Unix::init_others;
209 $self->{'TOUCH'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e touch';
210 $self->{'CHMOD'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e chmod';
211 $self->{'CP'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e cp';
212 $self->{'RM_F'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e rm_f';
213 $self->{'RM_RF'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e rm_rf';
214 $self->{'MV'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e mv';
215 $self->{'NOOP'} = 'rem';
216 $self->{'TEST_F'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e test_f';
217 $self->{'LD'} = $Config{'ld'} || 'link';
218 $self->{'AR'} = $Config{'ar'} || 'lib';
219 $self->{'LDLOADLIBS'} ||= $Config{'libs'};
220 # -Lfoo must come first for Borland, so we put it in LDDLFLAGS
222 my $libs = $self->{'LDLOADLIBS'};
224 while ($libs =~ s/(?:^|\s)(("?)-L.+?\2)(?:\s|$)/ /) {
225 $libpath .= ' ' if length $libpath;
228 $self->{'LDLOADLIBS'} = $libs;
229 $self->{'LDDLFLAGS'} ||= $Config{'lddlflags'};
230 $self->{'LDDLFLAGS'} .= " $libpath";
232 $self->{'DEV_NULL'} = '> NUL';
233 # $self->{'NOECHO'} = ''; # till we have it working
235 # incpath is copied to makefile var INCLUDE in constants sub, here just make it empty
236 my $libpth = $Config{'libpth'};
238 $self->{'LIBPTH'} = $libpth;
239 $self->{'BASE_IMPORT'} = $Config{'base_import'};
241 # Additional import file specified from Makefile.pl
242 if($self->{'base_import'}) {
243 $self->{'BASE_IMPORT'} .= ',' . $self->{'base_import'};
246 $self->{'NLM_VERSION'} = $Config{'nlm_version'};
247 $self->{'MPKTOOL'} = $Config{'mpktool'};
248 $self->{'TOOLPATH'} = $Config{'toolpath'};
254 Initializes lots of constants and .SUFFIXES and .PHONY
259 my($self,$libperl)=@_;
260 return $self->{CONST_CCCMD} if $self->{CONST_CCCMD};
261 return '' unless $self->needs_linking();
262 return $self->{CONST_CCCMD} =
263 q{CCCMD = $(CC) $(INC) $(CCFLAGS) $(OPTIMIZE) \\
264 $(PERLTYPE) $(LARGE) $(SPLIT) $(MPOLLUTE) \\
265 -DVERSION="$(VERSION)" -DXS_VERSION="$(XS_VERSION)"};
272 # Added LIBPTH, BASE_IMPORT, ABSTRACT, NLM_VERSION BOOT_SYMBOL, NLM_SHORT_NAME
277 AR_STATIC_ARGS NAME DISTNAME NAME_SYM VERSION
278 VERSION_SYM XS_VERSION INST_BIN INST_EXE INST_LIB
279 INST_ARCHLIB INST_SCRIPT PREFIX INSTALLDIRS
280 INSTALLPRIVLIB INSTALLARCHLIB INSTALLSITELIB
281 INSTALLSITEARCH INSTALLBIN INSTALLSCRIPT PERL_LIB
282 PERL_ARCHLIB SITELIBEXP SITEARCHEXP LIBPERL_A MYEXTLIB
283 FIRST_MAKEFILE MAKE_APERL_FILE PERLMAINCC PERL_SRC
284 PERL_INC PERL FULLPERL LIBPTH BASE_IMPORT PERLRUN
285 PERLRUNINST TEST_LIBS FULL_AR PERL_CORE
286 NLM_VERSION MPKTOOL TOOLPATH
289 next unless defined $self->{$tmp};
290 push @m, "$tmp = $self->{$tmp}\n";
293 (my $boot = $self->{'NAME'}) =~ s/:/_/g;
294 $self->{'BOOT_SYMBOL'}=$boot;
295 push @m, "BOOT_SYMBOL = $self->{'BOOT_SYMBOL'}\n";
297 # If the final binary name is greater than 8 chars,
298 # truncate it here and rename it after creation
299 # otherwise, Watcom Linker fails
300 if(length($self->{'BASEEXT'}) > 8) {
301 $self->{'NLM_SHORT_NAME'} = substr($self->{'NAME'},0,8);
302 push @m, "NLM_SHORT_NAME = $self->{'NLM_SHORT_NAME'}\n";
306 VERSION_MACRO = VERSION
307 DEFINE_VERSION = -D\$(VERSION_MACRO)=\\\"\$(VERSION)\\\"
308 XS_VERSION_MACRO = XS_VERSION
309 XS_DEFINE_VERSION = -D\$(XS_VERSION_MACRO)=\\\"\$(XS_VERSION)\\\"
312 # Get the include path and replace the spaces with ;
313 # Copy this to makefile as INCLUDE = d:\...;d:\;
314 (my $inc = $Config{'incpath'}) =~ s/ /;/g;
316 # Get the additional include path and append to INCLUDE, keep it in
317 # INC will give problems during compilation, hence reset it after getting
319 (my $add_inc = $self->{'INC'}) =~ s/ -I/;/g;
322 INCLUDE = $inc;$add_inc;
325 # Set the path to Watcom binaries which might not have been set in
328 PATH = \$(PATH);\$(TOOLPATH)
332 MAKEMAKER = $INC{'ExtUtils\MakeMaker.pm'}
333 MM_VERSION = $ExtUtils::MakeMaker::VERSION
337 # FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle).
338 # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle)
339 # ROOTEXT = Directory part of FULLEXT with leading slash (eg /DBD) !!! Deprecated from MM 5.32 !!!
340 # PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar)
341 # DLBASE = Basename part of dynamic library. May be just equal BASEEXT.
345 FULLEXT BASEEXT PARENT_NAME DLBASE VERSION_FROM INC DEFINE OBJECT
348 next unless defined $self->{$tmp};
349 push @m, "$tmp = $self->{$tmp}\n";
353 # Handy lists of source code files:
354 XS_FILES= ".join(" \\\n\t", sort keys %{$self->{XS}})."
355 C_FILES = ".join(" \\\n\t", @{$self->{C}})."
356 O_FILES = ".join(" \\\n\t", @{$self->{O_FILES}})."
357 H_FILES = ".join(" \\\n\t", @{$self->{H}})."
358 HTMLLIBPODS = ".join(" \\\n\t", sort keys %{$self->{HTMLLIBPODS}})."
359 HTMLSCRIPTPODS = ".join(" \\\n\t", sort keys %{$self->{HTMLSCRIPTPODS}})."
360 MAN1PODS = ".join(" \\\n\t", sort keys %{$self->{MAN1PODS}})."
361 MAN3PODS = ".join(" \\\n\t", sort keys %{$self->{MAN3PODS}})."
365 INST_HTMLPRIVLIBDIR INSTALLHTMLPRIVLIBDIR
366 INST_HTMLSITELIBDIR INSTALLHTMLSITELIBDIR
367 INST_HTMLSCRIPTDIR INSTALLHTMLSCRIPTDIR
368 INST_HTMLLIBDIR HTMLEXT
369 INST_MAN1DIR INSTALLMAN1DIR MAN1EXT
370 INST_MAN3DIR INSTALLMAN3DIR MAN3EXT
372 next unless defined $self->{$tmp};
373 push @m, "$tmp = $self->{$tmp}\n";
381 .NO_CONFIG_REC: Makefile
382 } if $ENV{CLEARCASE_ROOT};
384 # why not q{} ? -- emacs
386 # work around a famous dec-osf make(1) feature(?):
389 .SUFFIXES: .xs .c .C .cpp .cxx .cc \$(OBJ_EXT)
391 # Nick wanted to get rid of .PRECIOUS. I don't remember why. I seem to recall, that
392 # some make implementations will delete the Makefile when we rebuild it. Because
393 # we call false(1) when we rebuild it. So make(1) is not completely wrong when it
394 # does so. Our milage may vary.
395 # .PRECIOUS: Makefile # seems to be not necessary anymore
397 .PHONY: all config static dynamic test linkext manifest
399 # Where is the Config information that we are using/depend on
400 CONFIGDEP = \$(PERL_ARCHLIB)\\Config.pm \$(PERL_INC)\\config.h
403 my @parentdir = split(/::/, $self->{PARENT_NAME});
405 # Where to put things:
406 INST_LIBDIR = }. $self->catdir('$(INST_LIB)',@parentdir) .q{
407 INST_ARCHLIBDIR = }. $self->catdir('$(INST_ARCHLIB)',@parentdir) .q{
409 INST_AUTODIR = }. $self->catdir('$(INST_LIB)','auto','$(FULLEXT)') .q{
410 INST_ARCHAUTODIR = }. $self->catdir('$(INST_ARCHLIB)','auto','$(FULLEXT)') .q{
413 if ($self->has_link_code()) {
415 INST_STATIC = $(INST_ARCHAUTODIR)\$(BASEEXT)$(LIB_EXT)
416 INST_DYNAMIC = $(INST_ARCHAUTODIR)\$(DLBASE).$(DLEXT)
417 INST_BOOT = $(INST_ARCHAUTODIR)\$(BASEEXT).bs
427 $tmp = $self->export_list;
431 $tmp = $self->perl_archive;
437 #INST_PM = }.join(" \\\n\t", sort values %{$self->{PM}}).q{
439 #PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{
443 TO_INST_PM = }.join(" \\\n\t", sort keys %{$self->{PM}}).q{
445 PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{
454 my $path = $ENV{'PATH'} || $ENV{'Path'} || $ENV{'path'};
455 my @path = split(';',$path);
456 foreach(@path) { $_ = '.' if $_ eq '' }
462 Defines how to produce the *.a (or equivalent) files.
468 # Come to think of it, if there are subdirs with linkcode, we still have no INST_STATIC
469 # return '' unless $self->needs_linking(); #might be because of a subdir
471 return '' unless $self->has_link_code;
475 $(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)\.exists
479 # If this extension has its own library (eg SDBM_File)
480 # then copy that to $(INST_STATIC) and add $(OBJECT) into it.
481 push(@m, "\t$self->{CP} \$(MYEXTLIB) \$\@\n") if $self->{MYEXTLIB};
484 q{ $(AR) }.($BORLAND ? '$@ $(OBJECT:^"+")'
485 : ($GCC ? '-ru $@ $(OBJECT)'
486 : '-out:$@ $(OBJECT)')).q{
487 }.$self->{NOECHO}.q{echo "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)\extralibs.ld
491 # Old mechanism - still available:
493 push @m, "\t$self->{NOECHO}".q{echo "$(EXTRALIBS)" >> $(PERL_SRC)\ext.libs}."\n\n"
494 if $self->{PERL_SRC};
496 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
502 Defines targets for bootstrap files.
507 my($self, %attribs) = @_;
510 ' unless $self->has_link_code();
513 BOOTSTRAP = '."$self->{BASEEXT}.bs".'
515 # As Mkbootstrap might not write a file (if none is required)
516 # we use touch to prevent make continually trying to remake it.
517 # The DynaLoader only reads a non-empty file.
518 $(BOOTSTRAP): '."$self->{MAKEFILE} $self->{BOOTDEP}".' $(INST_ARCHAUTODIR)\.exists
519 '.$self->{NOECHO}.'echo "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))"
520 '.$self->{NOECHO}.'$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" \
521 -MExtUtils::Mkbootstrap \
522 -e "Mkbootstrap(\'$(BASEEXT)\',\'$(BSLOADLIBS)\');"
523 '.$self->{NOECHO}.'$(TOUCH) $(BOOTSTRAP)
526 $(INST_BOOT): $(BOOTSTRAP) $(INST_ARCHAUTODIR)\.exists
527 '."$self->{NOECHO}$self->{RM_RF}".' $(INST_BOOT)
528 -'.$self->{CP}.' $(BOOTSTRAP) $(INST_BOOT)
533 =item dynamic_lib (o)
535 Defines how to produce the *.so (or equivalent) files.
540 my($self, %attribs) = @_;
541 return '' unless $self->needs_linking(); #might be because of a subdir
543 return '' unless $self->has_link_code;
545 my($otherldflags) = $attribs{OTHERLDFLAGS} || ($BORLAND ? 'c0d32.obj': '');
546 my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || "";
547 my($ldfrom) = '$(LDFROM)';
549 (my $boot = $self->{NAME}) =~ s/:/_/g;
552 # This section creates the dynamically loadable $(INST_DYNAMIC)
553 # from $(OBJECT) and possibly $(MYEXTLIB).
554 OTHERLDFLAGS = '.$otherldflags.'
555 INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'
557 $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP)
560 # q{ $(LD) -out:$@ $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) }
561 # .q{$(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) -def:$(EXPORT_LIST)});
563 # Create xdc data for an MT safe NLM in case of mpk build
564 if ( $self->{CCFLAGS} =~ m/ -DMPK_ON /) {
566 push @m, ' $(MPKTOOL) $(BASEEXT).xdc
573 q{ $(LD) Form Novell NLM '$(DISTNAME) Extension, XS_VERSION=$(XS_VERSION)'}
576 # Taking care of long names like FileHandle, ByteLoader, SDBM_File etc
577 if($self->{NLM_SHORT_NAME}) {
578 # In case of nlms with names exceeding 8 chars, build nlm in the
579 # current dir, rename and move to auto\lib. If we create in auto\lib
580 # in the first place, we can't rename afterwards.
582 q{ Name $(NLM_SHORT_NAME).$(DLEXT)}
586 q{ Name $(INST_AUTODIR)\\$(BASEEXT).$(DLEXT)}
591 q{ Option Quiet Option Version = $(NLM_VERSION) Option Caseexact Option NoDefaultLibs Option screenname 'none' Option Synchronize }
596 q{ Option XDCDATA=$(BASEEXT).xdc }
600 # Add additional lib files if any (SDBM_File)
601 if($self->{MYEXTLIB}) {
603 q{ Library $(MYEXTLIB) }
607 #For now lets comment all the Watcom lib calls
608 #q{ LibPath $(LIBPTH) Library plib3s.lib Library math3s.lib Library clib3s.lib Library emu387.lib Library $(PERL_ARCHIVE) Library $(PERL_INC)\Main.lib}
611 q{ Library $(PERL_ARCHIVE) Library $(PERL_INC)\Main.lib}
612 .q{ Export boot_$(BOOT_SYMBOL) $(BASE_IMPORT) }
613 .q{ FILE $(OBJECT:.obj=,)}
616 # If it is having a short name, rename it
617 if($self->{NLM_SHORT_NAME}) {
619 if exist $(INST_AUTODIR)\\$(BASEEXT).$(DLEXT) del $(INST_AUTODIR)\\$(BASEEXT).$(DLEXT)';
621 rename $(NLM_SHORT_NAME).$(DLEXT) $(BASEEXT).$(DLEXT)';
623 move $(BASEEXT).$(DLEXT) $(INST_AUTODIR)';
630 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
637 return '$(PERL_INC)\\'.$Config{'libperl'};
643 return "$self->{BASEEXT}.def";
648 No physical check on the filesystem, but a logical cleanup of a
649 path. On UNIX eliminated successive slashes and successive "/.".
654 my($self,$path) = @_;
655 $path =~ s/^([a-z]:)/\u$1/;
657 $path =~ s|(.)\\+|$1\\|g ; # xx////xx -> xx/xx
658 $path =~ s|(\\\.)+\\|\\|g ; # xx/././xx -> xx/xx
659 $path =~ s|^(\.\\)+|| unless $path eq ".\\"; # ./xx -> xx
661 unless $path =~ m#^([a-z]:)?\\#; # xx/ -> xx
662 $path .= '.' if $path =~ m#\\$#;
668 Takes one argument, a file name, and returns the file name, if the
669 argument is likely to be a perl script. On MM_Unix this is true for
670 any ordinary, readable file.
675 my($self,$file) = @_;
676 return $file if -r $file && -f _;
677 return "$file.pl" if -r "$file.pl" && -f _;
678 return "$file.bat" if -r "$file.bat" && -f _;
684 Defines target that copies all files in the hash PM to their
685 destination and autosplits them. See L<ExtUtils::Install/DESCRIPTION>
691 my($autodir) = $self->catdir('$(INST_LIB)','auto');
693 pm_to_blib: $(TO_INST_PM)
694 }.$self->{NOECHO}.q{$(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" \
695 "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Install \
697 ($NMAKE ? 'qw[ <<pmfiles.dat ],'
698 : $DMAKE ? 'qw[ $(mktmp,pmfiles.dat $(PM_TO_BLIB:s,\\,\\\\,)\n) ],'
699 : '{ qw[$(PM_TO_BLIB)] },'
700 ).q{'}.$autodir.q{')"
704 } : '') . $self->{NOECHO}.q{$(TOUCH) $@
708 =item test_via_harness (o)
710 Helper method to write the test targets
714 sub test_via_harness {
715 my($self, $perl, $tests) = @_;
716 "\t$perl".q! -Mblib -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e "use Test::Harness qw(&runtests $$verbose); $$verbose=$(TEST_VERBOSE); runtests @ARGV;" !."$tests\n";
720 =item tool_autosplit (override)
722 Use Win32 quoting on command line.
727 my($self, %attribs) = @_;
729 $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN};
731 # Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
732 AUTOSPLITFILE = $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MAutoSplit }.$asl.q{ -e "autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1);"
736 =item tools_other (o)
740 Defines SHELL, LD, TOUCH, CP, MV, RM_F, RM_RF, CHMOD, UMASK_NULL in
741 the Makefile. Also defines the perl programs MKPATH,
742 WARN_IF_OLD_PACKLIST, MOD_INSTALL. DOC_INSTALL, and UNINSTALL.
749 my $bin_sh = $Config{sh} || 'cmd /c';
752 } unless $DMAKE; # dmake determines its own shell
754 for (qw/ CHMOD CP LD MV NOOP RM_F RM_RF TEST_F TOUCH UMASK_NULL DEV_NULL/ ) {
755 push @m, "$_ = $self->{$_}\n";
759 # The following is a portable way to say mkdir -p
760 # To see which directories are created, change the if 0 to if 1
761 MKPATH = $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e mkpath
763 # This helps us to minimize the effect of the .exists files A yet
764 # better solution would be to have a stable file in the perl
765 # distribution with a timestamp of zero. But this solution doesn't
766 # need any changes to the core distribution and works with older perls
767 EQUALIZE_TIMESTAMP = $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e eqtime
771 return join "", @m if $self->{PARENT};
774 # Here we warn users that an old packlist file was found somewhere,
775 # and that they should call some uninstall routine
776 WARN_IF_OLD_PACKLIST = $(PERL) -lwe "exit unless -f $$ARGV[0];" \\
777 -e "print 'WARNING: I have found an old package in';" \\
778 -e "print ' ', $$ARGV[0], '.';" \\
779 -e "print 'Please make sure the two installations are not conflicting';"
784 MOD_INSTALL = $(PERL) -I$(INST_LIB) -I$(PERL_LIB) -MExtUtils::Install \
785 -e "install({ @ARGV },'$(VERBINST)',0,'$(UNINST)');"
787 DOC_INSTALL = $(PERL) -e "$$\=\"\n\n\";" \
788 -e "print '=head2 ', scalar(localtime), ': C<', shift, '>', ' L<', shift, '>';" \
789 -e "print '=over 4';" \
790 -e "while (defined($$key = shift) and defined($$val = shift)) { print '=item *';print 'C<', \"$$key: $$val\", '>'; }" \
793 UNINSTALL = $(PERL) -MExtUtils::Install \
794 -e "uninstall($$ARGV[0],1,1); print \"\nUninstall is deprecated. Please check the";" \
795 -e "print \" packlist above carefully.\n There may be errors. Remove the\";" \
796 -e "print \" appropriate files manually.\n Sorry for the inconveniences.\n\""
804 Defines suffix rules to go from XS to object files directly. This is
805 only intended for broken make implementations.
809 sub xs_o { # many makes are too dumb to use xs_c then c_o
814 =item top_targets (o)
816 Defines the targets all, subdirs, config, and O_FILES
821 # --- Target Sections ---
826 #all :: config $(INST_PM) subdirs linkext manifypods
830 all :: pure_all htmlifypods manifypods
831 '.$self->{NOECHO}.'$(NOOP)
833 unless $self->{SKIPHASH}{'all'};
836 pure_all :: config pm_to_blib subdirs linkext
837 '.$self->{NOECHO}.'$(NOOP)
839 subdirs :: $(MYEXTLIB)
840 '.$self->{NOECHO}.'$(NOOP)
842 config :: '.$self->{MAKEFILE}.' $(INST_LIBDIR)\.exists
843 '.$self->{NOECHO}.'$(NOOP)
845 config :: $(INST_ARCHAUTODIR)\.exists
846 '.$self->{NOECHO}.'$(NOOP)
848 config :: $(INST_AUTODIR)\.exists
849 '.$self->{NOECHO}.'$(NOOP)
852 push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]);
854 if (%{$self->{HTMLLIBPODS}}) {
856 config :: \$(INST_HTMLLIBDIR)/.exists
857 $self->{NOECHO}\$(NOOP)
860 push @m, $self->dir_target(qw[$(INST_HTMLLIBDIR)]);
863 if (%{$self->{HTMLSCRIPTPODS}}) {
865 config :: \$(INST_HTMLSCRIPTDIR)/.exists
866 $self->{NOECHO}\$(NOOP)
869 push @m, $self->dir_target(qw[$(INST_HTMLSCRIPTDIR)]);
872 if (%{$self->{MAN1PODS}}) {
874 config :: \$(INST_MAN1DIR)\\.exists
875 $self->{NOECHO}\$(NOOP)
878 push @m, $self->dir_target(qw[$(INST_MAN1DIR)]);
880 if (%{$self->{MAN3PODS}}) {
882 config :: \$(INST_MAN3DIR)\\.exists
883 $self->{NOECHO}\$(NOOP)
886 push @m, $self->dir_target(qw[$(INST_MAN3DIR)]);
890 $(O_FILES): $(H_FILES)
891 ' if @{$self->{O_FILES} || []} && @{$self->{H} || []};
895 perldoc ExtUtils::MakeMaker
900 }.$self->{NOECHO}.q{$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \
901 -MExtUtils::MakeMaker=Version_check \
902 -e "Version_check('$(MM_VERSION)')"
908 =item htmlifypods (o)
910 Defines targets and routines to translate the pods into HTML manpages
911 and put them into the INST_HTMLLIBDIR and INST_HTMLSCRIPTDIR
914 Same as MM_Unix version (changes command-line quoting).
919 my($self, %attribs) = @_;
920 return "\nhtmlifypods : pure_all\n\t$self->{NOECHO}\$(NOOP)\n" unless
921 %{$self->{HTMLLIBPODS}} || %{$self->{HTMLSCRIPTPODS}};
924 if (defined $self->{PERL_SRC}) {
925 $pod2html_exe = $self->catfile($self->{PERL_SRC},'pod','pod2html');
927 $pod2html_exe = $self->catfile($Config{scriptdirexp},'pod2html');
929 unless ($pod2html_exe = $self->perl_script($pod2html_exe)) {
930 # No pod2html but some HTMLxxxPODS to be installed
933 Warning: I could not locate your pod2html program. Please make sure,
934 your pod2html program is in your PATH before you execute 'make'
937 $pod2html_exe = "-S pod2html";
941 qq[POD2HTML_EXE = $pod2html_exe\n],
942 qq[POD2HTML = \$(PERL) -we "use File::Basename; use File::Path qw(mkpath); %m=\@ARGV;for (keys %m){" \\\n],
943 q[-e "next if -e $$m{$$_} && -M $$m{$$_} < -M $$_ && -M $$m{$$_} < -M '],
944 $self->{MAKEFILE}, q[';" \\
945 -e "print qq(Htmlifying $$m{$$_}\n);" \\
946 -e "$$dir = dirname($$m{$$_}); mkpath($$dir) unless -d $$dir;" \\
947 -e "system(qq[$$^X ].q["-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" $(POD2HTML_EXE) ].qq[$$_>$$m{$$_}])==0 or warn qq(Couldn\\047t install $$m{$$_}\n);" \\
948 -e "chmod(oct($(PERM_RW))), $$m{$$_} or warn qq(chmod $(PERM_RW) $$m{$$_}: $$!\n);}"
950 push @m, "\nhtmlifypods : pure_all ";
951 push @m, join " \\\n\t", keys %{$self->{HTMLLIBPODS}}, keys %{$self->{HTMLSCRIPTPODS}};
954 if (%{$self->{HTMLLIBPODS}} || %{$self->{HTMLSCRIPTPODS}}) {
955 push @m, "\t$self->{NOECHO}\$(POD2HTML) \\\n\t";
956 push @m, join " \\\n\t", %{$self->{HTMLLIBPODS}}, %{$self->{HTMLSCRIPTPODS}};
963 We don't want manpage process.
969 return "\nmanifypods :\n\t$self->{NOECHO}\$(NOOP)\n";
974 Same as MM_Unix version (changes command-line quoting).
983 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=maniread \\
984 -e "@all = keys %{ maniread() };" \\
985 -e "print(\"Executing $(CI) @all\n\"); system(\"$(CI) @all\");" \\
986 -e "print(\"Executing $(RCS_LABEL) ...\n\"); system(\"$(RCS_LABEL) @all\");"
993 Same as MM_Unix version (changes command-line quoting).
1001 dist : $(DIST_DEFAULT)
1002 }.$self->{NOECHO}.q{$(PERL) -le "print \"Warning: Makefile possibly out of date with $$vf\" if " \
1003 -e "-e ($$vf=\"$(VERSION_FROM)\") and -M $$vf < -M \"}.$self->{MAKEFILE}.q{\";"
1005 tardist : $(DISTVNAME).tar$(SUFFIX)
1007 zipdist : $(DISTVNAME).zip
1009 $(DISTVNAME).tar$(SUFFIX) : distdir
1012 $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME)
1013 $(RM_RF) $(DISTVNAME)
1014 $(COMPRESS) $(DISTVNAME).tar
1017 $(DISTVNAME).zip : distdir
1019 $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME)
1020 $(RM_RF) $(DISTVNAME)
1023 uutardist : $(DISTVNAME).tar$(SUFFIX)
1024 uuencode $(DISTVNAME).tar$(SUFFIX) \\
1025 $(DISTVNAME).tar$(SUFFIX) > \\
1026 $(DISTVNAME).tar$(SUFFIX)_uu
1030 $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar
1031 $(RM_RF) $(DISTVNAME)
1039 Defines the string that is passed to recursive make calls in
1046 return "PASTHRU = " . ($NMAKE ? "-nologo" : "");