3232# Data Section
3333# ******************************************************************
3434
35- my $version = ' 0.1 ' ;
35+ my $version = ' 0.2 ' ;
3636
3737# ******************************************************************
3838# Subroutine Section
@@ -45,6 +45,8 @@ sub gather_info {
4545 if (open ($fh , $name )) {
4646 my @lines = ();
4747 my $pname = undef ;
48+ my $pline = undef ;
49+
4850 while (<$fh >) {
4951 # # Get the line a remove leading and trailing white space
5052 my $line = $_ ;
@@ -81,6 +83,7 @@ sub gather_info {
8183 # # us.
8284 $pname = Creator::fill_type_name(undef , $pname , $def );
8385 push (@lines , " project$parents {" );
86+ $pline = $def ;
8487 }
8588 elsif ($line =~ / ^(shared|static)name\s *=\s *(.+)$ / ) {
8689 # # Add in the libs and after settings.
@@ -95,10 +98,15 @@ sub gather_info {
9598 }
9699 close ($fh );
97100
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.
102110 return @lines if ($#lines > 0);
103111 }
104112
@@ -148,9 +156,7 @@ sub usageAndExit {
148156 print STDERR " Create Base Project v$version \n " ,
149157 " Usage: " , basename($0 ), " <mpc files> <output file or " ,
150158 " 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 " ;
154160 exit (0);
155161}
156162
0 commit comments