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