Builds completely with Mingw32, dynamic loaded extensions
[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,
3e3baf6d 355q{ $(AR) }.($BORLAND ? '$@ $(OBJECT:^"+")' : '-out:$@ $(OBJECT)').q{
356 }.$self->{NOECHO}.q{echo "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)\extralibs.ld
68dc0745 357 $(CHMOD) 755 $@
358};
359
360# Old mechanism - still available:
361
3e3baf6d 362 push @m, "\t$self->{NOECHO}".q{echo "$(EXTRALIBS)" >> $(PERL_SRC)\ext.libs}."\n\n"
68dc0745 363 if $self->{PERL_SRC};
364
365 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
366 join('', "\n",@m);
367}
368
3e3baf6d 369=item dynamic_bs (o)
370
371Defines targets for bootstrap files.
372
373=cut
68dc0745 374
3e3baf6d 375sub dynamic_bs {
376 my($self, %attribs) = @_;
377 return '
378BOOTSTRAP =
379' unless $self->has_link_code();
380
381 return '
382BOOTSTRAP = '."$self->{BASEEXT}.bs".'
383
384# As Mkbootstrap might not write a file (if none is required)
385# we use touch to prevent make continually trying to remake it.
386# The DynaLoader only reads a non-empty file.
387$(BOOTSTRAP): '."$self->{MAKEFILE} $self->{BOOTDEP}".' $(INST_ARCHAUTODIR)\.exists
388 '.$self->{NOECHO}.'echo "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))"
389 '.$self->{NOECHO}.'$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" \
390 -MExtUtils::Mkbootstrap \
391 -e "Mkbootstrap(\'$(BASEEXT)\',\'$(BSLOADLIBS)\');"
392 '.$self->{NOECHO}.'$(TOUCH) $(BOOTSTRAP)
393 $(CHMOD) 644 $@
394
395$(INST_BOOT): $(BOOTSTRAP) $(INST_ARCHAUTODIR)\.exists
396 '."$self->{NOECHO}$self->{RM_RF}".' $(INST_BOOT)
397 -'.$self->{CP}.' $(BOOTSTRAP) $(INST_BOOT)
398 $(CHMOD) 644 $@
399';
400}
68dc0745 401
402=item dynamic_lib (o)
403
404Defines how to produce the *.so (or equivalent) files.
405
406=cut
407
408sub dynamic_lib {
409 my($self, %attribs) = @_;
410 return '' unless $self->needs_linking(); #might be because of a subdir
411
412 return '' unless $self->has_link_code;
413
3e3baf6d 414 my($otherldflags) = $attribs{OTHERLDFLAGS} || ($BORLAND ? 'c0d32.obj': '');
68dc0745 415 my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || "";
416 my($ldfrom) = '$(LDFROM)';
417 my(@m);
418 push(@m,'
419# This section creates the dynamically loadable $(INST_DYNAMIC)
420# from $(OBJECT) and possibly $(MYEXTLIB).
421OTHERLDFLAGS = '.$otherldflags.'
422INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'
423
3e3baf6d 424$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)\.exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
68dc0745 425');
5b0d9cbe 426 if ($GCC) {
427 push(@m,
428 q{ $(LD) -o $@ -Wl,--base-file -Wl,dll.base $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) dll.exp
429 dlltool --def $(EXPORT_LIST) --base-file dll.base --output-exp dll.exp
430 $(LD) -o $@ $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) dll.exp });
431 } else {
432 push(@m, $BORLAND ?
433 q{ $(LD) $(LDDLFLAGS) $(OTHERLDFLAGS) }.$ldfrom.q{,$@,,$(PERL_ARCHIVE:s,/,\,) $(LDLOADLIBS:s,/,\,) $(MYEXTLIB:s,/,\,),$(EXPORT_LIST:s,/,\,),$(RESFILES)} :
434 q{ $(LD) -out:$@ $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) -def:$(EXPORT_LIST)}
3e3baf6d 435 );
5b0d9cbe 436 }
68dc0745 437 push @m, '
438 $(CHMOD) 755 $@
439';
440
441 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
442 join('',@m);
443}
444
445sub perl_archive
446{
447 return '$(PERL_INC)\perl$(LIB_EXT)';
448}
449
450sub export_list
451{
452 my ($self) = @_;
453 return "$self->{BASEEXT}.def";
454}
455
456=item canonpath
457
458No physical check on the filesystem, but a logical cleanup of a
459path. On UNIX eliminated successive slashes and successive "/.".
460
461=cut
462
463sub canonpath {
464 my($self,$path) = @_;
96e4d5b1 465 $path =~ s/^([a-z]:)/\u$1/;
68dc0745 466 $path =~ s|/|\\|g;
3e3baf6d 467 $path =~ s|(.)\\+|$1\\|g ; # xx////xx -> xx/xx
68dc0745 468 $path =~ s|(\\\.)+\\|\\|g ; # xx/././xx -> xx/xx
469 $path =~ s|^(\.\\)+|| unless $path eq ".\\"; # ./xx -> xx
470 $path =~ s|\\$||
471 unless $path =~ m#^([a-z]:)?\\#; # xx/ -> xx
472 $path .= '.' if $path =~ m#\\$#;
473 $path;
474}
475
476=item perl_script
477
478Takes one argument, a file name, and returns the file name, if the
479argument is likely to be a perl script. On MM_Unix this is true for
480any ordinary, readable file.
481
482=cut
483
484sub perl_script {
485 my($self,$file) = @_;
486 return "$file.pl" if -r "$file.pl" && -f _;
487 return;
488}
489
490=item pm_to_blib
491
492Defines target that copies all files in the hash PM to their
493destination and autosplits them. See L<ExtUtils::Install/DESCRIPTION>
494
495=cut
496
497sub pm_to_blib {
498 my $self = shift;
499 my($autodir) = $self->catdir('$(INST_LIB)','auto');
500 return q{
501pm_to_blib: $(TO_INST_PM)
502 }.$self->{NOECHO}.q{$(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" \
503 "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Install \
3e3baf6d 504 -e "pm_to_blib(qw[ }.
505 ($NMAKE ? '<<pmfiles.dat'
506 : '$(mktmp,pmfiles.dat $(PM_TO_BLIB:s,\\,\\\\,)\n)').
507 q{ ],'}.$autodir.q{')"
508 }. ($NMAKE ? q{
68dc0745 509$(PM_TO_BLIB)
510<<
3e3baf6d 511 } : '') . $self->{NOECHO}.q{$(TOUCH) $@
68dc0745 512};
513}
514
515=item test_via_harness (o)
516
517Helper method to write the test targets
518
519=cut
520
521sub test_via_harness {
522 my($self, $perl, $tests) = @_;
523 "\t$perl".q! -Mblib -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e "use Test::Harness qw(&runtests $$verbose); $$verbose=$(TEST_VERBOSE); runtests @ARGV;" !."$tests\n";
524}
525
3e3baf6d 526
68dc0745 527=item tool_autosplit (override)
528
529Use Win32 quoting on command line.
530
531=cut
532
533sub tool_autosplit{
534 my($self, %attribs) = @_;
535 my($asl) = "";
536 $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN};
537 q{
538# Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
539AUTOSPLITFILE = $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MAutoSplit }.$asl.q{ -e "autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1);"
540};
541}
542
543=item tools_other (o)
544
545Win32 overrides.
546
547Defines SHELL, LD, TOUCH, CP, MV, RM_F, RM_RF, CHMOD, UMASK_NULL in
548the Makefile. Also defines the perl programs MKPATH,
549WARN_IF_OLD_PACKLIST, MOD_INSTALL. DOC_INSTALL, and UNINSTALL.
550
551=cut
552
553sub tools_other {
554 my($self) = shift;
555 my @m;
556 my $bin_sh = $Config{sh} || 'cmd /c';
557 push @m, qq{
558SHELL = $bin_sh
3e3baf6d 559} unless $DMAKE; # dmake determines its own shell
68dc0745 560
561 for (qw/ CHMOD CP LD MV NOOP RM_F RM_RF TEST_F TOUCH UMASK_NULL DEV_NULL/ ) {
562 push @m, "$_ = $self->{$_}\n";
563 }
564
565 push @m, q{
566# The following is a portable way to say mkdir -p
567# To see which directories are created, change the if 0 to if 1
568MKPATH = $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e mkpath
569
570# This helps us to minimize the effect of the .exists files A yet
571# better solution would be to have a stable file in the perl
572# distribution with a timestamp of zero. But this solution doesn't
573# need any changes to the core distribution and works with older perls
574EQUALIZE_TIMESTAMP = $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e eqtime
575};
576
577
578 return join "", @m if $self->{PARENT};
579
580 push @m, q{
581# Here we warn users that an old packlist file was found somewhere,
582# and that they should call some uninstall routine
583WARN_IF_OLD_PACKLIST = $(PERL) -lwe "exit unless -f $$ARGV[0];" \\
584-e "print 'WARNING: I have found an old package in';" \\
585-e "print ' ', $$ARGV[0], '.';" \\
586-e "print 'Please make sure the two installations are not conflicting';"
587
588UNINST=0
589VERBINST=1
590
591MOD_INSTALL = $(PERL) -I$(INST_LIB) -I$(PERL_LIB) -MExtUtils::Install \
3e3baf6d 592-e "install({ @ARGV },'$(VERBINST)',0,'$(UNINST)');"
68dc0745 593
594DOC_INSTALL = $(PERL) -e "$$\=\"\n\n\";" \
595-e "print '=head2 ', scalar(localtime), ': C<', shift, '>', ' L<', shift, '>';" \
596-e "print '=over 4';" \
3e3baf6d 597-e "while (defined($$key = shift) and defined($$val = shift)) { print '=item *';print 'C<', \"$$key: $$val\", '>'; }" \
68dc0745 598-e "print '=back';"
599
600UNINSTALL = $(PERL) -MExtUtils::Install \
601-e "uninstall($$ARGV[0],1,1); print \"\nUninstall is deprecated. Please check the";" \
602-e "print \" packlist above carefully.\n There may be errors. Remove the\";" \
603-e "print \" appropriate files manually.\n Sorry for the inconveniences.\n\""
604};
605
606 return join "", @m;
607}
608
3e3baf6d 609=item xs_o (o)
610
611Defines suffix rules to go from XS to object files directly. This is
612only intended for broken make implementations.
613
614=cut
615
616sub xs_o { # many makes are too dumb to use xs_c then c_o
617 my($self) = shift;
618 return ''
619}
620
621=item top_targets (o)
622
623Defines the targets all, subdirs, config, and O_FILES
624
625=cut
626
627sub top_targets {
628# --- Target Sections ---
629
630 my($self) = shift;
631 my(@m);
632 push @m, '
633#all :: config $(INST_PM) subdirs linkext manifypods
634';
635
636 push @m, '
637all :: pure_all manifypods
638 '.$self->{NOECHO}.'$(NOOP)
639'
640 unless $self->{SKIPHASH}{'all'};
641
642 push @m, '
643pure_all :: config pm_to_blib subdirs linkext
644 '.$self->{NOECHO}.'$(NOOP)
645
646subdirs :: $(MYEXTLIB)
647 '.$self->{NOECHO}.'$(NOOP)
648
649config :: '.$self->{MAKEFILE}.' $(INST_LIBDIR)\.exists
650 '.$self->{NOECHO}.'$(NOOP)
651
652config :: $(INST_ARCHAUTODIR)\.exists
653 '.$self->{NOECHO}.'$(NOOP)
654
655config :: $(INST_AUTODIR)\.exists
656 '.$self->{NOECHO}.'$(NOOP)
657';
658
659 push @m, qq{
660config :: Version_check
661 $self->{NOECHO}\$(NOOP)
662
663} unless $self->{PARENT} or ($self->{PERL_SRC} && $self->{INSTALLDIRS} eq "perl") or $self->{NO_VC};
664
665 push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]);
666
667 if (%{$self->{MAN1PODS}}) {
668 push @m, qq[
669config :: \$(INST_MAN1DIR)\\.exists
670 $self->{NOECHO}\$(NOOP)
671
672];
673 push @m, $self->dir_target(qw[$(INST_MAN1DIR)]);
674 }
675 if (%{$self->{MAN3PODS}}) {
676 push @m, qq[
677config :: \$(INST_MAN3DIR)\\.exists
678 $self->{NOECHO}\$(NOOP)
679
680];
681 push @m, $self->dir_target(qw[$(INST_MAN3DIR)]);
682 }
683
684 push @m, '
685$(O_FILES): $(H_FILES)
686' if @{$self->{O_FILES} || []} && @{$self->{H} || []};
687
688 push @m, q{
689help:
690 perldoc ExtUtils::MakeMaker
691};
692
693 push @m, q{
694Version_check:
695 }.$self->{NOECHO}.q{$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \
696 -MExtUtils::MakeMaker=Version_check \
697 -e "Version_check('$(MM_VERSION)')"
698};
699
700 join('',@m);
701}
702
68dc0745 703=item manifypods (o)
704
705We don't want manpage process. XXX add pod2html support later.
706
707=cut
708
709sub manifypods {
710 return "\nmanifypods :\n\t$self->{NOECHO}\$(NOOP)\n";
711}
712
713=item dist_ci (o)
714
715Same as MM_Unix version (changes command-line quoting).
716
717=cut
718
719sub dist_ci {
720 my($self) = shift;
721 my @m;
722 push @m, q{
723ci :
724 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=maniread \\
725 -e "@all = keys %{ maniread() };" \\
726 -e "print(\"Executing $(CI) @all\n\"); system(\"$(CI) @all\");" \\
727 -e "print(\"Executing $(RCS_LABEL) ...\n\"); system(\"$(RCS_LABEL) @all\");"
728};
729 join "", @m;
730}
731
732=item dist_core (o)
733
734Same as MM_Unix version (changes command-line quoting).
735
736=cut
737
738sub dist_core {
739 my($self) = shift;
740 my @m;
741 push @m, q{
742dist : $(DIST_DEFAULT)
743 }.$self->{NOECHO}.q{$(PERL) -le "print \"Warning: Makefile possibly out of date with $$vf\" if " \
744 -e "-e ($$vf=\"$(VERSION_FROM)\") and -M $$vf < -M \"}.$self->{MAKEFILE}.q{\";"
745
746tardist : $(DISTVNAME).tar$(SUFFIX)
747
748zipdist : $(DISTVNAME).zip
749
750$(DISTVNAME).tar$(SUFFIX) : distdir
751 $(PREOP)
752 $(TO_UNIX)
753 $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME)
754 $(RM_RF) $(DISTVNAME)
755 $(COMPRESS) $(DISTVNAME).tar
756 $(POSTOP)
757
758$(DISTVNAME).zip : distdir
759 $(PREOP)
760 $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME)
761 $(RM_RF) $(DISTVNAME)
762 $(POSTOP)
763
764uutardist : $(DISTVNAME).tar$(SUFFIX)
765 uuencode $(DISTVNAME).tar$(SUFFIX) \\
766 $(DISTVNAME).tar$(SUFFIX) > \\
767 $(DISTVNAME).tar$(SUFFIX)_uu
768
769shdist : distdir
770 $(PREOP)
771 $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar
772 $(RM_RF) $(DISTVNAME)
773 $(POSTOP)
774};
775 join "", @m;
776}
777
778=item pasthru (o)
779
780Defines the string that is passed to recursive make calls in
781subdirectories.
782
783=cut
784
785sub pasthru {
786 my($self) = shift;
3e3baf6d 787 return "PASTHRU = " . ($NMAKE ? "-nologo" : "");
68dc0745 788}
789
790
791
7921;
793__END__
794
795=back
796
797=cut
798
5b0d9cbe 799