📄 mm_unix.pm
字号:
=cutsub depend { my($self,%attribs) = @_; my(@m,$key,$val); while (($key,$val) = each %attribs){ last unless defined $key; push @m, "$key : $val\n"; } join "", @m;}=item init_DEST $mm->init_DESTDefines the DESTDIR and DEST* variables paralleling the INSTALL*.=cutsub init_DEST { my $self = shift; # Initialize DESTDIR $self->{DESTDIR} ||= ''; # Make DEST variables. foreach my $var ($self->installvars) { my $destvar = 'DESTINSTALL'.$var; $self->{$destvar} ||= '$(DESTDIR)$(INSTALL'.$var.')'; }}=item init_dist $mm->init_dist;Defines a lot of macros for distribution support. macro description default TAR tar command to use tar TARFLAGS flags to pass to TAR cvf ZIP zip command to use zip ZIPFLAGS flags to pass to ZIP -r COMPRESS compression command to gzip --best use for tarfiles SUFFIX suffix to put on .gz compressed files SHAR shar command to use shar PREOP extra commands to run before making the archive POSTOP extra commands to run after making the archive TO_UNIX a command to convert linefeeds to Unix style in your archive CI command to checkin your ci -u sources to version control RCS_LABEL command to label your sources rcs -Nv$(VERSION_SYM): -q just after CI is run DIST_CP $how argument to manicopy() best when the distdir is created DIST_DEFAULT default target to use to tardist create a distribution DISTVNAME name of the resulting archive $(DISTNAME)-$(VERSION) (minus suffixes)=cutsub init_dist { my $self = shift; $self->{TAR} ||= 'tar'; $self->{TARFLAGS} ||= 'cvf'; $self->{ZIP} ||= 'zip'; $self->{ZIPFLAGS} ||= '-r'; $self->{COMPRESS} ||= 'gzip --best'; $self->{SUFFIX} ||= '.gz'; $self->{SHAR} ||= 'shar'; $self->{PREOP} ||= '$(NOECHO) $(NOOP)'; # eg update MANIFEST $self->{POSTOP} ||= '$(NOECHO) $(NOOP)'; # eg remove the distdir $self->{TO_UNIX} ||= '$(NOECHO) $(NOOP)'; $self->{CI} ||= 'ci -u'; $self->{RCS_LABEL}||= 'rcs -Nv$(VERSION_SYM): -q'; $self->{DIST_CP} ||= 'best'; $self->{DIST_DEFAULT} ||= 'tardist'; ($self->{DISTNAME} = $self->{NAME}) =~ s{::}{-}g unless $self->{DISTNAME}; $self->{DISTVNAME} ||= $self->{DISTNAME}.'-'.$self->{VERSION};}=item dist (o) my $dist_macros = $mm->dist(%overrides);Generates a make fragment defining all the macros initialized ininit_dist.%overrides can be used to override any of the above.=cutsub dist { my($self, %attribs) = @_; my $make = ''; foreach my $key (qw( TAR TARFLAGS ZIP ZIPFLAGS COMPRESS SUFFIX SHAR PREOP POSTOP TO_UNIX CI RCS_LABEL DIST_CP DIST_DEFAULT DISTNAME DISTVNAME )) { my $value = $attribs{$key} || $self->{$key}; $make .= "$key = $value\n"; } return $make;}=item dist_basics (o)Defines the targets distclean, distcheck, skipcheck, manifest, veryclean.=cutsub dist_basics { my($self) = shift; return <<'MAKE_FRAG';distclean :: realclean distcheck $(NOECHO) $(NOOP)distcheck : $(PERLRUN) "-MExtUtils::Manifest=fullcheck" -e fullcheckskipcheck : $(PERLRUN) "-MExtUtils::Manifest=skipcheck" -e skipcheckmanifest : $(PERLRUN) "-MExtUtils::Manifest=mkmanifest" -e mkmanifestveryclean : realclean $(RM_F) *~ */*~ *.orig */*.orig *.bak */*.bak *.old */*.old MAKE_FRAG}=item dist_ci (o)Defines a check in target for RCS.=cutsub dist_ci { my($self) = shift; return q{ci : $(PERLRUN) "-MExtUtils::Manifest=maniread" \\ -e "@all = keys %{ maniread() };" \\ -e "print(qq{Executing $(CI) @all\n}); system(qq{$(CI) @all});" \\ -e "print(qq{Executing $(RCS_LABEL) ...\n}); system(qq{$(RCS_LABEL) @all});"};}=item dist_core (o) my $dist_make_fragment = $MM->dist_core;Puts the targets necessary for 'make dist' together into one makefragment.=cutsub dist_core { my($self) = shift; my $make_frag = ''; foreach my $target (qw(dist tardist uutardist tarfile zipdist zipfile shdist)) { my $method = $target.'_target'; $make_frag .= "\n"; $make_frag .= $self->$method(); } return $make_frag;}=item B<dist_target> my $make_frag = $MM->dist_target;Returns the 'dist' target to make an archive for distribution. Thistarget simply checks to make sure the Makefile is up-to-date anddepends on $(DIST_DEFAULT).=cutsub dist_target { my($self) = shift; my $date_check = $self->oneliner(<<'CODE', ['-l']);print 'Warning: Makefile possibly out of date with $(VERSION_FROM)' if -e '$(VERSION_FROM)' and -M '$(VERSION_FROM)' < -M '$(FIRST_MAKEFILE)';CODE return sprintf <<'MAKE_FRAG', $date_check;dist : $(DIST_DEFAULT) $(FIRST_MAKEFILE) $(NOECHO) %sMAKE_FRAG}=item B<tardist_target> my $make_frag = $MM->tardist_target;Returns the 'tardist' target which is simply so 'make tardist' works.The real work is done by the dynamically named tardistfile_target()method, tardist should have that as a dependency.=cutsub tardist_target { my($self) = shift; return <<'MAKE_FRAG';tardist : $(DISTVNAME).tar$(SUFFIX) $(NOECHO) $(NOOP)MAKE_FRAG}=item B<zipdist_target> my $make_frag = $MM->zipdist_target;Returns the 'zipdist' target which is simply so 'make zipdist' works.The real work is done by the dynamically named zipdistfile_target()method, zipdist should have that as a dependency.=cutsub zipdist_target { my($self) = shift; return <<'MAKE_FRAG';zipdist : $(DISTVNAME).zip $(NOECHO) $(NOOP)MAKE_FRAG}=item B<tarfile_target> my $make_frag = $MM->tarfile_target;The name of this target is the name of the tarball generated bytardist. This target does the actual work of turning the distdir intoa tarball.=cutsub tarfile_target { my($self) = shift; return <<'MAKE_FRAG';$(DISTVNAME).tar$(SUFFIX) : distdir $(PREOP) $(TO_UNIX) $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME) $(RM_RF) $(DISTVNAME) $(COMPRESS) $(DISTVNAME).tar $(POSTOP)MAKE_FRAG}=item zipfile_target my $make_frag = $MM->zipfile_target;The name of this target is the name of the zip file generated byzipdist. This target does the actual work of turning the distdir intoa zip file.=cutsub zipfile_target { my($self) = shift; return <<'MAKE_FRAG';$(DISTVNAME).zip : distdir $(PREOP) $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME) $(RM_RF) $(DISTVNAME) $(POSTOP)MAKE_FRAG}=item uutardist_target my $make_frag = $MM->uutardist_target;Converts the tarfile into a uuencoded file=cutsub uutardist_target { my($self) = shift; return <<'MAKE_FRAG';uutardist : $(DISTVNAME).tar$(SUFFIX) uuencode $(DISTVNAME).tar$(SUFFIX) $(DISTVNAME).tar$(SUFFIX) > $(DISTVNAME).tar$(SUFFIX)_uuMAKE_FRAG}=item shdist_target my $make_frag = $MM->shdist_target;Converts the distdir into a shell archive.=cutsub shdist_target { my($self) = shift; return <<'MAKE_FRAG';shdist : distdir $(PREOP) $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar $(RM_RF) $(DISTVNAME) $(POSTOP)MAKE_FRAG}=item dlsyms (o)Used by some OS' to define DL_FUNCS and DL_VARS and write the *.exp files.Normally just returns an empty string.=cutsub dlsyms { return '';}=item dynamic_bs (o)Defines targets for bootstrap files.=cutsub dynamic_bs { my($self, %attribs) = @_; return 'BOOTSTRAP =' unless $self->has_link_code(); my $target = $Is_VMS ? '$(MMS$TARGET)' : '$@'; return sprintf <<'MAKE_FRAG', ($target) x 5;BOOTSTRAP = $(BASEEXT).bs# As Mkbootstrap might not write a file (if none is required)# we use touch to prevent make continually trying to remake it.# The DynaLoader only reads a non-empty file.$(BOOTSTRAP) : $(FIRST_MAKEFILE) $(BOOTDEP) $(INST_ARCHAUTODIR)$(DFSEP).exists $(NOECHO) $(ECHO) "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))" $(NOECHO) $(PERLRUN) \ "-MExtUtils::Mkbootstrap" \ -e "Mkbootstrap('$(BASEEXT)','$(BSLOADLIBS)');" $(NOECHO) $(TOUCH) %s $(CHMOD) $(PERM_RW) %s$(INST_BOOT) : $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DFSEP).exists $(NOECHO) $(RM_RF) %s - $(CP) $(BOOTSTRAP) %s $(CHMOD) $(PERM_RW) %sMAKE_FRAG}=item dynamic_lib (o)Defines how to produce the *.so (or equivalent) files.=cutsub dynamic_lib { my($self, %attribs) = @_; return '' unless $self->needs_linking(); #might be because of a subdir return '' unless $self->has_link_code; my($otherldflags) = $attribs{OTHERLDFLAGS} || ""; my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || ""; my($armaybe) = $attribs{ARMAYBE} || $self->{ARMAYBE} || ":"; my($ldfrom) = '$(LDFROM)'; $armaybe = 'ar' if ($Is_OSF and $armaybe eq ':'); my(@m); my $ld_opt = $Is_OS2 ? '$(OPTIMIZE) ' : ''; # Useful on other systems too? my $ld_fix = $Is_OS2 ? '|| ( $(RM_F) $@ && sh -c false )' : ''; push(@m,'# This section creates the dynamically loadable $(INST_DYNAMIC)# from $(OBJECT) and possibly $(MYEXTLIB).ARMAYBE = '.$armaybe.'OTHERLDFLAGS = '.$ld_opt.$otherldflags.'INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'INST_DYNAMIC_FIX = '.$ld_fix.'$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DFSEP).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP)'); if ($armaybe ne ':'){ $ldfrom = 'tmp$(LIB_EXT)'; push(@m,' $(ARMAYBE) cr '.$ldfrom.' $(OBJECT)'."\n"); push(@m,' $(RANLIB) '."$ldfrom\n"); } $ldfrom = "-all $ldfrom -none" if $Is_OSF; # The IRIX linker doesn't use LD_RUN_PATH my $ldrun = $Is_IRIX && $self->{LD_RUN_PATH} ? qq{-rpath "$self->{LD_RUN_PATH}"} : ''; # For example in AIX the shared objects/libraries from previous builds # linger quite a while in the shared dynalinker cache even when nobody # is using them. This is painful if one for instance tries to restart # a failed build because the link command will fail unnecessarily 'cos # the shared object/library is 'busy'. push(@m,' $(RM_F) $@'); my $libs = '$(LDLOADLIBS)'; if (($Is_NetBSD || $Is_Interix) && $Config{'useshrplib'} eq 'true') { # Use nothing on static perl platforms, and to the flags needed # to link against the shared libperl library on shared perl # platforms. We peek at lddlflags to see if we need -Wl,-R # or -R to add paths to the run-time library search path. if ($Config{'lddlflags'} =~ /-Wl,-R/) { $libs .= ' -L$(PERL_INC) -Wl,-R$(INSTALLARCHLIB)/CORE -Wl,-R$(PERL_ARCHLIB)/CORE -lperl'; } elsif ($Config{'lddlflags'} =~ /-R/) { $libs .= ' -L$(PERL_INC) -R$(INSTALLARCHLIB)/CORE -R$(PERL_ARCHLIB)/CORE -lperl'; } } my $ld_run_path_shell = ""; if ($self->{LD_RUN_PATH} ne "") { $ld_run_path_shell = 'LD_RUN_PATH="$(LD_RUN_PATH)" '; } push @m, sprintf <<'MAKE', $ld_run_path_shell, $ldrun, $ldfrom, $libs; %s$(LD) %s $(LDDLFLAGS) %s $(OTHERLDFLAGS) -o $@ $(MYEXTLIB) \ $(PERL_ARCHIVE) %s $(PERL_ARCHIVE_AFTER) $(EXPORT_LIST) \ $(INST_DYNAMIC_FIX)MAKE push @m, <<'MAKE'; $(CHMOD) $(PERM_RWX) $@MAKE return join('',@m);}=item exescan
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -