📄 am_edit
字号:
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"; $allidls .= $source . "_kidl "; } if ($allidls !~ /$sourcename/) { if ($skel) { $dep_lines .= "$sourcename.$cxxsuffix: $source.kidl\n"; $dep_lines .= "\t\$(DCOPIDL2CPP) --c++-suffix $cxxsuffix --no-stub $source.kidl\n"; } else { $dep_lines .= "$sourcename.$cxxsuffix: $sourcename.h\n"; $dep_lines .= "$sourcename.h: $source.kidl\n"; $dep_lines .= "\t\$(DCOPIDL2CPP) --c++-suffix $cxxsuffix --no-skel $source.kidl\n"; } @cppFiles = `grep -l "^#include *.$sourcename\.h." $cppExt 2> /dev/null`; foreach $file (@cppFiles) { chomp ($file); $dep_lines .= "\$(srcdir)/$file: $sourcename.h\n"; } # just to make sure the warning gets issused @cppFiles = `grep -l "^#include *.$sourcename\.h." $hExt 2> /dev/null`; foreach $file (@cppFiles) { print STDERR "Warning: $sourcename.h included in $printname/$file\n"; } $allidls .= $sourcename . " "; } $idlfiles{$program} .= $sourcename . " "; if ($program =~ /_la$/) { $realObjs{$program} .= " $sourcename.lo"; } else { $realObjs{$program} .= " $sourcename.\$(OBJEXT)"; } $sources{$program} .= " $sourcename.$cxxsuffix"; $idl_output .= "\\\n\t$sourcename.$cxxsuffix $sourcename.h $source.kidl "; } } if ($dep_lines) { appendLines($dep_lines); } if (0) { my $lookup = "($program)"; $lookup .= '(|\$\(EXEEXT\))'; $lookup =~ s/\_/./g; $lookup .= ":(.*..$program\_OBJECTS..*)";# $lookup = quotemeta($lookup); if ($MakefileData =~ /\n$lookup\n/) { my $line = "$1$2: "; foreach $file (split(' ', $idlfiles{$program})) { $line .= "$file.$cxxsuffix "; } $line .= $3; substituteLine($lookup, $line); } else { print STDERR "no built dependency found $lookup\n"; } }}sub tag_ICON(){ my $lookup = 'KDE_ICON\s*=\s*([^\n]*)'; return 1 if ($MakefileData !~ /\n$lookup/); my @_appnames = split(" ", $1); print STDOUT "KDE_ICON processing <@_appnames>\n" if ($verbose); my @appnames = (); foreach $appname (@_appnames) { push(@appnames, quotemeta($appname)); } my @files = (); opendir (THISDIR, "."); foreach $entry (readdir(THISDIR)) { next if ($entry eq "CVS" || $entry =~ /^\./ || $entry =~ /^Makefile/ || $entry =~ /~$/ || $entry =~ /^\#.*\#$/); next if (! -f $entry); foreach $appname (@appnames) { push(@files, $entry) if ($entry =~ /-$appname\.xpm/ || $entry =~ /-$appname\.png/); } } closedir (THISDIR); $target_adds{"install-data-am"} .= "install-kde-icons "; $target_adds{"uninstall-am"} .= "uninstall-kde-icons "; $install = "install-kde-icons:\n"; $uninstall = "uninstall-kde-icons:\n"; my %directories = (); foreach $file (@files) { my $newfile = $file; my $prefix = $file; $prefix =~ s/\.(png|xpm)$//; my $appname = $prefix; $appname =~ s/^[^-]+-// if ($appname =~ /-/) ; $appname =~ s/^[^-]+-// if ($appname =~ /-/) ; $appname = quotemeta($appname); $prefix =~ s/$appname$//; $prefix =~ s/-$//; $prefix = 'los-app' if ($prefix eq 'mini'); $prefix = 'lom-app' if ($prefix eq 'lo'); $prefix = 'hil-app' if ($prefix eq 'large'); $prefix .= '-app' if ($prefix =~ m/^...$/); my $type = $prefix; $type =~ s/^.*-([^-]+)$/$1/; $prefix =~ s/^(.*)-[^-]+$/$1/; my %type_hash = ( 'app' => 'apps', 'device' => 'devices', 'filesys' => 'filesystems', 'listitems' => 'listitems', 'mime' => 'mimetypes', 'toolbar' => 'toolbars' ); if (! defined $type_hash{$type} ) { print STDERR "unknown icon type $type in $printname ($file)\n"; next; } my %dir_hash = ( 'los' => 'small/locolor', 'him' => 'medium/hicolor', 'lom' => 'medium/locolor', 'hil' => 'large/hicolor', ); $newfile =~ s@.*-($appname\.(png|xpm?))@$1@; if (! defined $dir_hash{$prefix}) { print STDERR "unknown icon prefix $prefix in $printname\n"; next; } my $dir = $dir_hash{$prefix} . "/" . $type_hash{$type}; if (!defined $directories{$dir}) { $install .= "\t\$(mkinstalldirs) \$(DESTDIR)\$(kde_icondir)/$dir\n"; $directories{$dir} = 1; } $install .= "\t\$(INSTALL_DATA) \$(srcdir)/$file \$(DESTDIR)\$(kde_icondir)/$dir/$newfile\n"; $uninstall .= "\t-rm -f \$(DESTDIR)\$(kde_icondir)/$dir/$newfile\n"; } appendLines($install . "\n" . $uninstall);}sub handle_POFILES($$){ my @pofiles = split(" ", $_[0]); my $lang = $_[1]; # Build rules for creating the gmo files my $tmp = ""; my $allgmofiles = ""; my $pofileLine = "POFILES ="; foreach $pofile (@pofiles) { $pofile =~ /(.*)\.[^\.]*$/; # Find name minus extension $tmp .= "$1.gmo: $pofile\n"; $tmp .= "\trm -f $1.gmo; \$(GMSGFMT) -o $1.gmo \$(srcdir)/$pofile\n"; $allgmofiles .= " $1.gmo"; $pofileLine .= " $1.po"; } appendLines ($tmp); my $lookup = 'POFILES\s*=([^\n]*)'; if ($MakefileData !~ /\n$lookup/) { appendLines("$pofileLine\nGMOFILES =$allgmofiles"); } else { substituteLine ($lookup, "$pofileLine\nGMOFILES =$allgmofiles"); } if ($allgmofiles) { # Add the "clean" rule so that the maintainer-clean does something appendLines ("clean-nls:\n\t-rm -f $allgmofiles\n"); $target_adds{"maintainer-clean"} .= "clean-nls "; $lookup = 'DISTFILES\s*=\s*(.*)'; if ($MakefileData =~ /\n$lookup\n/) { $tmp = "DISTFILES = \$(GMOFILES) \$(POFILES) $1"; substituteLine ($lookup, $tmp); } } $target_adds{"install-data-am"} .= "install-nls "; $tmp = "install-nls:\n"; $tmp .= "install-nls:\n"; if ($lang) { $tmp .= "\t\$(mkinstalldirs) \$(DESTDIR)\$(kde_locale)/$lang/LC_MESSAGES\n"; } $tmp .= "\t\@for base in "; foreach $pofile (@pofiles) { $pofile =~ /(.*)\.[^\.]*$/; # Find name minus extension $tmp .= "$1 "; } $tmp .= "; do \\\n"; if ($lang) { $tmp .= "\t echo \$(INSTALL_DATA) \$\$base.gmo \$(DESTDIR)\$(kde_locale)/$lang/LC_MESSAGES/\$\$base.mo ;\\\n"; $tmp .= "\t test ! -f \$\$base.gmo || \$(INSTALL_DATA) \$\$base.gmo \$(DESTDIR)\$(kde_locale)/$lang/LC_MESSAGES/\$\$base.mo ;\\\n" } else { $tmp .= "\t echo \$(INSTALL_DATA) \$\$base.gmo \$(DESTDIR)\$(kde_locale)/\$\$base/LC_MESSAGES/\$(PACKAGE).mo ;\\\n"; $tmp .= "\t \$(mkinstalldirs) \$(DESTDIR)\$(kde_locale)/\$\$base/LC_MESSAGES ; \\\n"; $tmp .= "\t test ! -f \$\$base.gmo || \$(INSTALL_DATA) \$\$base.gmo \$(DESTDIR)\$(kde_locale)/\$\$base/LC_MESSAGES/\$(PACKAGE).mo ;\\\n"; } $tmp .= "\tdone\n\n"; appendLines ($tmp); $target_adds{"uninstall"} .= "uninstall-nls "; $tmp = "uninstall-nls:\n"; foreach $pofile (@pofiles) { $pofile =~ /(.*)\.[^\.]*$/; # Find name minus extension if ($lang) { $tmp .= "\trm -f \$(DESTDIR)\$(kde_locale)/$lang/LC_MESSAGES/$1.mo\n"; } else { $tmp .= "\trm -f \$(DESTDIR)\$(kde_locale)/$1/LC_MESSAGES/\$(PACKAGE).mo\n"; } } appendLines($tmp); $target_adds{"all"} .= "all-nls-\@USE_NLS\@ "; $tmp = "all-nls-no:\n"; $tmp .= "all-nls-yes: \$(GMOFILES)\n"; appendLines($tmp); $target_adds{"distdir"} .= "distdir-nls "; $tmp = "distdir-nls:\$(GMOFILES)\n"; $tmp .= "\tfor file in \$(POFILES); do \\\n"; $tmp .= "\t cp \$(srcdir)/\$\$file \$(distdir); \\\n"; $tmp .= "\tdone\n"; $tmp .= "\ttest -z \"\$(GMOFILES)\" || cp \$(GMOFILES) \$(distdir)\n"; appendLines ($tmp);}#-----------------------------------------------------------------------------# Returns 0 if the line was processed - 1 otherwise.# Errors are logged in the global $errorflagssub tag_POFILES (){ my $lookup = 'POFILES\s*=([^\n]*)'; return 1 if ($MakefileData !~ /\n$lookup/); print STDOUT "POFILES processing <$1>\n" if ($verbose); my $tmp = $1; # make sure these are all gone. if ($MakefileData =~ /\n\.po\.gmo:\n/) { print STDERR "Warning: Found old .po.gmo rules in $printname. New po rules not added\n"; return 1; } # Either find the pofiles in the directory (AUTO) or use # only the specified po files. my $pofiles = ""; if ($tmp =~ /^\s*AUTO\s*$/) { opendir (THISDIR, "."); next if ($entry eq "CVS" || $entry =~ /^\./ || $entry =~ /^Makefile/ || $entry =~ /~$/ || $entry =~ /^#.*#$/); $pofiles = join(" ", grep(/\.po$/, readdir(THISDIR))); closedir (THISDIR); print STDOUT "pofiles found = $pofiles\n" if ($verbose); } else { $tmp =~ s/\034/ /g; $pofiles = $tmp; } return 1 if (!$pofiles); # Nothing to do handle_POFILES($pofiles, $kdelang); return 0;}sub helper_LOCALINSTALL($){ my $lookup = "\n" . $_[0] . ":"; if ($MakefileData =~ /($lookup)/) { my $install = $MakefileData; $install =~ s/\n/\035/g; $install =~ s/.*\035$_[0]:[^\035]*\035//; my $emptyline = 0; while (! $emptyline) { if ($install =~ /([^\035]*)\035(.*)/) { local $line = $1; $install = $2; if ($line =~ /^\s*$/ || $line !~ /^\t/) { $emptyline = 1; } else { replaceDestDir($line); } } else { $emptyline = 1; } } }}sub tag_LOCALINSTALL (){ helper_LOCALINSTALL('install-exec-local'); helper_LOCALINSTALL('install-data-local'); helper_LOCALINSTALL('uninstall-local'); return 0;}sub replaceDestDir($) { local $line = $_[0]; if ($line =~ /^\s*\$\(mkinstalldirs\)/ || $line =~ /^\s*\$\(INSTALL\S*\)/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -