comparison kdiff3/admin/am_edit @ 66:efe33e938730

0.9.86
author joachim99
date Thu, 16 Sep 2004 02:40:08 +0000
parents 415083d043f3
children 8febbfb1148c
comparison
equal deleted inserted replaced
65:8ea11c8efeb5 66:efe33e938730
49 49
50 sub findMocCandidates (); 50 sub findMocCandidates ();
51 sub pruneMocCandidates ($); 51 sub pruneMocCandidates ($);
52 sub checkMocCandidates (); 52 sub checkMocCandidates ();
53 sub addMocRules (); 53 sub addMocRules ();
54 sub findKcfgFile($);
54 55
55 sub tag_AUTOMAKE (); 56 sub tag_AUTOMAKE ();
56 sub tag_META_INCLUDES (); 57 sub tag_META_INCLUDES ();
57 sub tag_METASOURCES (); 58 sub tag_METASOURCES ();
58 sub tag_POFILES (); 59 sub tag_POFILES ();
59 sub tag_DOCFILES (); 60 sub tag_DOCFILES ();
60 sub tag_LOCALINSTALL(); 61 sub tag_LOCALINSTALL();
61 sub tag_IDLFILES(); 62 sub tag_IDLFILES();
62 sub tag_UIFILES(); 63 sub tag_UIFILES();
64 sub tag_KCFGFILES();
63 sub tag_SUBDIRS(); 65 sub tag_SUBDIRS();
64 sub tag_ICON(); 66 sub tag_ICON();
65 sub tag_CLOSURE(); 67 sub tag_CLOSURE();
66 sub tag_NO_UNDEFINED(); 68 sub tag_NO_UNDEFINED();
67 sub tag_NMCHECK(); 69 sub tag_NMCHECK();
109 } 111 }
110 elsif (/^--verbose$|^-v$/) 112 elsif (/^--verbose$|^-v$/)
111 { 113 {
112 $verbose = 1; # Oh is there a problem...? 114 $verbose = 1; # Oh is there a problem...?
113 } 115 }
114 elsif (/^-p(.+)$|^--path=(.+)$/) 116 elsif (/^(?:-p|--path=)(.+)$/)
115 { 117 {
116 $thisProg = "$1/".basename($thisProg) if($1); 118 my $p = $1;
117 $thisProg = "$2/".basename($thisProg) if($2); 119 $thisProg = $p . "/". basename($thisProg);
118 warn ("$thisProg doesn't exist\n") if (!(-f $thisProg)); 120 warn ("$thisProg doesn't exist\n") if (!(-f $thisProg));
121 $thisProg .= " -p".$p;
119 $pathoption=1; 122 $pathoption=1;
120 } 123 }
121 elsif (/^--help$|^-h$/) 124 elsif (/^--help$|^-h$/)
122 { 125 {
123 print STDOUT "Usage $thisProg [OPTION] ... [dir/Makefile.in]...\n", 126 print STDOUT "Usage $thisProg [OPTION] ... [dir/Makefile.in]...\n",
220 local %realname = (); # the binary name of program variable 223 local %realname = (); # the binary name of program variable
221 local %idlfiles = (); # lists the idl files used for $program 224 local %idlfiles = (); # lists the idl files used for $program
222 local %globalmocs = ();# list of all mocfiles (in %mocFiles format) 225 local %globalmocs = ();# list of all mocfiles (in %mocFiles format)
223 local %important = (); # list of files to be generated asap 226 local %important = (); # list of files to be generated asap
224 local %uiFiles = (); 227 local %uiFiles = ();
228 local %kcfgFiles = ();
225 229
226 local $allidls = ""; 230 local $allidls = "";
227 local $idl_output = "";# lists all idl generated files for cleantarget 231 local $idl_output = "";# lists all idl generated files for cleantarget
228 local $ui_output = "";# lists all uic generated files for cleantarget 232 local $ui_output = "";# lists all uic generated files for cleantarget
233 local $kcfg_output = "";# lists all kcfg generated files for cleantarget
229 234
230 local %dependmocs = (); 235 local %dependmocs = ();
231 236
232 local $metasourceTags = 0; 237 local $metasourceTags = 0;
233 local $dep_files = ""; 238 local $dep_files = "";
261 $important{$program} = ""; 266 $important{$program} = "";
262 tag_IDLFILES(); # Sorts out idl rules 267 tag_IDLFILES(); # Sorts out idl rules
263 tag_NO_UNDEFINED(); 268 tag_NO_UNDEFINED();
264 tag_CLOSURE(); 269 tag_CLOSURE();
265 tag_NMCHECK(); 270 tag_NMCHECK();
266 tag_UIFILES(); # Sorts out ui rules 271 tag_UIFILES(); # Sorts out ui rules
272 tag_KCFGFILES(); # Sorts out kcfg rules
267 tag_METASOURCES (); # Sorts out the moc rules 273 tag_METASOURCES (); # Sorts out the moc rules
268 if ($sources_changed{$program}) { 274 if ($sources_changed{$program}) {
269 my $lookup = $program . '_SOURCES\s*=[ \t]*(.*)'; 275 my $lookup = $program . '_SOURCES\s*=[ \t]*(.*)';
270 276
271 if($program =~ /libkdeinit_(.*)/) { 277 if($program =~ /libkdeinit_(.*)/) {
272 my $prog = $1; 278 my $prog = $1;
273 substituteLine($prog . '_SOURCES\s*=[ \t]*.*', 279 substituteLine($prog . '_SOURCES\s*=[ \t]*(.*)',
274 "${prog}_SOURCES = ${prog}_dummy.$cxxsuffix\n" . 280 "${prog}_SOURCES = ${prog}_dummy.$cxxsuffix\n" .
275 "libkdeinit_${prog}_SOURCES = " . $sources{$program}); 281 "libkdeinit_${prog}_SOURCES = " . $sources{$program});
276 $sources{$prog} = "${prog}_dummy.$cxxsuffix"; 282 $sources{$prog} = "${prog}_dummy.$cxxsuffix";
277 } 283 }
278 else { 284 else {
316 } 322 }
317 323
318 if ($ui_output) { 324 if ($ui_output) {
319 appendLines ("$cleantarget-ui:\n\t-rm -f $ui_output\n"); 325 appendLines ("$cleantarget-ui:\n\t-rm -f $ui_output\n");
320 $target_adds{"$cleantarget-am"} .= "$cleantarget-ui "; 326 $target_adds{"$cleantarget-am"} .= "$cleantarget-ui ";
327 }
328
329 if ($kcfg_output) {
330 appendLines ("$cleantarget-kcfg:\n\t-rm -f $kcfg_output\n");
331 $target_adds{"$cleantarget-am"} .= "$cleantarget-kcfg ";
321 } 332 }
322 333
323 if ($closure_output) { 334 if ($closure_output) {
324 appendLines ("$cleantarget-closures:\n\t-rm -f $closure_output\n"); 335 appendLines ("$cleantarget-closures:\n\t-rm -f $closure_output\n");
325 $target_adds{"$cleantarget-am"} .= "$cleantarget-closures "; 336 $target_adds{"$cleantarget-am"} .= "$cleantarget-closures ";
525 print STDOUT "found Makefile.in without Makefile.am\n" if ($verbose); 536 print STDOUT "found Makefile.in without Makefile.am\n" if ($verbose);
526 return 0; 537 return 0;
527 } 538 }
528 539
529 # Checking for files to process... 540 # Checking for files to process...
530 open (FILEIN, $makefile) 541
531 || die "Could not open $makefileDir/$makefile: $!\n"; 542 open (FILEIN, $makefile) || die "Can't open $makefileDir/$makefile: $!\n";
543 # perl bug in 5.8.0: in utf8 mode it badly screws up
544 binmode(FILEIN, ":bytes") if ($] >= 5.008);
532 # Read the file 545 # Read the file
533 # stat(FILEIN)[7] might look more elegant, but is slower as it 546 # stat(FILEIN)[7] might look more elegant, but is slower as it
534 # requires stat'ing the file 547 # requires stat'ing the file
535 seek(FILEIN, 0, 2); 548 seek(FILEIN, 0, 2);
536 my $fsize = tell(FILEIN); 549 my $fsize = tell(FILEIN);
732 745
733 my @progsources = split(/[\034\s]+/, $sources{$program}); 746 my @progsources = split(/[\034\s]+/, $sources{$program});
734 my %shash = (); 747 my %shash = ();
735 @shash{@progsources} = 1; # we are only interested in the existence 748 @shash{@progsources} = 1; # we are only interested in the existence
736 my %sourcelist = (); 749 my %sourcelist = ();
750 my %extradeps = ();
737 751
738 foreach $source (@progsources) { 752 foreach $source (@progsources) {
739 my $suffix = $source; 753 my $suffix = $source;
740 $suffix =~ s/^.*\.([^\.]+)$/$1/; 754 $suffix =~ s/^.*\.([^\.]+)$/$1/;
741 755
749 } else { 763 } else {
750 $sourcelist{$cxxsuffix} .= "$mocFile.moc.$cxxsuffix "; 764 $sourcelist{$cxxsuffix} .= "$mocFile.moc.$cxxsuffix ";
751 $moc_cpp_added = 1; 765 $moc_cpp_added = 1;
752 } 766 }
753 } 767 }
768
769 # scan for extra given dependencies and add them to our target
770 while ($MakefileData =~ /\n\s*(\S+)\.(?:lo|o)\s*:([^\n]*)/g) {
771 $extradeps{$1} = $2;
772 }
773
754 foreach $suffix (keys %sourcelist) { 774 foreach $suffix (keys %sourcelist) {
755
756 # See if this file contains c++ code. (i.e., just check the file's suffix against c++ extensions) 775 # See if this file contains c++ code. (i.e., just check the file's suffix against c++ extensions)
757 my $suffix_is_cxx = 0; 776 my $suffix_is_cxx = 0;
758 if($suffix =~ /($cppExt)$/) { 777 if($suffix =~ /($cppExt)$/) {
759 $cxxsuffix = $1; 778 $cxxsuffix = $1;
760 $suffix_is_cxx = 1; 779 $suffix_is_cxx = 1;
767 if ((@sourcelist == 1 && !$mocfiles_in) || $suffix_is_cxx != 1 ) { 786 if ((@sourcelist == 1 && !$mocfiles_in) || $suffix_is_cxx != 1 ) {
768 787
769 # we support IDL on our own 788 # we support IDL on our own
770 if ($suffix eq "skel" || $suffix =~ /^stub/ 789 if ($suffix eq "skel" || $suffix =~ /^stub/
771 || $suffix =~ /^signals/ # obsolete, remove in KDE-4 790 || $suffix =~ /^signals/ # obsolete, remove in KDE-4
772 || $suffix eq "h" || $suffix eq "ui" ) { 791 || $suffix eq "h" || $suffix eq "ui"
792 || $suffix eq "kcfgc" ) {
773 next; 793 next;
774 } 794 }
775 795
776 foreach $file (@sourcelist) { 796 foreach $file (@sourcelist) {
777 $file =~ s/\Q$suffix\E$//; 797 $file =~ s/\Q$suffix\E$//;
791 if (-f $source) { 811 if (-f $source) {
792 $source_deps .= " \$(srcdir)/$source"; 812 $source_deps .= " \$(srcdir)/$source";
793 } else { 813 } else {
794 $source_deps .= " $source"; 814 $source_deps .= " $source";
795 } 815 }
816 my $plainsource = $source;
817 $plainsource =~ s/\.$cppExt$//;
818 $source_deps .= " " . $extradeps{$plainsource} if (exists($extradeps{$plainsource}));
796 } 819 }
797 820
798 $handling = "$program.all_$suffix.$suffix: \$(srcdir)/Makefile.in" . $source_deps . " " . join(' ', $mocs) . "\n"; 821 $handling = "$program.all_$suffix.$suffix: \$(srcdir)/Makefile.in" . $source_deps . " " . join(' ', $mocs) . "\n";
799 $handling .= "\t\@echo 'creating $program.all_$suffix.$suffix ...'; \\\n"; 822 $handling .= "\t\@echo 'creating $program.all_$suffix.$suffix ...'; \\\n";
800 $handling .= "\trm -f $program.all_$suffix.files $program.all_$suffix.final; \\\n"; 823 $handling .= "\trm -f $program.all_$suffix.files $program.all_$suffix.final; \\\n";
850 $lines .= "\n${kdeinit}.la.$cxxsuffix:\n"; 873 $lines .= "\n${kdeinit}.la.$cxxsuffix:\n";
851 $lines .= "\techo 'extern \"C\" int kdemain(int argc, char* argv[]);' > ${kdeinit}.la.$cxxsuffix; \\\n"; 874 $lines .= "\techo 'extern \"C\" int kdemain(int argc, char* argv[]);' > ${kdeinit}.la.$cxxsuffix; \\\n";
852 $lines .= "\techo 'int main(int argc, char* argv[]) { return kdemain(argc,argv); }' >> ${kdeinit}.la.$cxxsuffix\n"; 875 $lines .= "\techo 'int main(int argc, char* argv[]) { return kdemain(argc,argv); }' >> ${kdeinit}.la.$cxxsuffix\n";
853 876
854 $lines .= "\n${kdeinit}_dummy.$cxxsuffix:\n"; 877 $lines .= "\n${kdeinit}_dummy.$cxxsuffix:\n";
855 $lines .= "\t echo > ${kdeinit}_dummy.$cxxsuffix\n"; 878 $lines .= "\techo 'extern \"C\" int kdemain(int argc, char* argv[]);' > ${kdeinit}_dummy.$cxxsuffix; \\\n";
879 $lines .= "\techo 'extern \"C\" int kdeinitmain(int argc, char* argv[]) { return kdemain(argc,argv); }' >> ${kdeinit}_dummy.$cxxsuffix\n";
856 880
857 push(@cleanfiles, "${kdeinit}.la.$cxxsuffix"); 881 push(@cleanfiles, "${kdeinit}.la.$cxxsuffix");
858 push(@cleanfiles, "${kdeinit}_dummy.$cxxsuffix"); 882 push(@cleanfiles, "${kdeinit}_dummy.$cxxsuffix");
859 883
860 # add dependency 884 # add dependency
866 if($MakefileData =~ m/\n$lookup/) { 890 if($MakefileData =~ m/\n$lookup/) {
867 my $libadd = $1; 891 my $libadd = $1;
868 substituteLine($lookup, "${kdeinit}_la_LIBADD = libkdeinit_${kdeinit}.la"); 892 substituteLine($lookup, "${kdeinit}_la_LIBADD = libkdeinit_${kdeinit}.la");
869 appendLines("libkdeinit_${kdeinit}_la_LIBADD = $libadd\n"); 893 appendLines("libkdeinit_${kdeinit}_la_LIBADD = $libadd\n");
870 } 894 }
871 appendLines("libkdeinit_${kdeinit}_la_LDFLAGS = \$(all_libraries)\n"); 895 appendLines("libkdeinit_${kdeinit}_la_LDFLAGS = -no-undefined -avoid-version \$(all_libraries)\n");
872 896
873 # add library dependencies 897 # add library dependencies
874 $lookup = $kdeinit . '_la_DEPENDENCIES\s*=[ \t]*(.*)'; 898 $lookup = $kdeinit . '_la_DEPENDENCIES\s*=[ \t]*(.*)';
875 if($MakefileData =~ m/\n$lookup/) { 899 if($MakefileData =~ m/\n$lookup/) {
876 my $libdeps = $1; 900 my $libdeps = $1;
942 push(@programs, $kdeinit); 966 push(@programs, $kdeinit);
943 $realObjs{$kdeinit} = "${kdeinit}.la.\$(OBJEXT)"; 967 $realObjs{$kdeinit} = "${kdeinit}.la.\$(OBJEXT)";
944 $realname{$kdeinit} = $kdeinit; 968 $realname{$kdeinit} = $kdeinit;
945 $sources{$kdeinit} = "${kdeinit}.la.$cxxsuffix"; 969 $sources{$kdeinit} = "${kdeinit}.la.$cxxsuffix";
946 970
947 $lines .= "${kdeinit}_LDFLAGS = \$(all_libraries)\n"; 971 $lines .= "${kdeinit}_LDFLAGS = \$(KDE_RPATH) -no-undefined \$(all_libraries)\n";
948 $lines .= "${kdeinit}_LDADD = libkdeinit_${kdeinit}.la\n"; 972 $lines .= "${kdeinit}_LDADD = libkdeinit_${kdeinit}.la\n";
949 $lines .= "${kdeinit}_DEPENDENCIES = libkdeinit_${kdeinit}.la\n"; 973 $lines .= "${kdeinit}_DEPENDENCIES = libkdeinit_${kdeinit}.la\n";
950 974
951 $target_adds{"${kdeinit}\$(EXEEXT)"} = 975 $target_adds{"${kdeinit}\$(EXEEXT)"} =
952 "\$(${kdeinit}_OBJECTS) \$(${kdeinit}_DEPENDENCIES)\n" . 976 "\$(${kdeinit}_OBJECTS) \$(${kdeinit}_DEPENDENCIES)\n" .
970 } 994 }
971 } 995 }
972 996
973 if($#progs >= 0) { 997 if($#progs >= 0) {
974 if($MakefileData !~ m/\nbin_PROGRAMS\s*=/) { 998 if($MakefileData !~ m/\nbin_PROGRAMS\s*=/) {
975 print STDERR "Error: bin_PROGRAMS missing in $printname (required for bin_PROGRAMS).\n"; 999 print STDERR "Error: bin_PROGRAMS missing in $printname (required for kdeinit_LTLIBRARIES).\n";
976 $errorflag = 1; 1000 $errorflag = 1;
977 } 1001 }
978 else { 1002 else {
979 # add our new progs to SOURCES, DIST_SOURCES and bin_PROGRAMS 1003 # add our new progs to SOURCES, DIST_SOURCES and bin_PROGRAMS
980 my $progsources = ""; 1004 my $progsources = "";
1024 next if ($source eq $depend); 1048 next if ($source eq $depend);
1025 # avoid cyclic dependencies 1049 # avoid cyclic dependencies
1026 next if defined($donesources{$depend}); 1050 next if defined($donesources{$depend});
1027 push @deps, $depend; 1051 push @deps, $depend;
1028 } 1052 }
1029 $target_adds{$sdeps} = join(' ', @deps) if (@deps); 1053 $target_adds{$sdeps} .= join(' ', @deps) . ' ' if (@deps);
1030 $donesources{$source} = 1; 1054 $donesources{$source} = 1;
1031 } 1055 }
1032 } 1056 }
1033 } 1057 }
1034 } 1058 }
1126 substituteLine ($lookup, $newLine); 1150 substituteLine ($lookup, $newLine);
1127 $automkCall = $1; 1151 $automkCall = $1;
1128 1152
1129 $lookup = '.*cd \$\(srcdir\)\s+&&[\034\s]+\$\(AUTOCONF\)(.*)'; 1153 $lookup = '.*cd \$\(srcdir\)\s+&&[\034\s]+\$\(AUTOCONF\)(.*)';
1130 if ($MakefileData =~ /\n($lookup)\n/) { 1154 if ($MakefileData =~ /\n($lookup)\n/) {
1131 $newLine = "\tcd \$(srcdir) && rm -f configure && \$(MAKE) -f admin/Makefile.common configure"; 1155 $newLine = "\tcd \$(srcdir) && rm -f configure\n";
1156 $newLine .= "\tcd \$(top_srcdir) && \$(MAKE) -f admin/Makefile.common configure";
1132 substituteLine ($lookup, $newLine); 1157 substituteLine ($lookup, $newLine);
1133 } 1158 }
1134 1159
1135 return 0; 1160 return 0;
1136 } 1161 }
1234 } 1259 }
1235 } 1260 }
1236 1261
1237 if ($allidls !~ /$source\_kidl/) { 1262 if ($allidls !~ /$source\_kidl/) {
1238 1263
1264 $use_ng = ($MakefileData =~ /\n$source\_DCOPIDLNG\s*=\s*(\S+)\n/);
1265 $dcopidl = $use_ng ? "\$(DCOPIDLNG)" : "\$(DCOPIDL)";
1266
1239 $dep_lines .= "$source.kidl: $sourcedir$source.h \$(DCOP_DEPENDENCIES)\n"; 1267 $dep_lines .= "$source.kidl: $sourcedir$source.h \$(DCOP_DEPENDENCIES)\n";
1240 $dep_lines .= "\t\$(DCOPIDL) $sourcedir$source.h > $source.kidl || ( rm -f $source.kidl ; false )\n"; 1268 $dep_lines .= "\t$dcopidl $sourcedir$source.h > $source.kidl || ( rm -f $source.kidl ; false )\n";
1241 1269
1242 $allidls .= $source . "_kidl "; 1270 $allidls .= $source . "_kidl ";
1243 } 1271 }
1244 1272
1245 if ($allidls !~ /$sourcename/) { 1273 if ($allidls !~ /$sourcename/) {
1330 if (!$uiFiles{$source}) { 1358 if (!$uiFiles{$source}) {
1331 1359
1332 my $dep_lines = "$source.$cxxsuffix: $sourcedir$source.ui $source.h $source.moc\n"; 1360 my $dep_lines = "$source.$cxxsuffix: $sourcedir$source.ui $source.h $source.moc\n";
1333 $dep_lines .= "\trm -f $source.$cxxsuffix\n"; 1361 $dep_lines .= "\trm -f $source.$cxxsuffix\n";
1334 if (!$kdeopts{"qtonly"}) { 1362 if (!$kdeopts{"qtonly"}) {
1335 $dep_lines .= "\techo '#include <klocale.h>' > $source.$cxxsuffix\n"; 1363 $dep_lines .= "\techo '#include <kdialog.h>' > $source.$cxxsuffix\n";
1364 $dep_lines .= "\techo '#include <klocale.h>' >> $source.$cxxsuffix\n";
1336 my ($mangled_source) = $source; 1365 my ($mangled_source) = $source;
1337 $mangled_source =~ s/[^A-Za-z0-9]/_/g; # get rid of garbage 1366 $mangled_source =~ s/[^A-Za-z0-9]/_/g; # get rid of garbage
1338 $dep_lines .= "\t\$(UIC) -tr \${UIC_TR} -i $source.h $sourcedir$source.ui > $source.$cxxsuffix.temp ; ret=\$\$?; \\\n"; 1367 $dep_lines .= "\t\$(UIC) -tr \${UIC_TR} -i $source.h $sourcedir$source.ui > $source.$cxxsuffix.temp ; ret=\$\$?; \\\n";
1339 $dep_lines .= "\tsed -e \"s,\${UIC_TR}( \\\"\\\" ),QString::null,g\" $source.$cxxsuffix.temp | sed -e \"s,\${UIC_TR}( \\\"\\\"\\, \\\"\\\" ),QString::null,g\" | sed -e \"s,image\\([0-9][0-9]*\\)_data,img\\1_" . $mangled_source . ",g\" >> $source.$cxxsuffix ;\\\n"; 1368 $dep_lines .= "\t\$(PERL) -pe \"s,\${UIC_TR}( \\\"\\\" ),QString::null,g\" $source.$cxxsuffix.temp | \$(PERL) -pe \"s,\${UIC_TR}( \\\"\\\"\\, \\\"\\\" ),QString::null,g\" | \$(PERL) -pe \"s,image([0-9][0-9]*)_data,img\\\$\$1_" . $mangled_source . ",g\" >> $source.$cxxsuffix ;\\\n";
1340 $dep_lines .= "\trm -f $source.$cxxsuffix.temp ;\\\n"; 1369 $dep_lines .= "\trm -f $source.$cxxsuffix.temp ;\\\n";
1341 } else { 1370 } else {
1342 $dep_lines .= "\t\$(UIC) -i $source.h $sourcedir$source.ui > $source.$cxxsuffix; ret=\$\$?; \\\n"; 1371 $dep_lines .= "\t\$(UIC) -i $source.h $sourcedir$source.ui > $source.$cxxsuffix; ret=\$\$?; \\\n";
1343 } 1372 }
1344 $dep_lines .= "\tif test \"\$\$ret\" = 0; then echo '#include \"$source.moc\"' >> $source.$cxxsuffix; else rm -f $source.$cxxsuffix ; exit \$\$ret ; fi\n\n"; 1373 $dep_lines .= "\tif test \"\$\$ret\" = 0; then echo '#include \"$source.moc\"' >> $source.$cxxsuffix; else rm -f $source.$cxxsuffix ; exit \$\$ret ; fi\n\n";
1362 $sources{$program} .= " $source.$cxxsuffix"; 1391 $sources{$program} .= " $source.$cxxsuffix";
1363 $sources_changed{$program} = 1; 1392 $sources_changed{$program} = 1;
1364 $important{$program} .= "$source.h "; 1393 $important{$program} .= "$source.h ";
1365 $ui_output .= "\\\n\t$source.$cxxsuffix $source.h $source.moc "; 1394 $ui_output .= "\\\n\t$source.$cxxsuffix $source.h $source.moc ";
1366 push(@cleanfiles, "$source.$cxxsuffix"); 1395 push(@cleanfiles, "$source.$cxxsuffix");
1367 push(@cleanfiles, "source.h"); 1396 push(@cleanfiles, "$source.h");
1368 push(@cleanfiles, "$source.moc"); 1397 push(@cleanfiles, "$source.moc");
1398 $dep_files .= " \$(DEPDIR)/$source.P" if($dep_files !~/$source.P/ );
1399 }
1400 }
1401 }
1402
1403 sub tag_KCFGFILES ()
1404 {
1405 my @psources = split(/[\034\s]+/, $sources{$program});
1406 my @depFiles = ();
1407
1408 foreach $source (@psources) {
1409
1410 if ($source =~ m/\.kcfgc$/) {
1411
1412 print STDERR "adding KCFG file $source\n" if ($verbose);
1413
1414 my $qs = quotemeta($source);
1415 $sources{$program} =~ s/$qs//;
1416 $sources_changed{$program} = 1;
1417
1418 $source =~ s/\.kcfgc$//;
1419
1420 my $sourcedir = '';
1421 if (-f "$makefileDir/$source.kcfgc") {
1422 $sourcedir = '$(srcdir)/';
1423 }
1424
1425 if (!$kcfgFiles{$source}) {
1426 $kcfg = "$program.kcfg";
1427 findKcfgFile("$source.kcfgc");
1428
1429 my $fixsuffix = "";
1430 $fixsuffix = "else mv $source.cpp $source.$cxxsuffix ; "
1431 unless "cpp" eq $cxxsuffix;
1432
1433 my $dep_lines = "$source.$cxxsuffix: $source.h\n";
1434 $dep_lines .= "$source.h: $sourcedir$kcfg $sourcedir$source.kcfgc \$(KCFG_DEPENDENCIES)\n";
1435 $dep_lines .= "\t\$(KCONFIG_COMPILER) $sourcedir$kcfg $sourcedir$source.kcfgc; ret=\$\$?; \\\n";
1436 $dep_lines .= "\tif test \"\$\$ret\" != 0; then rm -f $source.h ; exit \$\$ret ; $fixsuffix fi\n\n";
1437
1438 $rule_adds{"$source.$cxxsuffix"} = $dep_lines;
1439
1440 $kcfgFiles{$source} = 1;
1441 }
1442
1443 if ($program =~ /_la$/) {
1444 $realObjs{$program} .= " $source.lo";
1445 } else {
1446 $realObjs{$program} .= " $source.\$(OBJEXT)";
1447 }
1448 $sources{$program} .= " $source.$cxxsuffix";
1449 $sources_changed{$program} = 1;
1450 $important{$program} .= "$source.h ";
1451 $kcfg_output .= "\\\n\t$source.$cxxsuffix $source.h ";
1452 push(@cleanfiles, "$source.$cxxsuffix");
1453 push(@cleanfiles, "$source.h");
1369 $dep_files .= " \$(DEPDIR)/$source.P" if($dep_files !~/$source.P/ ); 1454 $dep_files .= " \$(DEPDIR)/$source.P" if($dep_files !~/$source.P/ );
1370 } 1455 }
1371 } 1456 }
1372 } 1457 }
1373 1458
1642 { 1727 {
1643 opendir (THISDIR, "."); 1728 opendir (THISDIR, ".");
1644 $pofiles = join(" ", grep(/\.po$/, readdir(THISDIR))); 1729 $pofiles = join(" ", grep(/\.po$/, readdir(THISDIR)));
1645 closedir (THISDIR); 1730 closedir (THISDIR);
1646 print STDOUT "pofiles found = $pofiles\n" if ($verbose); 1731 print STDOUT "pofiles found = $pofiles\n" if ($verbose);
1647 if (-f "charset" && -f "kdelibs.po") { 1732 if (-f "charset" && -f "kdelibs/kdelibs.po") {
1648 handle_TOPLEVEL(); 1733 handle_TOPLEVEL();
1649 } 1734 }
1650 } 1735 }
1651 else 1736 else
1652 { 1737 {
2186 "\t echo \"\$\$i\"; \\\n" . 2271 "\t echo \"\$\$i\"; \\\n" .
2187 "\t if ! "; 2272 "\t if ! ";
2188 $t .= $cxxsuffix eq "KKK" ? 2273 $t .= $cxxsuffix eq "KKK" ?
2189 "\$(CXX) \$(DEFS) -I. -I\$(srcdir) -I\$(top_builddir) \$(INCLUDES) \$(AM_CPPFLAGS) \$(CPPFLAGS) \$(KDE_CXXFLAGS) " : 2274 "\$(CXX) \$(DEFS) -I. -I\$(srcdir) -I\$(top_builddir) \$(INCLUDES) \$(AM_CPPFLAGS) \$(CPPFLAGS) \$(KDE_CXXFLAGS) " :
2190 "\$(CXXCOMPILE) "; 2275 "\$(CXXCOMPILE) ";
2191 $t .= " --dump-class-hierarchy \$\$i.bchecktest.cc; then \\\n" . 2276 $t .= " --dump-class-hierarchy -c \$\$i.bchecktest.cc; then \\\n" .
2192 "\t rm -f \$\$i.bchecktest.cc; exit 1; \\\n" . 2277 "\t rm -f \$\$i.bchecktest.cc; exit 1; \\\n" .
2193 "\t fi ; \\\n" . 2278 "\t fi ; \\\n" .
2194 "\t echo \"\" >> \$\$i.bchecktest.cc.class; \\\n" . 2279 "\t echo \"\" >> \$\$i.bchecktest.cc.class; \\\n" .
2195 "\t perl \$(top_srcdir)/admin/bcheck.pl \$\$i.bchecktest.cc.class || { rm -f \$\$i.bchecktest.cc; exit 1; }; \\\n" . 2280 "\t perl \$(top_srcdir)/admin/bcheck.pl \$\$i.bchecktest.cc.class || { rm -f \$\$i.bchecktest.cc; exit 1; }; \\\n" .
2196 "\t rm -f a.out; \\\n" . 2281 "\t rm -f a.out; \\\n" .
2335 $MakefileData =~ s/[\n\034]#>\+.*[\n\034]$removeLines/\n/; 2420 $MakefileData =~ s/[\n\034]#>\+.*[\n\034]$removeLines/\n/;
2336 } 2421 }
2337 } 2422 }
2338 2423
2339 #----------------------------------------------------------------------------- 2424 #-----------------------------------------------------------------------------
2425
2426 # find the .kcfg file listed in the .kcfgc file
2427 sub findKcfgFile($)
2428 {
2429 my ($kcfgf) = @_;
2430 open (KCFGFIN, $kcfgf) || die "Could not open $kcfgf: $!\n";
2431 seek(KCFGFIN, 0, 2);
2432 my $kcfgfsize = tell(KCFGFIN);
2433 seek(KCFGFIN, 0, 0);
2434 read KCFGFIN, $kcfgfData, $kcfgfsize;
2435 close KCFGFIN;
2436 if(($kcfgfData =~ m/^File=(.*\.kcfg)/gm)) {
2437 $kcfg = $1;
2438 }
2439 }