599
|
1 |
#!/usr/bin/perl
|
|
2 |
# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
# All rights reserved.
|
|
4 |
# This component and the accompanying materials are made available
|
|
5 |
# under the terms of "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 |
# Nokia Corporation - initial contribution.
|
|
11 |
#
|
|
12 |
# Contributors:
|
|
13 |
#
|
|
14 |
# Description:
|
|
15 |
#
|
|
16 |
|
|
17 |
use File::Basename;
|
|
18 |
|
|
19 |
if (@ARGV <2)
|
|
20 |
{
|
|
21 |
print (STDERR "\ncreaterfifile.pl\n");
|
|
22 |
print STDERR << 'END_OF_HELP';
|
|
23 |
|
|
24 |
Usage: createrfifile.pl rss_cpp_deps_file.d output_file.rfi [exclude path]
|
|
25 |
|
|
26 |
Takes a file containing CPP dependency output from the preprocessing of a .rss file and
|
|
27 |
generates a "combined resource" .rfi that can be consumed by CDB.
|
|
28 |
Optionally takes an exclusion path under which "found" dependencies are then ignored.
|
|
29 |
|
|
30 |
END_OF_HELP
|
|
31 |
exit(0);
|
|
32 |
}
|
|
33 |
|
|
34 |
my ($deps, $rfi, $exclude) = @ARGV;
|
|
35 |
|
|
36 |
if ($exclude)
|
|
37 |
{
|
|
38 |
$exclude =~ s/\\/\//g; # Ensure consistent slashes
|
|
39 |
$exclude =~ s/\/\//\//g; # Remove double slashes
|
|
40 |
$exclude = quotemeta($exclude); # Convert for regex match
|
|
41 |
}
|
|
42 |
|
|
43 |
print ("RFI : exclude under - \"$exclude\"\n");
|
|
44 |
|
|
45 |
my @resources;
|
|
46 |
open DEPS, "< $deps" or die "\nCannot read \"$deps\"!\n\n";
|
|
47 |
while (<DEPS>)
|
|
48 |
{
|
|
49 |
# .d file format - whitespace at front is key, path format varies depending on platform
|
|
50 |
# the aim is to get a list of the "real" files. Missing files can appear "unpathed", although
|
|
51 |
# this isn't currently dealt with.
|
|
52 |
#
|
|
53 |
#HelloWorld_reg.o: \
|
|
54 |
# F:/source/personal/misc/filenamepolicy/ported/examples/helloworld/HelloWorld_reg.rss \
|
|
55 |
# F:/builds/sbs/9.5/epoc32/include/variant/Symbian_OS.hrh \
|
|
56 |
# F:/builds/sbs/9.5/epoc32/include/appinfo.rh \
|
|
57 |
# F:/builds/sbs/9.5/epoc32/include/helloworld.rsg
|
|
58 |
#
|
|
59 |
|
|
60 |
s/^.*\.o\://;
|
|
61 |
s/^\s+//;
|
|
62 |
s/\s*\\$//;
|
|
63 |
s/\/\//\//g;
|
|
64 |
chomp ($_);
|
|
65 |
next if !/\S/;
|
|
66 |
|
|
67 |
print ("WARNING: Could not find dependency \"$_\" in \"$deps\"\n") if !(-e $_);
|
|
68 |
|
|
69 |
print ("RFI : processing - \"$_\"\n");
|
|
70 |
next if ($exclude && /^$exclude/i);
|
|
71 |
push @resources,$_;
|
|
72 |
}
|
|
73 |
close DEPS;
|
|
74 |
|
|
75 |
open RFI, "> $rfi" or die "\nCannot write \"$deps\"!\n\n";
|
|
76 |
foreach my $resource (@resources)
|
|
77 |
{
|
|
78 |
print RFI "\n\n/* GXP ***********************\n";
|
|
79 |
print RFI " * ".basename($resource)."\n";
|
|
80 |
print RFI " ****************************/\n\n";
|
|
81 |
|
|
82 |
open RESOURCE, "< $resource" or die "\nCannot read \"$resource\"!\n\n";
|
|
83 |
print RFI $_ while (<RESOURCE>);
|
|
84 |
close RESOURCE;
|
|
85 |
}
|
|
86 |
close RFI;
|
|
87 |
|