summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2005-09-30 12:48:44 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2005-09-30 12:48:44 +0000
commita8dabfab50c5d4d303aac9fb0556651882c51bcb (patch)
treed88c933453cce054806311af8d6f79cdcd05f68f
parentef9be6e5e75d19cae6c55042aa16d1bf66947498 (diff)
downloadMPC-a8dabfab50c5d4d303aac9fb0556651882c51bcb.tar.gz
ChangeLogTag: Fri Sep 30 07:46:54 2005 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r--ChangeLog15
-rw-r--r--modules/BMakeWorkspaceCreator.pm22
-rw-r--r--modules/NMakeWorkspaceCreator.pm22
-rw-r--r--templates/automake.mpd18
4 files changed, 53 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index fff4a905..6aa057cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+Fri Sep 30 07:46:54 2005 Chad Elliott <elliott_c@ociweb.com>
+
+ * modules/BMakeWorkspaceCreator.pm:
+ * modules/NMakeWorkspaceCreator.pm:
+
+ Corrected the directory changing code to take 2 or more deep
+ relative paths into account. Thanks to Johnny Willemsen
+ <jwillemsen@remedy.nl> for reporting this.
+
+ * templates/automake.mpd:
+
+ Optimized this template with respect to checking a variable before
+ using foreach. The foreach already does this, so checking the
+ variable before hand is a waste of time.
+
Mon Sep 26 07:10:17 2005 Chad Elliott <elliott_c@ociweb.com>
* README:
diff --git a/modules/BMakeWorkspaceCreator.pm b/modules/BMakeWorkspaceCreator.pm
index 9644be7f..0dc6874f 100644
--- a/modules/BMakeWorkspaceCreator.pm
+++ b/modules/BMakeWorkspaceCreator.pm
@@ -87,6 +87,7 @@ sub write_project_targets {
my($target) = shift;
my($list) = shift;
my($crlf) = $self->crlf();
+ my($cwd) = $self->getcwd();
foreach my $project (@$list) {
my($dir) = $self->mpc_dirname($project);
@@ -97,12 +98,27 @@ sub write_project_targets {
## to figure out how to get back to our starting point
if ($dir ne '.') {
$chdir = 1;
- my($count) = ($dir =~ tr/\///);
+ my($count) = ($dir =~ tr/\///) + 1;
if ($dir =~ /^\.\.\//) {
- $back = ('../' x $count) . basename($self->getcwd());
+ ## Find out how many directories we went down
+ my($rel) = $dir;
+ while($rel =~ s/^\.\.\///) {
+ }
+ my($down) = ($rel =~ tr/\///) + 1;
+
+ ## Get $count - $down parts of the base of the current directory
+ $rel = $cwd;
+ my($index) = length($rel);
+ for(my $i = $down; $i < $count; $i++) {
+ $index = rindex($rel, '/', $index - 1);
+ }
+ if ($index > -1) {
+ $rel = substr($rel, $index + 1);
+ }
+ $back = ('../' x $down) . $rel;
}
else {
- $back = ('../' x ($count + 1));
+ $back = ('../' x $count);
}
}
diff --git a/modules/NMakeWorkspaceCreator.pm b/modules/NMakeWorkspaceCreator.pm
index 0794b6cc..3be47bf4 100644
--- a/modules/NMakeWorkspaceCreator.pm
+++ b/modules/NMakeWorkspaceCreator.pm
@@ -84,6 +84,7 @@ sub write_project_targets {
my($target) = shift;
my($list) = shift;
my($crlf) = $self->crlf();
+ my($cwd) = $self->getcwd();
foreach my $project (@$list) {
my($dir) = $self->mpc_dirname($project);
@@ -94,12 +95,27 @@ sub write_project_targets {
## to figure out how to get back to our starting point
if ($dir ne '.') {
$chdir = 1;
- my($count) = ($dir =~ tr/\///);
+ my($count) = ($dir =~ tr/\///) + 1;
if ($dir =~ /^\.\.\//) {
- $back = ('../' x $count) . basename($self->getcwd());
+ ## Find out how many directories we went down
+ my($rel) = $dir;
+ while($rel =~ s/^\.\.\///) {
+ }
+ my($down) = ($rel =~ tr/\///) + 1;
+
+ ## Get $count - $down parts of the base of the current directory
+ $rel = $cwd;
+ my($index) = length($rel);
+ for(my $i = $down; $i < $count; $i++) {
+ $index = rindex($rel, '/', $index - 1);
+ }
+ if ($index > -1) {
+ $rel = substr($rel, $index + 1);
+ }
+ $back = ('../' x $down) . $rel;
}
else {
- $back = ('../' x ($count + 1));
+ $back = ('../' x $count);
}
}
diff --git a/templates/automake.mpd b/templates/automake.mpd
index 7f8fa1a7..6378b5ea 100644
--- a/templates/automake.mpd
+++ b/templates/automake.mpd
@@ -90,11 +90,9 @@ lib<%if(sharedname)%><%normalize(sharedname)%><%else%><%normalize(staticname)%><
<%foreach(defines common_defines macros)%>
-D<%define%><%if(compile_flags || need_staticflags || dynamicflags)%> \<%else%><%fornotlast(" \\")%><%endif%>
<%endfor%>
-<%if(compile_flags)%>
<%foreach(compile_flags)%>
<%compile_flags%><%if(need_staticflags || dynamicflags)%> \<%else%><%fornotlast(" \\")%><%endif%>
<%endfor%>
-<%endif%>
<%if(need_staticflags)%>
<%if(staticflags)%>
<%foreach(staticflags)%>
@@ -104,13 +102,11 @@ lib<%if(sharedname)%><%normalize(sharedname)%><%else%><%normalize(staticname)%><
-D__NO_STATIC_FLAGS_AVAILABLE__
<%endif%>
<%else%>
-<%if(dynamicflags)%>
<%foreach(dynamicflags)%>
-D<%dynamicflag%><%fornotlast(" \\")%>
<%endfor%>
<%endif%>
<%endif%>
-<%endif%>
<%if(source_files)%>
<%if(exename)%>
@@ -122,13 +118,11 @@ lib<%if(sharedname)%><%normalize(sharedname)%><%else%><%normalize(staticname)%><
<%source_file%><%if(exename)%><%if(header_files || inline_files)%> \<%else%><%fornotlast(" \\")%><%endif%><%else%><%fornotlast(" \\")%><%endif%>
<%endfor%>
<%if(exename)%>
-<%if(header_files || inline_files)%>
<%foreach(header_file, sort(header_files inline_files))%>
<%header_file%><%fornotlast(" \\")%>
<%endfor%>
<%endif%>
<%endif%>
-<%endif%>
<%if(exename)%>
<%if(linkflags)%>
@@ -146,45 +140,33 @@ lib<%if(sharedname)%><%normalize(sharedname)%><%else%><%normalize(staticname)%><
<%if(libs || pure_libs || lit_libs)%>
<%normalize(exename)%>_LDADD = \
-<%if(libs)%>
<%foreach(libs)%>
lib<%lib%>.la<%if(lit_libs || pure_libs)%> \<%else%><%fornotlast(" \\")%><%endif%>
<%endfor%>
-<%endif%>
-<%if(lit_libs)%>
<%foreach(lit_libs)%>
-l<%lit_lib%><%if(pure_libs)%> \<%else%><%fornotlast(" \\")%><%endif%>
<%endfor%>
-<%endif%>
-<%if(pure_libs)%>
<%foreach(pure_libs)%>
<%pure_lib%><%fornotlast(" \\")%>
<%endfor%>
<%endif%>
-<%endif%>
<%else%>
<%if(install_this_target)%>
<%if(libs || pure_libs || lit_libs)%>
lib<%if(sharedname)%><%normalize(sharedname)%><%else%><%normalize(staticname)%><%endif%>_la_LIBADD = \
-<%if(libs)%>
<%foreach(libs)%>
lib<%lib%>.la<%if(lit_libs || pure_libs)%> \<%else%><%fornotlast(" \\")%><%endif%>
<%endfor%>
-<%endif%>
-<%if(lit_libs)%>
<%foreach(lit_libs)%>
-l<%lit_lib%><%if(pure_libs)%> \<%else%><%fornotlast(" \\")%><%endif%>
<%endfor%>
-<%endif%>
-<%if(pure_libs)%>
<%foreach(pure_libs)%>
<%pure_lib%><%fornotlast(" \\")%>
<%endfor%>
<%endif%>
<%endif%>
<%endif%>
-<%endif%>
<%if(!exename)%>
<%if(header_files || inline_files || template_files || idl_files || pidl_files)%>