diff options
author | elliott_c <ocielliottc@users.noreply.github.com> | 2004-03-16 13:57:03 +0000 |
---|---|---|
committer | elliott_c <ocielliottc@users.noreply.github.com> | 2004-03-16 13:57:03 +0000 |
commit | 3639a154819a49b21293e126c2de6df40e1853c0 (patch) | |
tree | 6cbd4a39d90fa233afa6f7ac301ac8ff8cc1c2d1 | |
parent | 93cfa57f452f127bbfa878d07244f9fa54e65334 (diff) | |
download | ATCD-3639a154819a49b21293e126c2de6df40e1853c0.tar.gz |
ChangeLogTag: Tue Mar 16 07:55:10 2004 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | bin/MakeProjectCreator/modules/GNUACEWorkspaceCreator.pm | 48 | ||||
-rw-r--r-- | bin/MakeProjectCreator/modules/TemplateParser.pm | 129 |
3 files changed, 112 insertions, 78 deletions
diff --git a/ChangeLog b/ChangeLog index 28142fd7820..5f013a8aaac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +Tue Mar 16 07:55:10 2004 Chad Elliott <elliott_c@ociweb.com> + + * bin/MakeProjectCreator/modules/GNUACEWorkspaceCreator.pm: + + Fixed a bug where workspaces that contain projects that depend + upon projects outside the local directory would have invalid + dependencies. + + * bin/MakeProjectCreator/modules/TemplateParser.pm: + + Rewrote the 'if' handling code to be complete and support multiple + or's, and's and not's. + Tue Mar 16 06:22:40 2004 Chad Elliott <elliott_c@ociweb.com> * bin/MakeProjectCreator/templates/gnu.mpd: diff --git a/bin/MakeProjectCreator/modules/GNUACEWorkspaceCreator.pm b/bin/MakeProjectCreator/modules/GNUACEWorkspaceCreator.pm index ba78c9f9f7b..3f58a14cfa5 100644 --- a/bin/MakeProjectCreator/modules/GNUACEWorkspaceCreator.pm +++ b/bin/MakeProjectCreator/modules/GNUACEWorkspaceCreator.pm @@ -92,12 +92,36 @@ sub write_comps { } } } + my($need_dirs) = ($#dirs > -1); ## Store the local projects in a separate list - my(@lprj) = (); + my(@lprj) = (); + my(%dirprj) = (); foreach my $project (@list) { if ($project !~ /\//) { push(@lprj, $project); + if ($need_dirs && defined $targnum{$project}) { + foreach my $number (@{$targnum{$project}}) { + if ($list[$number] =~ /\//) { + ## If any local project depends on a project that is not + ## in this directory, we can not rely on the directory + ## recursion to get the correct dependencies. We will do + ## all projects as local targets. + @lprj = (); + foreach my $prj (@list) { + push(@lprj, $prj); + if ($prj =~ /\//) { + $dirprj{$prj} = 1; + } + } + $need_dirs = 0; + last; + } + } + if (!$need_dirs) { + last; + } + } } } @@ -109,7 +133,7 @@ sub write_comps { print $fh ' ', $$pjs{$project}->[0]; } print $fh $crlf; - if ($#dirs > -1) { + if ($need_dirs) { foreach my $dir (@dirs) { print $fh "\t\$(KEEP_GOING)\@cd $dir && \$(MAKE) \$(\@)$crlf"; } @@ -127,7 +151,14 @@ sub write_comps { } } print $fh $crlf, - "\t\$(KEEP_GOING)\@\$(MAKE) -f $project$crlf"; + "\t\$(KEEP_GOING)\@"; + if (defined $dirprj{$project}) { + print $fh "cd ", dirname($project), + " && \$(MAKE) -f ", basename($project), $crlf; + } + else { + print $fh "\$(MAKE) -f $project$crlf"; + } } print $fh $crlf, "REMAINING_TARGETS := \$(subst all, , \$(TARGETS_NESTED:.nested=))$crlf", @@ -140,9 +171,16 @@ sub write_comps { ## They will be handled serially by make. print $fh "\$(REMAINING_TARGETS):$crlf"; foreach my $project (@lprj) { - print $fh "\t\$(KEEP_GOING)\@\$(MAKE) -f $project \$(\@)$crlf"; + print $fh "\t\$(KEEP_GOING)\@"; + if (defined $dirprj{$project}) { + print $fh "cd ", dirname($project), + " && \$(MAKE) -f ", basename($project), " \$(\@)", $crlf; + } + else { + print $fh "\$(MAKE) -f $project \$(\@)$crlf"; + } } - if ($#dirs > -1) { + if ($need_dirs) { foreach my $dir (@dirs) { print $fh "\t\$(KEEP_GOING)\@cd $dir && \$(MAKE) \$(\@)$crlf"; } diff --git a/bin/MakeProjectCreator/modules/TemplateParser.pm b/bin/MakeProjectCreator/modules/TemplateParser.pm index 78ae34e0275..1c8507d8e88 100644 --- a/bin/MakeProjectCreator/modules/TemplateParser.pm +++ b/bin/MakeProjectCreator/modules/TemplateParser.pm @@ -507,97 +507,80 @@ sub get_flag_overrides { } -sub handle_if { +sub process_compound_if { my($self) = shift; - my($val) = shift; - my($name) = 'endif'; - - push(@{$self->{'lstack'}}, $self->get_line_number() . " $val"); - if (!$self->{'if_skip'}) { - my($true) = 1; - push(@{$self->{'sstack'}}, $name); - if ($val !~ /\|\|/ && $val =~ /^!(.*)/) { - $val = $1; - $val =~ s/^\s+//; - $true = 0; - } - - if ($val =~ /flag_overrides\(([^\)]+),\s*([^\)]+)\)/) { - $val = $self->get_flag_overrides($1, $2); - } - else { - if ($val =~ /\|\|/) { - my($str) = $val; - $val = undef; - foreach my $v (split(/\s*\|\|\s*/, $str)) { - if ($v =~ /^!(.*)/) { - my($p) = $self->get_value($1); - if (!defined $p || $p eq '') { - $val = 'some non-empty value'; - last; - } - } - else { - my($p) = $self->get_value($v); - if (defined $p && $p ne '') { - $val = $p; - last; - } - } - } + my($str) = shift; + my($status) = 0; + + if ($str =~ /\|\|/) { + my($ret) = 0; + foreach my $v (split(/\s*\|\|\s*/, $str)) { + $ret |= $self->process_compound_if($v); + if ($ret != 0) { + return 1; } - elsif ($val =~ /\&\&/) { - my($str) = $val; - $val = 'some non-empty value'; - foreach my $v (split(/\s*\&\&\s*/, $str)) { - if ($v =~ /^!(.*)/) { - my($p) = $self->get_value($1); - if (defined $p && $p ne '') { - $val = undef; - last; - } - } - else { - my($p) = $self->get_value($v); - if (!defined $p || $p eq '') { - $val = undef; - last; - } - } - } - } - else { - $val = $self->get_value($val) + } + } + elsif ($str =~ /\&\&/) { + my($ret) = 1; + foreach my $v (split(/\s*\&\&\s*/, $str)) { + $ret &&= $self->process_compound_if($v); + if ($ret == 0) { + return 0; } } + $status = 1; + } + else { + ## See if we need to reverse the return value + my($not) = 0; + if ($str =~ /^!(.*)/) { + $not = 1; + $str = $1; + } + + ## Get the value based on the string + my($val) = ($str =~ /flag_overrides\(([^\)]+),\s*([^\)]+)\)/ ? + $self->get_flag_overrides($1, $2) : + $self->get_value($str)); + ## See if any portion of the value is defined and not empty + my($ret) = 0; if (defined $val) { if (UNIVERSAL::isa($val, 'ARRAY')) { - my($empty) = 1; foreach my $v (@$val) { if ($v ne '') { - $empty = 0; + $ret = 1; last; } } - if ($empty) { - $val = undef; - } } - elsif ($val eq '') { - $val = undef; + elsif ($val ne '') { + $ret = 1; } } + return ($not ? !$ret : $ret); + } - if (!defined $val) { - $self->{'if_skip'} = $true; - } - else { - $self->{'if_skip'} = !$true; - } + return $status; +} + + +sub handle_if { + my($self) = shift; + my($val) = shift; + my($name) = 'endif'; + + push(@{$self->{'lstack'}}, $self->get_line_number() . " $val"); + if ($self->{'if_skip'}) { + push(@{$self->{'sstack'}}, "*$name"); } else { - push(@{$self->{'sstack'}}, "*$name"); + ## Determine if we are skipping the portion of this if statement + ## $val will always be defined since we won't get into this method + ## without properly parsing the if statement. + $self->{'if_skip'} = !$self->process_compound_if($val); + push(@{$self->{'sstack'}}, $name); } } |