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