source: tags/arb-6.0.1/SOURCE_TOOLS/dependency_graphs.pl

Last change on this file was 7819, checked in by westram, 13 years ago

merge from dev [7774] [7778] [7779] [7780] [7781] [7782] [7783] [7784] [7785] [7786] [7787] [7788] [7789] [7790] [7791] [7792] [7793] [7794] [7795] [7796] [7817]

  • fixes/improvements to build ARB on multicores
    • made dependencies between targets explicit (let make resolve them)
    • fixed several failures caused by async calls ('dep_graph', 'up', tests)
    • try to make 'perl' 1st ("big target")
  • other changes
    • ctags (bug in 5.8; tag-order)
    • removed obsolete things from Makefiles
    • added SOURCE_TOOLS/remake_after_change.pl (call from ARB subdirs, knows what to do)
    • tests use own ARB_PID (no clash with running ARB)
  • Property svn:executable set to *
File size: 1.2 KB
Line 
1#!/usr/bin/perl
2
3my $ARBHOME = $ENV{ARBHOME};
4if (not -d $ARBHOME) {
5  die "ARBHOME has to be defined and has to mark a directory";
6}
7chdir($ARBHOME);
8
9sub make_suffix($) {
10  my ($name) = @_;
11
12  $name =~ s/[\/\.]/_/g;
13
14  $name =~ s/needs_libs//;
15
16  $name =~ s/__*/_/g;
17  $name =~ s/^_//;
18  $name =~ s/_$//;
19
20  return $name;
21}
22
23sub execute($) {
24  my ($cmd) = @_;
25  system($cmd)==0 || die "error calling '$cmd'";
26}
27
28sub main() {
29  my @dep_files = map {
30    if (/\.svn/) { ; }
31    else { chomp; s/^\.\///; $_; }
32  } `cd $ARBHOME;find . -name "needs_libs*"`;
33
34  my %gif_suffix = map { $_ => make_suffix($_); } @dep_files;
35
36  my $dest = 'dep_graphs';
37  if (not -d $dest) {
38    mkdir($dest) || die "can't create dir '$dest' (Reason: $!)";
39  }
40
41  my @childs = ();
42  foreach (@dep_files) {
43    my $pid = fork();
44    while (not defined $pid) {
45      print "Warning: could not fork\n";
46      sleep(1);
47      $pid = fork(); # retry
48    }
49    if ($pid == 0) { # child
50      my $destgif = "$dest/".$gif_suffix{$_}.".gif";
51      execute("SOURCE_TOOLS/needed_libs.pl -G $destgif -U -B -S $_");
52      exit(0);
53    }
54
55    push @childs, $pid;
56  }
57
58  print "Waiting for childs...\n";
59  foreach (@childs) {
60    waitpid($_, 0);
61  }
62  print "All childs terminated\n";
63}
64main();
Note: See TracBrowser for help on using the repository browser.