Mercurial > hg > easyhg-kdiff3
comparison kdiff3/admin/am_edit @ 14:415083d043f3
KDiff3 version 0.9.70
author | joachim99 |
---|---|
date | Mon, 06 Oct 2003 19:19:11 +0000 |
parents | 53b8ecbce0cb |
children | efe33e938730 |
comparison
equal
deleted
inserted
replaced
13:266aeefa1b11 | 14:415083d043f3 |
---|---|
16 # To install icons : | 16 # To install icons : |
17 # KDE_ICON = iconname iconname2 ... | 17 # KDE_ICON = iconname iconname2 ... |
18 # KDE_ICON = AUTO | 18 # KDE_ICON = AUTO |
19 # | 19 # |
20 # For documentation : | 20 # For documentation : |
21 # ... | 21 # http://developer.kde.org/documentation/other/developer-faq.html |
22 # | 22 # |
23 # and more new tags TBD! | 23 # and more new tags TBD! |
24 # | 24 # |
25 # The concept (and base code) for this program came from automoc, | 25 # The concept (and base code) for this program came from automoc, |
26 # supplied by the following | 26 # supplied by the following |
29 # Kalle Dalheimer <kalle@kde.org> (The original implementator) | 29 # Kalle Dalheimer <kalle@kde.org> (The original implementator) |
30 # Harri Porten <porten@tu-harburg.de> | 30 # Harri Porten <porten@tu-harburg.de> |
31 # Alex Zepeda <jazepeda@pacbell.net> | 31 # Alex Zepeda <jazepeda@pacbell.net> |
32 # David Faure <faure@kde.org> | 32 # David Faure <faure@kde.org> |
33 # Stephan Kulow <coolo@kde.org> | 33 # Stephan Kulow <coolo@kde.org> |
34 # Dirk Mueller <mueller@kde.org> | |
34 | 35 |
35 use Cwd; | 36 use Cwd; |
36 use File::Find; | 37 use File::Find; |
37 use File::Basename; | 38 use File::Basename; |
38 | 39 |
60 sub tag_IDLFILES(); | 61 sub tag_IDLFILES(); |
61 sub tag_UIFILES(); | 62 sub tag_UIFILES(); |
62 sub tag_SUBDIRS(); | 63 sub tag_SUBDIRS(); |
63 sub tag_ICON(); | 64 sub tag_ICON(); |
64 sub tag_CLOSURE(); | 65 sub tag_CLOSURE(); |
66 sub tag_NO_UNDEFINED(); | |
67 sub tag_NMCHECK(); | |
65 sub tag_DIST(); | 68 sub tag_DIST(); |
69 sub tag_KDEINIT(); | |
66 | 70 |
67 # Some global globals... | 71 # Some global globals... |
68 $verbose = 0; # a debug flag | 72 $verbose = 0; # a debug flag |
69 $thisProg = "$0"; # This programs name | 73 $thisProg = "$0"; # This programs name |
70 $topdir = cwd(); # The current directory | 74 $topdir = cwd(); # The current directory |
97 "Concept, design and unnecessary questions about perl\n", | 101 "Concept, design and unnecessary questions about perl\n", |
98 " by Matthias Ettrich <ettrich\@kde.org>\n\n", | 102 " by Matthias Ettrich <ettrich\@kde.org>\n\n", |
99 "Making it useful by Stephan Kulow <coolo\@kde.org> and\n", | 103 "Making it useful by Stephan Kulow <coolo\@kde.org> and\n", |
100 "Harri Porten <porten\@kde.org>\n", | 104 "Harri Porten <porten\@kde.org>\n", |
101 "Updated (Feb-1999), John Birch <jb.nz\@writeme.com>\n", | 105 "Updated (Feb-1999), John Birch <jb.nz\@writeme.com>\n", |
106 "Fixes and Improvements by Dirk Mueller <mueller\@kde.org>\n", | |
102 "Current Maintainer Stephan Kulow\n\n"; | 107 "Current Maintainer Stephan Kulow\n\n"; |
103 exit 0; | 108 exit 0; |
104 } | 109 } |
105 elsif (/^--verbose$|^-v$/) | 110 elsif (/^--verbose$|^-v$/) |
106 { | 111 { |
115 } | 120 } |
116 elsif (/^--help$|^-h$/) | 121 elsif (/^--help$|^-h$/) |
117 { | 122 { |
118 print STDOUT "Usage $thisProg [OPTION] ... [dir/Makefile.in]...\n", | 123 print STDOUT "Usage $thisProg [OPTION] ... [dir/Makefile.in]...\n", |
119 "\n", | 124 "\n", |
120 "Patches dir/Makefile.in generated from automake\n", | 125 "Patches dir/Makefile.in generated by automake\n", |
121 "(where dir can be a full or relative directory name)", | 126 "(where dir can be an absolute or relative directory name)\n", |
122 "\n", | 127 "\n", |
123 " -v, --verbose verbosely list files processed\n", | 128 " -v, --verbose verbosely list files processed\n", |
124 " -h, --help print this help, then exit\n", | 129 " -h, --help print this help, then exit\n", |
125 " --version print version number, then exit\n", | 130 " --version print version number, then exit\n", |
126 " -p, --path= use the path to am_edit if the path\n", | 131 " -p, --path= use the path to am_edit if the path\n", |
127 " --no-final don't patch for --enable-final\n", | 132 " called from is not the one to be used\n", |
128 " called from is not the one to be used\n"; | 133 " --no-final don't patch for --enable-final\n"; |
129 | 134 |
130 exit 0; | 135 exit 0; |
131 } | 136 } |
132 elsif (/^--no-final$/) | 137 elsif (/^--no-final$/) |
133 { | 138 { |
166 { | 171 { |
167 print STDOUT "Scanning for Makefile.in\n" if ($verbose); | 172 print STDOUT "Scanning for Makefile.in\n" if ($verbose); |
168 find (\&add_makefile, cwd()); | 173 find (\&add_makefile, cwd()); |
169 #chdir('$topdir'); | 174 #chdir('$topdir'); |
170 } else { | 175 } else { |
171 print STDOUT "Using user enter input files\n" if ($verbose); | 176 print STDOUT "Using input files specified by user\n" if ($verbose); |
172 } | 177 } |
173 | 178 |
174 foreach $makefile (sort(@makefiles)) | 179 foreach $makefile (sort(@makefiles)) |
175 { | 180 { |
176 processMakefile ($makefile); | 181 processMakefile ($makefile); |
204 | 209 |
205 local $cxxsuffix = "KKK"; | 210 local $cxxsuffix = "KKK"; |
206 | 211 |
207 local @programs = (); # lists the names of programs and libraries | 212 local @programs = (); # lists the names of programs and libraries |
208 local $program = ""; | 213 local $program = ""; |
214 | |
215 local @kdeinits = (); # lists the kdeinit targets | |
209 | 216 |
210 local %realObjs = (); # lists the objects compiled into $program | 217 local %realObjs = (); # lists the objects compiled into $program |
211 local %sources = (); # lists the sources used for $program | 218 local %sources = (); # lists the sources used for $program |
212 local %finalObjs = (); # lists the objects compiled when final | 219 local %finalObjs = (); # lists the objects compiled when final |
213 local %realname = (); # the binary name of program variable | 220 local %realname = (); # the binary name of program variable |
218 | 225 |
219 local $allidls = ""; | 226 local $allidls = ""; |
220 local $idl_output = "";# lists all idl generated files for cleantarget | 227 local $idl_output = "";# lists all idl generated files for cleantarget |
221 local $ui_output = "";# lists all uic generated files for cleantarget | 228 local $ui_output = "";# lists all uic generated files for cleantarget |
222 | 229 |
223 local %depedmocs = (); | 230 local %dependmocs = (); |
224 | 231 |
225 local $metasourceTags = 0; | 232 local $metasourceTags = 0; |
226 local $dep_files = ""; | 233 local $dep_files = ""; |
227 local $dep_finals = ""; | 234 local $dep_finals = ""; |
228 local %target_adds = (); # the targets to add | 235 local %target_adds = (); # the targets to add |
236 local %rule_adds = (); | |
229 local $kdelang = ""; | 237 local $kdelang = ""; |
230 local @cleanfiles = (); | 238 local @cleanfiles = (); |
231 local $cleanMoc = ""; | 239 local $cleanMoc = ""; |
232 local $closure_output = ""; | 240 local $closure_output = ""; |
241 | |
242 local %varcontent = (); | |
233 | 243 |
234 $makefileDir = dirname($makefile); | 244 $makefileDir = dirname($makefile); |
235 chdir ($makefileDir); | 245 chdir ($makefileDir); |
236 $printname = $makefile; | 246 $printname = $makefile; |
237 $printname =~ s/^\Q$topdir\E\///; | 247 $printname =~ s/^\Q$topdir\E\///; |
238 $makefile = basename($makefile); | 248 $makefile = basename($makefile); |
239 | 249 |
240 print STDOUT "Processing makefile $printname\n" if ($verbose); | 250 print STDOUT "Processing makefile $printname\n" if ($verbose); |
241 | 251 |
242 # Setup and see if we need to do this. | 252 # Setup and see if we need to do this. |
243 return if (!initialise()); | 253 return if (!initialise()); |
244 | 254 |
245 tag_AUTOMAKE (); # Allows a "make" to redo the Makefile.in | 255 tag_AUTOMAKE (); # Allows a "make" to redo the Makefile.in |
246 tag_META_INCLUDES (); # Supplies directories for src locations | 256 tag_META_INCLUDES (); # Supplies directories for src locations |
247 | 257 |
248 foreach $program (@programs) { | 258 foreach $program (@programs) { |
249 $sources_changed{$program} = 0; | 259 $sources_changed{$program} = 0; |
250 $depedmocs{$program} = ""; | 260 $dependmocs{$program} = ""; |
251 $important{$program} = ""; | 261 $important{$program} = ""; |
252 tag_IDLFILES(); # Sorts out idl rules | 262 tag_IDLFILES(); # Sorts out idl rules |
263 tag_NO_UNDEFINED(); | |
253 tag_CLOSURE(); | 264 tag_CLOSURE(); |
265 tag_NMCHECK(); | |
254 tag_UIFILES(); # Sorts out ui rules | 266 tag_UIFILES(); # Sorts out ui rules |
255 tag_METASOURCES (); # Sorts out the moc rules | 267 tag_METASOURCES (); # Sorts out the moc rules |
256 if ($sources_changed{$program}) { | 268 if ($sources_changed{$program}) { |
257 my $lookup = "$program" . '_SOURCES\s*=\s*(.*)'; | 269 my $lookup = $program . '_SOURCES\s*=[ \t]*(.*)'; |
258 substituteLine($lookup, "$program\_SOURCES=" . $sources{$program}); | 270 |
271 if($program =~ /libkdeinit_(.*)/) { | |
272 my $prog = $1; | |
273 substituteLine($prog . '_SOURCES\s*=[ \t]*.*', | |
274 "${prog}_SOURCES = ${prog}_dummy.$cxxsuffix\n" . | |
275 "libkdeinit_${prog}_SOURCES = " . $sources{$program}); | |
276 $sources{$prog} = "${prog}_dummy.$cxxsuffix"; | |
277 } | |
278 else { | |
279 substituteLine($lookup, "$program\_SOURCES=" . $sources{$program}); | |
280 } | |
259 } | 281 } |
260 if ($important{$program}) { | 282 if ($important{$program}) { |
261 local %source_dict = (); | 283 local %source_dict = (); |
262 for $source (split(/[\034\s]+/, $sources{$program})) { | 284 for $source (split(/[\034\s]+/, $sources{$program})) { |
263 $source_dict{$source} = 1; | 285 $source_dict{$source} = 1; |
283 # Add extra *.moc.cpp files created for USE_AUTOMOC because they | 305 # Add extra *.moc.cpp files created for USE_AUTOMOC because they |
284 # aren't included in the normal *.moc clean rules. | 306 # aren't included in the normal *.moc clean rules. |
285 appendLines ("$cleantarget-metasources:\n\t-rm -f $cleanMoc\n"); | 307 appendLines ("$cleantarget-metasources:\n\t-rm -f $cleanMoc\n"); |
286 $target_adds{"$cleantarget-am"} .= "$cleantarget-metasources "; | 308 $target_adds{"$cleantarget-am"} .= "$cleantarget-metasources "; |
287 } | 309 } |
288 tag_DIST(); | 310 |
311 tag_DIST() unless ($kdeopts{"noautodist"}); | |
289 | 312 |
290 if ($idl_output) { | 313 if ($idl_output) { |
291 appendLines ("$cleantarget-idl:\n\t-rm -f $idl_output\n"); | 314 appendLines ("$cleantarget-idl:\n\t-rm -f $idl_output\n"); |
292 $target_adds{"$cleantarget-am"} .= "$cleantarget-idl "; | 315 $target_adds{"$cleantarget-am"} .= "$cleantarget-idl "; |
293 } | 316 } |
316 | 339 |
317 my $tmp = "force-reedit:\n"; | 340 my $tmp = "force-reedit:\n"; |
318 $tmp .= "\t$automkCall\n\tcd \$(top_srcdir) && perl $thisProg $printname\n\n"; | 341 $tmp .= "\t$automkCall\n\tcd \$(top_srcdir) && perl $thisProg $printname\n\n"; |
319 appendLines($tmp); | 342 appendLines($tmp); |
320 | 343 |
344 make_bcheck_target(); | |
321 make_meta_classes(); | 345 make_meta_classes(); |
322 tag_COMPILE_FIRST(); | 346 tag_COMPILE_FIRST(); |
323 tag_FINAL() if (!$kdeopts{"nofinal"}); | 347 tag_FINAL() if (!$kdeopts{"nofinal"}); |
324 | 348 |
325 my $final_lines = "final:\n\t\$(MAKE) "; | 349 my $final_lines = "final:\n\t\$(MAKE) "; |
326 my $final_install_lines = "final-install:\n\t\$(MAKE) "; | 350 my $final_install_lines = "final-install:\n\t\$(MAKE) "; |
327 my $nofinal_lines = "no-final:\n\t\$(MAKE) "; | 351 my $nofinal_lines = "no-final:\n\t\$(MAKE) "; |
328 my $nofinal_install_lines = "no-final-install:\n\t\$(MAKE) "; | 352 my $nofinal_install_lines = "no-final-install:\n\t\$(MAKE) "; |
329 | 353 |
330 foreach $program (@programs) { | 354 foreach $program (@programs) { |
331 | 355 my $lookup = $program . '_OBJECTS\s*=[ \t]*.*'; |
332 my $lookup = "$program\_OBJECTS.*=[^\n]*"; | |
333 | |
334 my $new = ""; | 356 my $new = ""; |
335 | |
336 my @list = split(/[\034\s]+/, $realObjs{$program}); | 357 my @list = split(/[\034\s]+/, $realObjs{$program}); |
337 | |
338 if (!$kdeopts{"nofinal"} && @list > 1 && $finalObjs{$program}) { | 358 if (!$kdeopts{"nofinal"} && @list > 1 && $finalObjs{$program}) { |
339 | |
340 $new .= "$program\_final\_OBJECTS = " . $finalObjs{$program}; | 359 $new .= "$program\_final\_OBJECTS = " . $finalObjs{$program}; |
341 $new .= "\n$program\_nofinal\_OBJECTS = " . $realObjs{$program}; | 360 $new .= "\n$program\_nofinal\_OBJECTS = " . $realObjs{$program}; |
342 $new .= "\n\@KDE_USE_FINAL_FALSE\@$program\_OBJECTS = \$($program\_nofinal\_OBJECTS)"; | 361 $new .= "\n\@KDE_USE_FINAL_FALSE\@$program\_OBJECTS = \$($program\_nofinal\_OBJECTS)"; |
343 $new .= "\n\@KDE_USE_FINAL_TRUE\@$program\_OBJECTS = \$($program\_final\_OBJECTS)"; | 362 $new .= "\n\@KDE_USE_FINAL_TRUE\@$program\_OBJECTS = \$($program\_final\_OBJECTS)"; |
344 | 363 |
345 $final_lines .= "$program\_OBJECTS=\"\$($program\_final_OBJECTS)\" "; | 364 $final_lines .= "$program\_OBJECTS=\"\$($program\_final_OBJECTS)\" "; |
346 $final_install_lines .= "$program\_OBJECTS=\"\$($program\_final_OBJECTS)\" "; | 365 $final_install_lines .= "$program\_OBJECTS=\"\$($program\_final_OBJECTS)\" "; |
347 $nofinal_lines .= "$program\_OBJECTS=\"\$($program\_nofinal\_OBJECTS)\" "; | 366 $nofinal_lines .= "$program\_OBJECTS=\"\$($program\_nofinal\_OBJECTS)\" "; |
348 $nofinal_install_lines .= "$program\_OBJECTS=\"\$($program\_nofinal_OBJECTS)\" "; | 367 $nofinal_install_lines .= "$program\_OBJECTS=\"\$($program\_nofinal_OBJECTS)\" "; |
349 } else { | 368 } else { |
350 $new = "$program\_OBJECTS = " . $realObjs{$program}; | 369 $new = "$program\_OBJECTS = " . $realObjs{$program}; |
351 } | 370 } |
352 substituteLine ($lookup, $new); | 371 if($MakefileData =~ m/\n$lookup/) { |
353 } | 372 substituteLine ($lookup, $new); |
354 appendLines($final_lines . "all-am"); | 373 } |
355 appendLines($final_install_lines . "install-am"); | 374 else { |
356 appendLines($nofinal_lines . "all-am"); | 375 appendLines("$new\n"); |
357 appendLines($nofinal_install_lines . "install-am"); | 376 } |
358 | 377 } |
359 my $lookup = 'DEP_FILES\s*=([^\n]*)'; | 378 appendLines($final_lines . "all-am\n"); |
360 if ($MakefileData =~ /\n$lookup\n/o) { | 379 appendLines($final_install_lines . "install-am\n"); |
361 $depfiles = $1; | 380 appendLines($nofinal_lines . "all-am\n"); |
362 | 381 appendLines($nofinal_install_lines . "install-am\n"); |
382 | |
383 my $lookup = '(\@\S+\@)?DEP_FILES\s*=[ \t]*(.*)'; | |
384 if ($MakefileData =~ /\n$lookup/) { | |
385 my $condition = $1; | |
386 my $depfiles = $2; | |
387 my $workfiles; | |
388 | |
363 if ($dep_finals) { | 389 if ($dep_finals) { |
364 $lines = "\@KDE_USE_FINAL_TRUE\@DEP_FILES = $dep_files $dep_finals \034\t$depfiles\n"; | 390 # Add the conditions on every line, since |
365 $lines .= "\@KDE_USE_FINAL_FALSE\@DEP_FILES = $dep_files $depfiles\n"; | 391 # there may be line continuations in the list. |
392 $workfiles = "$dep_files $dep_finals $depfiles"; | |
393 $workfiles =~ s/\034/\034$condition\@KDE_USE_FINAL_TRUE\@\t/g; | |
394 $lines = "$condition\@KDE_USE_FINAL_TRUE\@DEP_FILES = $workfiles\n"; | |
395 $workfiles = "$dep_files $depfiles"; | |
396 $workfiles =~ s/\034/\034$condition\@KDE_USE_FINAL_FALSE\@\t/g; | |
397 $lines .= "$condition\@KDE_USE_FINAL_FALSE\@DEP_FILES = $workfiles"; | |
366 } else { | 398 } else { |
367 $lines = "DEP_FILES = $dep_files $depfiles\n"; | 399 $workfiles = "$dep_files $depfiles"; |
368 } | 400 $workfiles =~ s/\034/\034$condition\t/g; |
369 | 401 $lines = $condition . "DEP_FILES = $workfiles"; |
402 } | |
370 substituteLine($lookup, $lines); | 403 substituteLine($lookup, $lines); |
371 } | 404 } |
372 | 405 |
406 # new recursive targets | |
407 $target_adds{ "nmcheck" } .= ""; # always create nmcheck target | |
408 $target_adds{ "nmcheck-am" } .= "nmcheck"; | |
409 $lookup = 'RECURSIVE_TARGETS\s*=[ \t]*(.*)'; | |
410 if ($MakefileData =~ /\n$lookup/) { | |
411 substituteLine($lookup, "RECURSIVE_TARGETS = $1 nmcheck-recursive bcheck-recursive"); | |
412 } | |
413 | |
373 my $cvs_lines = "cvs-clean:\n"; | 414 my $cvs_lines = "cvs-clean:\n"; |
374 $cvs_lines .= "\t\$(MAKE) -f \$(top_srcdir)/admin/Makefile.common cvs-clean\n"; | 415 $cvs_lines .= "\t\$(MAKE) admindir=\$(top_srcdir)/admin -f \$(top_srcdir)/admin/Makefile.common cvs-clean\n"; |
375 appendLines($cvs_lines); | 416 appendLines($cvs_lines); |
376 | 417 |
377 $cvs_lines = "kde-rpo-clean:\n"; | 418 $cvs_lines = "kde-rpo-clean:\n"; |
378 $cvs_lines .= "\t-rm -f *.rpo\n"; | 419 $cvs_lines .= "\t-rm -f *.rpo\n"; |
379 appendLines($cvs_lines); | 420 appendLines($cvs_lines); |
380 $target_adds{"clean"} .= "kde-rpo-clean "; | 421 $target_adds{"clean"} .= "kde-rpo-clean "; |
381 | 422 |
423 my %target_dels = ("install-data-am" => ""); | |
424 | |
382 # some strange people like to do a install-exec, and expect that also | 425 # some strange people like to do a install-exec, and expect that also |
383 # all modules are installed. automake doesn't know this, so we need to move | 426 # all modules are installed. automake doesn't know this, so we need to move |
384 # this here from install-data to install-exec. | 427 # this here from install-data to install-exec. |
385 if ($MakefileData =~ m/\nkde_module_LTLIBRARIES\s*=/) { | 428 if ($MakefileData =~ m/\nkde_module_LTLIBRARIES\s*=/) { |
386 $target_adds{"install-exec-am"} .= "install-kde_moduleLTLIBRARIES"; | 429 # $target_adds{"install-exec-am"} .= "install-kde_moduleLTLIBRARIES "; |
387 my $lookup = 'install-data-am:\s*(.*)'; | 430 # don't use $target_adds here because we need to append the dependency, not |
388 if ($MakefileData =~ /\n$lookup\n/) { | 431 # prepend it. Fixes #44342 , when a module depends on a lib in the same dir |
389 my $newdeps = $1; | 432 # and libtool needs it during relinking upon install (Simon) |
390 $newdeps =~ s/\s*install-kde_moduleLTLIBRARIES\s*/ /g; | 433 my $lookup = "install-exec-am:([^\n]*)"; |
391 substituteLine($lookup, "install-data-am: " . $newdeps); | 434 if($MakefileData =~ /\n$lookup\n/) { |
435 substituteLine("$lookup", "install-exec-am: $1 install-kde_moduleLTLIBRARIES"); | |
392 } | 436 } |
393 } | 437 $target_dels{"install-data-am"} .= "install-kde_moduleLTLIBRARIES "; |
394 | 438 $target_adds{"install-data-am"} .= " "; |
439 } | |
440 | |
395 my $lines = ""; | 441 my $lines = ""; |
396 | 442 |
397 foreach $add (keys %target_adds) { | 443 foreach $add (keys %target_adds) { |
398 my $lookup = quotemeta($add) . ':([^\n]*)'; | 444 my $lookup = quotemeta($add) . ':([^\n]*)'; |
399 if ($MakefileData =~ /\n$lookup\n/) { | 445 if ($MakefileData =~ /\n$lookup\n/) { |
400 substituteLine($lookup, "$add: " . $target_adds{$add} . $1); | 446 my $newlines = $1; |
447 my $oldlines = $lookup; | |
448 if (defined $target_dels{$add}) { | |
449 foreach $del (split(' ', $target_dels{$add})) { | |
450 $newlines =~ s/\s*$del\s*/ /g; | |
451 } | |
452 } | |
453 substituteLine($oldlines, "$add: " . $target_adds{$add} . $newlines); | |
401 } else { | 454 } else { |
402 $lines .= "$add: " . $target_adds{$add} . "\n"; | 455 $lines .= "$add: " . $target_adds{$add} . "\n"; |
403 } | 456 } |
404 } | 457 } |
405 if ($lines) { | 458 |
406 appendLines($lines); | 459 appendLines($lines) if ($lines); |
407 } | 460 |
461 $lines = join("\n", values %rule_adds); | |
462 appendLines($lines) if ($lines); | |
408 | 463 |
409 my $found = 1; | 464 my $found = 1; |
410 | 465 |
411 while ($found) { | 466 while ($found) { |
412 if ($MakefileData =~ m/\n(.*)\$\(CXXFLAGS\)(.*)\n/) { | 467 if ($MakefileData =~ m/\n(.*)\$\(CXXFLAGS\)(.*)\n/) { |
413 my $vor = $1; # "vor" means before in German | 468 my $stuff_before = $1; |
414 my $nach = $2; # "nach" means after in German | 469 my $stuff_after = $2; |
415 my $lookup = quotemeta("$1\$(CXXFLAGS)$2"); | 470 my $lookup = quotemeta("$1\$(CXXFLAGS)$2"); |
416 my $replacement = "$1\$(KCXXFLAGS)$2"; | 471 my $replacement = "$1\$(KCXXFLAGS)$2"; |
417 $MakefileData =~ s/$lookup/$replacement/; | 472 $MakefileData =~ s/$lookup/$replacement/; |
418 $lookup =~ s/\\\$\\\(CXXFLAGS\\\)/\\\$\\\(KCXXFLAGS\\\)/; | 473 $lookup =~ s/\\\$\\\(CXXFLAGS\\\)/\\\$\\\(KCXXFLAGS\\\)/; |
419 $replacement = "$vor\$(KCXXFLAGS) \$(KDE_CXXFLAGS)$nach"; | 474 $replacement = "$stuff_before\$(KCXXFLAGS) \$(KDE_CXXFLAGS)$stuff_after"; |
420 substituteLine($lookup, $replacement); | 475 substituteLine($lookup, $replacement); |
421 } else { | 476 } else { |
422 $found = 0; | 477 $found = 0; |
423 } | 478 } |
424 } | 479 } |
425 | 480 |
426 if($foreign_libtool == 0) { | 481 if($foreign_libtool == 0) { |
427 $lookup = '(\n[^#].*\$\(LIBTOOL\) --mode=link) (\$\(CXXLD\).*\$\(KCXXFLAGS\))'; | 482 $lookup = '(\n[^#].*\$\(LIBTOOL\) --mode=link) (\$\(CXXLD\).*\$\(KCXXFLAGS\))'; |
428 | 483 |
429 if ($MakefileData =~ m/$lookup/ ) { | 484 if ($MakefileData =~ m/$lookup/ ) { |
430 $MakefileData =~ s/$lookup/$1 --tag=CXX $2/; | 485 $MakefileData =~ s/$lookup/$1 --tag=CXX $2/; |
431 } | 486 } |
432 | 487 |
433 $lookup = '(\n[^#].*\$\(LIBTOOL\) --mode=compile) (\$\(CXX\).*\$\(KCXXFLAGS\))'; | 488 $lookup = '(\n[^#].*\$\(LIBTOOL\) --mode=compile)\s+(\$\(CXX\)\s+)'; |
434 if ($MakefileData =~ m/$lookup/ ) { | 489 if ($MakefileData =~ m/$lookup/ ) { |
435 $MakefileData =~ s/$lookup/$1 --tag=CXX $2/; | 490 $MakefileData =~ s/$lookup/$1 --tag=CXX $2/; |
436 } | 491 } |
437 } | 492 } |
438 | 493 |
447 updateMakefile (); | 502 updateMakefile (); |
448 return; | 503 return; |
449 } | 504 } |
450 | 505 |
451 #----------------------------------------------------------------------------- | 506 #----------------------------------------------------------------------------- |
507 | |
508 # Beware: This procedure is not complete. E.g. it also parses lines | |
509 # containing a '=' in rules (for instance setting shell vars). For our | |
510 # usage this us enough, though. | |
511 sub read_variables () | |
512 { | |
513 while ($MakefileData =~ /\n\s*(\S+)\s*=([^\n]*)/g) { | |
514 $varcontent{$1} = $2; | |
515 } | |
516 } | |
452 | 517 |
453 # Check to see whether we should process this make file. | 518 # Check to see whether we should process this make file. |
454 # This is where we look for tags that we need to process. | 519 # This is where we look for tags that we need to process. |
455 # A small amount of initialising on the tags is also done here. | 520 # A small amount of initialising on the tags is also done here. |
456 # And of course we open and/or create the needed make files. | 521 # And of course we open and/or create the needed make files. |
474 close FILEIN; | 539 close FILEIN; |
475 print "DOS CRLF within $makefileDir/$makefile!\n" if($MakefileData =~ y/\r//d); | 540 print "DOS CRLF within $makefileDir/$makefile!\n" if($MakefileData =~ y/\r//d); |
476 | 541 |
477 # Remove the line continuations, but keep them marked | 542 # Remove the line continuations, but keep them marked |
478 # Note: we lose the trailing spaces but that's ok. | 543 # Note: we lose the trailing spaces but that's ok. |
479 $MakefileData =~ s/\\\s*\n\s*/\034/g; | 544 # Don't mangle line-leading spaces (usually tabs) |
545 # since they're important. | |
546 $MakefileData =~ s/\\\s*\n/\034/g; | |
480 | 547 |
481 # If we've processed the file before... | 548 # If we've processed the file before... |
482 restoreMakefile () if ($MakefileData =~ /$progId/); | 549 restoreMakefile () if ($MakefileData =~ /$progId/); |
483 | 550 |
484 foreach $dir (@foreignfiles) { | 551 foreach $dir (@foreignfiles) { |
488 } | 555 } |
489 | 556 |
490 %kdeopts = (); | 557 %kdeopts = (); |
491 $kdeopts{"foreign"} = 0; | 558 $kdeopts{"foreign"} = 0; |
492 $kdeopts{"qtonly"} = 0; | 559 $kdeopts{"qtonly"} = 0; |
560 $kdeopts{"noautodist"} = 0; | |
493 $kdeopts{"foreign-libtool"} = $foreign_libtool; | 561 $kdeopts{"foreign-libtool"} = $foreign_libtool; |
494 $kdeopts{"nofinal"} = !$use_final; # default | 562 $kdeopts{"nofinal"} = !$use_final; # default |
495 | 563 |
496 if ($MakefileData =~ /\nKDE_OPTIONS\s*=\s*([^\n]*)\n/) { | 564 read_variables(); |
497 local @kde_options = split(/[\s\034]/, $1); | 565 |
566 if ($MakefileData =~ /\nKDE_OPTIONS\s*=[ \t]*([^\n]*)\n/) { | |
567 my $kde_options_str = $1; | |
568 local @kde_options = split(/[\034\s]+/, $kde_options_str); | |
498 if (grep(/^foreign$/, @kde_options)) { | 569 if (grep(/^foreign$/, @kde_options)) { |
499 push(@foreignfiles, $makefileDir . "/"); | 570 push(@foreignfiles, $makefileDir . "/"); |
500 return 0; # don't touch me | 571 return 0; # don't touch me |
501 } | 572 } |
502 for $opt (@kde_options) { | 573 for $opt (@kde_options) { |
519 print STDERR "Error: Only one POFILES tag allowed\n"; | 590 print STDERR "Error: Only one POFILES tag allowed\n"; |
520 $errorflag = 1; | 591 $errorflag = 1; |
521 } | 592 } |
522 | 593 |
523 while ($MakefileData =~ /\n\.SUFFIXES:([^\n]+)\n/g) { | 594 while ($MakefileData =~ /\n\.SUFFIXES:([^\n]+)\n/g) { |
524 my @list=split(' ', $1); | 595 my $suffixes_str = $1; |
596 my @list=split(' ', $suffixes_str); | |
525 foreach $ext (@list) { | 597 foreach $ext (@list) { |
526 if ($ext =~ /^\.$cppExt$/) { | 598 if ($ext =~ /^\.$cppExt$/) { |
527 $cxxsuffix = $ext; | 599 $cxxsuffix = $ext; |
528 $cxxsuffix =~ s/\.//g; | 600 $cxxsuffix =~ s/\.//g; |
529 print STDOUT "will use suffix $cxxsuffix\n" if ($verbose); | 601 print STDOUT "will use suffix $cxxsuffix\n" if ($verbose); |
530 last; | 602 last; |
531 } | 603 } |
532 } | 604 } |
533 } | 605 } |
534 | 606 |
535 while ($MakefileData =~ /\n(\S*)_OBJECTS\s*=[ \t\034]*([^\n]*)\n/g) { | 607 tag_KDEINIT(); |
536 | 608 |
609 while ($MakefileData =~ /\n(\S*)_OBJECTS\s*=[\034 \t]*([^\n]*)\n/g) { | |
610 | |
537 my $program = $1; | 611 my $program = $1; |
538 my $objs = $2; # safe them | 612 my $objs = $2; # safe them |
539 | 613 |
540 my $ocv = 0; | 614 my $ocv = 0; |
541 | 615 |
542 my @objlist = split(/[\s\034]+/, $objs); | 616 my @objlist = split(/[\034\s]+/, $objs); |
543 foreach $obj (@objlist) { | 617 foreach $obj (@objlist) { |
544 if ($obj =~ /\$\((\S+)\)/ ) { | 618 if ($obj =~ /(\S*)\$\((\S+)\)/ ) { |
545 my $variable = $1; | 619 my $pre = $1; |
546 if ($variable !~ 'OBJEXT') { | 620 my $variable = $2; |
621 if ($pre eq '' && exists($varcontent{$variable})) { | |
622 my @addlist = split(/[\034\s]+/, $varcontent{$variable}); | |
623 push(@objlist, @addlist); | |
624 } elsif ($variable !~ 'OBJEXT') { | |
547 $ocv = 1; | 625 $ocv = 1; |
548 } | 626 } |
549 } | 627 } |
550 } | 628 } |
551 | 629 |
552 next if ($ocv); | 630 next if ($ocv); |
631 next if ($program =~ /^am_libkdeinit_/); | |
553 | 632 |
554 $program =~ s/^am_// if ($program =~ /^am_/); | 633 $program =~ s/^am_// if ($program =~ /^am_/); |
555 | 634 |
556 my $sourceprogram = $program; | 635 my $sourceprogram = $program; |
557 $sourceprogram =~ s/\@am_/\@/ if($sourceprogram =~ /^.*\@am_.+/); | 636 $sourceprogram =~ s/\@am_/\@/ if($sourceprogram =~ /^.*\@am_.+/); |
558 | 637 |
559 print STDOUT "found program $program\n" if ($verbose); | 638 print STDOUT "found program $program\n" if ($verbose); |
560 push(@programs, $program); | 639 push(@programs, $program); |
561 | 640 |
562 $realObjs{$program} = $objs; | 641 $realObjs{$program} = $objs; |
563 | 642 |
564 if ($MakefileData =~ /\n$sourceprogram\_SOURCES\s*=\s*(.*)\n/) { | 643 if ($MakefileData =~ /\n$sourceprogram\_SOURCES\s*=[ \t]*(.*)\n/) { |
565 $sources{$program} = $1; | 644 $sources{$program} = $1; |
566 } | 645 } |
567 else { | 646 else { |
568 $sources{$program} = ""; | 647 $sources{$program} = ""; |
569 print STDERR "found program with no _SOURCES: $program\n"; | 648 print STDERR "found program with no _SOURCES: $program\n"; |
576 } else { | 655 } else { |
577 # not standard Makefile - nothing to worry about | 656 # not standard Makefile - nothing to worry about |
578 $realname{$program} = ""; | 657 $realname{$program} = ""; |
579 } | 658 } |
580 } | 659 } |
581 | 660 |
582 my $lookup = '\nDEPDIR\s*=.*'; | 661 my $lookup = 'DEPDIR\s*=.*'; |
583 if ($MakefileData !~ /($lookup)\n/o) { | 662 if ($MakefileData !~ /\n$lookup/) { |
584 $lookup = '\nbindir\s*=.*'; | 663 $lookup = 'bindir\s*=[ \t]*.*'; |
585 if ($MakefileData =~ /($lookup)\n/) { | 664 substituteLine($lookup, "DEPDIR = .deps\n$1") if ($MakefileData =~ /\n($lookup)/); |
586 substituteLine ($lookup, "DEPDIR = .deps\n$1"); | 665 } |
587 } | |
588 } | |
589 | 666 |
590 my @marks = ('MAINTAINERCLEANFILES', 'CLEANFILES', 'DISTCLEANFILES'); | 667 my @marks = ('MAINTAINERCLEANFILES', 'CLEANFILES', 'DISTCLEANFILES'); |
591 foreach $mark (@marks) { | 668 foreach $mark (@marks) { |
592 while ($MakefileData =~ /\n($mark)\s*=\s*([^\n]*)/g) { | 669 while ($MakefileData =~ /\n($mark)\s*=[ \t]*([^\n]*)/g) { |
593 foreach $file (split('[\034\s]', $2)) { | 670 my $clean_str = $2; |
671 foreach $file (split('[\034\s]+', $clean_str)) { | |
594 $file =~ s/\.\///; | 672 $file =~ s/\.\///; |
595 push(@cleanfiles, $file); | 673 push(@cleanfiles, $file); |
596 } | 674 } |
597 } | 675 } |
598 } | 676 } |
607 | 685 |
608 # Gets the list of user defined directories - relative to $srcdir - where | 686 # Gets the list of user defined directories - relative to $srcdir - where |
609 # header files could be located. | 687 # header files could be located. |
610 sub tag_META_INCLUDES () | 688 sub tag_META_INCLUDES () |
611 { | 689 { |
612 my $lookup = '[^=\n]*META_INCLUDES\s*=\s*(.*)'; | 690 my $lookup = '[^=\n]*META_INCLUDES\s*=[ \t]*(.*)'; |
613 return 1 if ($MakefileData !~ /($lookup)\n/o); | 691 return 1 if ($MakefileData !~ /($lookup)\n/); |
614 print STDOUT "META_INCLUDE processing <$1>\n" if ($verbose); | 692 print STDOUT "META_INCLUDE processing <$1>\n" if ($verbose); |
615 | 693 |
616 my $headerStr = $2; | 694 my $headerStr = $2; |
617 removeLine ($lookup, $1); | 695 removeLine ($lookup, $1); |
618 | 696 |
619 $headerStr =~ tr/\034/ /; | 697 my @headerlist = split(/[\034\s]+/, $headerStr); |
620 my @headerlist = split(' ', $headerStr); | |
621 | 698 |
622 foreach $dir (@headerlist) | 699 foreach $dir (@headerlist) |
623 { | 700 { |
624 $dir =~ s#\$\(srcdir\)#.#; | 701 $dir =~ s#\$\(srcdir\)#.#; |
625 if (! -d $dir) | 702 if (! -d $dir) |
646 | 723 |
647 if ($sources{$program} =~ /\(/) { | 724 if ($sources{$program} =~ /\(/) { |
648 print STDOUT "found ( in $program\_SOURCES. skipping\n" if ($verbose); | 725 print STDOUT "found ( in $program\_SOURCES. skipping\n" if ($verbose); |
649 next; | 726 next; |
650 } | 727 } |
728 | |
729 my $mocs = ""; # Moc files (in this program) | |
730 my $moc_cpp_added = 0; # If we added some .moc.cpp files, due to | |
731 # no other .cpp file including the .moc one. | |
651 | 732 |
652 my $mocsources = ""; | 733 my @progsources = split(/[\034\s]+/, $sources{$program}); |
653 | 734 my %shash = (); |
654 my @progsources = split(/[\s\034]+/, $sources{$program}); | 735 @shash{@progsources} = 1; # we are only interested in the existence |
655 my %sourcelist = (); | 736 my %sourcelist = (); |
656 | 737 |
657 foreach $source (@progsources) { | 738 foreach $source (@progsources) { |
658 my $suffix = $source; | 739 my $suffix = $source; |
659 $suffix =~ s/^.*\.([^\.]+)$/$1/; | 740 $suffix =~ s/^.*\.([^\.]+)$/$1/; |
660 | 741 |
661 if (defined($sourcelist{$suffix})) { | 742 $sourcelist{$suffix} .= "$source "; |
662 $sourcelist{$suffix} .= " " . $source; | 743 } |
744 foreach my $mocFile (keys (%globalmocs)) | |
745 { | |
746 my ($dir, $hFile, $cppFile) = split ("\035", $globalmocs{$mocFile}, 3); | |
747 if (defined ($cppFile)) { | |
748 $mocs .= " $mocFile.moc" if exists $shash{$cppFile}; | |
663 } else { | 749 } else { |
664 $sourcelist{$suffix} .= $source; | 750 $sourcelist{$cxxsuffix} .= "$mocFile.moc.$cxxsuffix "; |
665 } | 751 $moc_cpp_added = 1; |
666 } | 752 } |
667 | 753 } |
668 foreach $suffix (keys %sourcelist) { | 754 foreach $suffix (keys %sourcelist) { |
669 | 755 |
670 # See if this file contains c++ code. (ie Just check the files suffix against | 756 # See if this file contains c++ code. (i.e., just check the file's suffix against c++ extensions) |
671 my $suffix_is_cxx = 0; | 757 my $suffix_is_cxx = 0; |
672 if($suffix =~ /($cppExt)$/) { | 758 if($suffix =~ /($cppExt)$/) { |
673 $cxxsuffix = $1; | 759 $cxxsuffix = $1; |
674 $suffix_is_cxx = 1; | 760 $suffix_is_cxx = 1; |
675 } | 761 } |
676 | 762 |
677 my $mocfiles_in = ($suffix eq $cxxsuffix) && | 763 my $mocfiles_in = ($suffix eq $cxxsuffix) && $moc_cpp_added; |
678 defined($depedmocs{$program}); | |
679 | 764 |
680 my @sourcelist = split(/[\s\034]+/, $sourcelist{$suffix}); | 765 my @sourcelist = split(/[\034\s]+/, $sourcelist{$suffix}); |
681 | 766 |
682 if ((@sourcelist == 1 && !$mocfiles_in) || $suffix_is_cxx != 1 ) { | 767 if ((@sourcelist == 1 && !$mocfiles_in) || $suffix_is_cxx != 1 ) { |
683 | 768 |
684 # we support IDL on our own | 769 # we support IDL on our own |
685 if ($suffix =~ /^skel$/ || $suffix =~ /^stub/ || $suffix =~ /^signals/ | 770 if ($suffix eq "skel" || $suffix =~ /^stub/ |
686 || $suffix =~ /^h$/ || $suffix =~ /^ui$/ ) { | 771 || $suffix =~ /^signals/ # obsolete, remove in KDE-4 |
772 || $suffix eq "h" || $suffix eq "ui" ) { | |
687 next; | 773 next; |
688 } | 774 } |
689 | 775 |
690 foreach $file (@sourcelist) { | 776 foreach $file (@sourcelist) { |
691 | |
692 $file =~ s/\Q$suffix\E$//; | 777 $file =~ s/\Q$suffix\E$//; |
693 | 778 |
694 $finalObjs{$program} .= $file; | 779 $finalObjs{$program} .= $file; |
695 if ($program =~ /_la$/) { | 780 if ($program =~ /_la$/) { |
696 $finalObjs{$program} .= "lo "; | 781 $finalObjs{$program} .= "lo "; |
702 } | 787 } |
703 | 788 |
704 my $source_deps = ""; | 789 my $source_deps = ""; |
705 foreach $source (@sourcelist) { | 790 foreach $source (@sourcelist) { |
706 if (-f $source) { | 791 if (-f $source) { |
707 $source_deps .= "\$(srcdir)/$source "; | 792 $source_deps .= " \$(srcdir)/$source"; |
708 } else { | 793 } else { |
709 $source_deps .= "$source "; | 794 $source_deps .= " $source"; |
710 } | 795 } |
711 } | 796 } |
712 | 797 |
713 $handling = "$program.all_$suffix.$suffix: \$(srcdir)/Makefile.in " . $source_deps . " "; | 798 $handling = "$program.all_$suffix.$suffix: \$(srcdir)/Makefile.in" . $source_deps . " " . join(' ', $mocs) . "\n"; |
714 | |
715 if ($mocfiles_in) { | |
716 $handling .= $depedmocs{$program}; | |
717 foreach $mocfile (split(' ', $depedmocs{$program})) { | |
718 | |
719 if ($mocfile =~ m/\.$suffix$/) { | |
720 $mocsources .= " " . $mocfile; | |
721 } | |
722 } | |
723 } | |
724 | |
725 $handling .= "\n"; | |
726 $handling .= "\t\@echo 'creating $program.all_$suffix.$suffix ...'; \\\n"; | 799 $handling .= "\t\@echo 'creating $program.all_$suffix.$suffix ...'; \\\n"; |
727 $handling .= "\trm -f $program.all_$suffix.files $program.all_$suffix.final; \\\n"; | 800 $handling .= "\trm -f $program.all_$suffix.files $program.all_$suffix.final; \\\n"; |
728 $handling .= "\techo \"#define KDE_USE_FINAL 1\" >> $program.all_$suffix.final; \\\n"; | 801 $handling .= "\techo \"#define KDE_USE_FINAL 1\" >> $program.all_$suffix.final; \\\n"; |
729 $handling .= "\tfor file in " . $sourcelist{$suffix} . " $mocsources; do \\\n"; | 802 $handling .= "\tfor file in " . $sourcelist{$suffix} . "; do \\\n"; |
730 $handling .= "\t echo \"#include \\\"\$\$file\\\"\" >> $program.all_$suffix.files; \\\n"; | 803 $handling .= "\t echo \"#include \\\"\$\$file\\\"\" >> $program.all_$suffix.files; \\\n"; |
731 $handling .= "\t test ! -f \$\(srcdir\)/\$\$file || egrep '^#pragma +implementation' \$\(srcdir\)/\$\$file >> $program.all_$suffix.final; \\\n"; | 804 $handling .= "\t test ! -f \$\(srcdir\)/\$\$file || egrep '^#pragma +implementation' \$\(srcdir\)/\$\$file >> $program.all_$suffix.final; \\\n"; |
732 $handling .= "\tdone; \\\n"; | 805 $handling .= "\tdone; \\\n"; |
733 $handling .= "\tcat $program.all_$suffix.final $program.all_$suffix.files > $program.all_$suffix.$suffix; \\\n"; | 806 $handling .= "\tcat $program.all_$suffix.final $program.all_$suffix.files > $program.all_$suffix.$suffix; \\\n"; |
734 $handling .= "\trm -f $program.all_$suffix.final $program.all_$suffix.files\n"; | 807 $handling .= "\trm -f $program.all_$suffix.final $program.all_$suffix.files\n"; |
735 | 808 |
736 appendLines($handling); | 809 appendLines($handling); |
737 | 810 |
738 push(@final_names, "$program.all_$suffix.$suffix"); | 811 push(@final_names, "$program.all_$suffix.$suffix"); |
739 $finalObjs{$program} .= "$program.all_$suffix."; | 812 my $finalObj = "$program.all_$suffix."; |
740 if ($program =~ /_la$/) { | 813 if ($program =~ /_la$/) { |
741 $finalObjs{$program} .= "lo "; | 814 $finalObj .= "lo"; |
742 } else { | 815 } else { |
743 $finalObjs{$program} .= "o "; | 816 $finalObj .= "o"; |
744 } | 817 } |
818 $finalObjs{$program} .= $finalObj . " "; | |
745 } | 819 } |
746 } | 820 } |
747 | 821 |
748 if (!$kdeopts{"nofinal"} && @final_names >= 1) { | 822 if (!$kdeopts{"nofinal"} && @final_names >= 1) { |
749 # add clean-final target | 823 # add clean-final target |
757 $dep_finals .= " \$(DEPDIR)/$finalfile"; | 831 $dep_finals .= " \$(DEPDIR)/$finalfile"; |
758 } | 832 } |
759 } | 833 } |
760 } | 834 } |
761 | 835 |
836 sub tag_KDEINIT() | |
837 { | |
838 my @progs = (); | |
839 my $ltlibs = ""; | |
840 my $lookup = 'kdeinit_LTLIBRARIES\s*=[ \t]*(.*)'; | |
841 | |
842 if ($MakefileData =~ m/\n$lookup/) { | |
843 @kdeinits = split(/[\034\s]+/, $1); | |
844 my $lines = ""; | |
845 foreach my $kdeinit (@kdeinits) { | |
846 if ($kdeinit =~ m/\.la$/) { | |
847 $kdeinit =~ s/\.la$//; | |
848 push(@progs, $kdeinit); | |
849 | |
850 $lines .= "\n${kdeinit}.la.$cxxsuffix:\n"; | |
851 $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"; | |
853 | |
854 $lines .= "\n${kdeinit}_dummy.$cxxsuffix:\n"; | |
855 $lines .= "\t echo > ${kdeinit}_dummy.$cxxsuffix\n"; | |
856 | |
857 push(@cleanfiles, "${kdeinit}.la.$cxxsuffix"); | |
858 push(@cleanfiles, "${kdeinit}_dummy.$cxxsuffix"); | |
859 | |
860 # add dependency | |
861 $dep_files .= " \$(DEPDIR)/${kdeinit}.la.Po" if($dep_files !~/${kdeinit}.la.Po/ ); | |
862 $dep_files .= " \$(DEPDIR)/${kdeinit}_dummy.Plo" if($dep_files !~/${kdeinit}_dummy.Plo/ ); | |
863 | |
864 # make library | |
865 $lookup = $kdeinit . '_la_LIBADD\s*=[ \t]*(.*)'; | |
866 if($MakefileData =~ m/\n$lookup/) { | |
867 my $libadd = $1; | |
868 substituteLine($lookup, "${kdeinit}_la_LIBADD = libkdeinit_${kdeinit}.la"); | |
869 appendLines("libkdeinit_${kdeinit}_la_LIBADD = $libadd\n"); | |
870 } | |
871 appendLines("libkdeinit_${kdeinit}_la_LDFLAGS = \$(all_libraries)\n"); | |
872 | |
873 # add library dependencies | |
874 $lookup = $kdeinit . '_la_DEPENDENCIES\s*=[ \t]*(.*)'; | |
875 if($MakefileData =~ m/\n$lookup/) { | |
876 my $libdeps = $1; | |
877 substituteLine($lookup, "${kdeinit}_la_DEPENDENCIES = libkdeinit_${kdeinit}.la"); | |
878 appendLines("libkdeinit_${kdeinit}_la_DEPENDENCIES = $libdeps\n"); | |
879 } | |
880 | |
881 # make library objects | |
882 $lookup = "am_${kdeinit}_la_OBJECTS" . '\s*=[ \t]*(.*)'; | |
883 if($MakefileData =~ m/\n$lookup/) { | |
884 my $libobjects = $1; | |
885 substituteLine($lookup, "am_${kdeinit}_la_OBJECTS = ${kdeinit}_dummy.lo"); | |
886 appendLines("am_libkdeinit_${kdeinit}_la_OBJECTS = $libobjects\n"); | |
887 my $prog = "libkdeinit_${kdeinit}_la"; | |
888 push(@programs, $prog); | |
889 $realObjs{$prog} = $libobjects; | |
890 $realname{$prog} = "libkdeinit_${kdeinit}.la"; | |
891 } | |
892 $target_adds{"libkdeinit_${kdeinit}.la"} = "\$(libkdeinit_${kdeinit}_la_OBJECTS) \$(libkdeinit_${kdeinit}_la_DEPENDENCIES)\n" . | |
893 "\t\$(CXXLINK) -rpath \$(libdir) \$(libkdeinit_${kdeinit}_la_LDFLAGS) ". | |
894 "\$(libkdeinit_${kdeinit}_la_OBJECTS) " . | |
895 "\$(libkdeinit_${kdeinit}_la_LIBADD) " . | |
896 "\$(LIBS)\n"; | |
897 | |
898 # make libkdeinit sources | |
899 $lookup = $kdeinit . '_la_SOURCES\s*=[ \t]*(.*)'; | |
900 if($MakefileData =~ m/\n$lookup/) { | |
901 my $srces = $1; | |
902 $sources_changed{"libkdeinit_${kdeinit}_la"} = 1; | |
903 $sources{"libkdeinit_${kdeinit}_la"} = $srces; | |
904 } | |
905 | |
906 # make libkdeinit metasources | |
907 $lookup = $kdeinit . '_la_METASOURCES\s*=[ \t]*(.*)'; | |
908 substituteLine($lookup, "libkdeinit_${kdeinit}_la_METASOURCES = $1") | |
909 if($MakefileData =~ m/\n$lookup/); | |
910 | |
911 =cut | |
912 # make binary sources | |
913 $lookup = $kdeinit. '_SOURCES\s*=[ \t]*(.*)'; | |
914 if($MakefileData =~ m/\n$lookup/) { | |
915 substituteLine($lookup, "${kdeinit}_SOURCES = ${kdeinit}.la.$cxxsuffix"); | |
916 $lookup = 'SOURCES\s*=[ \t]*(.*)'; | |
917 if($MakefileData =~ m/\n$lookup/) { | |
918 my $srces = $1; | |
919 $srces =~ s/\b$kdeinit\.c\b/\$(${kdeinit}_SOURCES)/; | |
920 $srces =~ s/\$\(${kdeinit}_la_SOURCES\)/\$(libkdeinit_${kdeinit}_la_SOURCES)/; | |
921 substituteLine($lookup, "SOURCES = $srces"); | |
922 } | |
923 $lookup = 'DIST_SOURCES\s*=[ \t](.*)'; | |
924 if($MakefileData =~ m/\n$lookup/) { | |
925 my $srces = $1; | |
926 $srces =~ s/\b$kdeinit\.c\b/\$(${kdeinit}_SOURCES)/; | |
927 $srces =~ s/\$\(${kdeinit}_la_SOURCES\)/\$(libkdeinit_${kdeinit}_la_SOURCES)/; | |
928 substituteLine($lookup, "DIST_SOURCES = $srces"); | |
929 } | |
930 } | |
931 | |
932 # make binary objects / libs | |
933 $lookup = $kdeinit . '_OBJECTS\s*=[ \t]*.*'; | |
934 if($MakefileData =~ m/\n$lookup/) { | |
935 $realObjs{$kdeinit} = "${kdeinit}.la.\$(OBJEXT)"; | |
936 substituteLine("${kdeinit}_LDFLAGS\\s*=.*", "${kdeinit}_LDFLAGS = \$(all_libraries)"); | |
937 substituteLine("${kdeinit}_LDADD\\s*=.*", "${kdeinit}_LDADD = libkdeinit_${kdeinit}.la"); | |
938 substituteLine("${kdeinit}_DEPENDENCIES\\s*=.*", "${kdeinit}_DEPENDENCIES = libkdeinit_${kdeinit}.la"); | |
939 } | |
940 =cut | |
941 # add binary | |
942 push(@programs, $kdeinit); | |
943 $realObjs{$kdeinit} = "${kdeinit}.la.\$(OBJEXT)"; | |
944 $realname{$kdeinit} = $kdeinit; | |
945 $sources{$kdeinit} = "${kdeinit}.la.$cxxsuffix"; | |
946 | |
947 $lines .= "${kdeinit}_LDFLAGS = \$(all_libraries)\n"; | |
948 $lines .= "${kdeinit}_LDADD = libkdeinit_${kdeinit}.la\n"; | |
949 $lines .= "${kdeinit}_DEPENDENCIES = libkdeinit_${kdeinit}.la\n"; | |
950 | |
951 $target_adds{"${kdeinit}\$(EXEEXT)"} = | |
952 "\$(${kdeinit}_OBJECTS) \$(${kdeinit}_DEPENDENCIES)\n" . | |
953 "\t\@rm -f ${kdeinit}\$(EXEEXT)\n" . | |
954 "\t\$(CXXLINK) \$(${kdeinit}_LDFLAGS) \$(${kdeinit}_OBJECTS) \$(${kdeinit}_LDADD) \$(LIBS)\n"; | |
955 | |
956 $ltlibs .= " libkdeinit_${kdeinit}.la"; | |
957 } | |
958 } | |
959 appendLines($lines); | |
960 | |
961 # add libkdeinit target | |
962 $lookup = 'lib_LTLIBRARIES\s*=[ \t]*(.*)'; | |
963 if($MakefileData =~ m/\n$lookup/) { | |
964 substituteLine($lookup, "lib_LTLIBRARIES = $1 $ltlibs"); | |
965 } | |
966 else { | |
967 print STDERR | |
968 "Error: lib_LTLIBRARIES missing in $printname (required for kdeinit_LTLIBRARIES).\n"; | |
969 $errorflag = 1; | |
970 } | |
971 } | |
972 | |
973 if($#progs >= 0) { | |
974 if($MakefileData !~ m/\nbin_PROGRAMS\s*=/) { | |
975 print STDERR "Error: bin_PROGRAMS missing in $printname (required for bin_PROGRAMS).\n"; | |
976 $errorflag = 1; | |
977 } | |
978 else { | |
979 # add our new progs to SOURCES, DIST_SOURCES and bin_PROGRAMS | |
980 my $progsources = ""; | |
981 my $progexes = ""; | |
982 foreach my $p (@progs) { | |
983 $progsources .= "\$(${p}_SOURCES) "; | |
984 $progexes .= "${p}\$(EXEEXT) "; | |
985 } | |
986 $lookup = 'SOURCES\s*=[ \t]*(.*)'; | |
987 if($MakefileData =~ /\n$lookup/) { | |
988 substituteLine($lookup, "SOURCES = $1 $progsources"); | |
989 } | |
990 $lookup = 'DIST_SOURCES\s*=[ \t]*(.*)'; | |
991 if($MakefileData =~ /\n$lookup/) { | |
992 substituteLine($lookup, "DIST_SOURCES = $1 $progsources"); | |
993 } | |
994 # bin_PROGRAMS is complicated, as it exists twice, so we do a little | |
995 # magic trick here | |
996 $lookup = 'PROGRAMS\s*=[ \t]*(.*)'; | |
997 if ($MakefileData =~ /\n$lookup/) { | |
998 substituteLine($lookup, "bin_PROGRAMS += $progexes\nPROGRAMS = $1"); | |
999 } | |
1000 } | |
1001 } | |
1002 } | |
1003 | |
762 #----------------------------------------------------------------------------- | 1004 #----------------------------------------------------------------------------- |
763 | 1005 |
764 sub tag_COMPILE_FIRST() | 1006 sub tag_COMPILE_FIRST() |
765 { | 1007 { |
766 foreach $program (@programs) { | 1008 foreach $program (@programs) { |
767 my $lookup = "$program" . '_COMPILE_FIRST\s*=\s*(.*)'; | 1009 my $lookup = "$program" . '_COMPILE_FIRST\s*=[ \t]*(.*)'; |
768 if ($MakefileData =~ m/\n$lookup\n/) { | 1010 if ($MakefileData =~ m/\n$lookup\n/) { |
769 my @compilefirst = split(/[\s\034]+/, $1); | 1011 my $compilefirst_str = $1; |
770 my @progsources = split(/[\s\034]+/, $sources{$program}); | 1012 my @compilefirst = split(/[\034\s]+/, $compilefirst_str); |
1013 my @progsources = split(/[\034\s]+/, $sources{$program}); | |
771 my %donesources = (); | 1014 my %donesources = (); |
772 $handling = ""; | |
773 foreach $source (@progsources) { | 1015 foreach $source (@progsources) { |
774 my @deps = (); | 1016 my @deps = (); |
775 my $sdeps = ""; | 1017 my $sdeps = ""; |
776 if (-f $source) { | 1018 if (-f $source) { |
777 $sdeps = "\$(srcdir)/$source"; | 1019 $sdeps = "\$(srcdir)/$source"; |
782 next if ($source eq $depend); | 1024 next if ($source eq $depend); |
783 # avoid cyclic dependencies | 1025 # avoid cyclic dependencies |
784 next if defined($donesources{$depend}); | 1026 next if defined($donesources{$depend}); |
785 push @deps, $depend; | 1027 push @deps, $depend; |
786 } | 1028 } |
787 $handling .= "$sdeps: " . join(' ', @deps) . "\n" if (@deps); | 1029 $target_adds{$sdeps} = join(' ', @deps) if (@deps); |
788 $donesources{$source} = 1; | 1030 $donesources{$source} = 1; |
789 } | 1031 } |
790 appendLines($handling) if (length($handling)); | |
791 } | 1032 } |
792 } | 1033 } |
793 } | 1034 } |
794 | 1035 |
795 #----------------------------------------------------------------------------- | 1036 #----------------------------------------------------------------------------- |
798 # Organises the list of headers that we'll use to produce moc files | 1039 # Organises the list of headers that we'll use to produce moc files |
799 # from. | 1040 # from. |
800 sub tag_METASOURCES () | 1041 sub tag_METASOURCES () |
801 { | 1042 { |
802 local @newObs = (); # here we add to create object files | 1043 local @newObs = (); # here we add to create object files |
803 local @deped = (); # here we add to create moc files | 1044 local @depend = (); # here we add to create moc files |
804 local $mocExt = ".moc"; | 1045 local $mocExt = ".moc"; |
805 local %mocFiles = (); | 1046 local %mocFiles = (); |
806 | 1047 |
807 my $line = ""; | 1048 my $line = ""; |
808 my $postEqual = ""; | 1049 my $postEqual = ""; |
809 | 1050 |
810 my $lookup; | 1051 my $lookup; |
811 my $found = ""; | 1052 my $found = ""; |
812 | |
813 if ($metasourceTags > 1) { | 1053 if ($metasourceTags > 1) { |
814 $lookup = $program . '_METASOURCES\s*=\s*(.*)'; | 1054 $lookup = $program . '_METASOURCES\s*=\s*(.*)'; |
815 return 1 if ($MakefileData !~ /\n($lookup)\n/); | 1055 return 1 if ($MakefileData !~ /\n($lookup)\n/); |
816 $found = $1; | 1056 $found = $1; |
817 } else { | 1057 } else { |
818 $lookup = $program . '_METASOURCES\s*=\s*(.*)'; | 1058 $lookup = $program . '_METASOURCES\s*=\s*(.*)'; |
819 if ($MakefileData !~ /\n($lookup)\n/) { | 1059 if ($MakefileData !~ /\n($lookup)\n/) { |
820 $lookup = 'METASOURCES\s*=\s*(.*)'; | 1060 $lookup = 'METASOURCES\s*=\s*(.*)'; |
821 return 1 if ($MakefileData !~ /\n($lookup)\n/o); | 1061 return 1 if ($MakefileData !~ /\n($lookup)\n/); |
822 $found = $1; | 1062 $found = $1; |
823 $metasourceTags = 0; # we can use the general target only once | 1063 $metasourceTags = 0; # we can use the general target only once |
824 } else { | 1064 } else { |
825 $found = $1; | 1065 $found = $1; |
826 } | 1066 } |
856 checkMocCandidates (); | 1096 checkMocCandidates (); |
857 | 1097 |
858 if (@newObs) { | 1098 if (@newObs) { |
859 my $ext = ($program =~ /_la$/) ? ".moc.lo " : ".moc.o "; | 1099 my $ext = ($program =~ /_la$/) ? ".moc.lo " : ".moc.o "; |
860 $realObjs{$program} .= "\034" . join ($ext, @newObs) . $ext; | 1100 $realObjs{$program} .= "\034" . join ($ext, @newObs) . $ext; |
861 $depedmocs{$program} = join (".moc.$cxxsuffix " , @newObs) . ".moc.$cxxsuffix"; | 1101 $dependmocs{$program} = join (".moc.$cxxsuffix " , @newObs) . ".moc.$cxxsuffix"; |
862 foreach $file (@newObs) { | 1102 foreach $file (@newObs) { |
863 $dep_files .= " \$(DEPDIR)/$file.moc.P" if($dep_files !~/$file.moc.P/); | 1103 $dep_files .= " \$(DEPDIR)/$file.moc.P" if($dep_files !~/$file.moc.P/); |
864 } | 1104 } |
865 } | 1105 } |
866 if (@deped) { | 1106 if (@depend) { |
867 $depedmocs{$program} .= " "; | 1107 $dependmocs{$program} .= " "; |
868 $depedmocs{$program} .= join('.moc ', @deped) . ".moc"; | 1108 $dependmocs{$program} .= join('.moc ', @depend) . ".moc"; |
869 $depedmocs{$program} .= " "; | 1109 $dependmocs{$program} .= " "; |
870 } | 1110 } |
871 addMocRules (); | 1111 addMocRules (); |
872 @globalmocs{keys %mocFiles}=values %mocFiles; | 1112 @globalmocs{keys %mocFiles}=values %mocFiles; |
873 } | 1113 } |
874 | 1114 |
876 | 1116 |
877 # Returns 0 if the line was processed - 1 otherwise. | 1117 # Returns 0 if the line was processed - 1 otherwise. |
878 # Errors are logged in the global $errorflags | 1118 # Errors are logged in the global $errorflags |
879 sub tag_AUTOMAKE () | 1119 sub tag_AUTOMAKE () |
880 { | 1120 { |
881 my $lookup = '.*cd \$\(top_srcdir\)\s+&&[\s\034]+\$\(AUTOMAKE\)(.*)'; | 1121 my $lookup = '.*cd \$\(top_srcdir\)\s+&&[\034\s]+\$\(AUTOMAKE\)(.*)'; |
882 return 1 if ($MakefileData !~ /\n($lookup)\n/); | 1122 return 1 if ($MakefileData !~ /\n($lookup)\n/); |
883 print STDOUT "AUTOMAKE processing <$1>\n" if ($verbose); | 1123 print STDOUT "AUTOMAKE processing <$1>\n" if ($verbose); |
884 | 1124 |
885 my $newLine = $1."\n\tcd \$(top_srcdir) && perl $thisProg $printname"; | 1125 my $newLine = $1."\n\tcd \$(top_srcdir) && perl $thisProg $printname"; |
886 substituteLine ($lookup, $newLine); | 1126 substituteLine ($lookup, $newLine); |
887 $automkCall = $1; | 1127 $automkCall = $1; |
1128 | |
1129 $lookup = '.*cd \$\(srcdir\)\s+&&[\034\s]+\$\(AUTOCONF\)(.*)'; | |
1130 if ($MakefileData =~ /\n($lookup)\n/) { | |
1131 $newLine = "\tcd \$(srcdir) && rm -f configure && \$(MAKE) -f admin/Makefile.common configure"; | |
1132 substituteLine ($lookup, $newLine); | |
1133 } | |
1134 | |
888 return 0; | 1135 return 0; |
889 } | 1136 } |
890 | 1137 |
891 #----------------------------------------------------------------------------- | 1138 #----------------------------------------------------------------------------- |
892 | 1139 |
943 next; | 1190 next; |
944 } | 1191 } |
945 } | 1192 } |
946 closedir (THISDIR); | 1193 closedir (THISDIR); |
947 | 1194 |
948 my $lines = "SUBDIRS =$subdirs\n"; | 1195 substituteLine('SUBDIRS\s*=.*', "SUBDIRS =$subdirs"); |
949 substituteLine('SUBDIRS\s*=.*', $lines); | |
950 return 0; | 1196 return 0; |
951 } | 1197 } |
952 | 1198 |
953 sub tag_IDLFILES () | 1199 sub tag_IDLFILES () |
954 { | 1200 { |
955 my @psources = split(/[\034\s]+/, $sources{$program}); | 1201 my @psources = split(/[\034\s]+/, $sources{$program}); |
956 my $dep_lines = ""; | 1202 my $dep_lines = ""; |
957 my @cppFiles = (); | 1203 my @cppFiles = (); |
958 | 1204 |
959 foreach $source (@psources) { | 1205 foreach $source (@psources) { |
960 | |
961 my $skel = ($source =~ m/\.skel$/); | 1206 my $skel = ($source =~ m/\.skel$/); |
962 my $stub = ($source =~ m/\.stub$/); | 1207 my $stub = ($source =~ m/\.stub$/); |
963 my $signals = ($source =~ m/\.signals$/); | 1208 my $signals = ($source =~ m/\.signals$/); # obsolete, remove in KDE-4 |
964 | 1209 |
965 if ($stub || $skel || $signals) { | 1210 if ($stub || $skel || $signals) { |
966 | 1211 |
967 my $qs = quotemeta($source); | 1212 my $qs = quotemeta($source); |
968 $sources{$program} =~ s/$qs//; | 1213 $sources{$program} =~ s/$qs//; |
969 $sources_changed{$program} = 1; | 1214 $sources_changed{$program} = 1; |
970 | 1215 |
971 print STDOUT "adding IDL file $source\n" if ($verbose); | |
972 | |
973 $source =~ s/\.(stub|skel|signals)$//; | 1216 $source =~ s/\.(stub|skel|signals)$//; |
974 | |
975 my $sourcename; | 1217 my $sourcename; |
976 | 1218 |
977 if ($skel) { | 1219 if ($skel) { |
978 $sourcename = "$source\_skel"; | 1220 $sourcename = "$source\_skel"; |
979 } elsif ($stub) { | 1221 } elsif ($stub) { |
980 $sourcename = "$source\_stub"; | 1222 $sourcename = "$source\_stub"; |
981 } else { | 1223 } else { |
992 } | 1234 } |
993 } | 1235 } |
994 | 1236 |
995 if ($allidls !~ /$source\_kidl/) { | 1237 if ($allidls !~ /$source\_kidl/) { |
996 | 1238 |
997 $dep_lines .= "$source.kidl: $sourcedir$source.h \$(DCOPIDL_DEPENDENCIES)\n"; | 1239 $dep_lines .= "$source.kidl: $sourcedir$source.h \$(DCOP_DEPENDENCIES)\n"; |
998 $dep_lines .= "\t\$(DCOPIDL) $sourcedir$source.h > $source.kidl || ( rm -f $source.kidl ; /bin/false )\n"; | 1240 $dep_lines .= "\t\$(DCOPIDL) $sourcedir$source.h > $source.kidl || ( rm -f $source.kidl ; false )\n"; |
999 | 1241 |
1000 $allidls .= $source . "_kidl "; | 1242 $allidls .= $source . "_kidl "; |
1001 } | 1243 } |
1002 | 1244 |
1003 if ($allidls !~ /$sourcename/) { | 1245 if ($allidls !~ /$sourcename/) { |
1007 if ($skel) { | 1249 if ($skel) { |
1008 $dep_lines .= "$sourcename.$cxxsuffix: $source.kidl\n"; | 1250 $dep_lines .= "$sourcename.$cxxsuffix: $source.kidl\n"; |
1009 $dep_lines .= "\t\$(DCOPIDL2CPP) --c++-suffix $cxxsuffix --no-signals --no-stub $source.kidl\n"; | 1251 $dep_lines .= "\t\$(DCOPIDL2CPP) --c++-suffix $cxxsuffix --no-signals --no-stub $source.kidl\n"; |
1010 } elsif ($stub) { | 1252 } elsif ($stub) { |
1011 $dep_lines_tmp = "\t\$(DCOPIDL2CPP) --c++-suffix $cxxsuffix --no-signals --no-skel $source.kidl\n"; | 1253 $dep_lines_tmp = "\t\$(DCOPIDL2CPP) --c++-suffix $cxxsuffix --no-signals --no-skel $source.kidl\n"; |
1012 } else { # signals | 1254 } else { # signals - obsolete, remove in KDE 4 |
1013 $dep_lines_tmp = "\t\$(DCOPIDL2CPP) --c++-suffix $cxxsuffix --no-stub --no-skel $source.kidl\n"; | 1255 $dep_lines_tmp = "\t\$(DCOPIDL2CPP) --c++-suffix $cxxsuffix --no-stub --no-skel $source.kidl\n"; |
1014 } | 1256 } |
1015 | 1257 |
1016 if ($stub || $signals) { | 1258 if ($stub || $signals) { |
1017 $target_adds{"$sourcename.$cxxsuffix"} .= "$sourcename.h "; | 1259 $target_adds{"$sourcename.$cxxsuffix"} .= "$sourcename.h "; |
1064 } | 1306 } |
1065 | 1307 |
1066 sub tag_UIFILES () | 1308 sub tag_UIFILES () |
1067 { | 1309 { |
1068 my @psources = split(/[\034\s]+/, $sources{$program}); | 1310 my @psources = split(/[\034\s]+/, $sources{$program}); |
1069 my $dep_lines = ""; | |
1070 my @depFiles = (); | 1311 my @depFiles = (); |
1071 | 1312 |
1072 foreach $source (@psources) { | 1313 foreach $source (@psources) { |
1073 | 1314 |
1074 if ($source =~ m/\.ui$/) { | 1315 if ($source =~ m/\.ui$/) { |
1086 $sourcedir = '$(srcdir)/'; | 1327 $sourcedir = '$(srcdir)/'; |
1087 } | 1328 } |
1088 | 1329 |
1089 if (!$uiFiles{$source}) { | 1330 if (!$uiFiles{$source}) { |
1090 | 1331 |
1091 $dep_lines .= "$source.$cxxsuffix: $sourcedir$source.ui $source.h $source.moc\n"; | 1332 my $dep_lines = "$source.$cxxsuffix: $sourcedir$source.ui $source.h $source.moc\n"; |
1092 $dep_lines .= "\trm -f $source.$cxxsuffix\n"; | 1333 $dep_lines .= "\trm -f $source.$cxxsuffix\n"; |
1093 if (!$kdeopts{"qtonly"}) { | 1334 if (!$kdeopts{"qtonly"}) { |
1094 $dep_lines .= "\techo '#include <klocale.h>' > $source.$cxxsuffix\n"; | 1335 $dep_lines .= "\techo '#include <klocale.h>' > $source.$cxxsuffix\n"; |
1095 $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\" >> $source.$cxxsuffix || rm -f $source.$cxxsuffix\n"; | 1336 my ($mangled_source) = $source; |
1337 $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"; | |
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"; | |
1340 $dep_lines .= "\trm -f $source.$cxxsuffix.temp ;\\\n"; | |
1096 } else { | 1341 } else { |
1097 $dep_lines .= "\t\$(UIC) -i $source.h $sourcedir$source.ui > $source.$cxxsuffix || rm -f $source.$cxxsuffix\n"; | 1342 $dep_lines .= "\t\$(UIC) -i $source.h $sourcedir$source.ui > $source.$cxxsuffix; ret=\$\$?; \\\n"; |
1098 } | 1343 } |
1099 $dep_lines .= "\techo '#include \"$source.moc\"' >> $source.$cxxsuffix\n\n"; | 1344 $dep_lines .= "\tif test \"\$\$ret\" = 0; then echo '#include \"$source.moc\"' >> $source.$cxxsuffix; else rm -f $source.$cxxsuffix ; exit \$\$ret ; fi\n\n"; |
1100 $dep_lines .= "$source.h: $sourcedir$source.ui\n"; | 1345 $dep_lines .= "$source.h: $sourcedir$source.ui\n"; |
1101 $dep_lines .= "\t\$(UIC) -o $source.h $sourcedir$source.ui\n\n"; | 1346 $dep_lines .= "\t\$(UIC) -o $source.h $sourcedir$source.ui\n\n"; |
1102 $dep_lines .= "$source.moc: $source.h\n"; | 1347 $dep_lines .= "$source.moc: $source.h\n"; |
1103 $dep_lines .= "\t\$(MOC) $source.h -o $source.moc\n"; | 1348 $dep_lines .= "\t\$(MOC) $source.h -o $source.moc\n"; |
1104 | 1349 |
1350 $rule_adds{"$source.$cxxsuffix"} = $dep_lines; | |
1351 | |
1105 $uiFiles{$source} = 1; | 1352 $uiFiles{$source} = 1; |
1106 $depedmocs{$program} .= " $source.moc"; | 1353 $dependmocs{$program} .= " $source.moc"; |
1107 $globalmocs{$source} = "\035$source.h\035$source.cpp"; | 1354 $globalmocs{$source} = "\035$source.h\035$source.cpp"; |
1108 } | 1355 } |
1109 | 1356 |
1110 if ($program =~ /_la$/) { | 1357 if ($program =~ /_la$/) { |
1111 $realObjs{$program} .= " $source.lo"; | 1358 $realObjs{$program} .= " $source.lo"; |
1120 push(@cleanfiles, "source.h"); | 1367 push(@cleanfiles, "source.h"); |
1121 push(@cleanfiles, "$source.moc"); | 1368 push(@cleanfiles, "$source.moc"); |
1122 $dep_files .= " \$(DEPDIR)/$source.P" if($dep_files !~/$source.P/ ); | 1369 $dep_files .= " \$(DEPDIR)/$source.P" if($dep_files !~/$source.P/ ); |
1123 } | 1370 } |
1124 } | 1371 } |
1125 if ($dep_lines) { | |
1126 appendLines($dep_lines); | |
1127 } | |
1128 } | 1372 } |
1129 | 1373 |
1130 sub tag_ICON() | 1374 sub tag_ICON() |
1131 { | 1375 { |
1132 my $lookup = '([^\s]*)_ICON\s*=\s*([^\n]*)'; | 1376 my $lookup = '([^\s]*)_ICON\s*=[ \t]*(.*)'; |
1133 my $install = ""; | 1377 my $install = ""; |
1134 my $uninstall = ""; | 1378 my $uninstall = ""; |
1135 | 1379 |
1136 while ($MakefileData =~ /\n$lookup/og) { | 1380 while ($MakefileData =~ /\n$lookup/g) { |
1137 my $destdir; | 1381 my $destdir; |
1138 if ($1 eq "KDE") { | 1382 if ($1 eq "KDE") { |
1139 $destdir = "kde_icondir"; | 1383 $destdir = "kde_icondir"; |
1140 } else { | 1384 } else { |
1141 $destdir = $1 . "dir"; | 1385 $destdir = $1 . "dir"; |
1142 } | 1386 } |
1143 my $iconauto = ($2 =~ /AUTO\s*$/); | 1387 my $iconauto = ($2 =~ /AUTO\s*$/); |
1144 my @appnames = (); | 1388 my @appnames = (); |
1145 if ( ! $iconauto ) { | 1389 if ( ! $iconauto ) { |
1146 my @_appnames = split(" ", $2); | 1390 my $appicon_str = $2; |
1391 my @_appnames = split(" ", $appicon_str); | |
1147 print STDOUT "KDE_ICON processing <@_appnames>\n" if ($verbose); | 1392 print STDOUT "KDE_ICON processing <@_appnames>\n" if ($verbose); |
1148 foreach $appname (@_appnames) { | 1393 foreach $appname (@_appnames) { |
1149 push(@appnames, quotemeta($appname)); | 1394 push(@appnames, quotemeta($appname)); |
1150 } | 1395 } |
1151 } else { | 1396 } else { |
1158 next if ($entry eq "CVS" || $entry =~ /^\./ || $entry =~ /^Makefile/ || $entry =~ /~$/ || $entry =~ /^\#.*\#$/); | 1403 next if ($entry eq "CVS" || $entry =~ /^\./ || $entry =~ /^Makefile/ || $entry =~ /~$/ || $entry =~ /^\#.*\#$/); |
1159 next if (! -f $entry); | 1404 next if (! -f $entry); |
1160 if ( $iconauto ) | 1405 if ( $iconauto ) |
1161 { | 1406 { |
1162 push(@files, $entry) | 1407 push(@files, $entry) |
1163 if ($entry =~ /\.xpm/ || $entry =~ /\.png/ || $entry =~ /\.mng/); | 1408 if ($entry =~ /\.xpm/ || $entry =~ /\.png/ || $entry =~ /\.mng/ || $entry =~ /\.svg/); |
1164 } else { | 1409 } else { |
1165 foreach $appname (@appnames) { | 1410 foreach $appname (@appnames) { |
1166 push(@files, $entry) | 1411 push(@files, $entry) |
1167 if ($entry =~ /-$appname\.xpm/ || $entry =~ /-$appname\.png/ || $entry =~ /-$appname\.mng/); | 1412 if ($entry =~ /-$appname\.xpm/ || $entry =~ /-$appname\.png/ || $entry =~ /-$appname\.mng/ || $entry =~ /-$appname\.svg/); |
1168 } | 1413 } |
1169 } | 1414 } |
1170 } | 1415 } |
1171 closedir (THISDIR); | 1416 closedir (THISDIR); |
1172 | 1417 |
1173 my %directories = (); | 1418 my %directories = (); |
1174 | 1419 |
1175 foreach $file (@files) { | 1420 foreach $file (@files) { |
1176 my $newfile = $file; | 1421 my $newfile = $file; |
1177 my $prefix = $file; | 1422 my $prefix = $file; |
1178 $prefix =~ s/\.(png|xpm|mng)$//; | 1423 $prefix =~ s/\.(png|xpm|mng|svg|svgz)$//; |
1179 my $appname = $prefix; | 1424 my $appname = $prefix; |
1180 $appname =~ s/^[^-]+-// if ($appname =~ /-/) ; | 1425 $appname =~ s/^[^-]+-// if ($appname =~ /-/) ; |
1181 $appname =~ s/^[^-]+-// if ($appname =~ /-/) ; | 1426 $appname =~ s/^[^-]+-// if ($appname =~ /-/) ; |
1182 $appname = quotemeta($appname); | 1427 $appname = quotemeta($appname); |
1183 $prefix =~ s/$appname$//; | 1428 $prefix =~ s/$appname$//; |
1198 'app' => 'apps', | 1443 'app' => 'apps', |
1199 'device' => 'devices', | 1444 'device' => 'devices', |
1200 'filesys' => 'filesystems', | 1445 'filesys' => 'filesystems', |
1201 'mime' => 'mimetypes' | 1446 'mime' => 'mimetypes' |
1202 ); | 1447 ); |
1203 | 1448 |
1204 if (! defined $type_hash{$type} ) { | 1449 if (! defined $type_hash{$type} ) { |
1205 print STDERR "unknown icon type $type in $printname ($file)\n"; | 1450 print STDERR "unknown icon type $type in $printname ($file)\n"; |
1206 next; | 1451 next; |
1207 } | 1452 } |
1208 | 1453 |
1209 my %dir_hash = | 1454 my %dir_hash = |
1210 ( | 1455 ( |
1211 'los' => 'locolor/16x16', | 1456 'los' => 'locolor/16x16', |
1212 'lom' => 'locolor/32x32', | 1457 'lom' => 'locolor/32x32', |
1213 'him' => 'hicolor/32x32', | 1458 'him' => 'hicolor/32x32', |
1218 'hi16' => 'hicolor/16x16', | 1463 'hi16' => 'hicolor/16x16', |
1219 'hi22' => 'hicolor/22x22', | 1464 'hi22' => 'hicolor/22x22', |
1220 'hi32' => 'hicolor/32x32', | 1465 'hi32' => 'hicolor/32x32', |
1221 'hi48' => 'hicolor/48x48', | 1466 'hi48' => 'hicolor/48x48', |
1222 'hi64' => 'hicolor/64x64', | 1467 'hi64' => 'hicolor/64x64', |
1223 'hisc' => 'hicolor/scalable' | 1468 'hi128' => 'hicolor/128x128', |
1469 'hisc' => 'hicolor/scalable', | |
1470 'cr16' => 'crystalsvg/16x16', | |
1471 'cr22' => 'crystalsvg/22x22', | |
1472 'cr32' => 'crystalsvg/32x32', | |
1473 'cr48' => 'crystalsvg/48x48', | |
1474 'cr64' => 'crystalsvg/64x64', | |
1475 'cr128' => 'crystalsvg/128x128', | |
1476 'crsc' => 'crystalsvg/scalable' | |
1224 ); | 1477 ); |
1225 | 1478 |
1226 $newfile =~ s@.*-($appname\.(png|xpm|mng?))@$1@; | 1479 $newfile =~ s@.*-($appname\.(png|xpm|mng|svgz|svg?))@$1@; |
1227 | 1480 |
1228 if (! defined $dir_hash{$prefix}) { | 1481 if (! defined $dir_hash{$prefix}) { |
1229 print STDERR "unknown icon prefix $prefix in $printname\n"; | 1482 print STDERR "unknown icon prefix $prefix in $printname\n"; |
1230 next; | 1483 next; |
1231 } | 1484 } |
1274 $allgmofiles .= " $1.gmo"; | 1527 $allgmofiles .= " $1.gmo"; |
1275 $pofileLine .= " $1.po"; | 1528 $pofileLine .= " $1.po"; |
1276 } | 1529 } |
1277 appendLines ($tmp); | 1530 appendLines ($tmp); |
1278 my $lookup = 'POFILES\s*=([^\n]*)'; | 1531 my $lookup = 'POFILES\s*=([^\n]*)'; |
1279 if ($MakefileData !~ /\n$lookup/o) { | 1532 if ($MakefileData !~ /\n$lookup/) { |
1280 appendLines("$pofileLine\nGMOFILES =$allgmofiles"); | 1533 appendLines("$pofileLine\nGMOFILES =$allgmofiles"); |
1281 } else { | 1534 } else { |
1282 substituteLine ($lookup, "$pofileLine\nGMOFILES =$allgmofiles"); | 1535 substituteLine ($lookup, "$pofileLine\nGMOFILES =$allgmofiles"); |
1283 } | 1536 } |
1284 | 1537 |
1287 # Add the "clean" rule so that the maintainer-clean does something | 1540 # Add the "clean" rule so that the maintainer-clean does something |
1288 appendLines ("clean-nls:\n\t-rm -f $allgmofiles\n"); | 1541 appendLines ("clean-nls:\n\t-rm -f $allgmofiles\n"); |
1289 | 1542 |
1290 $target_adds{"maintainer-clean"} .= "clean-nls "; | 1543 $target_adds{"maintainer-clean"} .= "clean-nls "; |
1291 | 1544 |
1292 $lookup = 'DISTFILES\s*=\s*(.*)'; | 1545 $lookup = 'DISTFILES\s*=[ \t]*(.*)'; |
1293 if ($MakefileData =~ /\n$lookup\n/o) { | 1546 if ($MakefileData =~ /\n$lookup/) { |
1294 $tmp = "DISTFILES = \$(GMOFILES) \$(POFILES) $1"; | 1547 $tmp = "DISTFILES = \$(GMOFILES) \$(POFILES) $1"; |
1295 substituteLine ($lookup, $tmp); | 1548 substituteLine ($lookup, $tmp); |
1296 } | 1549 } |
1297 } | 1550 } |
1298 | 1551 |
1310 } | 1563 } |
1311 | 1564 |
1312 $tmp .= "; do \\\n"; | 1565 $tmp .= "; do \\\n"; |
1313 if ($lang) { | 1566 if ($lang) { |
1314 $tmp .= "\t echo \$(INSTALL_DATA) \$\$base.gmo \$(DESTDIR)\$(kde_locale)/$lang/LC_MESSAGES/\$\$base.mo ;\\\n"; | 1567 $tmp .= "\t echo \$(INSTALL_DATA) \$\$base.gmo \$(DESTDIR)\$(kde_locale)/$lang/LC_MESSAGES/\$\$base.mo ;\\\n"; |
1315 $tmp .= "\t test ! -f \$\$base.gmo || \$(INSTALL_DATA) \$\$base.gmo \$(DESTDIR)\$(kde_locale)/$lang/LC_MESSAGES/\$\$base.mo ;\\\n" | 1568 $tmp .= "\t if test -f \$\$base.gmo; then \$(INSTALL_DATA) \$\$base.gmo \$(DESTDIR)\$(kde_locale)/$lang/LC_MESSAGES/\$\$base.mo ;\\\n"; |
1569 $tmp .= "\t elif test -f \$(srcdir)/\$\$base.gmo; then \$(INSTALL_DATA) \$(srcdir)/\$\$base.gmo \$(DESTDIR)\$(kde_locale)/$lang/LC_MESSAGES/\$\$base.mo ;\\\n"; | |
1570 $tmp .= "\t fi ;\\\n"; | |
1316 } else { | 1571 } else { |
1317 $tmp .= "\t echo \$(INSTALL_DATA) \$\$base.gmo \$(DESTDIR)\$(kde_locale)/\$\$base/LC_MESSAGES/\$(PACKAGE).mo ;\\\n"; | 1572 $tmp .= "\t echo \$(INSTALL_DATA) \$\$base.gmo \$(DESTDIR)\$(kde_locale)/\$\$base/LC_MESSAGES/\$(PACKAGE).mo ;\\\n"; |
1318 $tmp .= "\t \$(mkinstalldirs) \$(DESTDIR)\$(kde_locale)/\$\$base/LC_MESSAGES ; \\\n"; | 1573 $tmp .= "\t \$(mkinstalldirs) \$(DESTDIR)\$(kde_locale)/\$\$base/LC_MESSAGES ; \\\n"; |
1319 $tmp .= "\t test ! -f \$\$base.gmo || \$(INSTALL_DATA) \$\$base.gmo \$(DESTDIR)\$(kde_locale)/\$\$base/LC_MESSAGES/\$(PACKAGE).mo ;\\\n"; | 1574 $tmp .= "\t if test -f \$\$base.gmo; then \$(INSTALL_DATA) \$\$base.gmo \$(DESTDIR)\$(kde_locale)/\$\$base/LC_MESSAGES/\$(PACKAGE).mo ;\\\n"; |
1575 $tmp .= "\t elif test -f \$(srcdir)/\$\$base.gmo; then \$(INSTALL_DATA) \$(srcdir)/\$\$base.gmo \$(DESTDIR)\$(kde_locale)/\$\$base/LC_MESSAGES/\$(PACKAGE).mo ;\\\n"; | |
1576 $tmp .= "\t fi ;\\\n"; | |
1320 } | 1577 } |
1321 $tmp .= "\tdone\n\n"; | 1578 $tmp .= "\tdone\n\n"; |
1322 appendLines ($tmp); | 1579 appendLines ($tmp); |
1323 | 1580 |
1324 $target_adds{"uninstall"} .= "uninstall-nls "; | 1581 $target_adds{"uninstall"} .= "uninstall-nls "; |
1364 # Returns 0 if the line was processed - 1 otherwise. | 1621 # Returns 0 if the line was processed - 1 otherwise. |
1365 # Errors are logged in the global $errorflags | 1622 # Errors are logged in the global $errorflags |
1366 sub tag_POFILES () | 1623 sub tag_POFILES () |
1367 { | 1624 { |
1368 my $lookup = 'POFILES\s*=([^\n]*)'; | 1625 my $lookup = 'POFILES\s*=([^\n]*)'; |
1369 return 1 if ($MakefileData !~ /\n$lookup/o); | 1626 return 1 if ($MakefileData !~ /\n$lookup/); |
1370 print STDOUT "POFILES processing <$1>\n" if ($verbose); | 1627 print STDOUT "POFILES processing <$1>\n" if ($verbose); |
1371 | 1628 |
1372 my $tmp = $1; | 1629 my $tmp = $1; |
1373 | 1630 |
1374 # make sure these are all gone. | 1631 # make sure these are all gone. |
1403 return 0; | 1660 return 0; |
1404 } | 1661 } |
1405 | 1662 |
1406 sub helper_LOCALINSTALL($) | 1663 sub helper_LOCALINSTALL($) |
1407 { | 1664 { |
1408 my $lookup = "\n" . $_[0] . ":"; | 1665 my $lookup = "\035" . $_[0] . " *:[^\035]*\035\t"; |
1409 if ($MakefileData =~ /($lookup)/) { | 1666 my $copy = $MakefileData; |
1410 | 1667 $copy =~ s/\n/\035/g; |
1411 my $install = $MakefileData; | 1668 if ($copy =~ /($lookup.*)$/) { |
1412 $install =~ s/\n/\035/g; | 1669 |
1413 $install =~ s/.*\035$_[0]:[^\035]*\035//; | 1670 $install = $1; |
1671 $install =~ s/\035$_[0] *:[^\035]*\035//; | |
1414 my $emptyline = 0; | 1672 my $emptyline = 0; |
1415 while (! $emptyline) { | 1673 while (! $emptyline ) { |
1416 if ($install =~ /([^\035]*)\035(.*)/) { | 1674 if ($install =~ /([^\035]*)\035(.*)/) { |
1417 local $line = $1; | 1675 local $line = $1; |
1418 $install = $2; | 1676 $install = $2; |
1419 if ($line !~ /^\s*$/ && $line !~ /^(\@.*\@)*\t/) { | 1677 if ($line !~ /^\s*$/ && $line !~ /^(\@.*\@)*\t/) { |
1420 $emptyline = 1; | 1678 $emptyline = 1; |
1453 substituteLine($_[0], $line); | 1711 substituteLine($_[0], $line); |
1454 } | 1712 } |
1455 } | 1713 } |
1456 | 1714 |
1457 #--------------------------------------------------------------------------- | 1715 #--------------------------------------------------------------------------- |
1716 # libtool is very hard to persuade it could use -Wl,--no-undefined for making | |
1717 # -no-undefined actually work | |
1718 # append $(KDE_NO_UNFINED) after every -no-undefined in LDFLAGS | |
1719 # this may go away if libtool ever does this on its own | |
1720 sub tag_NO_UNDEFINED () { | |
1721 return if ($program !~ /_la$/); | |
1722 | |
1723 my $lookup = quotemeta($realname{$program}) . ":.*?\n\t.*?\\((.*?)\\) .*\n"; | |
1724 $MakefileData =~ m/$lookup/; | |
1725 return if (!defined($1)); | |
1726 return if ($1 !~ /CXXLINK/); | |
1727 | |
1728 if ($MakefileData !~ /\n$program\_LDFLAGS\s*=.*-no-undefined/ ) { | |
1729 return; | |
1730 } | |
1731 | |
1732 $lookup = $program . '\_LDFLAGS(\s*)=(.*)-no-undefined(.*)'; | |
1733 if ($MakefileData =~ /\n$lookup\n/) { | |
1734 my $replace = $program . "\_LDFLAGS$1=$2-no-undefined \$(KDE_NO_UNDEFINED)$3"; | |
1735 substituteLine($lookup, $replace); | |
1736 } | |
1737 } | |
1738 | |
1458 sub tag_CLOSURE () { | 1739 sub tag_CLOSURE () { |
1459 return if ($program !~ /_la$/); | 1740 return if ($program !~ /_la$/); |
1460 | 1741 |
1461 my $lookup = quotemeta($realname{$program}) . ":.*?\n\t.*?\\((.*?)\\) .*\n"; | 1742 my $lookup = quotemeta($realname{$program}) . ":.*?\n\t.*?\\((.*?)\\) .*\n"; |
1462 $MakefileData =~ m/$lookup/; | 1743 $MakefileData =~ m/$lookup/; |
1744 return if (!defined($1)); | |
1463 return if ($1 !~ /CXXLINK/); | 1745 return if ($1 !~ /CXXLINK/); |
1464 | 1746 |
1465 if ($MakefileData !~ /\n$program\_LDFLAGS\s*=.*-no-undefined/ && | 1747 if ($MakefileData !~ /\n$program\_LDFLAGS\s*=.*-no-undefined/ && |
1466 $MakefileData !~ /\n$program\_LDFLAGS\s*=.*KDE_PLUGIN/ ) { | 1748 $MakefileData !~ /\n$program\_LDFLAGS\s*=.*KDE_PLUGIN/ ) { |
1467 print STDERR "Report: $program contains undefined in $printname\n" if ($program =~ /^lib/ && $dryrun); | 1749 print STDERR "Report: $program contains undefined in $printname\n" if ($program =~ /^lib/ && $dryrun); |
1468 return; | 1750 return; |
1469 } | 1751 } |
1752 | |
1470 my $closure = $realname{$program} . ".closure"; | 1753 my $closure = $realname{$program} . ".closure"; |
1471 my $lines = "$closure: \$($program\_OBJECTS) \$($program\_DEPENDENCIES)\n"; | 1754 my $lines = "$closure: \$($program\_OBJECTS) \$($program\_DEPENDENCIES)\n"; |
1472 $lines .= "\t\@echo \"int main() {return 0;}\" > $program\_closure.$cxxsuffix\n"; | 1755 $lines .= "\t\@echo \"int main() {return 0;}\" > $program\_closure.$cxxsuffix\n"; |
1473 $lines .= "\t\@\$\(LTCXXCOMPILE\) -c $program\_closure.$cxxsuffix\n"; | 1756 $lines .= "\t\@\$\(LTCXXCOMPILE\) -c $program\_closure.$cxxsuffix\n"; |
1474 $lines .= "\t\$\(CXXLINK\) $program\_closure.lo \$($program\_LDFLAGS) \$($program\_OBJECTS) \$($program\_LIBADD) \$(LIBS)\n"; | 1757 $lines .= "\t\$\(CXXLINK\) $program\_closure.lo \$($program\_LDFLAGS) \$($program\_OBJECTS) \$($program\_LIBADD) \$(LIBS)\n"; |
1483 substituteLine($lookup, $lines); | 1766 substituteLine($lookup, $lines); |
1484 } | 1767 } |
1485 $closure_output .= " $closure"; | 1768 $closure_output .= " $closure"; |
1486 } | 1769 } |
1487 | 1770 |
1771 sub tag_NMCHECK () { | |
1772 return if ($program !~ /_la$/); | |
1773 my $lookup = quotemeta($realname{$program}) . ":.*?\n\t.*?\\((.*?)\\) .*\n"; | |
1774 $MakefileData =~ m/$lookup/; | |
1775 my $linkcmd = $1; | |
1776 return if (!defined($1)); | |
1777 return if ($linkcmd !~ /CXXLINK/ && $linkcmd !~ /LINK/); | |
1778 | |
1779 $lookup = $program . '_NMCHECK\s*=([^\n]*)'; | |
1780 if( $MakefileData !~ m/\n$lookup\n/ ) { | |
1781 return; | |
1782 } | |
1783 my $allowed = $1; | |
1784 $allowed =~ s/^ *//; | |
1785 $lookup = $program . '_NMCHECKWEAK\s*=([^\n]*)'; | |
1786 my $weak = ""; | |
1787 my $is_weak = 0; | |
1788 if( $MakefileData =~ m/\n$lookup\n/ ) { | |
1789 $weak = $1; | |
1790 $is_weak = 1; | |
1791 } | |
1792 $weak =~ s/^ *//; | |
1793 | |
1794 if( $is_weak ) | |
1795 { | |
1796 $weak = '--allowweak=\'' . $weak . '\' '; | |
1797 } | |
1798 my $nmline = "\@KDE_USE_NMCHECK_TRUE@\t\@\$(MAKE) \$(AM_MAKEFLAGS) nmcheck_$realname{$program} || ( rm -f $realname{$program}; exit 1 )"; | |
1799 $lookup = '(\t\$\(CXXLINK\)[^\n]*' . $program . '_OBJECTS[^\n]*)'; | |
1800 if( $MakefileData =~ /\n$lookup\n/ ) { | |
1801 my $oldstuff = $1; | |
1802 substituteLine( $lookup, $oldstuff . "\n" . $nmline ); | |
1803 } | |
1804 $lookup = '(\t\$\(LINK\)[^\n]*' . $program . '_OBJECTS[^\n]*)'; | |
1805 if( $MakefileData =~ /\n$lookup\n/ ) { | |
1806 my $oldstuff = $1; | |
1807 substituteLine( $lookup, $oldstuff . "\n" . $nmline ); | |
1808 } | |
1809 $nmline = "\@\$(top_srcdir)/admin/nmcheck $realname{$program} \'$allowed\' $weak"; | |
1810 appendLines( "\nnmcheck_$realname{$program}: $realname{$program} \n\t$nmline\n" ); | |
1811 $target_adds{ "nmcheck" } .= "nmcheck_$realname{$program} "; | |
1812 } | |
1813 | |
1488 sub tag_DIST () { | 1814 sub tag_DIST () { |
1489 my %foundfiles = (); | 1815 my %foundfiles = (); |
1490 opendir (THISDIR, "."); | 1816 opendir (THISDIR, "."); |
1491 foreach $entry (readdir(THISDIR)) { | 1817 foreach $entry (readdir(THISDIR)) { |
1492 next if ($entry eq "CVS" || $entry =~ /^\./ || $entry =~ /^Makefile$$/ || $entry =~ /~$/ || $entry =~ /^\#.*\#$/); | 1818 next if ($entry eq "CVS" || $entry =~ /^\./ || $entry eq "Makefile" || $entry =~ /~$/ || $entry =~ /^\#.*\#$/); |
1493 next if (! -f $entry); | 1819 next if (! -f $entry); |
1494 next if ($entry =~ /\.moc/ || $entry =~ /\.lo$/ || $entry =~ /\.la$/ || $entry =~ /\.o/); | 1820 next if ($entry =~ /\.moc/ || $entry =~ /\.moc.$cppExt$/ || $entry =~ /\.lo$/ || $entry =~ /\.la$/ || $entry =~ /\.o/); |
1495 next if ($entry =~ /.+meta_unload.$cppExt$/ || $entry =~ /\.all_$cppExt\.$cppExt$/); | 1821 next if ($entry =~ /\.all_$cppExt\.$cppExt$/); |
1496 $foundfiles{$entry} = 1; | 1822 $foundfiles{$entry} = 1; |
1497 } | 1823 } |
1498 closedir (THISDIR); | 1824 closedir (THISDIR); |
1499 | 1825 |
1500 # doing this for MAINTAINERCLEANFILES would be wrong | 1826 # doing this for MAINTAINERCLEANFILES would be wrong |
1501 my @marks = ("EXTRA_DIST", "DIST_COMMON", '\S*_SOURCES', '\S*_HEADERS', 'CLEANFILES', 'DISTCLEANFILES', '\S*_OBJECTS'); | 1827 my @marks = ("EXTRA_DIST", "DIST_COMMON", '\S*_SOURCES', '\S*_HEADERS', 'CLEANFILES', 'DISTCLEANFILES', '\S*_OBJECTS'); |
1502 foreach $mark (@marks) { | 1828 foreach $mark (@marks) { |
1503 while ($MakefileData =~ /\n($mark)\s*=\s*([^\n]*)/g) { | 1829 while ($MakefileData =~ /\n($mark)\s*=[ \t]*([^\n]*)/g) { |
1504 foreach $file (split('[\034\s]', $2)) { | 1830 my $cleanfiles_str = $2; |
1831 foreach $file (split('[\034\s]+', $cleanfiles_str)) { | |
1505 $file =~ s/\.\///; | 1832 $file =~ s/\.\///; |
1506 $foundfiles{$file} = 0 if (defined $foundfiles{$file}); | 1833 $foundfiles{$file} = 0 if (defined $foundfiles{$file}); |
1507 } | 1834 } |
1508 } | 1835 } |
1509 } | 1836 } |
1510 my @files = ("Makefile", "config.cache", "config.log", "stamp-h", | 1837 my @files = ("Makefile", "config.cache", "config.log", "stamp-h", |
1511 "stamp-h1", "stamp-h1", "config.h", "Makefile", "config.status", "config.h", "libtool"); | 1838 "stamp-h1", "stamp-h1", "config.h", "Makefile", |
1839 "config.status", "config.h", "libtool", "core" ); | |
1512 foreach $file (@files) { | 1840 foreach $file (@files) { |
1513 $foundfiles{$file} = 0 if (defined $foundfiles{$file}); | 1841 $foundfiles{$file} = 0 if (defined $foundfiles{$file}); |
1514 } | 1842 } |
1515 | 1843 |
1516 my $KDE_DIST = ""; | 1844 my $KDE_DIST = ""; |
1519 $KDE_DIST .= "$file "; | 1847 $KDE_DIST .= "$file "; |
1520 } | 1848 } |
1521 } | 1849 } |
1522 if ($KDE_DIST) { | 1850 if ($KDE_DIST) { |
1523 print "KDE_DIST $printname $KDE_DIST\n" if ($verbose); | 1851 print "KDE_DIST $printname $KDE_DIST\n" if ($verbose); |
1524 | 1852 |
1525 my $lookup = "DISTFILES *=(.*)"; | 1853 my $lookup = 'DISTFILES\s*=[ \t]*(.*)'; |
1526 if ($MakefileData =~ /\n$lookup\n/o) { | 1854 if ($MakefileData =~ /\n$lookup/) { |
1527 substituteLine($lookup, "KDE_DIST=$KDE_DIST\n\nDISTFILES=$1 \$(KDE_DIST)\n"); | 1855 substituteLine($lookup, "DISTFILES = $1 \$(KDE_DIST)"); |
1856 appendLines("KDE_DIST=$KDE_DIST\n"); | |
1528 } | 1857 } |
1529 } | 1858 } |
1530 } | 1859 } |
1531 | 1860 |
1532 #----------------------------------------------------------------------------- | 1861 #----------------------------------------------------------------------------- |
1533 # Returns 0 if the line was processed - 1 otherwise. | 1862 # Returns 0 if the line was processed - 1 otherwise. |
1534 # Errors are logged in the global $errorflags | 1863 # Errors are logged in the global $errorflags |
1535 sub tag_DOCFILES () | 1864 sub tag_DOCFILES () |
1536 { | 1865 { |
1537 # if ($MakefileData =~ /\nSUBDIRS\s*=/) { # subdirs | |
1538 # $MakefileData =~ /\n(.*-recursive:\s*)\n/; | |
1539 # my $orig_rules = $1; | |
1540 # my $rules = $orig_rules; | |
1541 # $rules =~ s/:\s*$//; | |
1542 # substituteLine($orig_rules, "$rules docs-recursive:"); | |
1543 # appendLines("docs: docs-recursive docs-am\n"); | |
1544 # } else { | |
1545 # appendLines("docs: docs-am\n"); | |
1546 # } | |
1547 $target_adds{"all"} .= "docs-am "; | 1866 $target_adds{"all"} .= "docs-am "; |
1548 | 1867 |
1549 my $lookup = 'KDE_DOCS\s*=\s*([^\n]*)'; | 1868 my $lookup = 'KDE_DOCS\s*=[ \t]*([^\n]*)'; |
1550 goto nodocs if ($MakefileData !~ /\n$lookup/o); | 1869 goto nodocs if ($MakefileData !~ /\n$lookup/); |
1551 print STDOUT "KDE_DOCS processing <$1>\n" if ($verbose); | 1870 print STDOUT "KDE_DOCS processing <$1>\n" if ($verbose); |
1552 | 1871 |
1553 my $tmp = $1; | 1872 my $tmp = $1; |
1554 | 1873 |
1555 # Either find the files in the directory (AUTO) or use | 1874 # Either find the files in the directory (AUTO) or use |
1567 | 1886 |
1568 if ($tmp !~ / - /) | 1887 if ($tmp !~ / - /) |
1569 { | 1888 { |
1570 opendir (THISDIR, "."); | 1889 opendir (THISDIR, "."); |
1571 foreach $entry (readdir(THISDIR)) { | 1890 foreach $entry (readdir(THISDIR)) { |
1572 next if ($entry eq "CVS" || $entry =~ /^\./ || $entry =~ /^Makefile/ || $entry =~ /~$/ || $entry =~ /^\#.*\#$/); | 1891 next if ($entry eq "CVS" || $entry =~ /^\./ || $entry =~ /^Makefile/ || $entry =~ /~$/ || $entry =~ /^\#.*\#$/ || $entry eq "core" || $entry eq "index.cache.bz2"); |
1573 next if (! -f $entry); | 1892 next if (! -f $entry); |
1574 $files .= "$entry "; | 1893 $files .= "$entry "; |
1575 } | 1894 } |
1576 closedir (THISDIR); | 1895 closedir (THISDIR); |
1577 print STDOUT "docfiles found = $files\n" if ($verbose); | 1896 print STDOUT "docfiles found = $files\n" if ($verbose); |
1583 $files = $tmp; | 1902 $files = $tmp; |
1584 } | 1903 } |
1585 goto nodocs if (!$files); # Nothing to do | 1904 goto nodocs if (!$files); # Nothing to do |
1586 | 1905 |
1587 if ($files =~ /(^| )index\.docbook($| )/) { | 1906 if ($files =~ /(^| )index\.docbook($| )/) { |
1588 | 1907 |
1589 my $lines = ""; | 1908 my $lines = ""; |
1590 my $lookup = 'MEINPROC\s*='; | 1909 my $lookup = 'MEINPROC\s*='; |
1591 if ($MakefileData !~ /\n($lookup)/) { | 1910 if ($MakefileData !~ /\n($lookup)/) { |
1592 $lines = "MEINPROC=/\$(kde_bindir)/meinproc\n"; | 1911 $lines = "MEINPROC=/\$(kde_bindir)/meinproc\n"; |
1593 } | 1912 } |
1596 $lines .= "KDE_XSL_STYLESHEET=/\$(kde_datadir)/ksgmltools2/customization/kde-chunk.xsl\n"; | 1915 $lines .= "KDE_XSL_STYLESHEET=/\$(kde_datadir)/ksgmltools2/customization/kde-chunk.xsl\n"; |
1597 } | 1916 } |
1598 $lookup = '\nindex.cache.bz2:'; | 1917 $lookup = '\nindex.cache.bz2:'; |
1599 if ($MakefileData !~ /\n($lookup)/) { | 1918 if ($MakefileData !~ /\n($lookup)/) { |
1600 $lines .= "index.cache.bz2: \$(srcdir)/index.docbook \$(KDE_XSL_STYLESHEET) $files\n"; | 1919 $lines .= "index.cache.bz2: \$(srcdir)/index.docbook \$(KDE_XSL_STYLESHEET) $files\n"; |
1601 $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"; | 1920 $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"; |
1602 $lines .= "\n"; | 1921 $lines .= "\n"; |
1603 } | 1922 } |
1604 | 1923 |
1605 $lines .= "docs-am: index.cache.bz2\n"; | 1924 $lines .= "docs-am: index.cache.bz2\n"; |
1606 $lines .= "\n"; | 1925 $lines .= "\n"; |
1607 $lines .= "install-docs: docs-am install-nls\n"; | 1926 $lines .= "install-docs: docs-am install-nls\n"; |
1608 $lines .= "\t\$(mkinstalldirs) \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname\n"; | 1927 $lines .= "\t\$(mkinstalldirs) \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname\n"; |
1609 $lines .= "\t\@if test -f index.cache.bz2; then \\\n"; | 1928 $lines .= "\t\@if test -f index.cache.bz2; then \\\n"; |
1610 $lines .= "\techo \$(INSTALL_DATA) index.cache.bz2 \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/; \\\n"; | 1929 $lines .= "\techo \$(INSTALL_DATA) index.cache.bz2 \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/; \\\n"; |
1611 $lines .= "\t\$(INSTALL_DATA) index.cache.bz2 \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/; \\\n"; | 1930 $lines .= "\t\$(INSTALL_DATA) index.cache.bz2 \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/; \\\n"; |
1931 $lines .= "\telif test -f \$(srcdir)/index.cache.bz2; then \\\n"; | |
1932 $lines .= "\techo \$(INSTALL_DATA) \$(srcdir)/index.cache.bz2 \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/; \\\n"; | |
1933 $lines .= "\t\$(INSTALL_DATA) \$(srcdir)/index.cache.bz2 \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/; \\\n"; | |
1612 $lines .= "\tfi\n"; | 1934 $lines .= "\tfi\n"; |
1613 $lines .= "\t-rm -f \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/common\n"; | 1935 $lines .= "\t-rm -f \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/common\n"; |
1614 $lines .= "\t\$(LN_S) \$(kde_libs_htmldir)/$kdelang/common \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/common\n"; | 1936 $lines .= "\t\$(LN_S) \$(kde_libs_htmldir)/$kdelang/common \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/common\n"; |
1615 | 1937 |
1616 $lines .= "\n"; | 1938 $lines .= "\n"; |
1626 appendLines ($lines); | 1948 appendLines ($lines); |
1627 } else { | 1949 } else { |
1628 appendLines("docs-am: $files\n"); | 1950 appendLines("docs-am: $files\n"); |
1629 } | 1951 } |
1630 | 1952 |
1631 $target_adds{"install-data-am"} .= "install-nls"; | 1953 $target_adds{"install-data-am"} .= "install-nls "; |
1632 $target_adds{"uninstall"} .= "uninstall-nls "; | 1954 $target_adds{"uninstall"} .= "uninstall-nls "; |
1633 | 1955 |
1634 $tmp = "install-nls:\n"; | 1956 $tmp = "install-nls:\n"; |
1635 $tmp .= "\t\$(mkinstalldirs) \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname\n"; | 1957 $tmp .= "\t\$(mkinstalldirs) \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname\n"; |
1636 $tmp .= "\t\@for base in $files; do \\\n"; | 1958 $tmp .= "\t\@for base in $files; do \\\n"; |
1637 $tmp .= "\t echo \$(INSTALL_DATA) \$\$base \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/\$\$base ;\\\n"; | 1959 $tmp .= "\t echo \$(INSTALL_DATA) \$\$base \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/\$\$base ;\\\n"; |
1638 $tmp .= "\t \$(INSTALL_DATA) \$(srcdir)/\$\$base \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/\$\$base ;\\\n"; | 1960 $tmp .= "\t \$(INSTALL_DATA) \$(srcdir)/\$\$base \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/\$\$base ;\\\n"; |
1639 $tmp .= "\tdone\n"; | 1961 $tmp .= "\tdone\n"; |
1640 if ($appname eq 'common') { | 1962 if ($appname eq 'common') { |
1641 $tmp .= "\t\@echo \"merging common and language specific dir\" ;\\\n"; | 1963 $tmp .= "\t\@echo \"merging common and language specific dir\" ;\\\n"; |
1642 $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"; | 1964 $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"; |
1643 $tmp .= "\t\@com_files=`cd \$(kde_htmldir)/en/common && echo *` ;\\\n"; | 1965 $tmp .= "\t\@com_files=`cd \$(kde_htmldir)/en/common && echo *` ;\\\n"; |
1644 $tmp .= "\tcd \$(DESTDIR)\$(kde_htmldir)/$kdelang/common ;\\\n"; | 1966 $tmp .= "\tcd \$(DESTDIR)\$(kde_htmldir)/$kdelang/common ;\\\n"; |
1645 $tmp .= "\tif test -n \"\$\$com_files\"; then for p in \$\$com_files ; do \\\n"; | 1967 $tmp .= "\tif test -n \"\$\$com_files\"; then for p in \$\$com_files ; do \\\n"; |
1646 $tmp .= "\t case \" $files \" in \\\n"; | 1968 $tmp .= "\t case \" $files \" in \\\n"; |
1647 $tmp .= "\t *\" \$\$p \"*) ;; \\\n"; | 1969 $tmp .= "\t *\" \$\$p \"*) ;; \\\n"; |
1648 $tmp .= "\t *) test ! -e \$\$p && echo \$(LN_S) ../../en/common/\$\$p \$(DESTDIR)\$(kde_htmldir)/$kdelang/common/\$\$p && \$(LN_S) ../../en/common/\$\$p \$\$p ;; \\\n"; | 1970 $tmp .= "\t *) test ! -f \$\$p && echo \$(LN_S) ../../en/common/\$\$p \$(DESTDIR)\$(kde_htmldir)/$kdelang/common/\$\$p && \$(LN_S) ../../en/common/\$\$p \$\$p ;; \\\n"; |
1649 $tmp .= "\t esac ; \\\n"; | 1971 $tmp .= "\t esac ; \\\n"; |
1650 $tmp .= "\tdone ; fi ; true\n"; | 1972 $tmp .= "\tdone ; fi ; true\n"; |
1651 } | 1973 } |
1652 $tmp .= "\n"; | 1974 $tmp .= "\n"; |
1653 $tmp .= "uninstall-nls:\n"; | 1975 $tmp .= "uninstall-nls:\n"; |
1694 $hfsize = tell(HFIN); | 2016 $hfsize = tell(HFIN); |
1695 seek(HFIN, 0, 0); | 2017 seek(HFIN, 0, 0); |
1696 read HFIN, $hfData, $hfsize; | 2018 read HFIN, $hfData, $hfsize; |
1697 close HFIN; | 2019 close HFIN; |
1698 # push (@list, $hf) if(index($hfData, "Q_OBJECT") >= 0); ### fast but doesn't handle //Q_OBJECT | 2020 # push (@list, $hf) if(index($hfData, "Q_OBJECT") >= 0); ### fast but doesn't handle //Q_OBJECT |
1699 if ( $hfData =~ /{([^}]*)Q_OBJECT/s ) { ## handle " { friend class blah; Q_OBJECT " | 2021 # handle " { friend class blah; Q_OBJECT ", but don't match antlarr_Q_OBJECT (\b). |
1700 push (@list, $hf) unless $1 =~ m://[^\n]*Q_OBJECT[^\n]*$:s; ## handle "// Q_OBJECT" | 2022 if ( $hfData =~ /{([^}]*)\bQ_OBJECT/s ) { |
2023 push (@list, $hf) unless $1 =~ m://[^\n]*Q_OBJECT[^\n]*$:s; ## reject "// Q_OBJECT" | |
1701 } | 2024 } |
1702 } | 2025 } |
1703 # The assoc array of root of headerfile and header filename | 2026 # The assoc array of root of headerfile and header filename |
1704 foreach $hFile (@list) | 2027 foreach $hFile (@list) |
1705 { | 2028 { |
1784 foreach my $mocFile (keys (%mocFiles)) | 2107 foreach my $mocFile (keys (%mocFiles)) |
1785 { | 2108 { |
1786 @cppFiles = keys %{$moc2cpp->{"$mocFile.moc"}}; | 2109 @cppFiles = keys %{$moc2cpp->{"$mocFile.moc"}}; |
1787 if (@cppFiles == 1) { | 2110 if (@cppFiles == 1) { |
1788 $mocFiles{$mocFile} .= "\035" . $cppFiles[0]; | 2111 $mocFiles{$mocFile} .= "\035" . $cppFiles[0]; |
1789 push(@deped, $mocFile); | 2112 push(@depend, $mocFile); |
1790 } elsif (@cppFiles == 0) { | 2113 } elsif (@cppFiles == 0) { |
1791 push (@newObs, $mocFile); # Produce new object file | 2114 push (@newObs, $mocFile); # Produce new object file |
1792 next if ($haveAutomocTag); # This is expected... | 2115 next if ($haveAutomocTag); # This is expected... |
1793 # But this is an error we can deal with - let them know | 2116 # But this is an error we can deal with - let them know |
1794 print STDERR | 2117 print STDERR |
1822 undef $cppFile; | 2145 undef $cppFile; |
1823 ($dir, $hFile, $cppFile) = split ("\035", $mocFiles{$mocFile}, 3); | 2146 ($dir, $hFile, $cppFile) = split ("\035", $mocFiles{$mocFile}, 3); |
1824 $dir =~ s#^\.#\$(srcdir)#; | 2147 $dir =~ s#^\.#\$(srcdir)#; |
1825 if (defined ($cppFile)) | 2148 if (defined ($cppFile)) |
1826 { | 2149 { |
1827 $target_adds{"\$(srcdir)/$cppFile"} .= "$mocFile.moc "; | 2150 $cppFile =~ s,\.[^.]*$,,; |
1828 appendLines ("$mocFile.moc: $dir/$hFile\n\t\$(MOC) $dir/$hFile -o $mocFile.moc\n"); | 2151 $target_adds{"$cppFile.o"} .= "$mocFile.moc "; |
1829 $cleanMoc .= " $mocFile.moc"; | 2152 $target_adds{"$cppFile.lo"} .= "$mocFile.moc "; |
2153 appendLines ("$mocFile.moc: $dir/$hFile\n\t\$(MOC) $dir/$hFile -o $mocFile.moc\n"); | |
2154 $cleanMoc .= " $mocFile.moc"; | |
2155 appendLines ("mocs: $mocFile.moc\n"); | |
1830 } | 2156 } |
1831 else | 2157 else |
1832 { | 2158 { |
1833 appendLines ("$mocFile$mocExt: $dir/$hFile\n\t\$(MOC) $dir/$hFile -o $mocFile$mocExt\n"); | 2159 appendLines ("$mocFile$mocExt: $dir/$hFile\n\t\$(MOC) $dir/$hFile -o $mocFile$mocExt\n"); |
1834 $cleanMoc .= " $mocFile$mocExt"; | 2160 $cleanMoc .= " $mocFile$mocExt"; |
1835 } | 2161 appendLines ("mocs: $mocFile$mocExt\n"); |
1836 } | 2162 } |
2163 } | |
2164 } | |
2165 | |
2166 sub make_bcheck_target() | |
2167 { | |
2168 my $lookup = 'RECURSIVE_TARGETS\s*=[ \t]*(.*)'; | |
2169 my $bcheckdep = "bcheck-am"; | |
2170 $bcheckdep = "bcheck-recursive" if ($MakefileData =~ /\n$lookup/); | |
2171 | |
2172 my $headers= ""; | |
2173 $headers = $1 if($MakefileData =~ /\nHEADERS\s*=[ \t]*(.+)/); | |
2174 $headers =~ s/\$\((?:noinst|EXTRA)_HEADERS\)//g; | |
2175 | |
2176 $target_adds{"clean-am"} .= "clean-bcheck "; | |
2177 | |
2178 my $t = "clean-bcheck: \n" . | |
2179 "\trm -f *.bchecktest.cc *.bchecktest.cc.class a.out\n\n" . | |
2180 "bcheck: $bcheckdep\n\n" . | |
2181 "bcheck-am:\n" . | |
2182 "\t\@for i in $headers; do \\\n" . | |
2183 "\t if test \$(srcdir)/\$\$i -nt \$\$i.bchecktest.cc; then \\\n" . | |
2184 "\t echo \"int main() {return 0;}\" > \$\$i.bchecktest.cc ; \\\n" . | |
2185 "\t echo \"#include \\\"\$\$i\\\"\" >> \$\$i.bchecktest.cc ; \\\n" . | |
2186 "\t echo \"\$\$i\"; \\\n" . | |
2187 "\t if ! "; | |
2188 $t .= $cxxsuffix eq "KKK" ? | |
2189 "\$(CXX) \$(DEFS) -I. -I\$(srcdir) -I\$(top_builddir) \$(INCLUDES) \$(AM_CPPFLAGS) \$(CPPFLAGS) \$(KDE_CXXFLAGS) " : | |
2190 "\$(CXXCOMPILE) "; | |
2191 $t .= " --dump-class-hierarchy \$\$i.bchecktest.cc; then \\\n" . | |
2192 "\t rm -f \$\$i.bchecktest.cc; exit 1; \\\n" . | |
2193 "\t fi ; \\\n" . | |
2194 "\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" . | |
2196 "\t rm -f a.out; \\\n" . | |
2197 "\t fi ; \\\n" . | |
2198 "\tdone\n"; | |
2199 appendLines("$t\n"); | |
1837 } | 2200 } |
1838 | 2201 |
1839 sub make_meta_classes () | 2202 sub make_meta_classes () |
1840 { | 2203 { |
1841 return if ($kdeopts{"qtonly"}); | 2204 return if ($kdeopts{"qtonly"}); |
1843 my $cppFile; | 2206 my $cppFile; |
1844 my $hFile; | 2207 my $hFile; |
1845 my $moc_class_headers = ""; | 2208 my $moc_class_headers = ""; |
1846 foreach $program (@programs) { | 2209 foreach $program (@programs) { |
1847 my $mocs = ""; | 2210 my $mocs = ""; |
1848 my @progsources = split(/[\s\034]+/, $sources{$program}); | 2211 my @progsources = split(/[\034\s]+/, $sources{$program}); |
1849 my @depmocs = split(' ', $depedmocs{$program}); | 2212 my @depmocs = split(' ', $dependmocs{$program}); |
1850 my %shash = (), %mhash = (); | 2213 my %shash = (), %mhash = (); |
1851 @shash{@progsources} = 1; # we are only interested in the existence | 2214 @shash{@progsources} = 1; # we are only interested in the existence |
1852 @mhash{@depmocs} = 1; | 2215 @mhash{@depmocs} = 1; |
1853 | 2216 |
1854 print STDOUT "program=$program\n" if ($verbose); | 2217 print STDOUT "program=$program\n" if ($verbose); |
1855 print STDOUT "psources=[".join(' ', keys %shash)."]\n" if ($verbose); | 2218 print STDOUT "psources=[".join(' ', keys %shash)."]\n" if ($verbose); |
1856 print STDOUT "depmocs=[".join(' ', keys %mhash)."]\n" if ($verbose); | 2219 print STDOUT "depmocs=[".join(' ', keys %mhash)."]\n" if ($verbose); |
1857 print STDOUT "globalmocs=[".join(' ', keys(%globalmocs))."]\n" if ($verbose); | 2220 print STDOUT "globalmocs=[".join(' ', keys(%globalmocs))."]\n" if ($verbose); |
1858 foreach my $mocFile (keys (%globalmocs)) | 2221 foreach my $mocFile (keys (%globalmocs)) |
1859 { | 2222 { |
1860 undef $cppFile; | 2223 my ($dir, $hFile, $cppFile) = split ("\035", $globalmocs{$mocFile}, 3); |
1861 ($dir, $hFile, $cppFile) = split ("\035", $globalmocs{$mocFile}, 3); | |
1862 $dir =~ s#^\.#\$(srcdir)#; | |
1863 if (defined ($cppFile)) | 2224 if (defined ($cppFile)) |
1864 { | 2225 { |
1865 $mocs .= " $mocFile.moc" if exists $shash{$cppFile}; | 2226 $mocs .= " $mocFile.moc" if exists $shash{$cppFile}; |
1866 } | 2227 } |
1867 else | 2228 else |
1868 { | 2229 { |
1869 # Bah. This is the case, if no C++ file includes the .moc | 2230 # Bah. This is the case, if no C++ file includes the .moc |
1870 # file. We make a .moc.cpp file for that. Unfortunately this | 2231 # file. We make a .moc.cpp file for that. Unfortunately this |
1871 # is not included in the %sources hash, but rather is mentioned | 2232 # is not included in the %sources hash, but rather is mentioned |
1872 # in %depedmocs. If the user wants to use AUTO he can't just | 2233 # in %dependmocs. If the user wants to use AUTO he can't just |
1873 # use an unspecific METAINCLUDES. Instead he must use | 2234 # use an unspecific METAINCLUDES. Instead he must use |
1874 # program_METAINCLUDES. Anyway, it's not working real nicely. | 2235 # program_METAINCLUDES. Anyway, it's not working real nicely. |
1875 # E.g. Its not clear what happens if user specifies two | 2236 # E.g. Its not clear what happens if user specifies two |
1876 # METAINCLUDES=AUTO in the same Makefile.am. | 2237 # METAINCLUDES=AUTO in the same Makefile.am. |
1877 $mocs .= " $mocFile.moc.$cxxsuffix" | 2238 $mocs .= " $mocFile.moc.$cxxsuffix" |
1878 if exists $mhash{$mocFile.".moc.$cxxsuffix"}; | 2239 if exists $mhash{$mocFile.".moc.$cxxsuffix"}; |
1879 } | 2240 } |
1880 } | 2241 } |
1881 if ($mocs) { | 2242 if ($mocs) { |
1882 print STDOUT "==> mocs=[".$mocs."]\n" if ($verbose); | 2243 print STDOUT "==> mocs=[".$mocs."]\n" if ($verbose); |
1883 my $sourcename = $program."_meta_unload"; | |
1884 my $ext = ($program =~ /_la$/) ? ".lo" : ".o"; | |
1885 my $srcfile = $sourcename.".$cxxsuffix"; | |
1886 my $objfile = $sourcename.$ext; | |
1887 $moc_class_headers .= " $srcfile"; | |
1888 my $appl; | |
1889 $appl = "$srcfile: $mocs\n"; | |
1890 $appl .= "\t\@echo 'creating $srcfile'\n"; | |
1891 $appl .= "\t\@-rm -f $srcfile\n"; | |
1892 $appl .= "\t\@if test \${kde_qtver} = 2; then \\\n"; | |
1893 $appl .= "\t\techo 'static const char * _metalist_$program\[\] = {' > $srcfile ;\\\n"; | |
1894 $appl .= "\t\tcat $mocs | grep 'char.*className' | "; | |
1895 $appl .= "sed -e 's/.*[^A-Za-z0-9_:]\\([A-Za-z0-9_:]*\\)::className.*\$\$/\\\"\\1\\\",/' | sort | uniq >> $srcfile ;\\\n"; | |
1896 $appl .= "\t\techo '0};' >> $srcfile ;\\\n"; | |
1897 $appl .= "\t\techo '#include <kunload.h>' >> $srcfile ;\\\n"; | |
1898 $appl .= "\t\techo '_UNLOAD($program)' >> $srcfile ;\\\n"; | |
1899 $appl .= "\telse echo > $srcfile; fi\n"; | |
1900 $appl .= "\n"; | |
1901 | |
1902 $realObjs{$program} .= " \034" . $objfile . " "; | |
1903 $sources{$program} .= " $srcfile"; | |
1904 $sources_changed{$program} = 1; | |
1905 $dep_files .= " \$(DEPDIR)/$sourcename.P" if($dep_files !~/$sourcename.P/); | |
1906 appendLines ($appl); | |
1907 } | 2244 } |
1908 print STDOUT "\n" if $verbose; | 2245 print STDOUT "\n" if $verbose; |
1909 } | 2246 } |
1910 if ($moc_class_headers) { | 2247 if ($moc_class_headers) { |
1911 appendLines ("$cleantarget-moc-classes:\n\t-rm -f $moc_class_headers\n"); | 2248 appendLines ("$cleantarget-moc-classes:\n\t-rm -f $moc_class_headers\n"); |
1920 return if ($dryrun); | 2257 return if ($dryrun); |
1921 | 2258 |
1922 open (FILEOUT, "> $makefile") | 2259 open (FILEOUT, "> $makefile") |
1923 || die "Could not create $makefile: $!\n"; | 2260 || die "Could not create $makefile: $!\n"; |
1924 | 2261 |
1925 print FILEOUT "\# $progId - " . '$Revision$ ' . "\n"; | 2262 $MakefileData =~ s/\034/\\\n/g; # Restore continuation lines |
1926 $MakefileData =~ s/\034/\\\n\t/g; # Restore continuation lines | 2263 # Append our $progId line, _below_ the "generated by automake" line |
2264 # because automake-1.6 relies on the first line to be his own. | |
2265 my $progIdLine = "\# $progId - " . '$Revision$ '."\n"; | |
2266 if ( !( $MakefileData =~ s/^(.*generated .*by automake.*\n)/$1$progIdLine/ ) ) { | |
2267 warn "automake line not found in $makefile\n"; | |
2268 # Fallback: first line | |
2269 print FILEOUT $progIdLine; | |
2270 }; | |
1927 print FILEOUT $MakefileData; | 2271 print FILEOUT $MakefileData; |
1928 close FILEOUT; | 2272 close FILEOUT; |
1929 } | 2273 } |
1930 | 2274 |
1931 #----------------------------------------------------------------------------- | 2275 #----------------------------------------------------------------------------- |
1950 my ($lookup, $new) = @_; | 2294 my ($lookup, $new) = @_; |
1951 | 2295 |
1952 if ($MakefileData =~ /\n($lookup)/) { | 2296 if ($MakefileData =~ /\n($lookup)/) { |
1953 $old = $1; | 2297 $old = $1; |
1954 $old =~ s/\034/\\\n#>\- /g; # Fix continuation lines | 2298 $old =~ s/\034/\\\n#>\- /g; # Fix continuation lines |
1955 $new =~ s/\034/\\\n\t/g; | 2299 my $newCount = ($new =~ tr/\034//) + ($new =~ tr/\n//) + 1; |
1956 my $newCount = ($new =~ tr/\n//) + 1; | 2300 $new =~ s/\\\n/\034/g; |
1957 $MakefileData =~ s/\n$lookup/\n#>- $old\n#>\+ $newCount\n$new/; | 2301 $MakefileData =~ s/\n$lookup/\n#>- $old\n#>\+ $newCount\n$new/; |
1958 } else { | 2302 } else { |
1959 print STDERR "Warning: substitution of \"$lookup\" in $printname failed\n"; | 2303 warn "Warning: substitution of \"$lookup\" in $printname failed\n"; |
1960 } | 2304 } |
1961 } | 2305 } |
1962 | 2306 |
1963 #----------------------------------------------------------------------------- | 2307 #----------------------------------------------------------------------------- |
1964 | 2308 |
1965 # Slap new lines on the back of the file. | 2309 # Slap new lines on the back of the file. |
1966 sub appendLines ($) | 2310 sub appendLines ($) |
1967 { | 2311 { |
1968 my ($new) = @_; | 2312 my ($new) = @_; |
1969 $new =~ s/\034/\\\n\t/g; # Fix continuation lines | 2313 my $copynew = $new; |
1970 my $newCount = ($new =~ tr/\n//) + 1; | 2314 my $newCount = ($new =~ tr/\034//) + ($new =~ tr/\n//) + 1; |
2315 $new =~ s/\\\n/\034/g; # Fix continuation lines | |
1971 $MakefileData .= "\n#>\+ $newCount\n$new"; | 2316 $MakefileData .= "\n#>\+ $newCount\n$new"; |
1972 } | 2317 } |
1973 | 2318 |
1974 #----------------------------------------------------------------------------- | 2319 #----------------------------------------------------------------------------- |
1975 | 2320 |