📄 am_edit
字号:
} } } while ($MakefileData =~ /\n(\S*)_OBJECTS\s*=\s*([^\n]*)\n/g) { my $program = $1; my $objs = $2; # safe them my $ocv = 0; my @objlist = split(/[\s\034]+/, $objs); foreach $obj (@objlist) { if ($obj =~ /\$\((\S+)\)/ ) { my $variable = $1; if ($variable !~ 'OBJEXT') { $ocv = 1; } } } next if ($ocv); $program =~ s/^am_// if ($program =~ /^am_/); print STDOUT "found program $program\n" if ($verbose); push(@programs, $program); $realObjs{$program} = $objs; if ($MakefileData =~ /\n$program\_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/) { $lookup = '\nbindir\s*=.*'; if ($MakefileData =~ /($lookup)\n/) { substituteLine ($lookup, "DEPDIR = .deps\n$1"); } } else { print STDERR "$printname defines DEPDIR. This means you're using automake > 1.4 - this is not supported!\n"; } 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/); print STDOUT "META_INCLUDE processing <$1>\n" if ($verbose); my $headerStr = $2; removeLine ($lookup, $1); $headerStr =~ tr/\034/ /; my @headerlist = split(' ', $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 STDERR "found ( in $program\_SOURCES. skipping\n" if ($verbose); next; } my $mocsources = ""; my @progsources = split(/[\s\034]+/, $sources{$program}); my %sourcelist = (); foreach $source (@progsources) { my $suffix = $source; $suffix =~ s/^.*\.([^\.]+)$/$1/; if (defined($sourcelist{$suffix})) { $sourcelist{$suffix} .= " " . $source; } else { $sourcelist{$suffix} .= $source; } } foreach $suffix (keys %sourcelist) { # See if this file contains c++ code. (ie Just check the files suffix against my $suffix_is_cxx = 0; foreach $cxx_suffix (split(' ', $cppExt)) { $cxx_suffix =~ s/^\*\.//; $cxx_suffix = quotemeta($cxx_suffix); if ($suffix =~ $cxx_suffix) { $suffix_is_cxx = 1; last; # $cxx_suffix } } my $mocfiles_in = ($suffix eq $cxxsuffix) && defined($depedmocs{$program}); my @sourcelist = split(/[\s\034]+/, $sourcelist{$suffix}); if ((@sourcelist == 1 && !$mocfiles_in) || $suffix_is_cxx != 1 ) { # we support IDL on our own if ($suffix =~ /^skel$/ || $suffix =~ /^stub/ || $suffix =~ /^h$/) { next; } foreach $file (@sourcelist) { $file =~ s/\Q$suffix\E$//; $finalObjs{$program} .= $file; if ($program =~ /_la$/) { $finalObjs{$program} .= "lo "; } else { $finalObjs{$program} .= "o "; } } next; # suffix } my $source_deps = ""; foreach $source (@sourcelist) { if (-f $source) { $source_deps .= "\$(srcdir)/$source "; } else { $source_deps .= "$source "; } } $handling = "$program.all_$suffix.$suffix: \$(srcdir)/Makefile.in " . $source_deps . " "; if ($mocfiles_in) { $handling .= $depedmocs{$program}; foreach $mocfile (split(' ', $depedmocs{$program})) { if ($mocfile =~ m/\.$suffix$/) { $mocsources .= " " . $mocfile; } } } $handling .= "\n"; $handling .= "\t\@echo 'creating $program.all_$suffix.$suffix ...'; \\\n"; $handling .= "\trm -f $program.all_$suffix.files $program.all_$suffix.final; \\\n"; $handling .= "\techo \"#define KDE_USE_FINAL 1\" >> $program.all_$suffix.final; \\\n"; $handling .= "\tfor file in " . $sourcelist{$suffix} . " $mocsources; do \\\n"; $handling .= "\t echo \"#include \\\"\$\$file\\\"\" >> $program.all_$suffix.files; \\\n"; $handling .= "\t test ! -f \$\(srcdir\)/\$\$file || egrep '^#pragma +implementation' \$\(srcdir\)/\$\$file >> $program.all_$suffix.final; \\\n"; $handling .= "\tdone; \\\n"; $handling .= "\tcat $program.all_$suffix.final $program.all_$suffix.files > $program.all_$suffix.$suffix; \\\n"; $handling .= "\trm -f $program.all_$suffix.final $program.all_$suffix.files\n"; appendLines($handling); push(@final_names, "$program.all_$suffix.$suffix"); $finalObjs{$program} .= "$program.all_$suffix."; if ($program =~ /_la$/) { $finalObjs{$program} .= "lo "; } else { $finalObjs{$program} .= "o "; } } } if ($use_final && @final_names >= 1) { # add clean-final target my $lines = "$cleantarget-final:\n"; $lines .= "\t-rm -f " . join(' ', @final_names) . "\n" if (@final_names); appendLines($lines); $target_adds{"$cleantarget-am"} .= "$cleantarget-final "; foreach $finalfile (@final_names) { $finalfile =~ s/\.[^.]*$/.P/; $dep_finals .= " \$(DEPDIR)/$finalfile"; } }}# Organises the list of headers that we'll use to produce moc files# from.sub tag_METASOURCES (){ local @newObs = (); # here we add to create object files local @deped = (); # here we add to create moc files local $mocExt = ".moc"; local %mocFiles = (); my $line = ""; my $postEqual = ""; my $lookup; my $found = ""; if ($metasourceTags > 1) { $lookup = $program . '_METASOURCES\s*=\s*(.*)'; return 1 if ($MakefileData !~ /\n($lookup)\n/); $found = $1; } else { $lookup = $program . '_METASOURCES\s*=\s*(.*)'; if ($MakefileData !~ /\n($lookup)\n/) { $lookup = 'METASOURCES\s*=\s*(.*)'; return 1 if ($MakefileData !~ /\n($lookup)\n/); $found = $1; $metasourceTags = 0; # we can use the general target only once } else { $found = $1; } } print STDOUT "METASOURCE processing <$found>)\n" if ($verbose); $postEqual = $found; $postEqual =~ s/[^=]*=//; removeLine ($lookup, $found); # Always find the header files that could be used to "moc" return 1 if (findMocCandidates ()); if ($postEqual =~ /AUTO\s*(\S*)|USE_AUTOMOC\s*(\S*)/) { print STDERR "$printname: the argument for AUTO|USE_AUTOMOC is obsolete" if ($+); $mocExt = ".moc.$cxxsuffix"; $haveAutomocTag = 1; } else { # Not automoc so read the list of files supplied which # should be .moc files. $postEqual =~ tr/\034/ /; # prune out extra headers - This also checks to make sure that # the list is valid. pruneMocCandidates ($postEqual); } checkMocCandidates (); if (@newObs) { my $ext = ($program =~ /_la$/) ? ".moc.lo " : ".moc.o "; $realObjs{$program} .= "\034" . join ($ext, @newObs) . $ext; $depedmocs{$program} = join (".moc.$cxxsuffix " , @newObs) . ".moc.$cxxsuffix"; foreach $file (@newObs) { $dep_files .= " \$(DEPDIR)/$file.moc.P"; } } if (@deped) { $depedmocs{$program} .= " "; $depedmocs{$program} .= join('.moc ', @deped) . ".moc"; $depedmocs{$program} .= " "; } addMocRules (); @globalmocs{keys %mocFiles}=values %mocFiles;}#-----------------------------------------------------------------------------# Returns 0 if the line was processed - 1 otherwise.# Errors are logged in the global $errorflagssub tag_AUTOMAKE (){ my $lookup = '.*cd \$\(top_srcdir\)\s+&&\s+\$\(AUTOMAKE\)(.*)'; return 1 if ($MakefileData !~ /($lookup)/); print STDOUT "AUTOMAKE processing <$1>\n" if ($verbose); my $newLine = $1."\n\tcd \$(top_srcdir) && perl $thisProg $printname"; substituteLine ($lookup, $newLine); $automkCall = $1; return 0;}#-----------------------------------------------------------------------------sub tag_TOPLEVEL(){ my $lookup = 'TOPLEVEL_LANG\s*=\s*(\S+)'; return 1 if ($MakefileData !~ /\n$lookup\n/); my $lang = $1; if (tag_SUBDIRS()) { print STDERR "Error: TOPLEVEL_LANG without SUBDIRS = \$(AUTODIRS) in $printname\n"; $errorflag = 1; return 1; } my $pofiles = ""; my @restfiles = (); opendir (THISDIR, "."); foreach $entry (readdir(THISDIR)) { next if (-d $entry); next if ($entry eq "CVS" || $entry =~ /^\./ || $entry =~ /^Makefile/ || $entry =~ /~$/ || $entry =~ /^#.*#$/ || $entry =~ /.gmo$/); if ($entry =~ /\.po$/) { $pofiles .= "$entry "; next; } push(@restfiles, $entry); } closedir (THISDIR); print STDOUT "pofiles found = $pofiles\n" if ($verbose); handle_POFILES($pofiles, '$(TOPLEVEL_LANG)') if ($pofiles); if (@restfiles) { $target_adds{"install-data-am"} .= "install-nls-files "; $lines = "install-nls-files:\n"; $lines .= "\t\$(mkinstalldirs) \$(DESTDIR)\$(kde_locale)/$lang\n"; for $file (@restfiles) { $lines .= "\t\$(INSTALL_DATA) \$\(srcdir\)/$file \$(DESTDIR)\$(kde_locale)/$lang/$file\n"; } appendLines($lines); } return 0;}#-----------------------------------------------------------------------------sub tag_SUBDIRS (){ if ($MakefileData !~ /\nSUBDIRS\s*=\s*\$\(AUTODIRS\)\s*\n/) { return 1; } my $subdirs; opendir (THISDIR, "."); foreach $entry (readdir(THISDIR)) { next if ($entry eq "CVS" || $entry =~ /^\./); if (-d $entry && -f $entry . "/Makefile.am") { $subdirs .= " $entry"; next; } } closedir (THISDIR); my $lines = "SUBDIRS =$subdirs\n"; substituteLine('SUBDIRS\s*=.*', $lines); return 0;}sub tag_IDLFILES (){ my @psources = split(/[\034\s]+/, $sources{$program}); my $dep_lines = ""; my @cppFiles = (); foreach $source (@psources) { my $skel = ($source =~ m/\.skel$/); if ($source =~ m/\.stub$/ || $skel) { print STDERR "adding IDL file $source\n" if ($verbose); $source =~ s/\.(stub|skel)$//; my $sourcename; if ($skel) { $sourcename = "$source\_skel"; } else { $sourcename = "$source\_stub"; } my $sourcedir = ''; if (-f "$makefileDir/$source.h") { $sourcedir = '$(srcdir)/'; } else { if ($MakefileData =~ /\n$source\_DIR\s*=\s*(\S+)\n/) {# $sourcedir = $1; $sourcedir .= "/" if ($sourcedir !~ /\/$/); } } if ($allidls !~ /$source\_kidl/) { $dep_lines .= "$source.kidl: $sourcedir$source.h \$(DCOPIDL_DEPENDENCIES)\n"; $dep_lines .= "\t\$(DCOPIDL) $sourcedir$source.h > $source.kidl || rm -f $source.kidl\n";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -