Update of /cvsroot/licq/qt-gui
In directory usw-pr-cvs1:/tmp/cvs-serv2799
Modified Files:
am_edit
Log Message:
update for automake 1.6
Index: am_edit
===================================================================
RCS file: /cvsroot/licq/qt-gui/am_edit,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- am_edit 7 Oct 2001 12:38:35 -0000 1.4
+++ am_edit 13 Sep 2002 09:19:19 -0000 1.5
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/perl -w
# Expands the specialised KDE tags in Makefile.in to (hopefully) valid
# make syntax.
@@ -31,22 +31,6 @@
# Alex Zepeda <jazepeda@...>
# David Faure <faure@...>
# Stephan Kulow <coolo@...>
-#
-# I've puddled around with automoc and produced something different
-# 1999-02-01 John Birch <jb.nz@...>
-# * Rewritten automoc to cater for more than just moc file expansion
-# Version 0.01 does the same as automoc at this stage.
-# 1999-02-18 jb
-# * We must always write a Makefile.in file out even if we fail
-# because we need the "perl autokmake" in the AUTOMAKE so that a
-# "make" will regenerate the Makefile.in correctly.
-# Reworked moc file checking so that missing includes in cpp
-# will work and includes in cpp when using use_automoc will also
-# work.
-# 1999-02-23 jb
-# * Added POFILE processing and changed the USE_AUTOMOC tag to
-# AUTO instead.
-# ... See ChangeLog for more logs
use Cwd;
use File::Find;
@@ -98,6 +82,7 @@
$cleantarget = "clean";
$dryrun = 0;
$pathoption = 0;
+$foreign_libtool = 0;
while (defined ($ARGV[0]))
{
@@ -132,15 +117,15 @@
{
print STDOUT "Usage $thisProg [OPTION] ... [dir/Makefile.in]...\n",
"\n",
- "Patches dir/Makefile.in generated from automake\n",
- "(where dir can be a full or relative directory name)",
+ "Patches dir/Makefile.in generated by automake\n",
+ "(where dir can be an absolute or relative directory name)\n",
"\n",
" -v, --verbose verbosely list files processed\n",
" -h, --help print this help, then exit\n",
" --version print version number, then exit\n",
" -p, --path= use the path to am_edit if the path\n",
- " --no-final don't patch for --enable-final\n",
- " called from is not the one to be used\n";
+ " called from is not the one to be used\n",
+ " --no-final don't patch for --enable-final\n";
exit 0;
}
@@ -149,6 +134,11 @@
$use_final = 0;
$thisProg .= " --no-final";
}
+ elsif (/^--foreign-libtool$/)
+ {
+ $foreign_libtool = 1;
+ $thisProg .= " --foreign-libtool";
+ }
elsif (/^-n$/)
{
$dryrun = 1;
@@ -178,7 +168,7 @@
find (\&add_makefile, cwd());
#chdir('$topdir');
} else {
- print STDOUT "Using user enter input files\n" if ($verbose);
+ print STDOUT "Using input files specified by user\n" if ($verbose);
}
foreach $makefile (sort(@makefiles))
@@ -241,6 +231,8 @@
local $cleanMoc = "";
local $closure_output = "";
+ local %varcontent = ();
+
$makefileDir = dirname($makefile);
chdir ($makefileDir);
$printname = $makefile;
@@ -295,7 +287,8 @@
appendLines ("$cleantarget-metasources:\n\t-rm -f $cleanMoc\n");
$target_adds{"$cleantarget-am"} .= "$cleantarget-metasources ";
}
- tag_DIST();
+
+ tag_DIST() unless ($kdeopts{"noautodist"});
if ($idl_output) {
appendLines ("$cleantarget-idl:\n\t-rm -f $idl_output\n");
@@ -329,6 +322,7 @@
appendLines($tmp);
make_meta_classes();
+ tag_COMPILE_FIRST();
tag_FINAL() if (!$kdeopts{"nofinal"});
my $final_lines = "final:\n\t\$(MAKE) ";
@@ -364,51 +358,55 @@
appendLines($final_install_lines . "install-am");
appendLines($nofinal_lines . "all-am");
appendLines($nofinal_install_lines . "install-am");
-
+
my $lookup = 'DEP_FILES\s*=([^\n]*)';
if ($MakefileData =~ /\n$lookup\n/o) {
$depfiles = $1;
-
+
if ($dep_finals) {
$lines = "\@KDE_USE_FINAL_TRUE\@DEP_FILES = $dep_files $dep_finals \034\t$depfiles\n";
$lines .= "\@KDE_USE_FINAL_FALSE\@DEP_FILES = $dep_files $depfiles\n";
} else {
$lines = "DEP_FILES = $dep_files $depfiles\n";
}
-
substituteLine($lookup, $lines);
}
-
+
my $cvs_lines = "cvs-clean:\n";
- $cvs_lines .= "\t\$(MAKE) -f \$(top_srcdir)/admin/Makefile.common 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";
- my $lookup = "install-data-am:\s*(.*)";
- if ($MakefileData =~ /\n$lookup\n/) {
- my $newdeps = $1;
- $newdeps =~ s/\s*install-kde_moduleLTLIBRARIES\s*/ /g;
- substituteLine($lookup, "install-data-am: " . $newdeps);
- }
+ $target_adds{"install-exec-am"} .= "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) . ":\s*(.*)";
+ my $lookup = quotemeta($add) . ':([^\n]*)';
if ($MakefileData =~ /\n$lookup\n/) {
- substituteLine($lookup, "$add: " . $target_adds{$add} . $1);
+ 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";
+ $lines .= "$add: " . $target_adds{$add} . "\n";
}
}
if ($lines) {
@@ -416,7 +414,7 @@
}
my $found = 1;
-
+
while ($found) {
if ($MakefileData =~ m/\n(.*)\$\(CXXFLAGS\)(.*)\n/) {
my $vor = $1; # "vor" means before in German
@@ -432,15 +430,17 @@
}
}
- $lookup = '(\n[^#].*\$\(LIBTOOL\) --mode=link) (\$\(CXXLD\).*\$\(KCXXFLAGS\))';
-
- if ($MakefileData =~ m/$lookup/ ) {
- $MakefileData =~ s/$lookup/$1 --tag=CXX $2/;
- }
+ if($foreign_libtool == 0) {
+ $lookup = '(\n[^#].*\$\(LIBTOOL\) --mode=link) (\$\(CXXLD\).*\$\(KCXXFLAGS\))';
- $lookup = '(\n[^#].*\$\(LIBTOOL\) --mode=compile) (\$\(CXX\).*\$\(KCXXFLAGS\))';
- if ($MakefileData =~ m/$lookup/ ) {
- $MakefileData =~ s/$lookup/$1 --tag=CXX $2/;
+ 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;
@@ -457,6 +457,16 @@
#-----------------------------------------------------------------------------
+# 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.
@@ -483,7 +493,7 @@
# Remove the line continuations, but keep them marked
# Note: we lose the trailing spaces but that's ok.
- $MakefileData =~ s/\\\s*\n/\034/g;
+ $MakefileData =~ s/\\\s*\n\s*/\034/g;
# If we've processed the file before...
restoreMakefile () if ($MakefileData =~ /$progId/);
@@ -497,8 +507,12 @@
%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/) {
local @kde_options = split(/[\s\034]/, $1);
if (grep(/^foreign$/, @kde_options)) {
@@ -537,42 +551,50 @@
}
}
}
-
+
while ($MakefileData =~ /\n(\S*)_OBJECTS\s*=[ \t\034]*([^\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') {
+ if ($obj =~ /(\S*)\$\((\S+)\)/ ) {
+ my $pre = $1;
+ my $variable = $2;
+ if ($pre eq '' && exists($varcontent{$variable})) {
+ my @addlist = split(/[\s\034]+/, $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$program\_SOURCES\s*=\s*(.*)\n/) {
+
+ if ($MakefileData =~ /\n$sourceprogram\_SOURCES\s*=\s*(.*)\n/) {
$sources{$program} = $1;
- } else {
+ }
+ else {
$sources{$program} = "";
print STDERR "found program with no _SOURCES: $program\n";
}
my $realprogram = $program;
- $realprogram =~ s/_/./g; # unmask to regexp
+ $realprogram =~ s/_/\\./g; # unmask to regexp
if ($MakefileData =~ /\n($realprogram)(\$\(EXEEXT\)?)?:.*\$\($program\_OBJECTS\)/) {
$realname{$program} = $1;
} else {
@@ -650,42 +672,50 @@
print STDOUT "found ( in $program\_SOURCES. skipping\n" if ($verbose);
next;
}
-
- my $mocsources = "";
+
+ 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(/[\s\034]+/, $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/;
- if (defined($sourcelist{$suffix})) {
- $sourcelist{$suffix} .= " " . $source;
+ $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{$suffix} .= $source;
- }
+ $sourcelist{$cxxsuffix} .= $mocFile . ".moc." . $cxxsuffix;
+ $moc_cpp_added = 1;
+ }
}
-
foreach $suffix (keys %sourcelist) {
- # See if this file contains c++ code. (ie Just check the files suffix against
+ # 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)$/) {
- $cxx_suffix = $1;
+ $cxxsuffix = $1;
$suffix_is_cxx = 1;
}
- my $mocfiles_in = ($suffix eq $cxxsuffix) &&
- defined($depedmocs{$program});
+ my $mocfiles_in = ($suffix eq $cxxsuffix) && $moc_cpp_added;
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$/
- || $suffix =~ /^ui$/ ) {
+ if ($suffix eq "skel" || $suffix =~ /^stub/ || $suffix =~ /^signals/
+ || $suffix eq "h" || $suffix eq "ui" ) {
next;
}
@@ -706,43 +736,33 @@
my $source_deps = "";
foreach $source (@sourcelist) {
if (-f $source) {
- $source_deps .= "\$(srcdir)/$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;
- }
+ $source_deps .= " $source";
}
}
- $handling .= "\n";
+ $handling = "$program.all_$suffix.$suffix: \$(srcdir)/Makefile.in" . $source_deps . " " . join(' ', $mocs) . "\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 .= "\tfor file in " . $sourcelist{$suffix} . "; 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 .= "\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.";
+ my $finalObj = "$program.all_$suffix.";
if ($program =~ /_la$/) {
- $finalObjs{$program} .= "lo ";
+ $finalObj .= "lo";
} else {
- $finalObjs{$program} .= "o ";
+ $finalObj .= "o";
}
+ $finalObjs{$program} .= $finalObj . " ";
}
}
@@ -760,6 +780,42 @@
}
}
+#-----------------------------------------------------------------------------
+
+sub tag_COMPILE_FIRST()
+{
+ foreach $program (@programs) {
+ my $lookup = "$program" . '_COMPILE_FIRST\s*=\s*(.*)';
+ if ($MakefileData =~ m/\n$lookup\n/) {
+ my @compilefirst = split(/[\s\034]+/, $1);
+ my @progsources = split(/[\s\034]+/, $sources{$program});
+ my %donesources = ();
+ $handling = "";
+ foreach $source (@progsources) {
+ my @deps = ();
+ my $sdeps = "";
+ if (-f $source) {
+ $sdeps = "\$(srcdir)/$source";
+ } else {
+ $sdeps = "$source";
+ }
+ foreach $depend (@compilefirst) {
+ next if ($source eq $depend);
+ # avoid cyclic dependencies
+ next if defined($donesources{$depend});
+ push @deps, $depend;
+ }
+ $handling .= "$sdeps: " . join(' ', @deps) . "\n" if (@deps);
+ $donesources{$source} = 1;
+ }
+ appendLines($handling) if (length($handling));
+ }
+ }
+}
+
+#-----------------------------------------------------------------------------
+
+
# Organises the list of headers that we'll use to produce moc files
# from.
sub tag_METASOURCES ()
@@ -774,7 +830,7 @@
my $lookup;
my $found = "";
-
+#print "$program: tag_METASOURCES\n";
if ($metasourceTags > 1) {
$lookup = $program . '_METASOURCES\s*=\s*(.*)';
return 1 if ($MakefileData !~ /\n($lookup)\n/);
@@ -898,7 +954,7 @@
return 1;
}
- my $subdirs;
+ my $subdirs = ".";
opendir (THISDIR, ".");
foreach $entry (readdir(THISDIR)) {
@@ -924,8 +980,10 @@
foreach $source (@psources) {
my $skel = ($source =~ m/\.skel$/);
+ my $stub = ($source =~ m/\.stub$/);
+ my $signals = ($source =~ m/\.signals$/);
- if ($source =~ m/\.stub$/ || $skel) {
+ if ($stub || $skel || $signals) {
my $qs = quotemeta($source);
$sources{$program} =~ s/$qs//;
@@ -933,14 +991,16 @@
print STDOUT "adding IDL file $source\n" if ($verbose);
- $source =~ s/\.(stub|skel)$//;
+ $source =~ s/\.(stub|skel|signals)$//;
my $sourcename;
if ($skel) {
$sourcename = "$source\_skel";
- } else {
+ } elsif ($stub) {
$sourcename = "$source\_stub";
+ } else {
+ $sourcename = "$source\_signals";
}
my $sourcedir = '';
@@ -955,7 +1015,7 @@
if ($allidls !~ /$source\_kidl/) {
- $dep_lines .= "$source.kidl: $sourcedir$source.h \$(DCOPIDL_DEPENDENCIES)\n";
+ $dep_lines .= "$source.kidl: $sourcedir$source.h \$(DCOP_DEPENDENCIES)\n";
$dep_lines .= "\t\$(DCOPIDL) $sourcedir$source.h > $source.kidl || ( rm -f $source.kidl ; /bin/false )\n";
$allidls .= $source . "_kidl ";
@@ -963,13 +1023,21 @@
if ($allidls !~ /$sourcename/) {
+ $dep_lines_tmp = "";
+
if ($skel) {
$dep_lines .= "$sourcename.$cxxsuffix: $source.kidl\n";
- $dep_lines .= "\t\$(DCOPIDL2CPP) --c++-suffix $cxxsuffix --no-stub $source.kidl\n";
- } else {
+ $dep_lines .= "\t\$(DCOPIDL2CPP) --c++-suffix $cxxsuffix --no-signals --no-stub $source.kidl\n";
+ } elsif ($stub) {
+ $dep_lines_tmp = "\t\$(DCOPIDL2CPP) --c++-suffix $cxxsuffix --no-signals --no-skel $source.kidl\n";
+ } else { # signals
+ $dep_lines_tmp = "\t\$(DCOPIDL2CPP) --c++-suffix $cxxsuffix --no-stub --no-skel $source.kidl\n";
+ }
+
+ if ($stub || $signals) {
$target_adds{"$sourcename.$cxxsuffix"} .= "$sourcename.h ";
$dep_lines .= "$sourcename.h: $source.kidl\n";
- $dep_lines .= "\t\$(DCOPIDL2CPP) --c++-suffix $cxxsuffix --no-skel $source.kidl\n";
+ $dep_lines .= $dep_lines_tmp;
}
$allidls .= $sourcename . " ";
@@ -1045,7 +1113,9 @@
$dep_lines .= "\trm -f $source.$cxxsuffix\n";
if (!$kdeopts{"qtonly"}) {
$dep_lines .= "\techo '#include <klocale.h>' > $source.$cxxsuffix\n";
- $dep_lines .= "\t\$(UIC) -tr \${UIC_TR} -i $source.h $sourcedir$source.ui | sed -e \"s,i18n( \\\"\\\" ),QString::null,g\" | sed -e \"s,QT_KDE_I18N( \\\"\\\"\\, \\\"\\\" ),QString::null,g\" >> $source.$cxxsuffix || rm -f $source.$cxxsuffix\n";
+ my ($mangled_source) = $source;
+ $mangled_source =~ s/[^A-Za-z0-9]/_/g; # get rid of garbage
+ $dep_lines .= "\t\$(UIC) -tr \${UIC_TR} -i $source.h $sourcedir$source.ui | sed -e \"s,\${UIC_TR}( \\\"\\\" ),QString::null,g\" | sed -e \"s,\${UIC_TR}( \\\"\\\"\\, \\\"\\\" ),QString::null,g\" | sed -e \"s,image\\([0-9][0-9]*\\)_data,img\\1_" . $mangled_source . ",g\" >> $source.$cxxsuffix || rm -f $source.$cxxsuffix\n";
} else {
$dep_lines .= "\t\$(UIC) -i $source.h $sourcedir$source.ui > $source.$cxxsuffix || rm -f $source.$cxxsuffix\n";
}
@@ -1113,11 +1183,11 @@
if ( $iconauto )
{
push(@files, $entry)
- if ($entry =~ /\.xpm/ || $entry =~ /\.png/);
+ if ($entry =~ /\.xpm/ || $entry =~ /\.png/ || $entry =~ /\.mng/);
} else {
foreach $appname (@appnames) {
push(@files, $entry)
- if ($entry =~ /-$appname\.xpm/ || $entry =~ /-$appname\.png/);
+ if ($entry =~ /-$appname\.xpm/ || $entry =~ /-$appname\.png/ || $entry =~ /-$appname\.mng/);
}
}
}
@@ -1128,7 +1198,7 @@
foreach $file (@files) {
my $newfile = $file;
my $prefix = $file;
- $prefix =~ s/\.(png|xpm)$//;
+ $prefix =~ s/\.(png|xpm|mng)$//;
my $appname = $prefix;
$appname =~ s/^[^-]+-// if ($appname =~ /-/) ;
$appname =~ s/^[^-]+-// if ($appname =~ /-/) ;
@@ -1153,12 +1223,12 @@
'filesys' => 'filesystems',
'mime' => 'mimetypes'
);
-
+
if (! defined $type_hash{$type} ) {
print STDERR "unknown icon type $type in $printname ($file)\n";
next;
}
-
+
my %dir_hash =
(
'los' => 'locolor/16x16',
@@ -1176,7 +1246,7 @@
'hisc' => 'hicolor/scalable'
);
- $newfile =~ s@...@;
+ $newfile =~ s@...@;
if (! defined $dir_hash{$prefix}) {
print STDERR "unknown icon prefix $prefix in $printname\n";
@@ -1337,7 +1407,6 @@
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);
@@ -1399,7 +1468,7 @@
|| $line =~ /^\s*(\@.*\@)*\s*\$\(INSTALL\S*\)/
|| $line =~ /^\s*(\@.*\@)*\s*(-?rm.*) \S*$/)
{
- $line =~ s/^(.*) ([^\s]*)\s*$/$1 \$(DESTDIR)$2/ if ($line !~ /\$\(DESTDIR\)/);
+ $line =~ s/^(.*) ([^\s]+)\s*$/$1 \$(DESTDIR)$2/ if ($line !~ /\$\(DESTDIR\)/);
}
if ($line ne $_[0]) {
@@ -1411,7 +1480,7 @@
#---------------------------------------------------------------------------
sub tag_CLOSURE () {
return if ($program !~ /_la$/);
-
+
my $lookup = quotemeta($realname{$program}) . ":.*?\n\t.*?\\((.*?)\\) .*\n";
$MakefileData =~ m/$lookup/;
return if ($1 !~ /CXXLINK/);
@@ -1425,7 +1494,7 @@
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\$\(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";
@@ -1443,14 +1512,16 @@
my %foundfiles = ();
opendir (THISDIR, ".");
foreach $entry (readdir(THISDIR)) {
- next if ($entry eq "CVS" || $entry =~ /^\./ || $entry =~ /^Makefile$$/ || $entry =~ /~$/ || $entry =~ /^\#.*\#$/);
+ next if ($entry eq "CVS" || $entry =~ /^\./ || $entry eq "Makefile" || $entry =~ /~$/ || $entry =~ /^\#.*\#$/);
next if (! -f $entry);
- next if ($entry =~ /\.moc/ || $entry =~ /\.lo$/ || $entry =~ /\.la$/ || $entry =~ /\.o/);
+ next if ($entry =~ /\.moc/ || $entry =~ /\.moc.$cppExt$/ || $entry =~ /\.lo$/ || $entry =~ /\.la$/ || $entry =~ /\.o/);
+ next if ($entry =~ /.+meta_unload.$cppExt$/ || $entry =~ /\.all_$cppExt\.$cppExt$/);
$foundfiles{$entry} = 1;
}
closedir (THISDIR);
- my @marks = ("EXTRA_DIST", "DIST_COMMON", '\S*_SOURCES', '\S*_HEADERS', 'MAINTAINERCLEANFILES', 'CLEANFILES', 'DISTCLEANFILES', '\S*_OBJECTS');
+ # 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) {
foreach $file (split('[\034\s]', $2)) {
@@ -1460,7 +1531,8 @@
}
}
my @files = ("Makefile", "config.cache", "config.log", "stamp-h",
- "stamp-h1", "stamp-h1", "config.h", "Makefile", "config.status", "config.h", "libtool");
+ "stamp-h1", "stamp-h1", "config.h", "Makefile",
+ "config.status", "config.h", "libtool", "core" );
foreach $file (@files) {
$foundfiles{$file} = 0 if (defined $foundfiles{$file});
}
@@ -1473,7 +1545,7 @@
}
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");
@@ -1486,16 +1558,6 @@
# Errors are logged in the global $errorflags
sub tag_DOCFILES ()
{
-# if ($MakefileData =~ /\nSUBDIRS\s*=/) { # subdirs
-# $MakefileData =~ /\n(.*-recursive:\s*)\n/;
-# my $orig_rules = $1;
-# my $rules = $orig_rules;
-# $rules =~ s/:\s*$//;
-# substituteLine($orig_rules, "$rules docs-recursive:");
-# appendLines("docs: docs-recursive docs-am\n");
-# } else {
-# appendLines("docs: docs-am\n");
-# }
$target_adds{"all"} .= "docs-am ";
my $lookup = 'KDE_DOCS\s*=\s*([^\n]*)';
@@ -1537,7 +1599,7 @@
goto nodocs if (!$files); # Nothing to do
if ($files =~ /(^| )index\.docbook($| )/) {
-
+
my $lines = "";
my $lookup = 'MEINPROC\s*=';
if ($MakefileData !~ /\n($lookup)/) {
@@ -1550,11 +1612,11 @@
$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 .= "\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 .= "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";
@@ -1580,7 +1642,7 @@
appendLines("docs-am: $files\n");
}
- $target_adds{"install-data-am"} .= "install-nls";
+ $target_adds{"install-data-am"} .= "install-nls ";
$target_adds{"uninstall"} .= "uninstall-nls ";
$tmp = "install-nls:\n";
@@ -1591,13 +1653,13 @@
$tmp .= "\tdone\n";
if ($appname eq 'common') {
$tmp .= "\t\@echo \"merging common and language specific dir\" ;\\\n";
- $tmp .= "\tif test ! -e \$(kde_htmldir)/en/common/kde-common.css; then echo 'no english docs found in \$(kde_htmldir)/en/common/'; exit 1; fi \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 ! -e \$\$p && echo \$(LN_S) ../../en/common/\$\$p \$(DESTDIR)\$(kde_htmldir)/$kdelang/common/\$\$p && \$(LN_S) ../../en/common/\$\$p \$\$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";
}
@@ -1633,10 +1695,11 @@
{
my @list = ();
opendir (SRCDIR, "$dir");
- @hFiles = grep { /.+\.$hExt$/o } readdir(SRCDIR);
+ @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";
@@ -1676,7 +1739,7 @@
sub pruneMocCandidates ($)
{
my %prunedMoc = ();
- local @mocList = split(' ', @_[0]);
+ local @mocList = split(' ', $_[0]);
foreach $mocname (@mocList)
{
@@ -1712,7 +1775,8 @@
return unless (keys %mocFiles);
opendir(THISDIR, ".") || return;
@cppFiles = grep { /.+\.$cppExt$/o && !/.+\.moc\.$cppExt$/o
- && !/.+\.all_$cppExt\.$cppExt$/o } readdir(THISDIR);
+ && !/.+\.all_$cppExt\.$cppExt$/o
+ && !/^\./ } readdir(THISDIR);
closedir THISDIR;
return unless (@cppFiles);
my $files = join (" ", @cppFiles);
@@ -1774,9 +1838,11 @@
$dir =~ s#^\.#\$(srcdir)#;
if (defined ($cppFile))
{
- $target_adds{"\$(srcdir)/$cppFile"} .= "$mocFile.moc ";
- appendLines ("$mocFile.moc: $dir/$hFile\n\t\$(MOC) $dir/$hFile -o $mocFile.moc\n");
- $cleanMoc .= " $mocFile.moc";
+ $cppFile =~ s,\.[^.]*$,,;
+ $target_adds{"$cppFile.o"} .= "$mocFile.moc ";
+ $target_adds{"$cppFile.lo"} .= "$mocFile.moc ";
+ appendLines ("$mocFile.moc: $dir/$hFile\n\t\$(MOC) $dir/$hFile -o $mocFile.moc\n");
+ $cleanMoc .= " $mocFile.moc";
}
else
{
@@ -1807,9 +1873,7 @@
print STDOUT "globalmocs=[".join(' ', keys(%globalmocs))."]\n" if ($verbose);
foreach my $mocFile (keys (%globalmocs))
{
- undef $cppFile;
- ($dir, $hFile, $cppFile) = split ("\035", $globalmocs{$mocFile}, 3);
- $dir =~ s#^\.#\$(srcdir)#;
+ my ($dir, $hFile, $cppFile) = split ("\035", $globalmocs{$mocFile}, 3);
if (defined ($cppFile))
{
$mocs .= " $mocFile.moc" if exists $shash{$cppFile};
@@ -1852,7 +1916,7 @@
$realObjs{$program} .= " \034" . $objfile . " ";
$sources{$program} .= " $srcfile";
$sources_changed{$program} = 1;
- $dep_files .= " \$(DEPDIR)/$sourcename.P" if($dep_files !~/$sourcename.P/);
+ $dep_files .= " \$(DEPDIR)/$sourcename.P" if($dep_files !~/$sourcename\.P/);
appendLines ($appl);
}
print STDOUT "\n" if $verbose;
@@ -1872,8 +1936,15 @@
open (FILEOUT, "> $makefile")
|| die "Could not create $makefile: $!\n";
- print FILEOUT "\# $progId - " . '$Revision$ ' . "\n";
- $MakefileData =~ s/\034/\\\n/g; # Restore continuation lines
+ $MakefileData =~ s/\034/\\\n\t/g; # Restore continuation lines
+ # Append our $progId line, _below_ the "generated by automake" line
+ # because automake-1.6 relies on the first line to be his own.
+ my $progIdLine = "\# $progId - " . '$Revision$ '."\n";
+ if ( !( $MakefileData =~ s/^(.*generated .*by automake.*\n)/$1$progIdLine/ ) ) {
+ warn "automake line not found in $makefile\n";
+ # Fallback: first line
+ print FILEOUT $progIdLine;
+ };
print FILEOUT $MakefileData;
close FILEOUT;
}
@@ -1902,7 +1973,7 @@
if ($MakefileData =~ /\n($lookup)/) {
$old = $1;
$old =~ s/\034/\\\n#>\- /g; # Fix continuation lines
- $new =~ s/\034/\\\n/g;
+ $new =~ s/\034/\\\n\t/g;
my $newCount = ($new =~ tr/\n//) + 1;
$MakefileData =~ s/\n$lookup/\n#>- $old\n#>\+ $newCount\n$new/;
} else {
@@ -1916,7 +1987,7 @@
sub appendLines ($)
{
my ($new) = @_;
- $new =~ s/\034/\\\n/g; # Fix continuation lines
+ $new =~ s/\034/\\\n\t/g; # Fix continuation lines
my $newCount = ($new =~ tr/\n//) + 1;
$MakefileData .= "\n#>\+ $newCount\n$new";
}
|