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