32
32
# Data Section
33
33
# ******************************************************************
34
34
35
- my $version = ' 0.1 ' ;
35
+ my $version = ' 0.2 ' ;
36
36
37
37
# ******************************************************************
38
38
# Subroutine Section
@@ -45,6 +45,8 @@ sub gather_info {
45
45
if (open ($fh , $name )) {
46
46
my @lines = ();
47
47
my $pname = undef ;
48
+ my $pline = undef ;
49
+
48
50
while (<$fh >) {
49
51
# # Get the line a remove leading and trailing white space
50
52
my $line = $_ ;
@@ -81,6 +83,7 @@ sub gather_info {
81
83
# # us.
82
84
$pname = Creator::fill_type_name(undef , $pname , $def );
83
85
push (@lines , " project$parents {" );
86
+ $pline = $def ;
84
87
}
85
88
elsif ($line =~ / ^(shared|static)name\s *=\s *(.+)$ / ) {
86
89
# # Add in the libs and after settings.
@@ -95,10 +98,15 @@ sub gather_info {
95
98
}
96
99
close ($fh );
97
100
98
- # # Only return the lines if there is more than one line. It is
99
- # # possible (and likely) that we've read in the project declaration,
100
- # # but the project did not contain a sharedname or staticname
101
- # # setting.
101
+ # # If we have the unmodified project name, but the user did not provide
102
+ # # a sharedname or staticname, we will use that as the library name.
103
+ if (defined $pline && $#lines == 0) {
104
+ push (@lines , " libs += $pline " ,
105
+ " after += $pname " ,
106
+ " }" );
107
+ }
108
+
109
+ # # Only return the lines if there is more than one line.
102
110
return @lines if ($#lines > 0);
103
111
}
104
112
@@ -148,9 +156,7 @@ sub usageAndExit {
148
156
print STDERR " Create Base Project v$version \n " ,
149
157
" Usage: " , basename($0 ), " <mpc files> <output file or " ,
150
158
" directory>\n\n This script will create a base project " ,
151
- " based on the contents of the\n supplied MPC file. " ,
152
- " This is only useful if the project " ,
153
- " explicitly sets\n sharedname or staticname.\n " ;
159
+ " based on the contents of the\n supplied MPC file.\n " ;
154
160
exit (0);
155
161
}
156
162
0 commit comments