This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix mismatched UV/U32 types for to_utf8_*()
[perl5.git] / lib / ExtUtils / MM_Win32.pm
CommitLineData
68dc0745
PP
1package ExtUtils::MM_Win32;
2
3=head1 NAME
4
5ExtUtils::MM_Win32 - methods to override UN*X behaviour in ExtUtils::MakeMaker
6
7=head1 SYNOPSIS
8
9 use ExtUtils::MM_Win32; # Done internally by ExtUtils::MakeMaker if needed
10
11=head1 DESCRIPTION
12
13See ExtUtils::MM_Unix for a documentation of the methods provided
14there. This package overrides the implementation of these methods, not
15the semantics.
16
17=over
18
19=cut
20
3e3baf6d 21use Config;
68dc0745
PP
22#use Cwd;
23use File::Basename;
24require Exporter;
25
26Exporter::import('ExtUtils::MakeMaker',
27 qw( $Verbose &neatvalue));
28
29$ENV{EMXSHELL} = 'sh'; # to run `commands`
30unshift @MM::ISA, 'ExtUtils::MM_Win32';
31
3e3baf6d 32$BORLAND = 1 if $Config{'cc'} =~ /^bcc/i;
5b0d9cbe 33$GCC = 1 if $Config{'cc'} =~ /^gcc/i;
3e3baf6d
TB
34$DMAKE = 1 if $Config{'make'} =~ /^dmake/i;
35$NMAKE = 1 if $Config{'make'} =~ /^nmake/i;
9d8a25dc 36$OBJ = 1 if $Config{'ccflags'} =~ /PERL_OBJECT/i;
3e3baf6d 37
68dc0745
PP
38sub dlsyms {
39 my($self,%attribs) = @_;
40
41 my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
42 my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
43 my($imports) = $attribs{IMPORTS} || $self->{IMPORTS} || {};
44 my(@m);
45 (my $boot = $self->{NAME}) =~ s/:/_/g;
46
47 if (not $self->{SKIPHASH}{'dynamic'}) {
48 push(@m,"
49$self->{BASEEXT}.def: Makefile.PL
50",
51 q! $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Mksymlists \\
52 -e "Mksymlists('NAME' => '!, $self->{NAME},
53 q!', 'DLBASE' => '!,$self->{DLBASE},
54 q!', 'DL_FUNCS' => !,neatvalue($funcs),
55 q!, 'IMPORTS' => !,neatvalue($imports),
56 q!, 'DL_VARS' => !, neatvalue($vars), q!);"
57!);
58 }
59 join('',@m);
60}
61
62sub replace_manpage_separator {
63 my($self,$man) = @_;
64 $man =~ s,/+,.,g;
65 $man;
66}
67
68sub maybe_command {
69 my($self,$file) = @_;
846f184a
GS
70 my @e = exists($ENV{'PATHEXT'})
71 ? split(/;/, $ENV{PATHEXT})
72 : qw(.com .exe .bat .cmd);
73 my $e = '';
74 for (@e) { $e .= "\Q$_\E|" }
75 chop $e;
76 # see if file ends in one of the known extensions
2b2708c8 77 if ($file =~ /($e)$/i) {
846f184a
GS
78 return $file if -e $file;
79 }
80 else {
81 for (@e) {
82 return "$file$_" if -e "$file$_";
83 }
84 }
68dc0745
PP
85 return;
86}
87
88sub file_name_is_absolute {
89 my($self,$file) = @_;
90 $file =~ m{^([a-z]:)?[\\/]}i ;
91}
92
93sub find_perl {
94 my($self, $ver, $names, $dirs, $trace) = @_;
95 my($name, $dir);
96 if ($trace >= 2){
97 print "Looking for perl $ver by these names:
98@$names
99in these dirs:
100@$dirs
101";
102 }
103 foreach $dir (@$dirs){
104 next unless defined $dir; # $self->{PERL_SRC} may be undefined
105 foreach $name (@$names){
106 my ($abs, $val);
107 if ($self->file_name_is_absolute($name)) { # /foo/bar
108 $abs = $name;
109 } elsif ($self->canonpath($name) eq $self->canonpath(basename($name))) { # foo
110 $abs = $self->catfile($dir, $name);
111 } else { # foo/bar
112 $abs = $self->canonpath($self->catfile($self->curdir, $name));
113 }
114 print "Checking $abs\n" if ($trace >= 2);
115 next unless $self->maybe_command($abs);
116 print "Executing $abs\n" if ($trace >= 2);
117 $val = `$abs -e "require $ver;" 2>&1`;
118 if ($? == 0) {
119 print "Using PERL=$abs\n" if $trace;
120 return $abs;
121 } elsif ($trace >= 2) {
122 print "Result: `$val'\n";
123 }
124 }
125 }
126 print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n";
127 0; # false and not empty
128}
129
130sub catdir {
131 my $self = shift;
132 my @args = @_;
133 for (@args) {
134 # append a slash to each argument unless it has one there
135 $_ .= "\\" if $_ eq '' or substr($_,-1) ne "\\";
136 }
137 my $result = $self->canonpath(join('', @args));
138 $result;
139}
140
141=item catfile
142
143Concatenate one or more directory names and a filename to form a
144complete path ending with a filename
145
146=cut
147
148sub catfile {
149 my $self = shift @_;
150 my $file = pop @_;
151 return $file unless @_;
152 my $dir = $self->catdir(@_);
96e4d5b1
PP
153 $dir =~ s/(\\\.)$//;
154 $dir .= "\\" unless substr($dir,length($dir)-1,1) eq "\\";
68dc0745
PP
155 return $dir.$file;
156}
157
158sub init_others
159{
160 my ($self) = @_;
161 &ExtUtils::MM_Unix::init_others;
162 $self->{'TOUCH'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e touch';
163 $self->{'CHMOD'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e chmod';
164 $self->{'CP'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e cp';
165 $self->{'RM_F'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e rm_f';
166 $self->{'RM_RF'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e rm_rf';
167 $self->{'MV'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e mv';
168 $self->{'NOOP'} = 'rem';
169 $self->{'TEST_F'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e test_f';
3e3baf6d
TB
170 $self->{'LD'} = $Config{'ld'} || 'link';
171 $self->{'AR'} = $Config{'ar'} || 'lib';
944acd49 172 $self->{'LDLOADLIBS'} ||= $Config{'libs'};
e47a9bbc 173 # -Lfoo must come first for Borland, so we put it in LDDLFLAGS
944acd49
GS
174 if ($BORLAND) {
175 my $libs = $self->{'LDLOADLIBS'};
176 my $libpath = '';
e47a9bbc 177 while ($libs =~ s/(?:^|\s)(("?)-L.+?\2)(?:\s|$)/ /) {
944acd49
GS
178 $libpath .= ' ' if length $libpath;
179 $libpath .= $1;
180 }
181 $self->{'LDLOADLIBS'} = $libs;
182 $self->{'LDDLFLAGS'} ||= $Config{'lddlflags'};
183 $self->{'LDDLFLAGS'} .= " $libpath";
184 }
68dc0745
PP
185 $self->{'DEV_NULL'} = '> NUL';
186 # $self->{'NOECHO'} = ''; # till we have it working
187}
188
3e3baf6d
TB
189
190=item constants (o)
191
192Initializes lots of constants and .SUFFIXES and .PHONY
193
194=cut
195
196sub constants {
197 my($self) = @_;
198 my(@m,$tmp);
199
200 for $tmp (qw/
201
202 AR_STATIC_ARGS NAME DISTNAME NAME_SYM VERSION
203 VERSION_SYM XS_VERSION INST_BIN INST_EXE INST_LIB
204 INST_ARCHLIB INST_SCRIPT PREFIX INSTALLDIRS
205 INSTALLPRIVLIB INSTALLARCHLIB INSTALLSITELIB
206 INSTALLSITEARCH INSTALLBIN INSTALLSCRIPT PERL_LIB
207 PERL_ARCHLIB SITELIBEXP SITEARCHEXP LIBPERL_A MYEXTLIB
208 FIRST_MAKEFILE MAKE_APERL_FILE PERLMAINCC PERL_SRC
209 PERL_INC PERL FULLPERL
210
211 / ) {
212 next unless defined $self->{$tmp};
213 push @m, "$tmp = $self->{$tmp}\n";
214 }
215
216 push @m, qq{
217VERSION_MACRO = VERSION
218DEFINE_VERSION = -D\$(VERSION_MACRO)=\\\"\$(VERSION)\\\"
219XS_VERSION_MACRO = XS_VERSION
220XS_DEFINE_VERSION = -D\$(XS_VERSION_MACRO)=\\\"\$(XS_VERSION)\\\"
221};
222
223 push @m, qq{
224MAKEMAKER = $INC{'ExtUtils\MakeMaker.pm'}
225MM_VERSION = $ExtUtils::MakeMaker::VERSION
226};
227
228 push @m, q{
229# FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle).
230# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle)
231# ROOTEXT = Directory part of FULLEXT with leading slash (eg /DBD) !!! Deprecated from MM 5.32 !!!
232# PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar)
233# DLBASE = Basename part of dynamic library. May be just equal BASEEXT.
234};
235
236 for $tmp (qw/
237 FULLEXT BASEEXT PARENT_NAME DLBASE VERSION_FROM INC DEFINE OBJECT
238 LDFROM LINKTYPE
239 / ) {
240 next unless defined $self->{$tmp};
241 push @m, "$tmp = $self->{$tmp}\n";
242 }
243
244 push @m, "
245# Handy lists of source code files:
246XS_FILES= ".join(" \\\n\t", sort keys %{$self->{XS}})."
247C_FILES = ".join(" \\\n\t", @{$self->{C}})."
248O_FILES = ".join(" \\\n\t", @{$self->{O_FILES}})."
249H_FILES = ".join(" \\\n\t", @{$self->{H}})."
250MAN1PODS = ".join(" \\\n\t", sort keys %{$self->{MAN1PODS}})."
251MAN3PODS = ".join(" \\\n\t", sort keys %{$self->{MAN3PODS}})."
252";
253
254 for $tmp (qw/
255 INST_MAN1DIR INSTALLMAN1DIR MAN1EXT INST_MAN3DIR INSTALLMAN3DIR MAN3EXT
256 /) {
257 next unless defined $self->{$tmp};
258 push @m, "$tmp = $self->{$tmp}\n";
259 }
260
261 push @m, qq{
262.USESHELL :
263} if $DMAKE;
264
265 push @m, q{
266.NO_CONFIG_REC: Makefile
267} if $ENV{CLEARCASE_ROOT};
268
269 # why not q{} ? -- emacs
270 push @m, qq{
271# work around a famous dec-osf make(1) feature(?):
272makemakerdflt: all
273
274.SUFFIXES: .xs .c .C .cpp .cxx .cc \$(OBJ_EXT)
275
276# Nick wanted to get rid of .PRECIOUS. I don't remember why. I seem to recall, that
277# some make implementations will delete the Makefile when we rebuild it. Because
278# we call false(1) when we rebuild it. So make(1) is not completely wrong when it
279# does so. Our milage may vary.
280# .PRECIOUS: Makefile # seems to be not necessary anymore
281
282.PHONY: all config static dynamic test linkext manifest
283
284# Where is the Config information that we are using/depend on
285CONFIGDEP = \$(PERL_ARCHLIB)\\Config.pm \$(PERL_INC)\\config.h
286};
287
288 my @parentdir = split(/::/, $self->{PARENT_NAME});
289 push @m, q{
290# Where to put things:
291INST_LIBDIR = }. $self->catdir('$(INST_LIB)',@parentdir) .q{
292INST_ARCHLIBDIR = }. $self->catdir('$(INST_ARCHLIB)',@parentdir) .q{
293
294INST_AUTODIR = }. $self->catdir('$(INST_LIB)','auto','$(FULLEXT)') .q{
295INST_ARCHAUTODIR = }. $self->catdir('$(INST_ARCHLIB)','auto','$(FULLEXT)') .q{
296};
297
298 if ($self->has_link_code()) {
299 push @m, '
300INST_STATIC = $(INST_ARCHAUTODIR)\$(BASEEXT)$(LIB_EXT)
301INST_DYNAMIC = $(INST_ARCHAUTODIR)\$(DLBASE).$(DLEXT)
302INST_BOOT = $(INST_ARCHAUTODIR)\$(BASEEXT).bs
303';
304 } else {
305 push @m, '
306INST_STATIC =
307INST_DYNAMIC =
308INST_BOOT =
309';
310 }
311
312 $tmp = $self->export_list;
313 push @m, "
314EXPORT_LIST = $tmp
315";
316 $tmp = $self->perl_archive;
317 push @m, "
318PERL_ARCHIVE = $tmp
319";
320
321# push @m, q{
322#INST_PM = }.join(" \\\n\t", sort values %{$self->{PM}}).q{
323#
324#PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{
325#};
326
327 push @m, q{
328TO_INST_PM = }.join(" \\\n\t", sort keys %{$self->{PM}}).q{
329
330PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{
331};
332
333 join('',@m);
334}
335
336
68dc0745
PP
337sub path {
338 local $^W = 1;
339 my($self) = @_;
340 my $path = $ENV{'PATH'} || $ENV{'Path'} || $ENV{'path'};
341 my @path = split(';',$path);
342 foreach(@path) { $_ = '.' if $_ eq '' }
343 @path;
344}
345
346=item static_lib (o)
347
348Defines how to produce the *.a (or equivalent) files.
349
350=cut
351
352sub static_lib {
353 my($self) = @_;
354# Come to think of it, if there are subdirs with linkcode, we still have no INST_STATIC
355# return '' unless $self->needs_linking(); #might be because of a subdir
356
357 return '' unless $self->has_link_code;
358
359 my(@m);
360 push(@m, <<'END');
3e3baf6d 361$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)\.exists
68dc0745
PP
362 $(RM_RF) $@
363END
364 # If this extension has it's own library (eg SDBM_File)
365 # then copy that to $(INST_STATIC) and add $(OBJECT) into it.
366 push(@m, "\t$self->{CP} \$(MYEXTLIB) \$\@\n") if $self->{MYEXTLIB};
367
368 push @m,
910dfcc8
GS
369q{ $(AR) }.($BORLAND ? '$@ $(OBJECT:^"+")'
370 : ($GCC ? '-ru $@ $(OBJECT)'
371 : '-out:$@ $(OBJECT)')).q{
3e3baf6d 372 }.$self->{NOECHO}.q{echo "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)\extralibs.ld
68dc0745
PP
373 $(CHMOD) 755 $@
374};
375
376# Old mechanism - still available:
377
3e3baf6d 378 push @m, "\t$self->{NOECHO}".q{echo "$(EXTRALIBS)" >> $(PERL_SRC)\ext.libs}."\n\n"
68dc0745
PP
379 if $self->{PERL_SRC};
380
381 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
382 join('', "\n",@m);
383}
384
3e3baf6d
TB
385=item dynamic_bs (o)
386
387Defines targets for bootstrap files.
388
389=cut
68dc0745 390
3e3baf6d
TB
391sub dynamic_bs {
392 my($self, %attribs) = @_;
393 return '
394BOOTSTRAP =
395' unless $self->has_link_code();
396
397 return '
398BOOTSTRAP = '."$self->{BASEEXT}.bs".'
399
400# As Mkbootstrap might not write a file (if none is required)
401# we use touch to prevent make continually trying to remake it.
402# The DynaLoader only reads a non-empty file.
403$(BOOTSTRAP): '."$self->{MAKEFILE} $self->{BOOTDEP}".' $(INST_ARCHAUTODIR)\.exists
404 '.$self->{NOECHO}.'echo "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))"
405 '.$self->{NOECHO}.'$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" \
406 -MExtUtils::Mkbootstrap \
407 -e "Mkbootstrap(\'$(BASEEXT)\',\'$(BSLOADLIBS)\');"
408 '.$self->{NOECHO}.'$(TOUCH) $(BOOTSTRAP)
409 $(CHMOD) 644 $@
410
411$(INST_BOOT): $(BOOTSTRAP) $(INST_ARCHAUTODIR)\.exists
412 '."$self->{NOECHO}$self->{RM_RF}".' $(INST_BOOT)
413 -'.$self->{CP}.' $(BOOTSTRAP) $(INST_BOOT)
414 $(CHMOD) 644 $@
415';
416}
68dc0745
PP
417
418=item dynamic_lib (o)
419
420Defines how to produce the *.so (or equivalent) files.
421
422=cut
423
424sub dynamic_lib {
425 my($self, %attribs) = @_;
426 return '' unless $self->needs_linking(); #might be because of a subdir
427
428 return '' unless $self->has_link_code;
429
3e3baf6d 430 my($otherldflags) = $attribs{OTHERLDFLAGS} || ($BORLAND ? 'c0d32.obj': '');
68dc0745
PP
431 my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || "";
432 my($ldfrom) = '$(LDFROM)';
433 my(@m);
434 push(@m,'
435# This section creates the dynamically loadable $(INST_DYNAMIC)
436# from $(OBJECT) and possibly $(MYEXTLIB).
437OTHERLDFLAGS = '.$otherldflags.'
438INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'
439
3e3baf6d 440$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)\.exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
68dc0745 441');
5b0d9cbe
NIS
442 if ($GCC) {
443 push(@m,
910dfcc8
GS
444 q{ dlltool --def $(EXPORT_LIST) --output-exp dll.exp
445 $(LD) -o $@ -Wl,--base-file -Wl,dll.base $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) dll.exp
5b0d9cbe
NIS
446 dlltool --def $(EXPORT_LIST) --base-file dll.base --output-exp dll.exp
447 $(LD) -o $@ $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) dll.exp });
448 } else {
449 push(@m, $BORLAND ?
450 q{ $(LD) $(LDDLFLAGS) $(OTHERLDFLAGS) }.$ldfrom.q{,$@,,$(PERL_ARCHIVE:s,/,\,) $(LDLOADLIBS:s,/,\,) $(MYEXTLIB:s,/,\,),$(EXPORT_LIST:s,/,\,),$(RESFILES)} :
451 q{ $(LD) -out:$@ $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) -def:$(EXPORT_LIST)}
3e3baf6d 452 );
5b0d9cbe 453 }
68dc0745
PP
454 push @m, '
455 $(CHMOD) 755 $@
456';
457
458 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
459 join('',@m);
460}
461
462sub perl_archive
463{
e3b8966e 464 my ($self) = @_;
f7a92b15 465 if($OBJ) {
e3b8966e 466 if ($self->{CAPI} eq 'TRUE') {
6de196ee 467 return '$(PERL_INC)\perlCAPI$(LIB_EXT)';
e3b8966e 468 }
f7a92b15 469 }
eda5ff31 470 return '$(PERL_INC)\\'.$Config{'libperl'};
68dc0745
PP
471}
472
473sub export_list
474{
475 my ($self) = @_;
476 return "$self->{BASEEXT}.def";
477}
478
479=item canonpath
480
481No physical check on the filesystem, but a logical cleanup of a
482path. On UNIX eliminated successive slashes and successive "/.".
483
484=cut
485
486sub canonpath {
487 my($self,$path) = @_;
96e4d5b1 488 $path =~ s/^([a-z]:)/\u$1/;
68dc0745 489 $path =~ s|/|\\|g;
3e3baf6d 490 $path =~ s|(.)\\+|$1\\|g ; # xx////xx -> xx/xx
68dc0745
PP
491 $path =~ s|(\\\.)+\\|\\|g ; # xx/././xx -> xx/xx
492 $path =~ s|^(\.\\)+|| unless $path eq ".\\"; # ./xx -> xx
493 $path =~ s|\\$||
494 unless $path =~ m#^([a-z]:)?\\#; # xx/ -> xx
495 $path .= '.' if $path =~ m#\\$#;
496 $path;
497}
498
499=item perl_script
500
501Takes one argument, a file name, and returns the file name, if the
502argument is likely to be a perl script. On MM_Unix this is true for
503any ordinary, readable file.
504
505=cut
506
507sub perl_script {
508 my($self,$file) = @_;
509 return "$file.pl" if -r "$file.pl" && -f _;
510 return;
511}
512
513=item pm_to_blib
514
515Defines target that copies all files in the hash PM to their
516destination and autosplits them. See L<ExtUtils::Install/DESCRIPTION>
517
518=cut
519
520sub pm_to_blib {
521 my $self = shift;
522 my($autodir) = $self->catdir('$(INST_LIB)','auto');
523 return q{
524pm_to_blib: $(TO_INST_PM)
525 }.$self->{NOECHO}.q{$(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" \
526 "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Install \
3e3baf6d
TB
527 -e "pm_to_blib(qw[ }.
528 ($NMAKE ? '<<pmfiles.dat'
529 : '$(mktmp,pmfiles.dat $(PM_TO_BLIB:s,\\,\\\\,)\n)').
530 q{ ],'}.$autodir.q{')"
531 }. ($NMAKE ? q{
68dc0745
PP
532$(PM_TO_BLIB)
533<<
3e3baf6d 534 } : '') . $self->{NOECHO}.q{$(TOUCH) $@
68dc0745
PP
535};
536}
537
538=item test_via_harness (o)
539
540Helper method to write the test targets
541
542=cut
543
544sub test_via_harness {
545 my($self, $perl, $tests) = @_;
546 "\t$perl".q! -Mblib -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e "use Test::Harness qw(&runtests $$verbose); $$verbose=$(TEST_VERBOSE); runtests @ARGV;" !."$tests\n";
547}
548
3e3baf6d 549
68dc0745
PP
550=item tool_autosplit (override)
551
552Use Win32 quoting on command line.
553
554=cut
555
556sub tool_autosplit{
557 my($self, %attribs) = @_;
558 my($asl) = "";
559 $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN};
560 q{
561# Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
562AUTOSPLITFILE = $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MAutoSplit }.$asl.q{ -e "autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1);"
563};
564}
565
566=item tools_other (o)
567
568Win32 overrides.
569
570Defines SHELL, LD, TOUCH, CP, MV, RM_F, RM_RF, CHMOD, UMASK_NULL in
571the Makefile. Also defines the perl programs MKPATH,
572WARN_IF_OLD_PACKLIST, MOD_INSTALL. DOC_INSTALL, and UNINSTALL.
573
574=cut
575
576sub tools_other {
577 my($self) = shift;
578 my @m;
579 my $bin_sh = $Config{sh} || 'cmd /c';
580 push @m, qq{
581SHELL = $bin_sh
3e3baf6d 582} unless $DMAKE; # dmake determines its own shell
68dc0745
PP
583
584 for (qw/ CHMOD CP LD MV NOOP RM_F RM_RF TEST_F TOUCH UMASK_NULL DEV_NULL/ ) {
585 push @m, "$_ = $self->{$_}\n";
586 }
587
588 push @m, q{
589# The following is a portable way to say mkdir -p
590# To see which directories are created, change the if 0 to if 1
591MKPATH = $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e mkpath
592
593# This helps us to minimize the effect of the .exists files A yet
594# better solution would be to have a stable file in the perl
595# distribution with a timestamp of zero. But this solution doesn't
596# need any changes to the core distribution and works with older perls
597EQUALIZE_TIMESTAMP = $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e eqtime
598};
599
600
601 return join "", @m if $self->{PARENT};
602
603 push @m, q{
604# Here we warn users that an old packlist file was found somewhere,
605# and that they should call some uninstall routine
606WARN_IF_OLD_PACKLIST = $(PERL) -lwe "exit unless -f $$ARGV[0];" \\
607-e "print 'WARNING: I have found an old package in';" \\
608-e "print ' ', $$ARGV[0], '.';" \\
609-e "print 'Please make sure the two installations are not conflicting';"
610
611UNINST=0
612VERBINST=1
613
614MOD_INSTALL = $(PERL) -I$(INST_LIB) -I$(PERL_LIB) -MExtUtils::Install \
3e3baf6d 615-e "install({ @ARGV },'$(VERBINST)',0,'$(UNINST)');"
68dc0745
PP
616
617DOC_INSTALL = $(PERL) -e "$$\=\"\n\n\";" \
618-e "print '=head2 ', scalar(localtime), ': C<', shift, '>', ' L<', shift, '>';" \
619-e "print '=over 4';" \
3e3baf6d 620-e "while (defined($$key = shift) and defined($$val = shift)) { print '=item *';print 'C<', \"$$key: $$val\", '>'; }" \
68dc0745
PP
621-e "print '=back';"
622
623UNINSTALL = $(PERL) -MExtUtils::Install \
624-e "uninstall($$ARGV[0],1,1); print \"\nUninstall is deprecated. Please check the";" \
625-e "print \" packlist above carefully.\n There may be errors. Remove the\";" \
626-e "print \" appropriate files manually.\n Sorry for the inconveniences.\n\""
627};
628
629 return join "", @m;
630}
631
3e3baf6d
TB
632=item xs_o (o)
633
634Defines suffix rules to go from XS to object files directly. This is
635only intended for broken make implementations.
636
637=cut
638
639sub xs_o { # many makes are too dumb to use xs_c then c_o
640 my($self) = shift;
641 return ''
642}
643
644=item top_targets (o)
645
646Defines the targets all, subdirs, config, and O_FILES
647
648=cut
649
650sub top_targets {
651# --- Target Sections ---
652
653 my($self) = shift;
654 my(@m);
655 push @m, '
656#all :: config $(INST_PM) subdirs linkext manifypods
657';
658
659 push @m, '
660all :: pure_all manifypods
661 '.$self->{NOECHO}.'$(NOOP)
662'
663 unless $self->{SKIPHASH}{'all'};
664
665 push @m, '
666pure_all :: config pm_to_blib subdirs linkext
667 '.$self->{NOECHO}.'$(NOOP)
668
669subdirs :: $(MYEXTLIB)
670 '.$self->{NOECHO}.'$(NOOP)
671
672config :: '.$self->{MAKEFILE}.' $(INST_LIBDIR)\.exists
673 '.$self->{NOECHO}.'$(NOOP)
674
675config :: $(INST_ARCHAUTODIR)\.exists
676 '.$self->{NOECHO}.'$(NOOP)
677
678config :: $(INST_AUTODIR)\.exists
679 '.$self->{NOECHO}.'$(NOOP)
680';
681
682 push @m, qq{
683config :: Version_check
684 $self->{NOECHO}\$(NOOP)
685
686} unless $self->{PARENT} or ($self->{PERL_SRC} && $self->{INSTALLDIRS} eq "perl") or $self->{NO_VC};
687
688 push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]);
689
690 if (%{$self->{MAN1PODS}}) {
691 push @m, qq[
692config :: \$(INST_MAN1DIR)\\.exists
693 $self->{NOECHO}\$(NOOP)
694
695];
696 push @m, $self->dir_target(qw[$(INST_MAN1DIR)]);
697 }
698 if (%{$self->{MAN3PODS}}) {
699 push @m, qq[
700config :: \$(INST_MAN3DIR)\\.exists
701 $self->{NOECHO}\$(NOOP)
702
703];
704 push @m, $self->dir_target(qw[$(INST_MAN3DIR)]);
705 }
706
707 push @m, '
708$(O_FILES): $(H_FILES)
709' if @{$self->{O_FILES} || []} && @{$self->{H} || []};
710
711 push @m, q{
712help:
713 perldoc ExtUtils::MakeMaker
714};
715
716 push @m, q{
717Version_check:
718 }.$self->{NOECHO}.q{$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \
719 -MExtUtils::MakeMaker=Version_check \
720 -e "Version_check('$(MM_VERSION)')"
721};
722
723 join('',@m);
724}
725
68dc0745
PP
726=item manifypods (o)
727
728We don't want manpage process. XXX add pod2html support later.
729
730=cut
731
732sub manifypods {
846f184a 733 my($self) = shift;
68dc0745
PP
734 return "\nmanifypods :\n\t$self->{NOECHO}\$(NOOP)\n";
735}
736
737=item dist_ci (o)
738
739Same as MM_Unix version (changes command-line quoting).
740
741=cut
742
743sub dist_ci {
744 my($self) = shift;
745 my @m;
746 push @m, q{
747ci :
748 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=maniread \\
749 -e "@all = keys %{ maniread() };" \\
750 -e "print(\"Executing $(CI) @all\n\"); system(\"$(CI) @all\");" \\
751 -e "print(\"Executing $(RCS_LABEL) ...\n\"); system(\"$(RCS_LABEL) @all\");"
752};
753 join "", @m;
754}
755
756=item dist_core (o)
757
758Same as MM_Unix version (changes command-line quoting).
759
760=cut
761
762sub dist_core {
763 my($self) = shift;
764 my @m;
765 push @m, q{
766dist : $(DIST_DEFAULT)
767 }.$self->{NOECHO}.q{$(PERL) -le "print \"Warning: Makefile possibly out of date with $$vf\" if " \
768 -e "-e ($$vf=\"$(VERSION_FROM)\") and -M $$vf < -M \"}.$self->{MAKEFILE}.q{\";"
769
770tardist : $(DISTVNAME).tar$(SUFFIX)
771
772zipdist : $(DISTVNAME).zip
773
774$(DISTVNAME).tar$(SUFFIX) : distdir
775 $(PREOP)
776 $(TO_UNIX)
777 $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME)
778 $(RM_RF) $(DISTVNAME)
779 $(COMPRESS) $(DISTVNAME).tar
780 $(POSTOP)
781
782$(DISTVNAME).zip : distdir
783 $(PREOP)
784 $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME)
785 $(RM_RF) $(DISTVNAME)
786 $(POSTOP)
787
788uutardist : $(DISTVNAME).tar$(SUFFIX)
789 uuencode $(DISTVNAME).tar$(SUFFIX) \\
790 $(DISTVNAME).tar$(SUFFIX) > \\
791 $(DISTVNAME).tar$(SUFFIX)_uu
792
793shdist : distdir
794 $(PREOP)
795 $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar
796 $(RM_RF) $(DISTVNAME)
797 $(POSTOP)
798};
799 join "", @m;
800}
801
802=item pasthru (o)
803
804Defines the string that is passed to recursive make calls in
805subdirectories.
806
807=cut
808
809sub pasthru {
810 my($self) = shift;
3e3baf6d 811 return "PASTHRU = " . ($NMAKE ? "-nologo" : "");
68dc0745
PP
812}
813
814
815
8161;
817__END__
818
819=back
820
821=cut
822
5b0d9cbe 823