📄 mm_unix.pm
字号:
=cut
sub const_cccmd {
my($self,$libperl)=@_;
return $self->{CONST_CCCMD} if $self->{CONST_CCCMD};
return '' unless $self->needs_linking();
return $self->{CONST_CCCMD} =
q{CCCMD = $(CC) -c $(INC) $(CCFLAGS) $(OPTIMIZE) \\
$(PERLTYPE) $(LARGE) $(SPLIT) $(DEFINE_VERSION) \\
$(XS_DEFINE_VERSION)};
}
=item const_config (o)
Defines a couple of constants in the Makefile that are imported from
%Config.
=cut
sub const_config {
# --- Constants Sections ---
my($self) = shift;
my(@m,$m);
push(@m,"\n# These definitions are from config.sh (via $INC{'Config.pm'})\n");
push(@m,"\n# They may have been overridden via Makefile.PL or on the command line\n");
my(%once_only);
foreach $m (@{$self->{CONFIG}}){
# SITE*EXP macros are defined in &constants; avoid duplicates here
next if $once_only{$m} or $m eq 'sitelibexp' or $m eq 'sitearchexp';
push @m, "\U$m\E = ".$self->{uc $m}."\n";
$once_only{$m} = 1;
}
join('', @m);
}
=item const_loadlibs (o)
Defines EXTRALIBS, LDLOADLIBS, BSLOADLIBS, LD_RUN_PATH. See
L<ExtUtils::Liblist> for details.
=cut
sub const_loadlibs {
my($self) = shift;
return "" unless $self->needs_linking;
my @m;
push @m, qq{
# $self->{NAME} might depend on some other libraries:
# See ExtUtils::Liblist for details
#
};
my($tmp);
for $tmp (qw/
EXTRALIBS LDLOADLIBS BSLOADLIBS LD_RUN_PATH
/) {
next unless defined $self->{$tmp};
push @m, "$tmp = $self->{$tmp}\n";
}
return join "", @m;
}
=item constants (o)
Initializes lots of constants and .SUFFIXES and .PHONY
=cut
sub constants {
my($self) = @_;
my(@m,$tmp);
for $tmp (qw/
AR_STATIC_ARGS NAME DISTNAME NAME_SYM VERSION
VERSION_SYM XS_VERSION INST_BIN INST_EXE INST_LIB
INST_ARCHLIB INST_SCRIPT PREFIX INSTALLDIRS
INSTALLPRIVLIB INSTALLARCHLIB INSTALLSITELIB
INSTALLSITEARCH INSTALLBIN INSTALLSCRIPT PERL_LIB
PERL_ARCHLIB SITELIBEXP SITEARCHEXP LIBPERL_A MYEXTLIB
FIRST_MAKEFILE MAKE_APERL_FILE PERLMAINCC PERL_SRC
PERL_INC PERL FULLPERL
/ ) {
next unless defined $self->{$tmp};
push @m, "$tmp = $self->{$tmp}\n";
}
push @m, qq{
VERSION_MACRO = VERSION
DEFINE_VERSION = -D\$(VERSION_MACRO)=\\\"\$(VERSION)\\\"
XS_VERSION_MACRO = XS_VERSION
XS_DEFINE_VERSION = -D\$(XS_VERSION_MACRO)=\\\"\$(XS_VERSION)\\\"
};
push @m, qq{
MAKEMAKER = $INC{'ExtUtils/MakeMaker.pm'}
MM_VERSION = $ExtUtils::MakeMaker::VERSION
};
push @m, q{
# FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle).
# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle)
# ROOTEXT = Directory part of FULLEXT with leading slash (eg /DBD) !!! Deprecated from MM 5.32 !!!
# PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar)
# DLBASE = Basename part of dynamic library. May be just equal BASEEXT.
};
for $tmp (qw/
FULLEXT BASEEXT PARENT_NAME DLBASE VERSION_FROM INC DEFINE OBJECT
LDFROM LINKTYPE
/ ) {
next unless defined $self->{$tmp};
push @m, "$tmp = $self->{$tmp}\n";
}
push @m, "
# Handy lists of source code files:
XS_FILES= ".join(" \\\n\t", sort keys %{$self->{XS}})."
C_FILES = ".join(" \\\n\t", @{$self->{C}})."
O_FILES = ".join(" \\\n\t", @{$self->{O_FILES}})."
H_FILES = ".join(" \\\n\t", @{$self->{H}})."
MAN1PODS = ".join(" \\\n\t", sort keys %{$self->{MAN1PODS}})."
MAN3PODS = ".join(" \\\n\t", sort keys %{$self->{MAN3PODS}})."
";
for $tmp (qw/
INST_MAN1DIR INSTALLMAN1DIR MAN1EXT INST_MAN3DIR INSTALLMAN3DIR MAN3EXT
/) {
next unless defined $self->{$tmp};
push @m, "$tmp = $self->{$tmp}\n";
}
for $tmp (qw(
PERM_RW PERM_RWX
)
) {
my $method = lc($tmp);
# warn "self[$self] method[$method]";
push @m, "$tmp = ", $self->$method(), "\n";
}
push @m, q{
.NO_CONFIG_REC: Makefile
} if $ENV{CLEARCASE_ROOT};
# why not q{} ? -- emacs
push @m, qq{
# work around a famous dec-osf make(1) feature(?):
makemakerdflt: all
.SUFFIXES: .xs .c .C .cpp .cxx .cc \$(OBJ_EXT)
# Nick wanted to get rid of .PRECIOUS. I don't remember why. I seem to recall, that
# some make implementations will delete the Makefile when we rebuild it. Because
# we call false(1) when we rebuild it. So make(1) is not completely wrong when it
# does so. Our milage may vary.
# .PRECIOUS: Makefile # seems to be not necessary anymore
.PHONY: all config static dynamic test linkext manifest
# Where is the Config information that we are using/depend on
CONFIGDEP = \$(PERL_ARCHLIB)/Config.pm \$(PERL_INC)/config.h
};
my @parentdir = split(/::/, $self->{PARENT_NAME});
push @m, q{
# Where to put things:
INST_LIBDIR = }. $self->catdir('$(INST_LIB)',@parentdir) .q{
INST_ARCHLIBDIR = }. $self->catdir('$(INST_ARCHLIB)',@parentdir) .q{
INST_AUTODIR = }. $self->catdir('$(INST_LIB)','auto','$(FULLEXT)') .q{
INST_ARCHAUTODIR = }. $self->catdir('$(INST_ARCHLIB)','auto','$(FULLEXT)') .q{
};
if ($self->has_link_code()) {
push @m, '
INST_STATIC = $(INST_ARCHAUTODIR)/$(BASEEXT)$(LIB_EXT)
INST_DYNAMIC = $(INST_ARCHAUTODIR)/$(DLBASE).$(DLEXT)
INST_BOOT = $(INST_ARCHAUTODIR)/$(BASEEXT).bs
';
} else {
push @m, '
INST_STATIC =
INST_DYNAMIC =
INST_BOOT =
';
}
$tmp = $self->export_list;
push @m, "
EXPORT_LIST = $tmp
";
$tmp = $self->perl_archive;
push @m, "
PERL_ARCHIVE = $tmp
";
# push @m, q{
#INST_PM = }.join(" \\\n\t", sort values %{$self->{PM}}).q{
#
#PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{
#};
push @m, q{
TO_INST_PM = }.join(" \\\n\t", sort keys %{$self->{PM}}).q{
PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{
};
join('',@m);
}
=item depend (o)
Same as macro for the depend attribute.
=cut
sub 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 dir_target (o)
Takes an array of directories that need to exist and returns a
Makefile entry for a .exists file in these directories. Returns
nothing, if the entry has already been processed. We're helpless
though, if the same directory comes as $(FOO) _and_ as "bar". Both of
them get an entry, that's why we use "::".
=cut
sub dir_target {
# --- Make-Directories section (internal method) ---
# dir_target(@array) returns a Makefile entry for the file .exists in each
# named directory. Returns nothing, if the entry has already been processed.
# We're helpless though, if the same directory comes as $(FOO) _and_ as "bar".
# Both of them get an entry, that's why we use "::". I chose '$(PERL)' as the
# prerequisite, because there has to be one, something that doesn't change
# too often :)
my($self,@dirs) = @_;
my(@m,$dir,$targdir);
foreach $dir (@dirs) {
my($src) = $self->catfile($self->{PERL_INC},'perl.h');
my($targ) = $self->catfile($dir,'.exists');
# catfile may have adapted syntax of $dir to target OS, so...
if ($Is_VMS) { # Just remove file name; dirspec is often in macro
($targdir = $targ) =~ s:/?\.exists$::;
}
else { # while elsewhere we expect to see the dir separator in $targ
$targdir = dirname($targ);
}
next if $self->{DIR_TARGET}{$self}{$targdir}++;
push @m, qq{
$targ :: $src
$self->{NOECHO}\$(MKPATH) $targdir
$self->{NOECHO}\$(EQUALIZE_TIMESTAMP) $src $targ
};
push(@m, qq{
-$self->{NOECHO}\$(CHMOD) \$(PERM_RWX) $targdir
}) unless $Is_VMS;
}
join "", @m;
}
=item dist (o)
Defines a lot of macros for distribution support.
=cut
sub dist {
my($self, %attribs) = @_;
my(@m);
# VERSION should be sanitised before use as a file name
my($version) = $attribs{VERSION} || '$(VERSION)';
my($name) = $attribs{NAME} || '$(DISTNAME)';
my($tar) = $attribs{TAR} || 'tar'; # eg /usr/bin/gnutar
my($tarflags) = $attribs{TARFLAGS} || 'cvf';
my($zip) = $attribs{ZIP} || 'zip'; # eg pkzip Yuck!
my($zipflags) = $attribs{ZIPFLAGS} || '-r';
my($compress) = $attribs{COMPRESS} || 'gzip --best';
my($suffix) = $attribs{SUFFIX} || '.gz'; # eg .gz
my($shar) = $attribs{SHAR} || 'shar'; # eg "shar --gzip"
my($preop) = $attribs{PREOP} || "$self->{NOECHO}\$(NOOP)"; # eg update MANIFEST
my($postop) = $attribs{POSTOP} || "$self->{NOECHO}\$(NOOP)"; # eg remove the distdir
my($to_unix) = $attribs{TO_UNIX} || ($Is_OS2
? "$self->{NOECHO}"
. '$(TEST_F) tmp.zip && $(RM) tmp.zip;'
. ' $(ZIP) -ll -mr tmp.zip $(DISTVNAME) && unzip -o tmp.zip && $(RM) tmp.zip'
: "$self->{NOECHO}\$(NOOP)");
my($ci) = $attribs{CI} || 'ci -u';
my($rcs_label)= $attribs{RCS_LABEL}|| 'rcs -Nv$(VERSION_SYM): -q';
my($dist_cp) = $attribs{DIST_CP} || 'best';
my($dist_default) = $attribs{DIST_DEFAULT} || 'tardist';
push @m, "
DISTVNAME = ${name}-$version
TAR = $tar
TARFLAGS = $tarflags
ZIP = $zip
ZIPFLAGS = $zipflags
COMPRESS = $compress
SUFFIX = $suffix
SHAR = $shar
PREOP = $preop
POSTOP = $postop
TO_UNIX = $to_unix
CI = $ci
RCS_LABEL = $rcs_label
DIST_CP = $dist_cp
DIST_DEFAULT = $dist_default
";
join "", @m;
}
=item dist_basics (o)
Defines the targets distclean, distcheck, skipcheck, manifest.
=cut
sub dist_basics {
my($self) = shift;
my @m;
push @m, q{
distclean :: realclean distcheck
};
push @m, q{
distcheck :
$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=fullcheck \\
-e fullcheck
};
push @m, q{
skipcheck :
$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=skipcheck \\
-e skipcheck
};
push @m, q{
manifest :
$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=mkmanifest \\
-e mkmanifest
};
join "", @m;
}
=item dist_ci (o)
Defines a check in target for RCS.
=cut
sub 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)
Defeines the targets dist, tardist, zipdist, uutardist, shdist
=cut
sub 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)_uu
shdist : distdir
$(PREOP)
$(SHAR) $(DISTVNAME) > $(DISTVNAME).shar
$(RM_RF) $(DISTVNAME)
$(POSTOP)
};
join "", @m;
}
=item dist_dir (o)
Defines the scratch directory target that will hold the distribution
before tar-ing (or shar-ing).
=cut
sub dist_dir {
my($self) = shift;
my @m;
push @m, q{
distdir :
$(RM_RF) $(DISTVNAME)
$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=manicopy,maniread \\
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -