williamr/scan_sbs_makefile.pl
author Dario Sestito <darios@symbian.org>
Mon, 06 Sep 2010 12:00:01 +0100
changeset 322 2b7e66ca13ba
parent 2 a600c1a596f7
permissions -rw-r--r--
Fix for total releasables count not appearing
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
     1
#!/usr/bin/perl
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
     2
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
     3
# Copyright (c) 2009 Symbian Foundation Ltd
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
     4
# This component and the accompanying materials are made available
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
     5
# under the terms of the License "Eclipse Public License v1.0"
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
     6
# which accompanies this distribution, and is available
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
     8
#
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
     9
# Initial Contributors:
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    10
# Symbian Foundation Ltd - initial contribution.
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    11
# 
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    12
# Contributors:
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    13
#
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    14
# Description:
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    15
# Approximate "abld -what" from SBS Makefile.default and Makefile.export
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    16
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    17
use strict;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    18
my $component = "";
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    19
my $mmp = "";
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    20
my $linkpath = "";
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    21
my $target = "";
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    22
my $targettype = "";
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    23
my $exports = "";
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    24
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    25
sub completed
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    26
  {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    27
  if ($component ne "")
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    28
    {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    29
    if ($exports eq "")
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    30
      {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    31
      # Compilation makefile target
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    32
      print "$component\t$mmp\t$linkpath/$target.$targettype\n";
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    33
      }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    34
    else
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    35
      {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    36
      # export makefile
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    37
      my @exportpairs = split / /, $exports;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    38
      foreach my $pair (@exportpairs)
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    39
        {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    40
        my ($dest,$src) = split /<-/, $pair;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    41
        $dest =~ s/^.:\///;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    42
        print "$component\texport\t$dest\n";
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    43
        }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    44
      }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    45
    }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    46
  $component = "";
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    47
  $mmp = "";
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    48
  $linkpath = "";
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    49
  $target = "";
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    50
  $targettype = "";
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    51
  $exports = "";
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    52
  }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    53
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    54
sub scan_logfile($)
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    55
  {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    56
  my ($logfile) = @_;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    57
  
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    58
  open FILE, "<$logfile" or print "Error: cannot open $logfile: $!\n" and return;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    59
  
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    60
  my $line;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    61
  while ($line = <FILE>)
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    62
    {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    63
    # COMPONENT_META:=s:/sf/os/boardsupport/emulator/emulatorbsp/bld.inf
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    64
    # PROJECT_META:=s:/sf/os/boardsupport/emulator/emulatorbsp/cakdwins.mmp
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    65
    # LINKPATH:=winscw/udeb
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    66
    # TARGET:=ekdata
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    67
    # TARGETTYPE:=dll
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    68
    # EXPORT:=s:/epoc32/tools/scanlog.pl<-s:/sf/os/buildtools/bldsystemtools/buildsystemtools/scanlog/scanlog.pl more...
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    69
    # MAKEFILE_LIST:=
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    70
    
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    71
    if ($line =~ /^(COMPONENT_META|PROJECT_META|LINKPATH|TARGET|REQUESTEDTARGETEXT|EXPORT|MAKEFILE_LIST):=(.*)$/o)
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    72
      {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    73
      my $variable = $1;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    74
      my $value = $2;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    75
      
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    76
      if ($variable eq "MAKEFILE_LIST")
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    77
        {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    78
        completed();
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    79
        next;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    80
        }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    81
      if ($variable eq "COMPONENT_META")
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    82
        {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    83
        $component = $value;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    84
        next;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    85
        }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    86
      if ($variable eq "PROJECT_META")
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    87
        {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    88
        $mmp = $value;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    89
        next;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    90
        }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    91
      if ($variable eq "LINKPATH")
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    92
        {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    93
        $linkpath = $value;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    94
        next;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    95
        }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    96
      if ($variable eq "TARGET")
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    97
        {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    98
        $target = $value;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    99
        next;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   100
        }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   101
      if ($variable eq "REQUESTEDTARGETEXT")
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   102
        {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   103
        $targettype = $value;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   104
        next;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   105
        }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   106
      if ($variable eq "EXPORT")
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   107
        {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   108
        $exports = $value;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   109
        next;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   110
        }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   111
      }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   112
    }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   113
    close FILE;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   114
  }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   115
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   116
  my @logfiles = map(glob,@ARGV);
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   117
  foreach my $logfile (@logfiles)
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   118
    {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   119
    # print "Scanning $logfile...\n";
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   120
    scan_logfile($logfile);
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   121
    }