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

📄 am_edit

📁 bookcase,by shell script and c++ and perl
💻
📖 第 1 页 / 共 5 页
字号:
            $workfiles = "$dep_files $depfiles";            $workfiles =~ s/\034/\034$condition\@KDE_USE_FINAL_FALSE\@\t/g;            $lines .= "$condition\@KDE_USE_FINAL_FALSE\@DEP_FILES = $workfiles\n";        } else {            $workfiles = "$dep_files $depfiles";            $workfiles =~ s/\034/\034$condition\t/g;            $lines = $condition . "DEP_FILES = $workfiles\n";        }        substituteLine($lookup, $lines);    }    my $cvs_lines = "cvs-clean:\n";    $cvs_lines .= "\t\$(MAKE) admindir=\$(top_srcdir)/admin -f \$(top_srcdir)/admin/Makefile.common cvs-clean\n";    appendLines($cvs_lines);    $cvs_lines  = "kde-rpo-clean:\n";    $cvs_lines .= "\t-rm -f *.rpo\n";    appendLines($cvs_lines);    $target_adds{"clean"} .= "kde-rpo-clean ";    my %target_dels = ("install-data-am" => "");    # some strange people like to do a install-exec, and expect that also    # all modules are installed.  automake doesn't know this, so we need to move    # this here from install-data to install-exec.    if ($MakefileData =~ m/\nkde_module_LTLIBRARIES\s*=/) {#      $target_adds{"install-exec-am"} .= "install-kde_moduleLTLIBRARIES ";#      don't use $target_adds here because we need to append the dependency, not#      prepend it. Fixes #44342 , when a module depends on a lib in the same dir#      and libtool needs it during relinking upon install (Simon)      my $lookup = "install-exec-am:([^\n]*)";      if($MakefileData =~ /\n$lookup\n/) {        substituteLine("$lookup", "install-exec-am: $1 install-kde_moduleLTLIBRARIES");      }      $target_dels{"install-data-am"} .= "install-kde_moduleLTLIBRARIES ";      $target_adds{"install-data-am"} .= " ";    }    my $lines = "";    foreach $add (keys %target_adds) {	my $lookup = quotemeta($add) . ':([^\n]*)';        if ($MakefileData =~ /\n$lookup\n/) {	  my $newlines = $1;	  my $oldlines = $lookup;	  if (defined $target_dels{$add}) {	    foreach $del (split(' ', $target_dels{$add})) {	      $newlines =~ s/\s*$del\s*/ /g;	    }	  }	  substituteLine($oldlines, "$add: " . $target_adds{$add} . $newlines);        } else {	  $lines .= "$add: " . $target_adds{$add} . "\n";        }    }    if ($lines) {        appendLines($lines);    }    my $found = 1;    while ($found) {        if ($MakefileData =~ m/\n(.*)\$\(CXXFLAGS\)(.*)\n/) {            my $stuff_before = $1;            my $stuff_after = $2;            my $lookup = quotemeta("$1\$(CXXFLAGS)$2");            my $replacement = "$1\$(KCXXFLAGS)$2";            $MakefileData =~ s/$lookup/$replacement/;            $lookup =~ s/\\\$\\\(CXXFLAGS\\\)/\\\$\\\(KCXXFLAGS\\\)/;            $replacement = "$stuff_before\$(KCXXFLAGS) \$(KDE_CXXFLAGS)$stuff_after";            substituteLine($lookup, $replacement);        } else {            $found = 0;        }    }    if($foreign_libtool == 0) {        $lookup = '(\n[^#].*\$\(LIBTOOL\) --mode=link) (\$\(CXXLD\).*\$\(KCXXFLAGS\))';        if ($MakefileData =~ m/$lookup/ ) {            $MakefileData =~ s/$lookup/$1 --tag=CXX $2/;        }        $lookup = '(\n[^#].*\$\(LIBTOOL\) --mode=compile)\s+(\$\(CXX\)\s+)';        if ($MakefileData =~ m/$lookup/ ) {            $MakefileData =~ s/$lookup/$1 --tag=CXX $2/;        }    }    $MakefileData =~ s/\$\(KCXXFLAGS\)/\$\(CXXFLAGS\)/g;    $lookup = '(.*)cp -pr \$\$/\$\$file \$\(distdir\)/\$\$file(.*)';    if ($MakefileData =~ m/\n$lookup\n/) {        substituteLine($lookup, "$1cp -pr \$\$d/\$\$file \$(distdir)/\$\$file$2");    }    # Always update the Makefile.in    updateMakefile ();    return;}#-----------------------------------------------------------------------------# Beware: This procedure is not complete.  E.g. it also parses lines# containing a '=' in rules (for instance setting shell vars).  For our# usage this us enough, though.sub read_variables (){    while ($MakefileData =~ /\n\s*(\S+)\s*=([^\n]*)/g) {        $varcontent{$1} = $2;    }}# Check to see whether we should process this make file.# This is where we look for tags that we need to process.# A small amount of initialising on the tags is also done here.# And of course we open and/or create the needed make files.sub initialise (){    if (! -r "Makefile.am") {	print STDOUT "found Makefile.in without Makefile.am\n" if ($verbose);	return 0;    }    # Checking for files to process...    open (FILEIN, $makefile)      || die "Could not open $makefileDir/$makefile: $!\n";    # Read the file    # stat(FILEIN)[7] might look more elegant, but is slower as it     # requires stat'ing the file    seek(FILEIN, 0, 2);    my $fsize = tell(FILEIN);    seek(FILEIN, 0, 0);    read FILEIN, $MakefileData, $fsize;    close FILEIN;    print "DOS CRLF within $makefileDir/$makefile!\n" if($MakefileData =~ y/\r//d);    # Remove the line continuations, but keep them marked    # Note: we lose the trailing spaces but that's ok.    # Don't mangle line-leading spaces (usually tabs)    # since they're important.    $MakefileData =~ s/\\\s*\n/\034/g;    # If we've processed the file before...    restoreMakefile ()      if ($MakefileData =~ /$progId/);    foreach $dir (@foreignfiles) {      if (substr($makefileDir,0,length($dir)) eq $dir) {	return 0;      }    }    %kdeopts = ();    $kdeopts{"foreign"} = 0;    $kdeopts{"qtonly"} = 0;    $kdeopts{"noautodist"} = 0;    $kdeopts{"foreign-libtool"} = $foreign_libtool;    $kdeopts{"nofinal"} = !$use_final; # default    read_variables();    if ($MakefileData =~ /\nKDE_OPTIONS\s*=\s*([^\n]*)\n/) {	my $kde_options_str = $1;        local @kde_options = split(/[\034\s]+/, $kde_options_str);        if (grep(/^foreign$/, @kde_options)) {            push(@foreignfiles, $makefileDir . "/");            return 0; # don't touch me        }        for $opt (@kde_options) {            if (!defined $kdeopts{$opt}) {                print STDERR "Warning: unknown option $opt in $printname\n";            } else {                $kdeopts{$opt} = 1;            }        }    }    # Look for the tags that mean we should process this file.    $metasourceTags = 0;    $metasourceTags++    while ($MakefileData =~ /\n[^=\#]*METASOURCES\s*=/g);    my $pofileTag = 0;    $pofileTag++    while ($MakefileData =~ /\nPOFILES\s*=/g);    if ($pofileTag > 1)      {          print STDERR "Error: Only one POFILES tag allowed\n";          $errorflag = 1;      }    while ($MakefileData =~ /\n\.SUFFIXES:([^\n]+)\n/g) {	my $suffixes_str = $1;	my @list=split(' ', $suffixes_str);	foreach $ext (@list) {	    if ($ext =~ /^\.$cppExt$/) {		$cxxsuffix = $ext;		$cxxsuffix =~ s/\.//g;		print STDOUT "will use suffix $cxxsuffix\n" if ($verbose);		last;	    }	}    }    while ($MakefileData =~ /\n(\S*)_OBJECTS\s*=[\034\s]*([^\n]*)\n/g) {        my $program = $1;        my $objs = $2; # safe them        my $ocv = 0;        my @objlist = split(/[\034\s]+/, $objs);        foreach $obj (@objlist) {            if ($obj =~ /(\S*)\$\((\S+)\)/ ) {		my $pre = $1;                my $variable = $2;		if ($pre eq '' && exists($varcontent{$variable})) {		    my @addlist = split(/[\034\s]+/, $varcontent{$variable});		    push(@objlist, @addlist);                } elsif ($variable !~ 'OBJEXT') {                    $ocv = 1;		}            }        }        next if ($ocv);        $program =~ s/^am_// if ($program =~ /^am_/);        my $sourceprogram = $program;        $sourceprogram =~ s/\@am_/\@/ if($sourceprogram =~ /^.*\@am_.+/);        print STDOUT "found program $program\n" if ($verbose);        push(@programs, $program);        $realObjs{$program} = $objs;        if ($MakefileData =~ /\n$sourceprogram\_SOURCES\s*=\s*(.*)\n/) {            $sources{$program} = $1;        }         else {            $sources{$program} = "";            print STDERR "found program with no _SOURCES: $program\n";        }                my $realprogram = $program;        $realprogram =~ s/_/./g; # unmask to regexp        if ($MakefileData =~ /\n($realprogram)(\$\(EXEEXT\)?)?:.*\$\($program\_OBJECTS\)/) {            $realname{$program} = $1;        } else {            # not standard Makefile - nothing to worry about            $realname{$program} = "";        }    }        my $lookup = '\nDEPDIR\s*=.*';    if ($MakefileData !~ /($lookup)\n/o) {        $lookup = '\nbindir\s*=.*';        if ($MakefileData =~ /($lookup)\n/) {            substituteLine ($lookup, "DEPDIR = .deps\n$1");        }    }     my @marks = ('MAINTAINERCLEANFILES', 'CLEANFILES', 'DISTCLEANFILES');    foreach $mark (@marks) {        while ($MakefileData =~ /\n($mark)\s*=\s*([^\n]*)/g) {	    my $clean_str = $2;             foreach $file (split('[\034\s]+', $clean_str)) {                $file =~ s/\.\///;                push(@cleanfiles, $file);            }        }    }    my $localTag = 0;    $localTag++ if ($MakefileData =~ /\ninstall-\S+-local:/);        return (!$errorflag);}#-----------------------------------------------------------------------------# Gets the list of user defined directories - relative to $srcdir - where# header files could be located.sub tag_META_INCLUDES (){    my $lookup = '[^=\n]*META_INCLUDES\s*=\s*(.*)';    return 1    if ($MakefileData !~ /($lookup)\n/o);    print STDOUT "META_INCLUDE processing <$1>\n"       if ($verbose);    my $headerStr = $2;    removeLine ($lookup, $1);    my @headerlist = split(/[\034\s]+/, $headerStr);    foreach $dir (@headerlist)    {        $dir =~ s#\$\(srcdir\)#.#;        if (! -d $dir)        {            print STDERR "Warning: $dir can't be found. ",                            "Must be a relative path to \$(srcdir)\n";        }        else        {            push (@headerdirs, $dir);        }    }    return 0;}#-----------------------------------------------------------------------------sub tag_FINAL(){    my @final_names = ();        foreach $program (@programs) {                if ($sources{$program} =~ /\(/) {            print STDOUT "found ( in $program\_SOURCES. skipping\n" if ($verbose);            next;        }        my $mocs = "";       # Moc files (in this program)	my $moc_cpp_added = 0;  # If we added some .moc.cpp files, due to				# no other .cpp file including the .moc one.                my @progsources = split(/[\034\s]+/, $sources{$program});        my %shash = ();        @shash{@progsources} = 1;  # we are only interested in the existence        my %sourcelist = ();                foreach $source (@progsources) {            my $suffix = $source;            $suffix =~ s/^.*\.([^\.]+)$/$1/;                        $sourcelist{$suffix} .= "$source ";        }        foreach my $mocFile (keys (%globalmocs))        {            my ($dir, $hFile, $cppFile) = split ("\035", $globalmocs{$mocFile}, 3);            if (defined ($cppFile)) {                $mocs .= " $mocFile.moc" if exists $shash{$cppFile};            } else {		$sourcelist{$cxxsuffix} .= "$mocFile.moc.$cxxsuffix ";		$moc_cpp_added = 1;	    }        }        foreach $suffix (keys %sourcelist) {                        # See if this file contains c++ code. (i.e., just check the file's suffix against c++ extensions)            my $suffix_is_cxx = 0;            if($suffix =~ /($cppExt)$/) {              $cxxsuffix = $1;              $suffix_is_cxx = 1;            }                        my $mocfiles_in = ($suffix eq $cxxsuffix) && $moc_cpp_added;                        my @sourcelist = split(/[\034\s]+/, $sourcelist{$suffix});                        if ((@sourcelist == 1 && !$mocfiles_in) || $suffix_is_cxx != 1 ) {                                # we support IDL on our own                if ($suffix eq "skel" || $suffix =~ /^stub/ || $suffix =~ /^signals/                     || $suffix eq "h" || $suffix eq "ui" ) {                    next;                }                                foreach $file (@sourcelist) {                    $file =~ s/\Q$suffix\E$//;                                        $finalObjs{$program} .= $file;                    if ($program =~ /_la$/) {                        $finalObjs{$program} .= "lo ";                    } else {

⌨️ 快捷键说明

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