summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2006-03-06 18:09:15 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2006-03-06 18:09:15 +0000
commita3717a1908096b14a4cacb951e92999aa4216216 (patch)
tree3d581685e2d242c8c38742c9e724f531b56deb4d
parentc02c149fdfadd19862193bc9283263497694d4a0 (diff)
downloadMPC-a3717a1908096b14a4cacb951e92999aa4216216.tar.gz
ChangeLogTag: Mon Mar 6 18:09:36 UTC 2006 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r--ChangeLog51
-rw-r--r--config/qt.mpb10
-rwxr-xr-xgenerate_export_header.pl121
-rw-r--r--modules/BMakeProjectCreator.pm2
-rw-r--r--modules/BMakeWorkspaceCreator.pm2
-rw-r--r--modules/Creator.pm100
-rw-r--r--modules/DirectoryManager.pm16
-rw-r--r--modules/Driver.pm3
-rw-r--r--modules/HTMLProjectCreator.pm8
-rw-r--r--modules/NMakeWorkspaceCreator.pm2
-rw-r--r--modules/Options.pm60
-rw-r--r--modules/ProjectCreator.pm255
-rw-r--r--modules/TemplateParser.pm33
-rw-r--r--modules/VC7WorkspaceCreator.pm3
-rw-r--r--modules/WinProjectBase.pm11
-rw-r--r--modules/WorkspaceCreator.pm9
-rw-r--r--templates/make.mpd19
-rw-r--r--templates/makedll.mpt2
-rw-r--r--templates/vc7.mpd6
-rw-r--r--templates/vc8.mpd6
20 files changed, 412 insertions, 307 deletions
diff --git a/ChangeLog b/ChangeLog
index d03dfcaa..a90c84a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,54 @@
+Mon Mar 6 18:09:36 UTC 2006 Chad Elliott <elliott_c@ociweb.com>
+
+ * config/qt.mpb:
+
+ The qt library can have a variety of suffixes (depending on
+ platform and version). This base project was changed such that
+ there is no 'specific' section for for the qt library name. It is
+ added to 'lit_libs' as qt-mt$(QT_VERSION).
+
+ * generate_export_header.pl:
+
+ This is a new script that will generate an export header file that
+ can be used (not in conjunction with ACE) to support symbol
+ visibility using a variety of compilers.
+
+ * modules/BMakeProjectCreator.pm:
+ * modules/BMakeWorkspaceCreator.pm:
+ * modules/Creator.pm:
+ * modules/DirectoryManager.pm:
+ * modules/Driver.pm:
+ * modules/HTMLProjectCreator.pm:
+ * modules/NMakeWorkspaceCreator.pm:
+ * modules/Options.pm:
+ * modules/ProjectCreator.pm:
+ * modules/TemplateParser.pm:
+ * modules/VC7WorkspaceCreator.pm:
+ * modules/WinProjectBase.pm:
+ * modules/WorkspaceCreator.pm:
+
+ The majority of the changes to these files are performance
+ related. However, two bug fixes are included (one pertaining to
+ file grouping and the other pertaining to directory translation of
+ a directory only containing "..").
+
+ * templates/make.mpd:
+
+ Three modifications:
+
+ 1) Only set PICFLAGS if the dll_ext template variable is defined.
+ 2) Allow the user to override the 'chmod' template variable.
+ 3) Removed the .<%slash%> in front of the call to "specialscript"
+
+ * templates/makedll.mpt:
+
+ Added -mthreads -mminimal-toc compiler flags for LynxOS.
+
+ * templates/vc7.mpd:
+ * templates/vc8.mpd:
+
+ Fixed whitespace for default grouped files.
+
Mon Feb 27 17:35:55 UTC 2006 Chad Elliott <elliott_c@ociweb.com>
* config/zlib.mpb:
diff --git a/config/qt.mpb b/config/qt.mpb
index 9c7c468a..c6bc7cc6 100644
--- a/config/qt.mpb
+++ b/config/qt.mpb
@@ -6,14 +6,7 @@ project {
includes += $(QTDIR)/include
libpaths += $(QTDIR)/lib
macros += QT_THREAD_SUPPORT
-
- // @@ Notice: If you are building with Cygwin, you may need to manually
- // change the following Qt library to qt-mt230nc.
- specific(gnuace, make, sle, automake, ghs) {
- lit_libs += qt-mt
- } else {
- lit_libs += qt-mt230nc
- }
+ lit_libs += qt-mt$(QT_VERSION)
Define_Custom(UIC) {
automatic = 1
@@ -33,5 +26,4 @@ project {
pre_extension = _moc
source_outputext = .cpp
}
-
}
diff --git a/generate_export_header.pl b/generate_export_header.pl
new file mode 100755
index 00000000..f6e8d6cd
--- /dev/null
+++ b/generate_export_header.pl
@@ -0,0 +1,121 @@
+eval '(exit $?0)' && eval 'exec perl -w -S $0 ${1+"$@"}'
+ & eval 'exec perl -w -S $0 $argv:q'
+ if 0;
+
+# ******************************************************************
+# Author: Chad Elliott
+# Date: 3/1/2006
+# $Id$
+# Description: Generate an export header file for use with various compilers
+# ******************************************************************
+
+# ******************************************************************
+# Pragma Section
+# ******************************************************************
+
+use strict;
+use FileHandle;
+use File::Basename;
+
+# ******************************************************************
+# Data Section
+# ******************************************************************
+
+my($version) = '$Id$';
+$version =~ s/.*\s+(\d+[\.\d]+)\s+.*/$1/;
+
+# ******************************************************************
+# Subroutine Section
+# ******************************************************************
+
+sub generate_export_header {
+ my($name) = shift;
+ my($output) = shift;
+ my($fh) = new FileHandle();
+
+ if (open($fh, ">$output")) {
+ $name = uc($name);
+ print $fh <<EOM
+#ifndef ${name}_EXPORT_H
+#define ${name}_EXPORT_H
+
+#if !defined(${name}_HAS_DLL)
+# if defined(${name}_AS_STATIC_LIBS)
+# define ${name}_HAS_DLL 0
+# else
+# define ${name}_HAS_DLL 1
+# endif
+#endif
+
+#if (${name}_HAS_DLL == 1)
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC >= 0x550)
+# if defined(${name}_BUILD_DLL)
+# define ${name}_Export __symbolic
+# else
+# define ${name}_Export __global
+# endif
+# elif defined(WIN32) || defined(UNDER_CE) || defined(__CYGWIN__)
+# if defined(${name}_BUILD_DLL)
+# define ${name}_Export __declspec(dllexport)
+# else
+# define ${name}_Export __declspec(dllimport)
+# endif
+# elif (defined(__GNUC__) && (__GNUC__ >= 4))
+# if defined(${name}_BUILD_DLL)
+# define ${name}_Export __attribute__((visibility("default")))
+# else
+# define ${name}_Export
+# endif
+# else
+# define ${name}_Export
+# endif
+#else
+# define ${name}_Export
+#endif
+
+#endif
+EOM
+;
+ close($fh);
+ print "Output written to $output\n";
+ }
+}
+
+sub usageAndExit {
+ my($str) = shift;
+ if (defined $str) {
+ print STDERR "$str\n";
+ }
+ print STDERR "Generate Export Header v$version\n",
+ "Usage: ", basename($0), " <library name> [output file]\n";
+ exit(0);
+}
+
+# ******************************************************************
+# Main Section
+# ******************************************************************
+
+my($name) = shift;
+my($output) = shift;
+
+if (!defined $name) {
+ usageAndExit();
+}
+elsif (index($name, '-') == 0) {
+ usageAndExit();
+}
+
+if (!defined $output) {
+ $output = $name . '_' . (substr($name, 0, 1) =~ /[A-Z]/ ? 'E' : 'e') .
+ 'xport.h';
+}
+
+if ($name =~ s/^\d+//) {
+ print "WARNING: Removing beginning numbers from export name.\n";
+}
+if ($name =~ s/-\s/_/g) {
+ print "WARNING: Converting dashes and ",
+ "whitespace to underscores in export name.\n";
+}
+
+exit(generate_export_header($name, $output));
diff --git a/modules/BMakeProjectCreator.pm b/modules/BMakeProjectCreator.pm
index 3863cd22..57a5ed9d 100644
--- a/modules/BMakeProjectCreator.pm
+++ b/modules/BMakeProjectCreator.pm
@@ -39,7 +39,7 @@ sub fill_value {
$dirname = '.';
}
else {
- $dirname = $self->slash_to_backslash($dirname);
+ $dirname =~ s/\//\\/g;
}
$dirnames{$dirname} = 1;
}
diff --git a/modules/BMakeWorkspaceCreator.pm b/modules/BMakeWorkspaceCreator.pm
index 398db8a1..7d568140 100644
--- a/modules/BMakeWorkspaceCreator.pm
+++ b/modules/BMakeWorkspaceCreator.pm
@@ -99,7 +99,7 @@ sub write_project_targets {
if ($dir ne '.') {
$chdir = 1;
my($count) = ($dir =~ tr/\///) + 1;
- if ($dir =~ /^\.\.\//) {
+ if (index($dir, '../') == 0) {
## Find out how many directories we went down
my($rel) = $dir;
while($rel =~ s/^\.\.\///) {
diff --git a/modules/Creator.pm b/modules/Creator.pm
index e866ad3b..8417f510 100644
--- a/modules/Creator.pm
+++ b/modules/Creator.pm
@@ -23,6 +23,9 @@ use vars qw(@ISA);
# Data Section
# ************************************************************
+my($assign_key) = 'assign';
+my($gassign_key) = 'global_assign';
+
my(@statekeys) = ('global', 'include', 'template', 'ti',
'dynamic', 'static', 'relative', 'addtemp',
'addproj', 'progress', 'toplevel', 'baseprojs',
@@ -32,6 +35,7 @@ my(@statekeys) = ('global', 'include', 'template', 'ti',
);
my(%all_written) = ();
+my($onVMS) = ($^O eq 'VMS');
# ************************************************************
# Subroutine Section
@@ -78,8 +82,8 @@ sub new {
$self->{'files_written'} = {};
$self->{'real_fwritten'} = [];
$self->{'reading_global'} = 0;
- $self->{'global_assign'} = {};
- $self->{'assign'} = {};
+ $self->{$gassign_key} = {};
+ $self->{$assign_key} = {};
$self->{'baseprojs'} = $baseprojs;
$self->{'dynamic'} = $dynamic;
$self->{'static'} = $static;
@@ -200,22 +204,8 @@ sub parse_assignment {
my($line) = shift;
my($values) = shift;
- if ($line =~ /^(\w+(::\w+)*)\s*\+=\s*(.*)?/) {
- my($name) = lc($1);
- my($value) = $3;
- push(@$values, 'assign_add', $name, $value);
- return 1;
- }
- elsif ($line =~ /^(\w+(::\w+)*)\s*=\s*(.*)?/) {
- my($name) = lc($1);
- my($value) = $3;
- push(@$values, 'assignment', $name, $value);
- return 1;
- }
- elsif ($line =~ /^(\w+(::\w+)*)\s*\-=\s*(.*)?/) {
- my($name) = lc($1);
- my($value) = $3;
- push(@$values, 'assign_sub', $name, $value);
+ if ($line =~ /^(\w+(::\w+)*)\s*([\-+]?=)\s*(.*)?/) {
+ push(@$values, $3, lc($1), $4);
return 1;
}
@@ -249,15 +239,9 @@ sub parse_known {
}
else {
if (defined $parents) {
- my(@parents) = ();
- $parents =~ s/^://;
- foreach my $parent (split(',', $parents)) {
- $parent =~ s/^\s+//;
- $parent =~ s/\s+$//;
- if ($parent ne '') {
- push(@parents, $parent);
- }
- }
+ $parents =~ s/^:\s*//;
+ $parents =~ s/\s+$//;
+ my(@parents) = split(/\s*,\s*/, $parents);
if (!defined $parents[0]) {
## The : was used, but no parents followed. This
## is an error.
@@ -285,15 +269,9 @@ sub parse_known {
my(@names) = split(/\s*,\s*/, $name);
if (defined $parents) {
- my(@parents) = ();
- $parents =~ s/^://;
- foreach my $parent (split(',', $parents)) {
- $parent =~ s/^\s+//;
- $parent =~ s/\s+$//;
- if ($parent ne '') {
- push(@parents, $parent);
- }
- }
+ $parents =~ s/^:\s*//;
+ $parents =~ s/\s+$//;
+ my(@parents) = split(/\s*,\s*/, $parents);
if (!defined $parents[0]) {
## The : was used, but no parents followed. This
## is an error.
@@ -384,13 +362,13 @@ sub parse_scope {
my(@values) = ();
if (defined $validNames && $self->parse_assignment($line, \@values)) {
if (defined $$validNames{$values[1]}) {
- if ($values[0] eq 'assignment') {
+ if ($values[0] eq '=') {
$self->process_assignment($values[1], $values[2], $flags);
}
- elsif ($values[0] eq 'assign_add') {
+ elsif ($values[0] eq '+=') {
$self->process_assignment_add($values[1], $values[2], $flags);
}
- elsif ($values[0] eq 'assign_sub') {
+ elsif ($values[0] eq '-=') {
$self->process_assignment_sub($values[1], $values[2], $flags);
}
}
@@ -437,7 +415,7 @@ sub generate_default_file_list {
my($need_dir) = ($dir ne '.');
my($skip) = 0;
foreach my $file (grep(!/^\.\.?$/, readdir($dh))) {
- $file =~ s/\.dir$// if ($^O eq 'VMS');
+ $file =~ s/\.dir$// if ($onVMS);
## Prefix each file name with the directory only if it's not '.'
my($full) = ($need_dir ? "$dir/" : '') . $file;
@@ -523,7 +501,7 @@ sub extension_recursive_input_list {
if (opendir($fh, $dir)) {
foreach my $file (grep(!/^\.\.?$/, readdir($fh))) {
- $file =~ s/\.dir$// if ($^O eq 'VMS');
+ $file =~ s/\.dir$// if ($onVMS);
my($skip) = 0;
my($full) = ($dir ne '.' ? "$dir/" : '') . $file;
@@ -562,8 +540,8 @@ sub modify_assignment_value {
my($name) = shift;
my($value) = shift;
- if ($self->{'convert_slashes'} && $name !~ /flags/) {
- $value = $self->slash_to_backslash($value);
+ if ($self->{'convert_slashes'} && index($name, 'flags') == -1) {
+ $value =~ s/\//\\/g;
}
return $value;
}
@@ -572,17 +550,8 @@ sub modify_assignment_value {
sub get_assignment_hash {
## NOTE: If anything in this block changes, then you must make the
## same change in process_assignment.
- my($self) = shift;
- my($tag) = ($self->{'reading_global'} ? 'global_assign' : 'assign');
- my($assign) = $self->{$tag};
-
- ## If we haven't yet defined the hash table in this project
- if (!defined $assign) {
- $assign = {};
- $self->{$tag} = $assign;
- }
-
- return $assign;
+ my($self) = shift;
+ return $self->{$self->{'reading_global'} ? $gassign_key : $assign_key};
}
@@ -596,14 +565,8 @@ sub process_assignment {
if (!defined $assign) {
## NOTE: If anything in this block changes, then you must make the
## same change in get_assignment_hash.
- my($tag) = ($self->{'reading_global'} ? 'global_assign' : 'assign');
- $assign = $self->{$tag};
-
- ## If we haven't yet defined the hash table in this project
- if (!defined $assign) {
- $assign = {};
- $self->{$tag} = $assign;
- }
+ $assign = $self->{$self->{'reading_global'} ?
+ $gassign_key : $assign_key};
}
if (defined $value) {
@@ -876,8 +839,8 @@ sub get_assignment {
## If no hash table was passed in
if (!defined $assign) {
- my($tag) = ($self->{'reading_global'} ? 'global_assign' : 'assign');
- $assign = $self->{$tag};
+ $assign = $self->{$self->{'reading_global'} ?
+ $gassign_key : $assign_key};
}
return $$assign{$name};
@@ -940,6 +903,7 @@ sub get_language {
return $self->{'language'};
}
+
sub get_outdir {
my($self) = shift;
if (defined $self->{'into'}) {
@@ -1026,10 +990,10 @@ sub sort_files {
sub file_sorter {
- my($self) = shift;
- my($left) = shift;
- my($right) = shift;
- return $left cmp $right;
+ #my($self) = shift;
+ #my($left) = shift;
+ #my($right) = shift;
+ return $_[1] cmp $_[2];
}
diff --git a/modules/DirectoryManager.pm b/modules/DirectoryManager.pm
index d563868e..c91e1848 100644
--- a/modules/DirectoryManager.pm
+++ b/modules/DirectoryManager.pm
@@ -18,6 +18,7 @@ use File::Basename;
# Data Section
# ************************************************************
+my($onVMS) = ($^O eq 'VMS');
my($case_insensitive) = File::Spec->case_tolerant();
my($cwd) = Cwd::getcwd();
if ($^O eq 'cygwin' && $cwd !~ /[A-Za-z]:/) {
@@ -28,7 +29,7 @@ if ($^O eq 'cygwin' && $cwd !~ /[A-Za-z]:/) {
}
$case_insensitive = 1;
}
-elsif ($^O eq 'VMS') {
+elsif ($onVMS) {
$cwd = VMS::Filespec::unixify($cwd);
$cwd =~ s!/$!!g;
}
@@ -51,7 +52,7 @@ sub cd {
## If the new directory contains a relative directory
## then we just get the real working directory
- if ($dir =~ /\.\./) {
+ if (index($dir, '..') >= 0) {
$cwd = Cwd::getcwd();
if ($^O eq 'cygwin' && $cwd !~ /[A-Za-z]:/) {
my($cyg) = `cygpath -w $cwd`;
@@ -60,7 +61,7 @@ sub cd {
chop($cwd = $cyg);
}
}
- elsif ($^O eq 'VMS') {
+ elsif ($onVMS) {
$cwd = VMS::Filespec::unixify($cwd);
$cwd =~ s!/$!!g;
}
@@ -93,8 +94,8 @@ sub mpc_dirname {
my($self) = shift;
my($dir) = shift;
- if ($^O eq 'VMS') {
- if ($dir =~ /\//) {
+ if ($onVMS) {
+ if (index($dir, '/') >= 0) {
$dir = VMS::Filespec::unixify(dirname($dir));
$dir =~ s!/$!!g;
return $dir;
@@ -117,7 +118,7 @@ sub mpc_glob {
## glob() provided by OpenVMS does not understand [] within
## the pattern. So, we implement our own through recursive calls
## to mpc_glob().
- if ($^O eq 'VMS' && $pattern =~ /(.*)\[([^\]]+)\](.*)/) {
+ if ($onVMS && $pattern =~ /(.*)\[([^\]]+)\](.*)/) {
my($pre) = $1;
my($mid) = $2;
my($post) = $3;
@@ -153,10 +154,11 @@ sub translate_directory {
my($dir) = shift;
my($dd) = 'dotdot';
- if ($dir =~ /\.\./) {
+ if (index($dir, '..') >= 0) {
$dir =~ s/^\.\.([\/\\])/$dd$1/;
$dir =~ s/([\/\\])\.\.$/$1$dd/;
$dir =~ s/([\/\\])\.\.([\/\\])/$1$dd$2/g;
+ $dir =~ s/^\.\.$/$dd/;
}
return $dir;
}
diff --git a/modules/Driver.pm b/modules/Driver.pm
index 82e51b02..01574be7 100644
--- a/modules/Driver.pm
+++ b/modules/Driver.pm
@@ -68,8 +68,7 @@ sub parse_line {
$value =~ s/^\s+//;
$value =~ s/\s+$//;
}
- if ($name =~ /\*/) {
- $name =~ s/\*/.*/g;
+ if ($name =~ s/\*/.*/g) {
foreach my $key (keys %ENV) {
if ($key =~ /^$name$/ && !exists $self->{'reldefs'}->{$key}) {
## Put this value at the front since it doesn't need
diff --git a/modules/HTMLProjectCreator.pm b/modules/HTMLProjectCreator.pm
index 5be54806..44d6b61f 100644
--- a/modules/HTMLProjectCreator.pm
+++ b/modules/HTMLProjectCreator.pm
@@ -30,10 +30,10 @@ my($style_indent) = .5;
# ************************************************************
sub file_sorter {
- my($self) = shift;
- my($left) = shift;
- my($right) = shift;
- return lc($left) cmp lc($right);
+ #my($self) = shift;
+ #my($left) = shift;
+ #my($right) = shift;
+ return lc($_[1]) cmp lc($_[2]);
}
diff --git a/modules/NMakeWorkspaceCreator.pm b/modules/NMakeWorkspaceCreator.pm
index 4d8b1cd2..8f765db9 100644
--- a/modules/NMakeWorkspaceCreator.pm
+++ b/modules/NMakeWorkspaceCreator.pm
@@ -96,7 +96,7 @@ sub write_project_targets {
if ($dir ne '.') {
$chdir = 1;
my($count) = ($dir =~ tr/\///) + 1;
- if ($dir =~ /^\.\.\//) {
+ if (index($dir, '../') == 0) {
## Find out how many directories we went down
my($rel) = $dir;
while($rel =~ s/^\.\.\///) {
diff --git a/modules/Options.pm b/modules/Options.pm
index 5a876ad2..402e9d96 100644
--- a/modules/Options.pm
+++ b/modules/Options.pm
@@ -519,37 +519,35 @@ sub options {
}
}
- my(%options) = ('global' => $global,
- 'feature_file' => $feature_f,
- 'gfeature_file' => $gfeature_f,
- 'features' => \@features,
- 'include' => \@include,
- 'input' => \@input,
- 'creators' => \@creators,
- 'baseprojs' => \@baseprojs,
- 'template' => $template,
- 'ti' => \%ti,
- 'dynamic' => $dynamic,
- 'static' => $static,
- 'relative' => \%relative,
- 'reldefs' => $reldefs,
- 'toplevel' => $toplevel,
- 'recurse' => $recurse,
- 'addtemp' => \%addtemp,
- 'addproj' => \%addproj,
- 'coexistence' => $makeco,
- 'hierarchy' => $hierarchy,
- 'exclude' => \@exclude,
- 'name_modifier' => $nmodifier,
- 'apply_project' => $applypj,
- 'genins' => $genins,
- 'into' => $into,
- 'language' => $language,
- 'use_env' => $use_env,
- 'expand_vars' => $expandvars,
- );
-
- return \%options;
+ return {'global' => $global,
+ 'feature_file' => $feature_f,
+ 'gfeature_file' => $gfeature_f,
+ 'features' => \@features,
+ 'include' => \@include,
+ 'input' => \@input,
+ 'creators' => \@creators,
+ 'baseprojs' => \@baseprojs,
+ 'template' => $template,
+ 'ti' => \%ti,
+ 'dynamic' => $dynamic,
+ 'static' => $static,
+ 'relative' => \%relative,
+ 'reldefs' => $reldefs,
+ 'toplevel' => $toplevel,
+ 'recurse' => $recurse,
+ 'addtemp' => \%addtemp,
+ 'addproj' => \%addproj,
+ 'coexistence' => $makeco,
+ 'hierarchy' => $hierarchy,
+ 'exclude' => \@exclude,
+ 'name_modifier' => $nmodifier,
+ 'apply_project' => $applypj,
+ 'genins' => $genins,
+ 'into' => $into,
+ 'language' => $language,
+ 'use_env' => $use_env,
+ 'expand_vars' => $expandvars,
+ };
}
diff --git a/modules/ProjectCreator.pm b/modules/ProjectCreator.pm
index 37512dae..cf9faec2 100644
--- a/modules/ProjectCreator.pm
+++ b/modules/ProjectCreator.pm
@@ -339,15 +339,16 @@ sub process_assignment {
## the user to correctly depend on another project within the same
## directory.
if (defined $value) {
- if ($name eq 'after' && $value =~ /\*/) {
+ if ($name eq 'after' && index($value, '*') >= 0) {
$value = $self->fill_type_name($value,
$self->get_default_project_name());
}
- if (!$self->{'dollar_special'} && $value =~ /\$\$/) {
+ if (!$self->{'dollar_special'} && index($value, '$$') >= 0) {
$value =~ s/\$\$/\$/g;
}
if (defined $self->{'valid_names'}->{$name} &&
- ($self->{'valid_names'}->{$name} & 0x04) == 0 && $value =~ /<%/) {
+ ($self->{'valid_names'}->{$name} & 0x04) == 0 &&
+ index($value, '<%') >= 0) {
$value = $self->replace_parameters($value, $self->{'command_subs'});
}
}
@@ -359,7 +360,7 @@ sub process_assignment {
if (!defined $assign || $assign == $self->get_assignment_hash()) {
my($mapped) = $self->{'valid_names'}->{$name};
if (defined $mapped && UNIVERSAL::isa($mapped, 'ARRAY')) {
- $self->parse_scoped_assignment($$mapped[0], 'assignment',
+ $self->parse_scoped_assignment($$mapped[0], '=',
$$mapped[1], $value,
$self->{'generated_exts'}->{$$mapped[0]});
}
@@ -680,7 +681,7 @@ sub parse_line {
$name = $self->transform_file_name($name);
## Replace any *'s with the default name
- if ($name =~ /\*/) {
+ if (index($name, '*') >= 0) {
$name = $self->fill_type_name(
$name,
$self->get_default_project_name());
@@ -701,7 +702,7 @@ sub parse_line {
}
}
}
- elsif ($values[0] eq 'assignment') {
+ elsif ($values[0] eq '=') {
my($name) = $values[1];
my($value) = $values[2];
if (defined $self->{'valid_names'}->{$name}) {
@@ -712,7 +713,7 @@ sub parse_line {
$status = 0;
}
}
- elsif ($values[0] eq 'assign_add') {
+ elsif ($values[0] eq '+=') {
my($name) = $values[1];
my($value) = $values[2];
if (defined $self->{'valid_names'}->{$name}) {
@@ -723,7 +724,7 @@ sub parse_line {
$status = 0;
}
}
- elsif ($values[0] eq 'assign_sub') {
+ elsif ($values[0] eq '-=') {
my($name) = $values[1];
my($value) = $values[2];
if (defined $self->{'valid_names'}->{$name}) {
@@ -841,10 +842,10 @@ sub parse_scoped_assignment {
$self->{'flag_overrides'}->{$tag} = $over;
}
- if ($type eq 'assignment') {
+ if ($type eq '=') {
$self->process_assignment($name, $value, $flags);
}
- elsif ($type eq 'assign_add') {
+ elsif ($type eq '+=') {
## If there is no value in $$flags, then we need to get
## the outer scope value and put it in there.
if (!defined $self->get_assignment($name, $flags)) {
@@ -853,7 +854,7 @@ sub parse_scoped_assignment {
}
$self->process_assignment_add($name, $value, $flags);
}
- elsif ($type eq 'assign_sub') {
+ elsif ($type eq '-=') {
## If there is no value in $$flags, then we need to get
## the outer scope value and put it in there.
if (!defined $self->get_assignment($name, $flags)) {
@@ -886,10 +887,10 @@ sub handle_unknown_assignment {
## Now modify the addtemp values
$self->information("'$values[1]' was used as a template modifier.");
- if ($values[0] eq 'assign_add') {
+ if ($values[0] eq '+=') {
$values[0] = 1;
}
- elsif ($values[0] eq 'assign_sub') {
+ elsif ($values[0] eq '-=') {
$values[0] = -1;
}
else {
@@ -981,35 +982,38 @@ sub process_component_line {
## slashes to ensure that later flag_overrides checks will happen
## correctly.
$line = $self->relative($line);
- if ($self->{'convert_slashes'}) {
- $line =~ s/\\/\//g;
- }
+ $line =~ s/\\/\//g if ($self->{'convert_slashes'});
## Now look for specially listed files
- if ($line =~ /(.*)\s+(>>|<<)\s+(.*)/) {
+ if ((index($line, '>>') >= 0 || index($line, '<<') >= 0) &&
+ $line =~ /(.*)\s+(>>|<<)\s+(.*)/) {
$line = $1;
my($oop) = $2;
+ my($iop) = ($oop eq '>>' ? '<<' : '>>');
my($out) = ($oop eq '>>' ? $3 : undef);
my($dep) = ($oop eq '<<' ? $3 : undef);
$line =~ s/\s+$//;
- if ($line =~ /(.*)\s+(>>|<<)\s+(.*)/) {
+ if (index($line, $iop) >= 0 && $line =~ /(.*)\s+$iop\s+(.*)/) {
$line = $1;
- $out = ($2 eq '>>' ? $3 : $out);
- $dep = ($2 eq '<<' ? $3 : $dep);
-
- if ($2 eq $oop) {
- $status = 0;
- $error = "Duplicate $oop used";
- }
+ $out = ($iop eq '>>' ? $2 : $out);
+ $dep = ($iop eq '<<' ? $2 : $dep);
$line =~ s/\s+$//;
}
+ ## Check for both possible error conditions
+ if (index($line, $oop) >= 0) {
+ $status = 0;
+ $error = "Duplicate $oop used";
+ }
+ elsif (index($line, $iop) >= 0) {
+ $status = 0;
+ $error = "Duplicate $iop used";
+ }
+
## Keys used internally to MPC need to be in forward slash format.
my($key) = $line;
- if ($self->{'convert_slashes'}) {
- $key =~ s/\\/\//g;
- }
+ $key =~ s/\\/\//g if ($self->{'convert_slashes'});
if (defined $out) {
if (!defined $self->{'custom_special_output'}->{$tag}) {
$self->{'custom_special_output'}->{$tag} = {};
@@ -1244,7 +1248,7 @@ sub parse_components {
## If we didn't encounter an error, didn't have any files explicitly
## listed and we attempted to exclude files, then we need to find the
## set of files that don't match the excluded files and add them.
- if ($status && $#exclude != -1 && defined $grname) {
+ if ($status && defined $exclude[0] && defined $grname) {
my($alldir) = $self->get_assignment('recurse') || $flags{'recurse'};
my(%checked) = ();
my(@files) = ();
@@ -1375,16 +1379,16 @@ sub process_array_assignment {
my($type) = shift;
my($array) = shift;
- if (!defined $$aref || $type eq 'assignment') {
- if ($type ne 'assign_sub') {
+ if (!defined $$aref || $type eq '=') {
+ if ($type ne '-=') {
$$aref = $array;
}
}
else {
- if ($type eq 'assign_add') {
+ if ($type eq '+=') {
push(@{$$aref}, @$array);
}
- elsif ($type eq 'assign_sub') {
+ elsif ($type eq '-=') {
my($count) = scalar(@{$$aref});
for(my $i = 0; $i < $count; ++$i) {
foreach my $val (@$array) {
@@ -1545,17 +1549,17 @@ sub parse_define_custom {
$value = $self->relative($value);
if (($customDefined{$name} & 0x04) != 0) {
- if ($type eq 'assignment') {
+ if ($type eq '=') {
$self->process_assignment(
$name, $value,
$self->{'generated_exts'}->{$tag});
}
- elsif ($type eq 'assign_add') {
+ elsif ($type eq '+=') {
$self->process_assignment_add(
$name, $value,
$self->{'generated_exts'}->{$tag});
}
- elsif ($type eq 'assign_sub') {
+ elsif ($type eq '-=') {
$self->process_assignment_sub(
$name, $value,
$self->{'generated_exts'}->{$tag});
@@ -1649,7 +1653,8 @@ sub remove_duplicate_addition {
## perform a little fix on the value to avoid multiple
## libraries and to try to insure the correct linking order
if ($name eq 'macros' || $name eq 'libpaths' ||
- $name eq 'includes' || $name =~ /libs$/ || $name =~ /^$grouped_key/) {
+ $name eq 'includes' || $name =~ /libs$/ ||
+ index($name, $grouped_key) == 0) {
my($allowed) = '';
my(%parts) = ();
@@ -1766,18 +1771,15 @@ sub already_added {
my($array) = shift;
my($name) = shift;
- ## This method expects that the file
- ## name will be unix style
- $name =~ s/\\/\//g;
+ ## This method expects that the file name will be unix style
+ $name =~ s/\\/\//g if ($self->{'convert_slashes'});
## Remove the leading ./
$name =~ s/^\.\///;
my($dsname) = "./$name";
foreach my $file (@$array) {
- if ($file eq $name || $file eq $dsname) {
- return 1;
- }
+ return 1 if ($file eq $name || $file eq $dsname);
}
return 0;
@@ -1824,8 +1826,9 @@ sub process_optional_option {
my($value) = shift;
my($status) = undef;
my(@parts) = grep(!/^$/, split(/\s+/, $opt));
+ my($pcount) = scalar(@parts);
- for(my $i = 0; $i <= $#parts; $i++) {
+ for(my $i = 0; $i < $pcount; $i++) {
if ($parts[$i] eq '&&' || $parts[$i] eq '||') {
if (defined $status) {
if (defined $parts[$i + 1]) {
@@ -1915,7 +1918,7 @@ sub get_pre_keyword_array {
## If the current array only has the default,
## then we need to remove it
- if ($#additional >= 0) {
+ if (defined $additional[0]) {
if ($#array == 0 && $array[0] eq '') {
pop(@array);
}
@@ -1990,7 +1993,7 @@ sub generated_filename_arrays {
my(@exts) = (defined $self->{'generated_exts'}->{$type}->{$tag} ?
@{$self->{'generated_exts'}->{$type}->{$tag}} : ());
- if ($#exts == -1) {
+ if (!defined $exts[0]) {
my($backtag) = $tag;
if ($backtag =~ s/files$/outputext/) {
$self->add_optional_filename_portion($type, $backtag,
@@ -1998,7 +2001,7 @@ sub generated_filename_arrays {
}
}
- if ($#pearr == 0 && $#pfarr == 0 && $#exts == -1 &&
+ if (!defined $exts[0] && $#pearr == 0 && $#pfarr == 0 &&
$pearr[0] eq '' && $pfarr[0] eq '') {
## If both arrays are defined to be the defaults, then there
## is nothing for us to do.
@@ -2054,16 +2057,9 @@ sub generated_filename_arrays {
sub generated_filenames {
my($self) = shift;
- my($part) = shift;
- my($type) = shift;
- my($tag) = shift;
- my($file) = shift;
- my($noext) = shift;
my(@files) = ();
- my(@array) = $self->generated_filename_arrays($part, $type, $tag,
- $file, $noext);
- foreach my $array (@array) {
+ foreach my $array ($self->generated_filename_arrays(@_)) {
push(@files, @$array);
}
@@ -2102,7 +2098,7 @@ sub add_generated_files {
}
}
- if ($#added >= 0) {
+ if (defined $added[0]) {
my($names) = $self->{$tag};
## Get all files in one list and save the directory
@@ -2130,7 +2126,7 @@ sub add_generated_files {
## If we have files to add, make sure we add them to a group
## that has the same directory location as the files we're adding.
- if ($#oktoadd >= 0) {
+ if (defined $oktoadd[0]) {
my($key) = (defined $group ? $group :
$dircomp{$self->mpc_dirname($oktoadd[0])});
if (!defined $key) {
@@ -2300,10 +2296,10 @@ sub generate_default_target_names {
## If we still don't have a project type, then we will
## default to a library if there are source or resource files
if (!defined $exename) {
- if ($#sources < 0) {
+ if (!defined $sources[0]) {
@sources = $self->get_component_list('resource_files', 1);
}
- if ($#sources >= 0) {
+ if (defined $sources[0]) {
if (!$shared_empty) {
$self->process_assignment('sharedname',
$self->{'unmodified_project_name'});
@@ -2328,7 +2324,7 @@ sub generate_default_target_names {
## Check for the use of an asterisk in the name
foreach my $key ('exename', 'sharedname', 'staticname') {
my($value) = $self->get_assignment($key);
- if (defined $value && $value =~ /\*/) {
+ if (defined $value && index($value, '*') >= 0) {
$value = $self->fill_type_name($value,
$self->{'unmodified_project_name'});
$self->process_assignment($key, $value);
@@ -2344,8 +2340,7 @@ sub generate_default_pch_filenames {
my($pchcdef) = (defined $self->get_assignment('pch_source'));
if (!$pchhdef || !$pchcdef) {
- my($pname) = $self->escape_regex_special(
- $self->get_assignment('project_name'));
+ my($pname) = $self->get_assignment('project_name');
my($hcount) = 0;
my($ccount) = 0;
my($hmatching) = undef;
@@ -2353,13 +2348,13 @@ sub generate_default_pch_filenames {
foreach my $file (@$files) {
## If the file doesn't even contain _pch, then there's no point
## in looping through all of the extensions
- if ($file =~ /_pch/) {
+ if (index($file, '_pch') >= 0) {
if (!$pchhdef) {
foreach my $ext (@{$self->{'valid_components'}->{'header_files'}}) {
if ($file =~ /(.*_pch$ext)$/) {
$self->process_assignment('pch_header', $1);
++$hcount;
- if ($file =~ /$pname/) {
+ if (index($file, $pname) >= 0) {
$hmatching = $file;
}
last;
@@ -2371,7 +2366,7 @@ sub generate_default_pch_filenames {
if ($file =~ /(.*_pch$ext)$/) {
$self->process_assignment('pch_source', $1);
++$ccount;
- if ($file =~ /$pname/) {
+ if (index($file, $pname) >= 0) {
$cmatching = $file;
}
last;
@@ -2406,15 +2401,13 @@ sub remove_extra_pch_listings {
my(@pchs) = ('pch_header', 'pch_source');
my(@tags) = ('header_files', 'source_files');
- for(my $j = 0; $j <= $#pchs; ++$j) {
+ for(my $j = 0; $j < 2; ++$j) {
my($pch) = $self->get_assignment($pchs[$j]);
if (defined $pch) {
## If we are converting slashes, then we need to
## convert the pch file back to forward slashes
- if ($self->{'convert_slashes'}) {
- $pch =~ s/\\/\//g;
- }
+ $pch =~ s/\\/\//g if ($self->{'convert_slashes'});
## Find out which files are duplicated
my($names) = $self->{$tags[$j]};
@@ -2447,30 +2440,32 @@ sub sift_files {
my($alldir) = shift;
my(@saved) = ();
my($ec) = $self->{'exclude_components'};
+ my($havec) = (defined $$ec{$tag});
foreach my $file (@$files) {
foreach my $ext (@$exts) {
## Always exclude the precompiled header and cpp
if ($file =~ /$ext$/ && (!defined $pchh || $file ne $pchh) &&
(!defined $pchc || $file ne $pchc)) {
- my($exclude) = 0;
- if (defined $$ec{$tag}) {
+ if ($havec) {
+ my($exclude) = 0;
foreach my $exc (@{$$ec{$tag}}) {
if ($file =~ /$exc$/) {
$exclude = 1;
last;
}
}
+ last if ($exclude);
}
elsif (!$alldir && $tag eq 'resource_files') {
## Save these files for later. There may
## be more than one and we want to try and
## find the one that corresponds to this project
- $exclude = 1;
push(@saved, $file);
+ last;
}
- if (!$exclude && !$self->already_added($array, $file)) {
+ if (!$self->already_added($array, $file)) {
push(@$array, $file);
}
last;
@@ -2480,7 +2475,7 @@ sub sift_files {
## Now deal with the saved files
if (defined $saved[0]) {
- if ($#saved == 0) {
+ if (!defined $saved[1]) {
## Theres only one rc file, take it
push(@$array, $saved[0]);
}
@@ -2600,7 +2595,7 @@ sub generate_default_components {
}
}
- if ($#input != -1) {
+ if (defined $input[0]) {
my(@front) = ();
my(@copy) = @$array;
@@ -2612,10 +2607,10 @@ sub generate_default_components {
my(@files) = $self->generated_filenames($part, $gentype,
$tag, $input);
- if ($#copy != -1) {
+ if (defined $copy[0]) {
my($found) = 0;
foreach my $file (@files) {
- for(my $i = 0; $i <= $#copy; $i++) {
+ for(my $i = 0; $i < scalar(@copy); $i++) {
my($re) = $self->escape_regex_special($copy[$i]);
if ($file eq $copy[$i] || $file =~ /[\/\\]$re$/) {
## No need to check for previously added files
@@ -2648,7 +2643,7 @@ sub generate_default_components {
}
}
}
- if ($#copy != -1) {
+ if (defined $copy[0]) {
## No need to check for previously added files
## here since there are none.
push(@$array, @copy);
@@ -2658,7 +2653,7 @@ sub generate_default_components {
}
if (defined $front[0]) {
if (defined $newgroup) {
- if ($#copy != -1) {
+ if (defined $copy[0]) {
$self->process_assignment_add($grtag, $defgroup);
}
if (!defined $self->{$tag}->{$defcomp}->{$newgroup}) {
@@ -2980,6 +2975,7 @@ sub add_corresponding_component_files {
my($file) = "$sfile$ext";
if (!$self->already_added($array, $file)) {
push(@$array, $file);
+ ++$found;
}
last;
}
@@ -2989,31 +2985,33 @@ sub add_corresponding_component_files {
## If we have any files at all in the component array, check
## to see if we need to add a new group name
if (defined $$array[0]) {
- my($compexists) = undef;
- my($grval) = $self->get_assignment($grname);
- if (defined $grval) {
- foreach my $grkey (@{$self->create_array($grval)}) {
- if ($grkey eq $comp) {
- $compexists = 1;
- last;
+ if ($comp eq $defgroup) {
+ $adddefaultgroup = 1;
+ }
+ else {
+ my($compexists) = undef;
+ my($grval) = $self->get_assignment($grname);
+ if (defined $grval) {
+ foreach my $grkey (@{$self->create_array($grval)}) {
+ if ($grkey eq $comp) {
+ $compexists = 1;
+ last;
+ }
}
}
- }
- if (!$compexists) {
- if ($comp eq $defgroup) {
- $adddefaultgroup = 1;
- }
- else {
+ if (!$compexists) {
$self->process_assignment_add($grname, $comp);
- $oktoadddefault = 1;
- $adddefaultgroup |= $fexist;
}
+ $oktoadddefault = 1;
+ $adddefaultgroup |= $fexist;
}
## Put the array back into the component list
- foreach my $name (keys %$names) {
- $$names{$name}->{$comp} = $array;
+ if ($found) {
+ foreach my $name (keys %$names) {
+ $$names{$name}->{$comp} = $array;
+ }
}
}
}
@@ -3144,7 +3142,7 @@ sub generate_defaults {
push(@all, @{$$names{$name}->{$key}});
}
}
- $ok = ($#all == -1);
+ $ok = (!defined $all[0]);
}
if ($ok) {
$self->generate_default_components(\@files, $tag);
@@ -3156,7 +3154,7 @@ sub generate_defaults {
## Now that all of the other files have been added
## we need to remove those that have need to be removed
my(@rmkeys) = keys %{$self->{'remove_files'}};
- if ($#rmkeys != -1) {
+ if (defined $rmkeys[0]) {
$self->remove_excluded(@rmkeys);
}
}
@@ -3225,8 +3223,8 @@ sub get_component_list {
## the slashes, in that case get_component_list() was called with
## an additional parameter indicating this.
if (!$noconvert && $self->{'convert_slashes'}) {
- for(my $i = 0; $i <= $#list; $i++) {
- $list[$i] = $self->slash_to_backslash($list[$i]);
+ foreach my $item (@list) {
+ $item =~ s/\//\\/g;
}
}
@@ -3261,9 +3259,7 @@ sub check_custom_output {
}
else {
my($base) = $built;
- if ($self->{'convert_slashes'}) {
- $base =~ s/\\/\//g;
- }
+ $base =~ s/\\/\//g if ($self->{'convert_slashes'});
my($re) = $self->escape_regex_special(basename($base));
foreach my $c (@$comps) {
## We only match if the built file name matches from
@@ -3292,10 +3288,10 @@ sub get_special_value {
if ($type eq 'feature') {
return $self->get_feature_value($cmd, $based);
}
- elsif ($type =~ /^custom_type/) {
+ elsif (index($type, 'custom_type') == 0) {
return $self->get_custom_value($cmd, $based, @params);
}
- elsif ($type =~ /^$grouped_key/) {
+ elsif (index($type, $grouped_key) == 0) {
return $self->get_grouped_value($type, $cmd, $based);
}
@@ -3542,7 +3538,7 @@ sub get_custom_value {
## type is not automatic, we may have directories here and will need
## to get the file list for that type.
my($once) = undef;
- for(my $i = 0; $i <= $#array; ++$i) {
+ for(my $i = 0; $i < scalar(@array); ++$i) {
if (-d $array[$i]) {
if (!defined $once) {
$once = {'recurse' => $self->get_assignment('recurse'),
@@ -3580,9 +3576,7 @@ sub get_custom_value {
## If we are converting slashes,
## change them back for this parameter
- if ($self->{'convert_slashes'}) {
- $ainput =~ s/\\/\//g;
- }
+ $ainput =~ s/\\/\//g if ($self->{'convert_slashes'});
## Add all of the output files
foreach my $vc (keys %{$self->{'valid_components'}}, $generic_key) {
@@ -4169,18 +4163,17 @@ sub update_project_info {
}
## Append the values of all names into one string
- my(@narr) = @$names;
- for(my $i = 0; $i <= $#narr; $i++) {
+ my($ncount) = scalar(@$names) - 1;
+ for(my $i = 0; $i <= $ncount; $i++) {
$value .= $self->translate_value(
- $narr[$i],
- $tparser->get_value_with_default($narr[$i]));
- $value .= $sep if ($i != $#narr);
+ $$names[$i],
+ $tparser->get_value_with_default($$names[$i]));
+ $value .= $sep if ($i != $ncount);
}
## If we haven't seen this value yet, put it on the array
- if (!defined $self->{'project_info_hash_table'}->{"@narr $value"}) {
- $self->{'project_info_hash_table'}->{"@narr $value"} = 1;
- #$self->save_project_value("@narr", $value);
+ if (!defined $self->{'project_info_hash_table'}->{"@$names $value"}) {
+ $self->{'project_info_hash_table'}->{"@$names $value"} = 1;
push(@$arr, $value);
}
@@ -4206,7 +4199,7 @@ sub adjust_value {
my($replace) = (defined $self->{'valid_names'}->{$base} &&
($self->{'valid_names'}->{$base} & 0x04) == 0);
foreach my $val (@{$atemp->{lc($name)}}) {
- if ($replace && $$val[1] =~ /<%/) {
+ if ($replace && index($$val[1], '<%') >= 0) {
$$val[1] = $self->replace_parameters($$val[1],
$self->{'command_subs'});
}
@@ -4226,8 +4219,8 @@ sub adjust_value {
}
}
elsif ($$val[0] < 0) {
- my($parts) = undef;
if (defined $value) {
+ my($parts) = undef;
if (UNIVERSAL::isa($value, 'ARRAY')) {
$parts = $value;
}
@@ -4278,9 +4271,7 @@ sub expand_variables {
my($start) = 0;
## Fix up the value for Windows switch the \\'s to /
- if ($self->{'convert_slashes'}) {
- $cwd =~ s/\\/\//g;
- }
+ $cwd =~ s/\\/\//g if ($self->{'convert_slashes'});
while(substr($value, $start) =~ /(\$\(([^)]+)\))/) {
my($whole) = $1;
@@ -4289,17 +4280,13 @@ sub expand_variables {
if (defined $val) {
if ($expand) {
- if ($self->{'convert_slashes'}) {
- $val = $self->slash_to_backslash($val);
- }
+ $val =~ s/\//\\/g if ($self->{'convert_slashes'});
substr($value, $start) =~ s/\$\([^)]+\)/$val/;
$whole = $val;
}
else {
## Fix up the value for Windows switch the \\'s to /
- if ($self->{'convert_slashes'}) {
- $val =~ s/\\/\//g;
- }
+ $val =~ s/\\/\//g if ($self->{'convert_slashes'});
my($icwd) = ($self->{'case_insensitive'} ? lc($cwd) : $cwd);
my($ival) = ($self->{'case_insensitive'} ? lc($val) : $val);
@@ -4335,9 +4322,7 @@ sub expand_variables {
if (defined $append) {
$ival .= $append;
}
- if ($self->{'convert_slashes'}) {
- $ival = $self->slash_to_backslash($ival);
- }
+ $ival =~ s/\//\\/g if ($self->{'convert_slashes'});
substr($value, $start) =~ s/\$\([^)]+\)/$ival/;
$whole = $ival;
}
@@ -4354,9 +4339,7 @@ sub expand_variables {
(defined $val ? $val : []));
if (defined $$arr[0]) {
$val = "@$arr";
- if ($self->{'convert_slashes'}) {
- $val = $self->slash_to_backslash($val);
- }
+ $val =~ s/\//\\/g if ($self->{'convert_slashes'});
substr($value, $start) =~ s/\$\([^)]+\)/$val/;
## We have replaced the template value, but that template
@@ -4397,7 +4380,7 @@ sub relative {
}
$value = \@built;
}
- elsif ($value =~ /\$/) {
+ elsif (index($value, '$') >= 0) {
my($ovalue) = $value;
my(@keys) = keys %{$self->{'expanded'}};
if (defined $keys[0]) {
@@ -4567,7 +4550,7 @@ sub project_file_name {
my($name) = shift;
if (!defined $name) {
- $name = $self->project_name();
+ $name = $self->get_assignment('project_name');
}
return $self->get_modified_project_file_name(
diff --git a/modules/TemplateParser.pm b/modules/TemplateParser.pm
index 50528b70..6a246c36 100644
--- a/modules/TemplateParser.pm
+++ b/modules/TemplateParser.pm
@@ -627,7 +627,7 @@ sub get_flag_overrides {
}
## Replace the custom_type key with the actual custom type
- if ($name =~ /^custom_type\->/) {
+ if (index($name, 'custom_type->') == 0) {
my($ct) = $self->get_value('custom_type');
if (defined $ct) {
$name = $ct;
@@ -940,7 +940,7 @@ sub process_compound_if {
my($str) = shift;
my($status) = 0;
- if ($str =~ /\|\|/) {
+ if (index($str, '||') >= 0) {
my($ret) = 0;
foreach my $v (split(/\s*\|\|\s*/, $str)) {
$ret |= $self->process_compound_if($v);
@@ -949,7 +949,7 @@ sub process_compound_if {
}
}
}
- elsif ($str =~ /\&\&/) {
+ elsif (index($str, '&&') >= 0) {
my($ret) = 1;
foreach my $v (split(/\s*\&\&\s*/, $str)) {
$ret &&= $self->process_compound_if($v);
@@ -1303,7 +1303,7 @@ sub handle_eval {
my($val) = $self->get_value_with_default($name);
if (defined $val) {
- if ($val =~ /<%eval\($name\)%>/) {
+ if (index($val, "<%eval($name)%>") >= 0) {
$self->warning("Infinite recursion detected in '$name'.");
}
else {
@@ -1420,9 +1420,7 @@ sub prepare_parameters {
my($output) = undef;
if (defined $input) {
- if ($self->{'cslashes'}) {
- $input = $self->{'prjc'}->slash_to_backslash($input);
- }
+ $input =~ s/\//\\/g if ($self->{'cslashes'});
$output = $self->get_value($prefix . '->input_file->output_files');
if (defined $output) {
@@ -1432,9 +1430,7 @@ sub prepare_parameters {
if (defined $fo) {
$$output[$i] = $fo . '/' . $self->tp_basename($$output[$i]);
}
- if ($self->{'cslashes'}) {
- $$output[$i] = $self->{'prjc'}->slash_to_backslash($$output[$i]);
- }
+ $$output[$i] =~ s/\//\\/g if ($self->{'cslashes'});
}
}
}
@@ -1545,9 +1541,7 @@ sub collect_data {
my($cwd) = $self->getcwd();
## Set the current working directory
- if ($self->{'cslashes'}) {
- $cwd = $prjc->slash_to_backslash($cwd);
- }
+ $cwd =~ s/\//\\/g if ($self->{'cslashes'});
$self->{'values'}->{'cwd'} = $cwd;
## Collect the components into {'values'} somehow
@@ -1618,7 +1612,7 @@ sub parse_line {
my($line) = shift;
my($status) = 1;
my($errorString) = undef;
- my($startempty) = (length($line) == 0 ? 1 : 0);
+ my($startempty) = ($line eq '');
## If processing a foreach or the line only
## contains a keyword, then we do
@@ -1666,8 +1660,8 @@ sub parse_line {
}
elsif ($name) {
my($substr) = substr($item, $i);
- my($efcheck) = ($substr =~ /^endfor\%\>/);
- my($focheck) = ($efcheck ? 0 : ($substr =~ /^foreach\(/));
+ my($efcheck) = (index($substr, 'endfor%>') == 0);
+ my($focheck) = ($efcheck ? 0 : (index($substr, 'foreach(') == 0));
if ($focheck && $self->{'foreach'}->{'count'} >= 0) {
++$self->{'foreach'}->{'nested'};
@@ -1682,11 +1676,12 @@ sub parse_line {
$errorString,
$nlen) = $self->process_name($substr);
- if ($status && $nlen == 0) {
+ if (!$status) {
+ last;
+ }
+ elsif ($nlen == 0) {
$errorString = "Could not parse this line at column $i";
$status = 0;
- }
- if (!$status) {
last;
}
diff --git a/modules/VC7WorkspaceCreator.pm b/modules/VC7WorkspaceCreator.pm
index 61c84907..bd70dd1f 100644
--- a/modules/VC7WorkspaceCreator.pm
+++ b/modules/VC7WorkspaceCreator.pm
@@ -150,7 +150,8 @@ sub write_comps {
my($pguid) = $guids{$language};
my($deps) = $self->get_validated_ordering($project);
## Convert all /'s to \
- my($cpy) = $self->slash_to_backslash($project);
+ my($cpy) = $project;
+ $cpy =~ s/\//\\/g;
print $fh "Project(\"{$pguid}\") = \"$name\", \"$cpy\", \"{$guid}\"$crlf";
$self->print_inner_project($fh, $gen, $guid, $deps, $name, \%name_to_guid_map);
print $fh "EndProject$crlf";
diff --git a/modules/WinProjectBase.pm b/modules/WinProjectBase.pm
index 4ff55777..24c33707 100644
--- a/modules/WinProjectBase.pm
+++ b/modules/WinProjectBase.pm
@@ -42,8 +42,9 @@ sub translate_directory {
$dir = $self->DirectoryManager::translate_directory($dir);
## Remove the current working directory from $dir (if it is contained)
- my($cwd) = $self->slash_to_backslash($self->getcwd());
+ my($cwd) = $self->getcwd();
my($cwdl) = length($cwd);
+ $cwd =~ s/\//\\/g;
if (index($dir, $cwd) == 0) {
$dir = substr($dir, $cwdl + 1);
}
@@ -99,10 +100,10 @@ sub crlf {
sub file_sorter {
- my($self) = shift;
- my($left) = shift;
- my($right) = shift;
- return lc($left) cmp lc($right);
+ #my($self) = shift;
+ #my($left) = shift;
+ #my($right) = shift;
+ return lc($_[1]) cmp lc($_[2]);
}
diff --git a/modules/WorkspaceCreator.pm b/modules/WorkspaceCreator.pm
index 761b6ca7..cb3bea3d 100644
--- a/modules/WorkspaceCreator.pm
+++ b/modules/WorkspaceCreator.pm
@@ -227,7 +227,7 @@ sub parse_line {
$self->{$self->{'type_check'}} = 1;
}
}
- elsif ($values[0] eq 'assignment') {
+ elsif ($values[0] eq '=') {
if (defined $validNames{$values[1]}) {
$self->process_assignment($values[1], $values[2]);
}
@@ -236,7 +236,7 @@ sub parse_line {
$status = 0;
}
}
- elsif ($values[0] eq 'assign_add') {
+ elsif ($values[0] eq '+=') {
if (defined $validNames{$values[1]}) {
$self->process_assignment_add($values[1], $values[2]);
}
@@ -245,7 +245,7 @@ sub parse_line {
$status = 0;
}
}
- elsif ($values[0] eq 'assign_sub') {
+ elsif ($values[0] eq '-=') {
if (defined $validNames{$values[1]}) {
$self->process_assignment_sub($values[1], $values[2]);
}
@@ -2058,10 +2058,9 @@ sub source_listing_callback {
my($self) = shift;
my($project_file) = shift;
my($project_name) = shift;
- my(@files) = @_;
my($cwd) = $self->getcwd();
$self->{'project_file_list'}->{$project_name} = [ $project_file,
- $cwd, \@files ];
+ $cwd, \@_ ];
}
diff --git a/templates/make.mpd b/templates/make.mpd
index a5866259..fe75e07c 100644
--- a/templates/make.mpd
+++ b/templates/make.mpd
@@ -20,7 +20,7 @@ CPUTYPE = <%cputype%>
<%if(cpu)%>
CPU = <%cpu%>
<%endif%>
-<%if(pic)%>
+<%if(dll_ext && pic)%>
PICFLAGS = <%pic%>
<%endif%>
CPPFLAGS = <%if(visibility && visopt)%><%visopt%> <%endif%>$(PICFLAGS) $(GENFLAGS)<%if(compile_flags)%> <%compile_flags%><%endif%><%if(cpu)%> -DCPU=$(CPU)<%endif%><%if(tempincopt)%> <%tempincopt%>$(TEMPINCDIR)<%endif%><%if(compilerflags)%> <%compilerflags%><%endif%><%if(build64bit && compilerflags64)%> <%compilerflags64%><%endif%><%if(pch_source && pchsupport)%><%foreach(pch_defines)%> -D<%pch_define%><%endfor%><%endif%><%if(extracppflags)%> <%extracppflags%><%endif%><%if(includes)%><%foreach(includes)%> -I"<%include%>"<%endfor%><%endif%><%if(macros)%><%foreach(macros)%> -D<%macro%><%endfor%><%endif%>
@@ -109,12 +109,12 @@ all: $(BIN)<%if(postbuild)%> __postbuild__<%endif%>
<%if(specialscript)%>
specialscript:
@echo '<%specialscript%>' > specialscript
- @chmod 755 specialscript
+ @<%chmod("chmod")%> 755 specialscript
<%endif%>
<%if(prelink)%>
<%prelink%>: specialscript $(OBJS)
- @.<%slash%>specialscript $(NM) "$(OBJS)" "$(LDLIBS)" "<%if(libpaths)%><%libpaths%><%else%>.<%endif%>" <%prelink%>
+ @specialscript $(NM) "$(OBJS)" "$(LDLIBS)" "<%if(libpaths)%><%libpaths%><%else%>.<%endif%>" <%prelink%>
@$(RM) specialscript
<%targetoutdir%><%noextension(prelink)%>$(OBJEXT): <%prelink%>
@@ -171,13 +171,12 @@ $(LIB): $(LTARGETDIR) <%if(tempinc)%>$(TEMPINCDIR) <%endif%>$(OBJS)
<%if(custom_types)%>
GENERATED_DIRTY =<%foreach(custom_types)%><%foreach(custom_type->input_files)%><%if(custom_type->input_file->output_files)%><%foreach(custom_type->input_file->output_files)%> <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%><%slash%><%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%><%endfor%><%endif%><%endfor%><%endfor%>
<%foreach(custom_types)%>
-<%if(custom_type->libpath)%>
-# These may be needed, but some versions of make do not accept this syntax
-#DYLD_LIBRARY_PATH := $(DYLD_LIBRARY_PATH):<%custom_type->libpath%>
-#LD_LIBRARY_PATH := $(LD_LIBRARY_PATH):<%custom_type->libpath%>
-#SHLIB_PATH := $(SHLIB_PATH):<%custom_type->libpath%>
-#LIBPATH := $(LIBPATH):<%custom_type->libpath%>
-#PATH := $(PATH):<%custom_type->libpath%>
+<%if(expanded_variable_assignment && custom_type->libpath)%>
+DYLD_LIBRARY_PATH := $(DYLD_LIBRARY_PATH):<%custom_type->libpath%>
+LD_LIBRARY_PATH := $(LD_LIBRARY_PATH):<%custom_type->libpath%>
+SHLIB_PATH := $(SHLIB_PATH):<%custom_type->libpath%>
+LIBPATH := $(LIBPATH):<%custom_type->libpath%>
+PATH := $(PATH):<%custom_type->libpath%>
<%endif%>
<%foreach(custom_type->input_files)%>
diff --git a/templates/makedll.mpt b/templates/makedll.mpt
index 3dd68d57..0f0d0f60 100644
--- a/templates/makedll.mpt
+++ b/templates/makedll.mpt
@@ -257,7 +257,7 @@ irix {
lynxos {
dll_ext =
- extracppflags = -D__NO_INCLUDE_WARN__
+ extracppflags = -D__NO_INCLUDE_WARN__ -mthreads -mminimal-toc
}
macos {
diff --git a/templates/vc7.mpd b/templates/vc7.mpd
index 54163fbd..fac10496 100644
--- a/templates/vc7.mpd
+++ b/templates/vc7.mpd
@@ -348,9 +348,9 @@
<%foreach(sort(grouped_inline_files))%>
<%if(compares(grouped_inline_file, default_group))%>
<%foreach(grouped_inline_file->files)%>
- <File
- RelativePath="<%grouped_inline_file->file%>">
- </File>
+ <File
+ RelativePath="<%grouped_inline_file->file%>">
+ </File>
<%endfor%>
<%else%>
<Filter
diff --git a/templates/vc8.mpd b/templates/vc8.mpd
index e62b1d57..fcb7e02a 100644
--- a/templates/vc8.mpd
+++ b/templates/vc8.mpd
@@ -664,9 +664,9 @@
<%foreach(sort(grouped_inline_files))%>
<%if(compares(grouped_inline_file, default_group))%>
<%foreach(grouped_inline_file->files)%>
- <File
- RelativePath="<%grouped_inline_file->file%>">
- </File>
+ <File
+ RelativePath="<%grouped_inline_file->file%>">
+ </File>
<%endfor%>
<%else%>
<Filter