⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 am_edit

📁 bookcase,by shell script and c++ and perl
💻
📖 第 1 页 / 共 5 页
字号:
  local $line = $_[0];  if (   $line =~ /^\s*(\@.*\@)*\s*\$\(mkinstalldirs\)/      || $line =~ /^\s*(\@.*\@)*\s*\$\(INSTALL\S*\)/      || $line =~ /^\s*(\@.*\@)*\s*(-?rm.*) \S*$/)  {    $line =~ s/^(.*) ([^\s]+)\s*$/$1 \$(DESTDIR)$2/ if ($line !~ /\$\(DESTDIR\)/);  }  if ($line ne $_[0]) {    $_[0] = quotemeta $_[0];    substituteLine($_[0], $line);  }}#---------------------------------------------------------------------------# libtool is very hard to persuade it could use -Wl,--no-undefined for making# -no-undefined actually work# append $(KDE_NO_UNFINED) after every -no-undefined in LDFLAGS# this may go away if libtool ever does this on its ownsub tag_NO_UNDEFINED () {    return if ($program !~ /_la$/);    my $lookup = quotemeta($realname{$program}) . ":.*?\n\t.*?\\((.*?)\\) .*\n";    $MakefileData =~ m/$lookup/;    return if ($1 !~ /CXXLINK/);    if ($MakefileData !~ /\n$program\_LDFLAGS\s*=.*-no-undefined/ ) {        return;    }    $lookup = $program . '\_LDFLAGS(\s*)=(.*)-no-undefined(.*)';    if ($MakefileData =~ /\n$lookup\n/) {	my $replace = $program . "\_LDFLAGS$1=$2-no-undefined \$(KDE_NO_UNDEFINED)$3";        substituteLine($lookup, $replace);    }}sub tag_CLOSURE () {    return if ($program !~ /_la$/);    my $lookup = quotemeta($realname{$program}) . ":.*?\n\t.*?\\((.*?)\\) .*\n";    $MakefileData =~ m/$lookup/;    return if ($1 !~ /CXXLINK/);    if ($MakefileData !~ /\n$program\_LDFLAGS\s*=.*-no-undefined/ &&        $MakefileData !~ /\n$program\_LDFLAGS\s*=.*KDE_PLUGIN/ ) {        print STDERR "Report: $program contains undefined in $printname\n" if ($program =~ /^lib/ && $dryrun);        return;    }    my $closure = $realname{$program} . ".closure";    my $lines = "$closure: \$($program\_OBJECTS) \$($program\_DEPENDENCIES)\n";    $lines .= "\t\@echo \"int main() {return 0;}\" > $program\_closure.$cxxsuffix\n";    $lines .= "\t\@\$\(LTCXXCOMPILE\) -c $program\_closure.$cxxsuffix\n";    $lines .= "\t\$\(CXXLINK\) $program\_closure.lo \$($program\_LDFLAGS) \$($program\_OBJECTS) \$($program\_LIBADD) \$(LIBS)\n";    $lines .= "\t\@rm -f $program\_closure.* $closure\n";    $lines .= "\t\@echo \"timestamp\" > $closure\n";    $lines .= "\n";    appendLines($lines);    $lookup = $realname{$program} . ": (.*)";    if ($MakefileData =~ /\n$lookup\n/) {        $lines  = "\@KDE_USE_CLOSURE_TRUE@". $realname{$program} . ": $closure $1";        $lines .= "\n\@KDE_USE_CLOSURE_FALSE@" . $realname{$program} . ": $1";        substituteLine($lookup, $lines);    }    $closure_output .= " $closure";}sub tag_DIST () {    my %foundfiles = ();    opendir (THISDIR, ".");    foreach $entry (readdir(THISDIR)) {        next if ($entry eq "CVS" || $entry =~ /^\./  || $entry eq "Makefile" || $entry =~ /~$/ || $entry =~ /^\#.*\#$/);        next if (! -f $entry);        next if ($entry =~ /\.moc/ || $entry =~ /\.moc.$cppExt$/ || $entry =~ /\.lo$/ || $entry =~ /\.la$/ || $entry =~ /\.o/);        next if ($entry =~ /\.all_$cppExt\.$cppExt$/);        $foundfiles{$entry} = 1;    }    closedir (THISDIR);    # doing this for MAINTAINERCLEANFILES would be wrong    my @marks = ("EXTRA_DIST", "DIST_COMMON", '\S*_SOURCES', '\S*_HEADERS', 'CLEANFILES', 'DISTCLEANFILES', '\S*_OBJECTS');    foreach $mark (@marks) {        while ($MakefileData =~ /\n($mark)\s*=\s*([^\n]*)/g) {	    my $cleanfiles_str = $2;            foreach $file (split('[\034\s]+', $cleanfiles_str)) {                $file =~ s/\.\///;                $foundfiles{$file} = 0 if (defined $foundfiles{$file});            }        }    }    my @files = ("Makefile", "config.cache", "config.log", "stamp-h",                 "stamp-h1", "stamp-h1", "config.h", "Makefile",                  "config.status", "config.h", "libtool", "core" );    foreach $file (@files) {        $foundfiles{$file} = 0 if (defined $foundfiles{$file});    }    my $KDE_DIST = "";    foreach $file (keys %foundfiles) {        if ($foundfiles{$file} == 1) {            $KDE_DIST .= "$file ";        }    }    if ($KDE_DIST) {        print "KDE_DIST $printname $KDE_DIST\n" if ($verbose);        my $lookup = "DISTFILES *=(.*)";        if ($MakefileData =~ /\n$lookup\n/o) {            substituteLine($lookup, "KDE_DIST=$KDE_DIST\n\nDISTFILES=$1 \$(KDE_DIST)\n");        }    }}#-----------------------------------------------------------------------------# Returns 0 if the line was processed - 1 otherwise.# Errors are logged in the global $errorflagssub tag_DOCFILES (){    $target_adds{"all"} .= "docs-am ";    my $lookup = 'KDE_DOCS\s*=\s*([^\n]*)';    goto nodocs    if ($MakefileData !~ /\n$lookup/o);    print STDOUT "KDE_DOCS processing <$1>\n"   if ($verbose);    my $tmp = $1;    # Either find the files in the directory (AUTO) or use    # only the specified po files.    my $files = "";    my $appname = $tmp;    $appname =~ s/^(\S*)\s*.*$/$1/;    if ($appname =~ /AUTO/) {      $appname = basename($makefileDir);      if ("$appname" eq "en") {      	  print STDERR "Error: KDE_DOCS = AUTO relies on the directory name. Yours is 'en' - you most likely want something else, e.g. KDE_DOCS = myapp\n";          exit(1);      }    }    if ($tmp !~ / - /)    {        opendir (THISDIR, ".");	foreach $entry (readdir(THISDIR)) {	  next if ($entry eq "CVS" || $entry =~ /^\./  || $entry =~ /^Makefile/ || $entry =~ /~$/ || $entry =~ /^\#.*\#$/ || $entry eq "core" || $entry eq "index.cache.bz2");	  next if (! -f $entry);	  $files .= "$entry ";	}        closedir (THISDIR);        print STDOUT "docfiles found = $files\n"   if ($verbose);    }    else    {        $tmp =~ s/\034/ /g;	$tmp =~ s/^\S*\s*-\s*//;        $files = $tmp;    }    goto nodocs if (!$files);        # Nothing to do    if ($files =~ /(^| )index\.docbook($| )/) {      my $lines = "";      my $lookup = 'MEINPROC\s*=';      if ($MakefileData !~ /\n($lookup)/) {	$lines = "MEINPROC=/\$(kde_bindir)/meinproc\n";      }      $lookup = 'KDE_XSL_STYLESHEET\s*=';      if ($MakefileData !~ /\n($lookup)/) {        $lines .= "KDE_XSL_STYLESHEET=/\$(kde_datadir)/ksgmltools2/customization/kde-chunk.xsl\n";      }      $lookup = '\nindex.cache.bz2:';      if ($MakefileData !~ /\n($lookup)/) {         $lines .= "index.cache.bz2: \$(srcdir)/index.docbook \$(KDE_XSL_STYLESHEET) $files\n";         $lines .= "\t\@if test -n \"\$(MEINPROC)\"; then echo \$(MEINPROC) --check --cache index.cache.bz2 \$(srcdir)/index.docbook; \$(MEINPROC) --check --cache index.cache.bz2 \$(srcdir)/index.docbook; fi\n";         $lines .= "\n";      }      $lines .= "docs-am: index.cache.bz2\n";      $lines .= "\n";      $lines .= "install-docs: docs-am install-nls\n";      $lines .= "\t\$(mkinstalldirs) \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname\n";      $lines .= "\t\@if test -f index.cache.bz2; then \\\n";      $lines .= "\techo \$(INSTALL_DATA) index.cache.bz2 \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/; \\\n";      $lines .= "\t\$(INSTALL_DATA) index.cache.bz2 \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/; \\\n";      $lines .= "\telif test -f  \$(srcdir)/index.cache.bz2; then \\\n";      $lines .= "\techo \$(INSTALL_DATA) \$(srcdir)/index.cache.bz2 \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/; \\\n";      $lines .= "\t\$(INSTALL_DATA) \$(srcdir)/index.cache.bz2 \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/; \\\n";      $lines .= "\tfi\n";      $lines .= "\t-rm -f \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/common\n";      $lines .= "\t\$(LN_S) \$(kde_libs_htmldir)/$kdelang/common \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/common\n";      $lines .= "\n";      $lines .= "uninstall-docs:\n";      $lines .= "\t-rm -rf \$(kde_htmldir)/$kdelang/$appname\n";      $lines .= "\n";      $lines .= "clean-docs:\n";      $lines .= "\t-rm -f index.cache.bz2\n";      $lines .= "\n";      $target_adds{"install-data-am"} .= "install-docs ";      $target_adds{"uninstall"} .= "uninstall-docs ";      $target_adds{"clean-am"} .= "clean-docs ";      appendLines ($lines);    } else {      appendLines("docs-am: $files\n");    }    $target_adds{"install-data-am"} .= "install-nls ";    $target_adds{"uninstall"} .= "uninstall-nls ";    $tmp = "install-nls:\n";    $tmp .= "\t\$(mkinstalldirs) \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname\n";    $tmp .= "\t\@for base in $files; do \\\n";    $tmp .= "\t  echo \$(INSTALL_DATA) \$\$base \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/\$\$base ;\\\n";    $tmp .= "\t  \$(INSTALL_DATA) \$(srcdir)/\$\$base \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/\$\$base ;\\\n";    $tmp .= "\tdone\n";    if ($appname eq 'common') {      $tmp .= "\t\@echo \"merging common and language specific dir\" ;\\\n";      $tmp .= "\tif test ! -f \$(kde_htmldir)/en/common/kde-common.css; then echo 'no english docs found in \$(kde_htmldir)/en/common/'; exit 1; fi \n";      $tmp .= "\t\@com_files=`cd \$(kde_htmldir)/en/common && echo *` ;\\\n";      $tmp .= "\tcd \$(DESTDIR)\$(kde_htmldir)/$kdelang/common ;\\\n";      $tmp .= "\tif test -n \"\$\$com_files\"; then for p in \$\$com_files ; do \\\n";      $tmp .= "\t  case \" $files \" in \\\n";      $tmp .= "\t    *\" \$\$p \"*) ;; \\\n";      $tmp .= "\t    *) test ! -f \$\$p && echo \$(LN_S) ../../en/common/\$\$p \$(DESTDIR)\$(kde_htmldir)/$kdelang/common/\$\$p && \$(LN_S) ../../en/common/\$\$p \$\$p ;; \\\n";      $tmp .= "\t  esac ; \\\n";      $tmp .= "\tdone ; fi ; true\n";    }    $tmp .= "\n";    $tmp .= "uninstall-nls:\n";    $tmp .= "\tfor base in $files; do \\\n";    $tmp .= "\t  rm -f \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/\$\$base ;\\\n";    $tmp .= "\tdone\n\n";    appendLines ($tmp);    $target_adds{"distdir"} .= "distdir-nls ";    $tmp = "distdir-nls:\n";    $tmp .= "\tfor file in $files; do \\\n";    $tmp .= "\t  cp \$(srcdir)/\$\$file \$(distdir); \\\n";    $tmp .= "\tdone\n";    appendLines ($tmp);    return 0;  nodocs:    appendLines("docs-am:\n");    return 1;}#-----------------------------------------------------------------------------# Find headers in any of the source directories specified previously, that# are candidates for "moc-ing".sub findMocCandidates (){    foreach $dir (@headerdirs)    {        my @list = ();        opendir (SRCDIR, "$dir");        @hFiles = grep { /.+\.$hExt$/o && !/^\./ } readdir(SRCDIR);        closedir SRCDIR;        foreach $hf (@hFiles)        {            next if ($hf =~ /^\.\#/);	    $hf =~ /(.*)\.[^\.]*$/;          # Find name minus extension	    next if ($uiFiles{$1});            open (HFIN, "$dir/$hf") || die "Could not open $dir/$hf: $!\n";            my $hfsize = 0;            seek(HFIN, 0, 2);            $hfsize = tell(HFIN);            seek(HFIN, 0, 0);            read HFIN, $hfData, $hfsize;            close HFIN;            # push (@list, $hf) if(index($hfData, "Q_OBJECT") >= 0); ### fast but doesn't handle //Q_OBJECT            if ( $hfData =~ /{([^}]*)Q_OBJECT/s ) {              ## handle " { friend class blah; Q_OBJECT "                push (@list, $hf) unless $1 =~ m://[^\n]*Q_OBJECT[^\n]*$:s;  ## handle "// Q_OBJECT"            }        }        # The assoc array of root of headerfile and header filename        foreach $hFile (@list)        {            $hFile =~ /(.*)\.[^\.]*$/;          # Find name minus extension            if ($mocFiles{$1})            {              print STDERR "Warning: Multiple header files found for $1\n";              next;                           # Use the first one            }            $mocFiles{$1} = "$dir\035$hFile";   # Add relative dir        }    }    return 0;}#-----------------------------------------------------------------------------# The programmer has specified a moc list. Prune out the moc candidates# list that we found based on looking at the header files. This generates# a warning if the programmer gets the list wrong, but this doesn't have# to be fatal here.sub pruneMocCandidates ($){    my %prunedMoc = ();    local @mocList = split(' ', $_[0]);    foreach $mocname (@mocList)    {        $mocname =~ s/\.moc$//;        if ($mocFiles{$mocname})        {            $prunedMoc{$mocname} = $mocFiles{$mocname};        }        else        {            my $print = $makefileDir;            $print =~ s/^\Q$topdir\E\\//;            # They specified a moc file but we can't find a header that            # will generate this moc file. That's possible fatal!            print STDERR "Warning: No moc-able header file for $print/$mocname\n";        }    }    undef %mocFiles;    %mocFiles = %prunedMoc;}#-----------------------------------------------------------------------------# Finds the cpp files (If they exist).# The cpp files get appended to the header file separated by \035sub checkMocCandidates (){    my @cppFiles;    my $cpp2moc;  # which c++ file includes which .moc files    my $moc2cpp;  # which moc file is included by which c++ files    return unless (keys %mocFiles);    opendir(THISDIR, ".") || return;    @cppFiles = grep { /.+\.$cppExt$/o  && !/.+\.moc\.$cppExt$/o                         && !/.+\.all_$cppExt\.$cppExt$/o			 && !/^\./  } readdir(THISDIR);    closedir THISDIR;    return unless (@cppFiles);    my $files = join (" ", @cppFiles);    $cpp2moc = {};    $moc2cpp = {};    foreach $cxxf (@cppFiles)    {      open (CXXFIN, $cxxf) || die "Could not open $cxxf: $!\n";      seek(CXXFIN, 0, 2);      my $cxxfsize = tell(CXXFIN);      seek(CXXFIN, 0, 0);      read CXXFIN, $cxxfData, $cxxfsize;      close CXXFIN;      while(($cxxfData =~ m/^[ \t]*\#include\s*[<\"](.*\.moc)[>\"]/gm)) {	$cpp2moc->{$cxxf}->{$1} = 1;	$moc2cpp->{$1}->{$cxxf} = 1;      }    }    foreach my $mocFile (keys (%mocFiles))    {	@cppFiles = keys %{$moc2cpp->{"$mocFile.moc"}};        if (@cppFiles == 1) {            $mocFiles{$mocFile} .= "\035" . $cppFiles[0];	    push(@deped, $mocFile);        } elsif (@cppFiles == 0) {            push (@newObs, $mocFile);           # Produce new object file            next    if ($haveAutomocTag);       # This is expected...            # But this is an error we can deal with - let them know            print STDERR                "Warning: No c++ file that includes $mocFile.moc\n";        } else {            # We can't decide which file to use, so it's fatal. A

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -