📄 mm_win32.pm
字号:
return '' unless $self->has_link_code; my($otherldflags) = $attribs{OTHERLDFLAGS} || ($BORLAND ? 'c0d32.obj': ''); my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || ""; my($ldfrom) = '$(LDFROM)'; my(@m);# one thing for GCC/Mingw32:# we try to overcome non-relocateable-DLL problems by generating# a (hopefully unique) image-base from the dll's name# -- BKS, 10-19-1999 if ($GCC) { my $dllname = $self->{BASEEXT} . "." . $self->{DLEXT}; $dllname =~ /(....)(.{0,4})/; my $baseaddr = unpack("n", $1 ^ $2); $otherldflags .= sprintf("-Wl,--image-base,0x%x0000 ", $baseaddr); } push(@m,'# This section creates the dynamically loadable $(INST_DYNAMIC)# from $(OBJECT) and possibly $(MYEXTLIB).OTHERLDFLAGS = '.$otherldflags.'INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)\.exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)'); if ($GCC) { push(@m, q{ dlltool --def $(EXPORT_LIST) --output-exp dll.exp $(LD) -o $@ -Wl,--base-file -Wl,dll.base $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) dll.exp dlltool --def $(EXPORT_LIST) --base-file dll.base --output-exp dll.exp $(LD) -o $@ $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) dll.exp }); } elsif ($BORLAND) { push(@m, q{ $(LD) $(LDDLFLAGS) $(OTHERLDFLAGS) }.$ldfrom.q{,$@,,} .($DMAKE ? q{$(PERL_ARCHIVE:s,/,\,) $(LDLOADLIBS:s,/,\,) } .q{$(MYEXTLIB:s,/,\,),$(EXPORT_LIST:s,/,\,)} : q{$(subst /,\,$(PERL_ARCHIVE)) $(subst /,\,$(LDLOADLIBS)) } .q{$(subst /,\,$(MYEXTLIB)),$(subst /,\,$(EXPORT_LIST))}) .q{,$(RESFILES)}); } else { # VC push(@m, q{ $(LD) -out:$@ $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) } .q{$(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) -def:$(EXPORT_LIST)}); } push @m, ' $(CHMOD) 755 $@'; push @m, $self->dir_target('$(INST_ARCHAUTODIR)'); join('',@m);}sub perl_archive{ my ($self) = @_; return '$(PERL_INC)\\'.$Config{'libperl'};}sub export_list{ my ($self) = @_; return "$self->{BASEEXT}.def";}=item canonpathNo physical check on the filesystem, but a logical cleanup of apath. On UNIX eliminated successive slashes and successive "/.".=cutsub canonpath { my($self,$path) = @_; $path =~ s/^([a-z]:)/\u$1/; $path =~ s|/|\\|g; $path =~ s|(.)\\+|$1\\|g ; # xx////xx -> xx/xx $path =~ s|(\\\.)+\\|\\|g ; # xx/././xx -> xx/xx $path =~ s|^(\.\\)+|| unless $path eq ".\\"; # ./xx -> xx $path =~ s|\\$|| unless $path =~ m#^([a-z]:)?\\#; # xx/ -> xx $path .= '.' if $path =~ m#\\$#; $path;}=item perl_scriptTakes one argument, a file name, and returns the file name, if theargument is likely to be a perl script. On MM_Unix this is true forany ordinary, readable file.=cutsub perl_script { my($self,$file) = @_; return $file if -r $file && -f _; return "$file.pl" if -r "$file.pl" && -f _; return "$file.bat" if -r "$file.bat" && -f _; return;}=item pm_to_blibDefines target that copies all files in the hash PM to theirdestination and autosplits them. See L<ExtUtils::Install/DESCRIPTION>=cutsub pm_to_blib { my $self = shift; my($autodir) = $self->catdir('$(INST_LIB)','auto'); return q{pm_to_blib: $(TO_INST_PM) }.$self->{NOECHO}.q{$(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" \ "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Install \ -e "pm_to_blib(}. ($NMAKE ? 'qw[ <<pmfiles.dat ],' : $DMAKE ? 'qw[ $(mktmp,pmfiles.dat $(PM_TO_BLIB:s,\\,\\\\,)\n) ],' : '{ qw[$(PM_TO_BLIB)] },' ).q{'}.$autodir.q{','$(PM_FILTER)')" }. ($NMAKE ? q{$(PM_TO_BLIB)<< } : '') . $self->{NOECHO}.q{$(TOUCH) $@};}=item test_via_harness (o)Helper method to write the test targets=cutsub test_via_harness { my($self, $perl, $tests) = @_; "\t$perl".q! -Mblib -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e "use Test::Harness qw(&runtests $$verbose); $$verbose=$(TEST_VERBOSE); runtests @ARGV;" !."$tests\n";}=item tool_autosplit (override)Use Win32 quoting on command line.=cutsub tool_autosplit{ my($self, %attribs) = @_; my($asl) = ""; $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN}; q{# Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitIntoAUTOSPLITFILE = $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MAutoSplit }.$asl.q{ -e "autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1);"};}=item tools_other (o)Win32 overrides.Defines SHELL, LD, TOUCH, CP, MV, RM_F, RM_RF, CHMOD, UMASK_NULL inthe Makefile. Also defines the perl programs MKPATH,WARN_IF_OLD_PACKLIST, MOD_INSTALL. DOC_INSTALL, and UNINSTALL.=cutsub tools_other { my($self) = shift; my @m; my $bin_sh = $Config{sh} || 'cmd /c'; push @m, qq{SHELL = $bin_sh} unless $DMAKE; # dmake determines its own shell for (qw/ CHMOD CP LD MV NOOP RM_F RM_RF TEST_F TOUCH UMASK_NULL DEV_NULL/ ) { push @m, "$_ = $self->{$_}\n"; } push @m, q{# The following is a portable way to say mkdir -p# To see which directories are created, change the if 0 to if 1MKPATH = $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e mkpath# This helps us to minimize the effect of the .exists files A yet# better solution would be to have a stable file in the perl# distribution with a timestamp of zero. But this solution doesn't# need any changes to the core distribution and works with older perlsEQUALIZE_TIMESTAMP = $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e eqtime}; return join "", @m if $self->{PARENT}; push @m, q{# Here we warn users that an old packlist file was found somewhere,# and that they should call some uninstall routineWARN_IF_OLD_PACKLIST = $(PERL) -lwe "exit unless -f $$ARGV[0];" \\-e "print 'WARNING: I have found an old package in';" \\-e "print ' ', $$ARGV[0], '.';" \\-e "print 'Please make sure the two installations are not conflicting';"UNINST=0VERBINST=1MOD_INSTALL = $(PERL) -I$(INST_LIB) -I$(PERL_LIB) -MExtUtils::Install \-e "install({ @ARGV },'$(VERBINST)',0,'$(UNINST)');"DOC_INSTALL = $(PERL) -e "$$\=\"\n\n\";" \-e "print '=head2 ', scalar(localtime), ': C<', shift, '>', ' L<', $$arg=shift, '|', $$arg, '>';" \-e "print '=over 4';" \-e "while (defined($$key = shift) and defined($$val = shift)) { print '=item *';print 'C<', \"$$key: $$val\", '>'; }" \-e "print '=back';"UNINSTALL = $(PERL) -MExtUtils::Install \-e "uninstall($$ARGV[0],1,1); print \"\nUninstall is deprecated. Please check the";" \-e "print \" packlist above carefully.\n There may be errors. Remove the\";" \-e "print \" appropriate files manually.\n Sorry for the inconveniences.\n\""}; return join "", @m;}=item xs_o (o)Defines suffix rules to go from XS to object files directly. This isonly intended for broken make implementations.=cutsub xs_o { # many makes are too dumb to use xs_c then c_o my($self) = shift; return ''}=item top_targets (o)Defines the targets all, subdirs, config, and O_FILES=cutsub top_targets {# --- Target Sections --- my($self) = shift; my(@m); push @m, '#all :: config $(INST_PM) subdirs linkext manifypods'; push @m, 'all :: pure_all htmlifypods manifypods '.$self->{NOECHO}.'$(NOOP)' unless $self->{SKIPHASH}{'all'}; push @m, 'pure_all :: config pm_to_blib subdirs linkext '.$self->{NOECHO}.'$(NOOP)subdirs :: $(MYEXTLIB) '.$self->{NOECHO}.'$(NOOP)config :: '.$self->{MAKEFILE}.' $(INST_LIBDIR)\.exists '.$self->{NOECHO}.'$(NOOP)config :: $(INST_ARCHAUTODIR)\.exists '.$self->{NOECHO}.'$(NOOP)config :: $(INST_AUTODIR)\.exists '.$self->{NOECHO}.'$(NOOP)'; push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]); if (%{$self->{HTMLLIBPODS}}) { push @m, qq[config :: \$(INST_HTMLLIBDIR)/.exists $self->{NOECHO}\$(NOOP)]; push @m, $self->dir_target(qw[$(INST_HTMLLIBDIR)]); } if (%{$self->{HTMLSCRIPTPODS}}) { push @m, qq[config :: \$(INST_HTMLSCRIPTDIR)/.exists $self->{NOECHO}\$(NOOP)]; push @m, $self->dir_target(qw[$(INST_HTMLSCRIPTDIR)]); } if (%{$self->{MAN1PODS}}) { push @m, qq[config :: \$(INST_MAN1DIR)\\.exists $self->{NOECHO}\$(NOOP)]; push @m, $self->dir_target(qw[$(INST_MAN1DIR)]); } if (%{$self->{MAN3PODS}}) { push @m, qq[config :: \$(INST_MAN3DIR)\\.exists $self->{NOECHO}\$(NOOP)]; push @m, $self->dir_target(qw[$(INST_MAN3DIR)]); } push @m, '$(O_FILES): $(H_FILES)' if @{$self->{O_FILES} || []} && @{$self->{H} || []}; push @m, q{help: perldoc ExtUtils::MakeMaker}; push @m, q{Version_check: }.$self->{NOECHO}.q{$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \ -MExtUtils::MakeMaker=Version_check \ -e "Version_check('$(MM_VERSION)')"}; join('',@m);}=item htmlifypods (o)Defines targets and routines to translate the pods into HTML manpagesand put them into the INST_HTMLLIBDIR and INST_HTMLSCRIPTDIRdirectories.Same as MM_Unix version (changes command-line quoting).=cutsub htmlifypods { my($self, %attribs) = @_; return "\nhtmlifypods : pure_all\n\t$self->{NOECHO}\$(NOOP)\n" unless %{$self->{HTMLLIBPODS}} || %{$self->{HTMLSCRIPTPODS}}; my($dist); my($pod2html_exe); if (defined $self->{PERL_SRC}) { $pod2html_exe = $self->catfile($self->{PERL_SRC},'pod','pod2html'); } else { $pod2html_exe = $self->catfile($Config{scriptdirexp},'pod2html'); } unless ($pod2html_exe = $self->perl_script($pod2html_exe)) { # No pod2html but some HTMLxxxPODS to be installed print <<END;Warning: I could not locate your pod2html program. Please make sure, your pod2html program is in your PATH before you execute 'make'END $pod2html_exe = "-S pod2html"; } my(@m); push @m,qq[POD2HTML_EXE = $pod2html_exe\n],qq[POD2HTML = \$(PERL) -we "use File::Basename; use File::Path qw(mkpath); %m=\@ARGV;for (keys %m){" \\\n],q[-e "next if -e $$m{$$_} && -M $$m{$$_} < -M $$_ && -M $$m{$$_} < -M '], $self->{MAKEFILE}, q[';" \\-e "print qq(Htmlifying $$m{$$_}\n);" \\-e "$$dir = dirname($$m{$$_}); mkpath($$dir) unless -d $$dir;" \\-e "system(qq[$$^X ].q["-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" $(POD2HTML_EXE) ].qq[$$_>$$m{$$_}])==0 or warn qq(Couldn\\047t install $$m{$$_}\n);" \\-e "chmod(oct($(PERM_RW))), $$m{$$_} or warn qq(chmod $(PERM_RW) $$m{$$_}: $$!\n);}"]; push @m, "\nhtmlifypods : pure_all "; push @m, join " \\\n\t", keys %{$self->{HTMLLIBPODS}}, keys %{$self->{HTMLSCRIPTPODS}}; push(@m,"\n"); if (%{$self->{HTMLLIBPODS}} || %{$self->{HTMLSCRIPTPODS}}) { push @m, "\t$self->{NOECHO}\$(POD2HTML) \\\n\t"; push @m, join " \\\n\t", %{$self->{HTMLLIBPODS}}, %{$self->{HTMLSCRIPTPODS}}; } join('', @m);}=item manifypods (o)We don't want manpage process.=cutsub manifypods { my($self) = shift; return "\nmanifypods :\n\t$self->{NOECHO}\$(NOOP)\n";}=item dist_ci (o)Same as MM_Unix version (changes command-line quoting).=cutsub dist_ci { my($self) = shift; my @m; push @m, q{ci : $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=maniread \\ -e "@all = keys %{ maniread() };" \\ -e "print(\"Executing $(CI) @all\n\"); system(\"$(CI) @all\");" \\ -e "print(\"Executing $(RCS_LABEL) ...\n\"); system(\"$(RCS_LABEL) @all\");"}; join "", @m;}=item dist_core (o)Same as MM_Unix version (changes command-line quoting).=cutsub dist_core { my($self) = shift; my @m; push @m, q{dist : $(DIST_DEFAULT) }.$self->{NOECHO}.q{$(PERL) -le "print \"Warning: Makefile possibly out of date with $$vf\" if " \ -e "-e ($$vf=\"$(VERSION_FROM)\") and -M $$vf < -M \"}.$self->{MAKEFILE}.q{\";"tardist : $(DISTVNAME).tar$(SUFFIX)zipdist : $(DISTVNAME).zip$(DISTVNAME).tar$(SUFFIX) : distdir $(PREOP) $(TO_UNIX) $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME) $(RM_RF) $(DISTVNAME) $(COMPRESS) $(DISTVNAME).tar $(POSTOP)$(DISTVNAME).zip : distdir $(PREOP) $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME) $(RM_RF) $(DISTVNAME) $(POSTOP)uutardist : $(DISTVNAME).tar$(SUFFIX) uuencode $(DISTVNAME).tar$(SUFFIX) \\ $(DISTVNAME).tar$(SUFFIX) > \\ $(DISTVNAME).tar$(SUFFIX)_uushdist : distdir $(PREOP) $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar $(RM_RF) $(DISTVNAME) $(POSTOP)}; join "", @m;}=item pasthru (o)Defines the string that is passed to recursive make calls insubdirectories.=cutsub pasthru { my($self) = shift; return "PASTHRU = " . ($NMAKE ? "-nologo" : "");}1;__END__=back=cut
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -