diff options
Diffstat (limited to 'samwise/PerlSam/Generator')
-rw-r--r-- | samwise/PerlSam/Generator/Automake.pm | 264 | ||||
-rw-r--r-- | samwise/PerlSam/Generator/Borland.pm | 383 | ||||
-rw-r--r-- | samwise/PerlSam/Generator/GNUMake.pm | 390 | ||||
-rw-r--r-- | samwise/PerlSam/Generator/MSVC6.pm | 847 | ||||
-rw-r--r-- | samwise/PerlSam/Generator/View.pm | 42 | ||||
-rw-r--r-- | samwise/PerlSam/Generator/VisualAge.pm | 118 |
6 files changed, 0 insertions, 2044 deletions
diff --git a/samwise/PerlSam/Generator/Automake.pm b/samwise/PerlSam/Generator/Automake.pm deleted file mode 100644 index 54b883dd136..00000000000 --- a/samwise/PerlSam/Generator/Automake.pm +++ /dev/null @@ -1,264 +0,0 @@ -# $Id$ - -package PerlSam::Generator::Automake; - -use Cwd; -use Data::Dumper; -use File::Basename; -use FileHandle; -use strict; - -############################################################################### -# Forward Declarations - - -############################################################################### -# Constructor - -sub new (@) -{ - my $proto = shift; - my $class = ref ($proto) || $proto; - my $self = {}; - - bless ($self, $class); - return $self; -} - -############################################################################### -# Methods - -sub GenerateWorkspace (\%) -{ - my $self = shift; - my $data = shift; - - my $string; - - $string .= "##\n"; - $string .= "## \$Id\$\n"; - $string .= "##\n"; - $string .= "## Automake makefile generated by the Samwise Compiler\n"; - $string .= "##\n"; - $string .= "\n"; - $string .= "#----------------------------------------------------------------------------\n"; - $string .= "# Subdirectories\n"; - $string .= "#----------------------------------------------------------------------------\n"; - $string .= "\n"; - $string .= "SUBDIRS ="; - - foreach my $dir (@{$data->{WORKSPACE}->{SUBDIRS}}) { - $string .= " \\\n $dir"; - } - $string .= "\n"; - $string .= "\n"; - - $string .= "#----------------------------------------------------------------------------\n"; - $string .= "# Subprojects\n"; - $string .= "#----------------------------------------------------------------------------\n"; - - $string .= "\n"; - $string .= "lib_LTLIBRARIES ="; - - foreach my $project (@{$data->{WORKSPACE}->{PROJECTLINKS}->{LIST}}) { - my $type = - $data->{PROJECTS}->{$project}->{TYPE}; - if ($type eq 'library') { - $string .= " \\\n lib".$project.".la"; - } - } - - $string .= "\n\n"; - $string .= "noinst_PROGRAMS ="; - - foreach my $project (@{$data->{WORKSPACE}->{PROJECTLINKS}->{LIST}}) { - my $type = - $data->{PROJECTS}->{$project}->{TYPE}; - my $install = - $data->{PROJECTS}->{$project}->{INSTALL}; - if ($type eq 'executable' && $install eq 'no') { - $string .= " \\\n $project"; - } - } - - $string .= "\n\n"; - $string .= "bin_PROGRAMS ="; - - foreach my $project (@{$data->{WORKSPACE}->{PROJECTLINKS}->{LIST}}) { - my $type = - $data->{PROJECTS}->{$project}->{TYPE}; - my $install = - $data->{PROJECTS}->{$project}->{INSTALL}; - if ($type eq 'executable' && $install eq 'yes') { - $string .= " \\\n $project"; - } - } - $string .= "\n"; - $string .= "\n"; - - print "Creating Workspace: Makefile.am\n"; - - my $file_handle = new FileHandle ("Makefile.am", "w"); - print $file_handle $string; -} - -sub GenerateProjects (\%) -{ - my $self = shift; - my $data = shift; - - my @INCLUDES = (); - - foreach my $project (sort keys %{$data->{PROJECTS}}) { - my $string; - my $description = $data->{PROJECTS}->{$project}->{DESCRIPTION}; - my $target = $data->{PROJECTS}->{$project}->{TARGET}; - my $type = $data->{PROJECTS}->{$project}->{TYPE}; - - $string .= "##----------------------------------------------------------------------------\n"; - $string .= "##\n"; - $string .= "## Project Description: $description\n"; - $string .= "##\n"; - $string .= "##----------------------------------------------------------------------------\n"; - $string .= "\n"; - - my $project_prefix = ''; - - if ($type eq 'executable') { - $project_prefix = $project; - } elsif ($type eq 'library') { - $project_prefix = 'lib'.$project.'_la'; - } else { - die "Unknown project type $type\n"; - } - - my @project_libs = (); - if (defined $data->{PROJECTS}->{$project}->{LIBS}) { - @project_libs = @{$data->{PROJECTS}->{$project}->{LIBS}}; - } - # Libraries need to add their own -I directory to the list! - if (defined $data->{PROJECTS}->{$project}->{LIBINFO}->{NAMESPACE} - && defined $data->{PROJECTS}->{$project}->{LIBINFO}->{NAME}) { - push @project_libs, - $data->{PROJECTS}->{$project}->{LIBINFO}->{NAMESPACE} - .'::' - .$data->{PROJECTS}->{$project}->{LIBINFO}->{NAME}; - } - my $inc_dirs = PerlSam::Generator::ExpandIncludeDirs (@project_libs); - - foreach my $inc (split / /, $inc_dirs) { - if ($inc =~ m/^\//) { - push @INCLUDES, "-I\$(top_builddir)$inc"; - push @INCLUDES, "-I\$(top_srcdir)$inc"; - } else { - push @INCLUDES, "-I$inc"; - } - } - - # and we also need to add any local includes.... - if (defined $data->{PROJECTS}->{$project}->{LIBINFO}->{INCLUDE}) { - foreach my $inc (split / /, $data->{PROJECTS}->{$project}->{LIBINFO}->{INCLUDE}) { - push @INCLUDES, "-I$inc"; - } - } - - if ($type eq 'library') { - $string .= $project_prefix."_LIBADD ="; - } else { - $string .= $project_prefix."_LDADD ="; - } - - my $libs = PerlSam::Generator::ExpandLibraries (@{$data->{PROJECTS}->{$project}->{LIBS}}); - - foreach my $lib (reverse split / /, $libs) { - $string .= "\\\n ". - File::Basename::dirname ($lib) - .'/lib' - .File::Basename::basename ($lib) - .'.la'; - } - $string .= "\n"; - - my %vpath; - - $string .= $project_prefix."_SOURCES ="; - foreach my $src (sort keys %{$data->{PROJECTS}->{$project}->{SOURCES}}) { - my $type = $data->{PROJECTS}->{$project}->{SOURCES}->{$src}->{TYPE}; - - if (defined $type && $type eq 'template') { - next; - } - - if ($src =~ /\.cpp$/ - || $src =~ /\.cc$/ - || $src =~ /\.C$/ - || $src =~ /\.c$/) { - $string .= " \\\n $src"; - } - $vpath{File::Basename::dirname ($src)} = '1'; - } - $string .= "\n"; - $string .= "\n"; - # $string .= 'VPATH +=' . join(':', sort keys %vpath) . "\n"; - $string .= "\n"; - - $string .= "pkginclude_HEADERS ="; - - foreach my $src (sort keys %{$data->{PROJECTS}->{$project}->{SOURCES}}) { - my $type = $data->{PROJECTS}->{$project}->{SOURCES}->{$src}->{TYPE}; - - if (defined $type && $type eq 'template') { - $string .= " \\\n $src"; - } - } - foreach my $src (sort keys %{$data->{PROJECTS}->{$project}->{SOURCES}}) { - if ($src =~ /.h$/ || $src =~ /.i$/ || $src =~ /.inl$/) { - $string .= " \\\n $src"; - } - } - $string .= "\n"; - $string .= "\n"; - - my $has_idls = 0; - - foreach my $file (keys %{$data->{PROJECTS}->{$project}->{SOURCES}}) { - my $type = $data->{PROJECTS}->{$project}->{SOURCES}->{$file}->{TYPE}; - if (defined $type && ($type eq 'idl' || $type eq 'clientidl')) { - $has_idls = 1; - } - } - - if ($has_idls) { - print "ERROR: IDL Files detected but not supported!!!\n"; - } - - print "Adding Project: $project\n"; - - my $file_handle = new FileHandle ("Makefile.am", "a"); - - print $file_handle $string; - } - - my $string; - $string .= "##----------------------------------------------------------------------------\n"; - $string .= "##\n"; - $string .= "## Global settings for all projects\n"; - $string .= "##\n"; - $string .= "##----------------------------------------------------------------------------\n"; - $string .= "\n"; - $string .= "AM_CPPFLAGS ="; - my $last_include = ''; - for my $inc (sort @INCLUDES) { - next if ($last_include eq $inc); - $string .= "\\\n $inc"; - } - $string .= "\n"; - - my $file_handle = new FileHandle ("Makefile.am", "a"); - print $file_handle $string; -} - -############################################################################### -# Internal Methods - -1; diff --git a/samwise/PerlSam/Generator/Borland.pm b/samwise/PerlSam/Generator/Borland.pm deleted file mode 100644 index a26486c2720..00000000000 --- a/samwise/PerlSam/Generator/Borland.pm +++ /dev/null @@ -1,383 +0,0 @@ -# $Id$ - -package PerlSam::Generator::Borland; - -use Cwd; -use Data::Dumper; -use FileHandle; -use strict; - -############################################################################### -# Forward Declarations - -sub GetIncDir ($); - -############################################################################### -# Constructor - -sub new (@) -{ - my $proto = shift; - my $class = ref ($proto) || $proto; - my $self = {}; - - bless ($self, $class); - return $self; -} - -############################################################################### -# Methods - -sub GenerateWorkspace (\%) -{ - my $self = shift; - my $data = shift; - - my $output; - - $output .= "#\n"; - $output .= "# \$Id\$\n"; - $output .= "#\n"; - $output .= "# Borland Workspace Makefile generated by the Samwise Compiler\n"; - $output .= "#\n"; - $output .= "\n"; - - # - # Output the list of subdirectories, if there are any - # - - if (scalar @{$data->{WORKSPACE}->{SUBDIRS}} > 0) { - $output .= "# Subdirectories\n"; - $output .= "\n"; - $output .= "DIRS ="; - - foreach my $dir (@{$data->{WORKSPACE}->{SUBDIRS}}) { - $output .= " \\\n $dir"; - } - $output .= "\n"; - $output .= "\n"; - } - - # - # Output the list of projects, if there are any - # - - if (scalar @{$data->{WORKSPACE}->{PROJECTLINKS}->{LIST}} > 0) { - $output .= "# Subprojects\n"; - $output .= "\n"; - $output .= "MAKEFILES ="; - - foreach my $project (@{$data->{WORKSPACE}->{PROJECTLINKS}->{LIST}}) { - $output .= " \\\n $project.bor"; - } - $output .= "\n"; - $output .= "\n"; - } - - $output .= "!include <\$(ACE_ROOT)\\include\\makeinclude\\recurse.bor>\n"; - - my $file_name = "Makefile.bor"; - - print "Creating Workspace: $file_name\n"; - - my $file_handle = new FileHandle ($file_name, "w"); - print $file_handle $output; -} - -sub GenerateProjects (\%) -{ - my $self = shift; - my $projectdata = shift; - - foreach my $project (sort keys %{$projectdata->{PROJECTS}}) { - my $output; - my $data = $projectdata->{PROJECTS}->{$project}; - - my @basenames = PerlSam::Generator::ExpandBaseNames (@{$data->{LIBS}}); - - # - # Add generated files to list of sources - # - - PerlSam::Generator::ExpandIDLFiles(%{$data}); - - # - # Output the Makefile header - # - - $output .= "#\n"; - $output .= "# \$Id\$\n"; - $output .= "#\n"; - $output .= "# Borland Project Makefile generated by the Samwise Compiler\n"; - $output .= "# Project Description: $data->{DESCRIPTION}\n"; - $output .= "#\n\n"; - - # - # Output the target - # - - $output .= "NAME = $data->{TARGET}\n\n"; - - # - # Look through all source files and store them for later use - # - - my @idlfiles; # List of IDL files - my @objfiles; # List of object files - my @resfiles; # List of resource files - my %filedirs; # Hash of all the subdirs used for source files - - foreach my $source (sort keys %{$data->{SOURCES}}) { - if (defined $data->{SOURCES}->{$source}->{TYPE} - && ($data->{SOURCES}->{$source}->{TYPE} eq 'idl' - || $data->{SOURCES}->{$source}->{TYPE} eq 'clientidl')) - { - push @idlfiles, $source; - } - elsif ($source =~ m/(.*)\.cpp$/ - && (!defined $data->{SOURCES}->{$source}->{TYPE} - || $data->{SOURCES}->{$source}->{TYPE} ne 'template')) - { - $source = $1; - - # Check for source file in a subdirectory - - if ($source =~ m/^(.*)\/([^\/]+)$/) { - %filedirs->{$1} = 1; - $source = $2; - } - - push @objfiles, $source . '.obj'; - } - elsif ($source =~ m/^(.*)\.rc$/) { - $source = $1; - - # Check for source file in a subdirectory - - if ($source =~ m/^(.*)\/([^\/]+)$/) { - %filedirs->{$1} = 1; - $source = $2; - } - - push @resfiles, $source . '.res'; - } - } - - # - # Output the list of IDL files - # - - if (scalar (@idlfiles) > 0) { - $output .= "IDLFILES ="; - foreach my $idlfile (@idlfiles) { - $output .= " \\\n\t\$(IDLDIR)\\$idlfile"; - } - $output .= "\n\n"; - } - - # - # Output the list of object files - # - - if (scalar (@objfiles) > 0) { - $output .= "OBJFILES ="; - foreach my $objfile (sort @objfiles) { - $output .= " \\\n\t\$(OBJDIR)\\$objfile"; - } - $output .= "\n\n"; - } - - # - # Output the list of resource files - # - - if (scalar (@resfiles) > 0) { - $output .= "RESOURCE ="; - foreach my $resfile (@resfiles) { - $output .= " \$(OBJDIR)\\$resfile"; - } - $output .= "\n\n"; - } - - # - # Output the compiler flags - # - - $output .= "CFLAGS ="; - - foreach my $basename (@basenames) { - $output .= " \\\n\t\$(" . uc $basename . "_CFLAGS)"; - } - - # If we are a library, also output our CFLAGS - - if (defined $data->{LIBINFO}->{BASE}) { - $output .= " \\\n\t\$(" . uc $data->{LIBINFO}->{BASE} . "_CFLAGS)"; - } - - # And if we are a library, also define our export macro(s) - - if (defined $data->{LIBINFO}->{EXPORT}) { - foreach my $export (split / /, $data->{LIBINFO}->{EXPORT}) { - $output .= " \\\n\t-D" . uc $export . "_BUILD_DLL"; - } - } - - $output .= "\n\n"; - - # - # Output the list of libraries - # - - if ($#basenames >= 0) { - $output .= "LIBFILES ="; - foreach my $basename (@basenames) { - $output .= " \\\n\t\$(" . uc $basename . "_LIB)"; - } - $output .= "\n\n"; - } - - # - # Output the CPPDIR and IDLDIR - # - - $output .= "CPPDIR = ."; - foreach my $filedir (sort keys %filedirs) { - $output .= ";$filedir"; - } - $output .= "\n\n"; - - if (scalar (@idlfiles) > 0) { - # $TODO Can we have multiple subdirs here, like with CPPDIR? - - $output .= "IDLDIR = .\n\n"; - } - - # - # Output install information for libraries - # - - if ($data->{TYPE} eq 'library') { - - # INCDIR_NAME is based of the libinfo include data - - if (defined $data->{LIBINFO}->{INCLUDE}) { - $output .= "INCDIR_NAME = " . GetIncDir ($data->{LIBINFO}->{INCLUDE}) . "\n"; - } - - # INCLUDES lists all the template, header, and inline files. - - $output .= "INCLUDES ="; - - foreach my $source (sort keys %{$data->{SOURCES}}) { - my $filetype = $data->{SOURCES}->{$source}->{TYPE}; - if (defined $filetype && $filetype eq 'template') { - $output .= " \\\n\t$source"; - } - - $source =~ s/\//\\/g; - - if ($source =~ m/\.(h|i|inl|pidl)$/) { - $output .= " \\\n\t$source"; - } - } - - $output .= "\n\n"; - } - - # - # Output this command if we have IDL files - # - - if (scalar (@idlfiles) > 0) { - $output .= "all: idl_src_files\n\n"; - } - - # - # Output the inclusion of a system *.bor file - # - - if ($data->{TYPE} eq 'executable') { - if (defined $data->{INSTALL} && $data->{INSTALL} eq 'yes') { - $output .= "!include <\$(ACE_ROOT)\\include\\makeinclude\\build_core_exe.bor>"; - } - else { - $output .= "!include <\$(ACE_ROOT)\\include\\makeinclude\\build_exe.bor>"; - } - } - elsif ($data->{TYPE} eq 'library') { - $output .= "!include <\$(ACE_ROOT)\\include\\makeinclude\\build_core_library.bor>\n"; - } - - # - # IDL files need some explicit dependencies defined - # - - if (scalar (@idlfiles) > 0) { - $output .= "\n#\n# IDL Build rules\n#\n\n"; - - $output .= "idl_src_files: \$(IDLFILES:.idl=C.cpp) \$(IDLFILES:.idl=S.cpp)\n\n"; - - foreach my $idlfile (@idlfiles) { - my $idlroot = ""; - - if ($idlfile =~ m/^(.*)\.idl$/) { - $idlroot = $1; - } - - $output .= "\$(IDLDIR)\\" . $idlroot . "C.cpp \$(IDLDIR)\\"; - $output .= $idlroot . "S.cpp: "; - $output .= "\$(IDLDIR)\\$idlfile\n"; - $output .= "\t\$(CORE_BINDIR)\\tao_idl -g \$(CORE_BINDIR)\\gperf.exe \\\n"; - $output .= "\t\t$data->{SOURCES}->{$idlfile}->{OPTS} \\\n"; - $output .= "\t\t\$**\n\n"; - } - } - - # - # Save the output to the file - # - - my $filename = $project . ".bor"; - - print "Creating Project: $filename\n"; - - my $filehandle = new FileHandle ($filename, "w"); - - if (!defined $filehandle) { - print STDERR "Error: Could not open $filename for writing: $!\n"; - return; - } - - print $filehandle $output; - } -} - -############################################################################### -# Internal Methods - -sub GetIncDir ($) -{ - my $incdir = shift; - my $curdir = getcwd (); - my $result = ""; - - # - # Replace each ../ with the corresponding value from $curdir - # - - while ($incdir =~ m/..\/(.*)/) { - $incdir = $1; - if ($curdir =~ m/(.*)\/(.*)/) { - $curdir = $1; - $result = "$2\\" . $result; - } - } - - # We don't want to end with a \, so remove it. - - $result =~ s/\\$//; - - return $result; -} -1;
\ No newline at end of file diff --git a/samwise/PerlSam/Generator/GNUMake.pm b/samwise/PerlSam/Generator/GNUMake.pm deleted file mode 100644 index 184c1be8573..00000000000 --- a/samwise/PerlSam/Generator/GNUMake.pm +++ /dev/null @@ -1,390 +0,0 @@ -# $Id$ - -package PerlSam::Generator::GNUMake; - -use Cwd; -use Data::Dumper; -use File::Basename; -use FileHandle; -use strict; - -############################################################################### -# Forward Declarations - - -############################################################################### -# Constructor - -sub new (@) -{ - my $proto = shift; - my $class = ref ($proto) || $proto; - my $self = {}; - - bless ($self, $class); - return $self; -} - -############################################################################### -# Methods - -sub GenerateWorkspace (\%) -{ - my $self = shift; - my $data = shift; - - my $string; - - $string .= "#----------------------------------------------------------------------------\n"; - $string .= "#\n"; - $string .= "# \$Id\$\n"; - $string .= "#\n"; - $string .= "# GNU Workspace Makefile generated by the Samwise Compiler\n"; - $string .= "#\n"; - $string .= "#----------------------------------------------------------------------------\n"; - $string .= "\n"; - $string .= "#----------------------------------------------------------------------------\n"; - $string .= "# Subdirectories\n"; - $string .= "#----------------------------------------------------------------------------\n"; - $string .= "\n"; - $string .= "DIRS ="; - - foreach my $dir (@{$data->{WORKSPACE}->{SUBDIRS}}) { - $string .= " \\\n $dir"; - } - $string .= "\n"; - $string .= "\n"; - - $string .= "#----------------------------------------------------------------------------\n"; - $string .= "# Subprojects\n"; - $string .= "#----------------------------------------------------------------------------\n"; - - $string .= "\n"; - $string .= "MAKEFILES ="; - - foreach my $project (PerlSam::Generator::ProjectOrder (%{$data})) { - $string .= " \\\n $project.gnu"; - } - $string .= "\n"; - $string .= "\n"; - - $string .= "#----------------------------------------------------------------------------\n"; - $string .= "# Include macros and targets\n"; - $string .= "#----------------------------------------------------------------------------\n"; - $string .= "\n"; - - my $ace_root = PerlSam::Generator::ConvertPathToRelative ("/"); - - # Only put this in if we are in the ACE_wrappers tree - if ($ace_root ne "\$ACE_ROOT/") { - $string .= "ifndef ACE_ROOT\n"; - $string .= " ACE_ROOT = $ace_root\n"; - $string .= "endif\n"; - $string .= "\n"; - } - - $string .= "include \$(ACE_ROOT)/samwise/makeinclude/workspace.GNU\n"; - $string .= "\n"; - - my $file_name = "GNUmakefile"; - - print "Creating Workspace: $file_name\n"; - - my $file_handle = new FileHandle ($file_name, "w"); - print $file_handle $string; -} - -sub GenerateProjects (\%) -{ - my $self = shift; - my $data = shift; - - foreach my $project (sort keys %{$data->{PROJECTS}}) { - my $string; - my $description = $data->{PROJECTS}->{$project}->{DESCRIPTION}; - my $target = $data->{PROJECTS}->{$project}->{TARGET}; - my $type = $data->{PROJECTS}->{$project}->{TYPE}; - - my $file_name = $project . ".gnu"; - - $string .= "#----------------------------------------------------------------------------\n"; - $string .= "#\n"; - $string .= "# \$Id\$\n"; - $string .= "#\n"; - $string .= "# GNU Project Makefile generated by the Samwise Compiler\n"; - $string .= "# Project Description: $description\n"; - $string .= "#\n"; - $string .= "#----------------------------------------------------------------------------\n"; - $string .= "\n"; - - my $ace_root = PerlSam::Generator::ConvertPathToRelative ("/"); - - # Only put this in if we are in the ACE_wrappers tree - if ($ace_root ne "\$ACE_ROOT/") { - $string .= "ifndef ACE_ROOT\n"; - $string .= " ACE_ROOT = $ace_root\n"; - $string .= "endif\n"; - $string .= "\n"; - } - - if ($type ne 'executable' && $type ne 'library') { - die "Unknown project type $type\n"; - } - - $string .= "MAKEFILE = $file_name\n\n"; - - my @project_libs = (); - if (defined $data->{PROJECTS}->{$project}->{LIBS}) { - @project_libs = @{$data->{PROJECTS}->{$project}->{LIBS}}; - } - # Libraries need to add their own -I directory to the list! - if (defined $data->{PROJECTS}->{$project}->{LIBINFO}->{NAMESPACE} - && defined $data->{PROJECTS}->{$project}->{LIBINFO}->{NAME}) { - push @project_libs, - $data->{PROJECTS}->{$project}->{LIBINFO}->{NAMESPACE} - .'::' - .$data->{PROJECTS}->{$project}->{LIBINFO}->{NAME}; - } - my $dirs = PerlSam::Generator::ExpandIncludeDirs (@project_libs); - my $include_dirs = PerlSam::Generator::ConvertPathToRelative ($dirs); - - $string .= "CPPFLAGS += "; - foreach my $inc (split / /, $include_dirs) { - $string .= "\\\n -I".$inc; - } - - # and we also need to add any local includes.... - if (defined $data->{PROJECTS}->{$project}->{LIBINFO}->{INCLUDE}) { - foreach my $inc (split / /, $data->{PROJECTS}->{$project}->{LIBINFO}->{INCLUDE}) { - $string .= "\\\n -I".$inc; - } - } - - $string .= "\n"; - - $string .= "LDLIBS ="; - - my $libs = PerlSam::Generator::ExpandLibraries (@{$data->{PROJECTS}->{$project}->{LIBS}}); - - foreach my $lib (reverse split / /, $libs) { - $string .= " \\\n -L".File::Basename::dirname ($lib); - $string .= " \\\n -l".File::Basename::basename ($lib); - } - $string .= "\n"; - - if ($type eq 'library') { - $string .= "ACE_SHLIBS ="; - - foreach my $lib (split / /, $libs) { - $string .= " \\\n -L".File::Basename::dirname ($lib); - $string .= " \\\n -l".File::Basename::basename ($lib); - } - $string .= "\n"; - } - - my $SRC_MACRO = ''; - my $GNU_INCLUDE = ''; - - if ($type eq 'executable') { - $string .= "BIN = $target\n"; - $SRC_MACRO = 'SRC'; - $GNU_INCLUDE = 'executable.GNU'; - } - elsif ($type eq 'library') { - $string .= "LIBNAME = $target\n"; - $string .= "LIB = lib\$(LIBNAME).a\n"; - $string .= "SHLIB = lib\$(LIBNAME).\$(SOEXT)\n"; - $SRC_MACRO = 'LSRC'; - $GNU_INCLUDE = 'library.GNU'; - } - - my %vpath = (); - $string .= "$SRC_MACRO="; - foreach my $src (sort keys %{$data->{PROJECTS}->{$project}->{SOURCES}}) { - my $type = $data->{PROJECTS}->{$project}->{SOURCES}->{$src}->{TYPE}; - - if (defined $type && $type eq 'template') { - next; - } - - if ($src =~ /\.cpp$/ - || $src =~ /\.cc$/ - || $src =~ /\.C$/ - || $src =~ /\.c$/) { - $string .= " \\\n $src"; - } - $vpath{File::Basename::dirname ($src)} = '1'; - } - $string .= "\n"; - $string .= "\n"; - $string .= 'VPATH=' . join(':', sort keys %vpath) . "\n"; - $string .= "\n"; - $string .= "TEMPLATE_FILES ="; - - foreach my $src (sort keys %{$data->{PROJECTS}->{$project}->{SOURCES}}) { - my $type = $data->{PROJECTS}->{$project}->{SOURCES}->{$src}->{TYPE}; - - if (defined $type && $type eq 'template') { - $string .= " \\\n $src"; - } - } - $string .= "\n"; - - $string .= "HEADERS ="; - - foreach my $src (sort keys %{$data->{PROJECTS}->{$project}->{SOURCES}}) { - if ($src =~ /.h$/ || $src =~ /.i$/ || $src =~ /.inl$/) { - $string .= " \\\n $src"; - } - } - $string .= "\n"; - $string .= "\n"; - - my $has_idls = 0; - - foreach my $file (keys %{$data->{PROJECTS}->{$project}->{SOURCES}}) { - my $type = $data->{PROJECTS}->{$project}->{SOURCES}->{$file}->{TYPE}; - if (defined $type && ($type eq 'idl' || $type eq 'clientidl')) { - $has_idls = 1; - } - } - - if ($has_idls) { - $string .= "IDL_FILES="; - - foreach my $file (sort keys %{$data->{PROJECTS}->{$project}->{SOURCES}}) { - my $type = $data->{PROJECTS}->{$project}->{SOURCES}->{$file}->{TYPE}; - if (defined $type && ($type eq 'idl' || $type eq 'clientidl')) { - my $base = $file; - $base =~ s/\.idl$//; - $string .= "\\\n $base"; - } - } - $string .= "\n"; - - $string .= "$SRC_MACRO+="; - foreach my $file (sort keys %{$data->{PROJECTS}->{$project}->{SOURCES}}) { - my $type = $data->{PROJECTS}->{$project}->{SOURCES}->{$file}->{TYPE}; - if (defined $type && ($type eq 'idl' || $type eq 'clientidl')) { - my $idl = $file; - my $base = $idl; - $base =~ s/\.idl$//; - - $string .= "\\\n $base\$(IDL_CLIENT_SRC_EXT)"; - - if ($type ne 'clientidl') { - $string .= "\\\n $base\$(IDL_SERVER_SRC_EXT)"; - } - } - } - $string .= "\n"; - - $string .= "HEADERS+="; - foreach my $file (sort keys %{$data->{PROJECTS}->{$project}->{SOURCES}}) { - my $type = $data->{PROJECTS}->{$project}->{SOURCES}->{$file}->{TYPE}; - if (defined $type && ($type eq 'idl' || $type eq 'clientidl')) { - my $idl = $file; - - my $base = $idl; - $base =~ s/\.idl$//; - - $string .= "\\\n $base\$(IDL_CLIENT_HDR_EXT)"; - $string .= "\\\n $base\$(IDL_CLIENT_INL_EXT)"; - - if ($type ne 'clientidl') { - $string .= "\\\n $base\$(IDL_SERVER_HDR_EXT)"; - $string .= "\\\n $base\$(IDL_SERVER_INL_EXT)"; - $string .= "\\\n $base\$(IDL_SERVER_THDR_EXT)"; - $string .= "\\\n $base\$(IDL_SERVER_TINL_EXT)"; - } - } - } - $string .= "\n"; - - $string .= "TEMPLATE_FILES+="; - foreach my $file (sort keys %{$data->{PROJECTS}->{$project}->{SOURCES}}) { - my $type = $data->{PROJECTS}->{$project}->{SOURCES}->{$file}->{TYPE}; - if (defined $type && ($type eq 'idl' || $type eq 'clientidl')) { - if ($type ne 'clientidl') { - my $base = $file; - $base =~ s/\.idl$//; - - $string .= "\\\n $base\$(IDL_SERVER_TSRC_EXT)"; - } - } - } - $string .= "\n"; - - my @opts = (); - foreach my $file (sort keys %{$data->{PROJECTS}->{$project}->{SOURCES}}) { - my $type = $data->{PROJECTS}->{$project}->{SOURCES}->{$file}->{TYPE}; - if (defined $type && ($type eq 'idl' || $type eq 'clientidl')) { - push @opts, - $data->{PROJECTS}->{$project}->{SOURCES}->{$file}->{OPTS}; - } - } - my @unique_opts = sort @opts; - $string .= "TAO_IDLFLAGS+="; - my $previous_opt = ''; - foreach my $o (@unique_opts) { - if ($o ne $previous_opt) { - $string .= "\\\n $o"; - $previous_opt = $o; - } - } - $string .= "\n"; - - } - $string .= "\n"; - $string .= "include \$(ACE_ROOT)/samwise/makeinclude/$GNU_INCLUDE\n"; - $string .= "\n"; - - if ($has_idls) { - my $idl_deps = ""; - my $realclean_cmds = ""; - foreach my $file (sort keys %{$data->{PROJECTS}->{$project}->{SOURCES}}) { - my $type = $data->{PROJECTS}->{$project}->{SOURCES}->{$file}->{TYPE}; - if (defined $type && ($type eq 'idl' || $type eq 'clientidl')) { - my $base = $file; - $base =~ s/\.idl$//; - - $realclean_cmds .= "\t\-\$(RM) \$(foreach ext, \$(IDL_EXT), $base\$(ext))\n"; - $string .= "\n"; - $string .= ".PRECIOUS: \$(foreach ext, \$(IDL_EXT), $base\$(ext))\n"; - $string .= "\n"; - - $idl_deps .= " $base\$(IDL_CLIENT_HDR_EXT)"; - } - } - $string .= "realclean:\n"; - $string .= $realclean_cmds; - $string .= "\n"; - - foreach my $src (sort keys %{$data->{PROJECTS}->{$project}->{SOURCES}}) { - my $type = $data->{PROJECTS}->{$project}->{SOURCES}->{$src}->{TYPE}; - - if ((!defined $type || $type ne 'template') && $src =~ /.cpp$/) { - my $base = $src; - $base =~ s/\.cpp$//; - $base = File::Basename::basename ($base); - - $string .= ".shobj/$base.o .obj/$base.o "; - $string .= ".shobj/$base.so .obj/$base.so:"; - $string .= $idl_deps . "\n"; - } - } - $string .= "\n"; - } - - print "Creating Project: $file_name\n"; - - my $file_handle = new FileHandle ($file_name, "w"); - - print $file_handle $string; - } -} - -############################################################################### -# Internal Methods - -1; diff --git a/samwise/PerlSam/Generator/MSVC6.pm b/samwise/PerlSam/Generator/MSVC6.pm deleted file mode 100644 index 2d903acae9a..00000000000 --- a/samwise/PerlSam/Generator/MSVC6.pm +++ /dev/null @@ -1,847 +0,0 @@ -# $Id$ - -package PerlSam::Generator::MSVC6; - -use Cwd; -use Data::Dumper; -use FileHandle; -use strict; - -############################################################################### -# Forward Declarations - -sub GenerateExeProject (\%); -sub GenerateDLLProject (\%); -sub GenerateLIBProject (\%); - -sub WorkspaceProject ($$\@); - -sub ProjectHeader (\%\@$); -sub ProjectAllGroups ($\%\@); -sub ProjectGroup ($$$\%\@); -sub ProjectSource ($$\%\@); -sub ProjectFooter (); -sub ConfigSection (%); - -############################################################################### -# Constructor - -sub new (@) -{ - my $proto = shift; - my $class = ref ($proto) || $proto; - my $self = {}; - - bless ($self, $class); - return $self; -} - -############################################################################### -# Methods - -my %tempdirs = ( 'Win32 Debug' => 'Debug', - 'Win32 Release' => 'Release', - 'Win32 Static Debug' => 'Debug\Static', - 'Win32 Static Release' => 'Release\Static', - 'Win32 MFC Debug' => 'Debug\MFC', - 'Win32 MFC Release' => 'Release\MFC' - ); - -sub GenerateWorkspace (\%) -{ - my $self = shift; - my $data = shift; - - # Check to see if we even need to generate a workspace file - if (!defined @{$data->{WORKSPACE}->{PROJECTLINKS}->{LIST}}) { - return; - } - - my $string; - - $string .= <<EOWH; -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -EOWH - - foreach my $project (sort @{$data->{WORKSPACE}->{PROJECTLINKS}->{LIST}}) { - my $description = $data->{PROJECTS}->{$project}->{DESCRIPTION}; - - if (!defined $data->{PROJECTS}->{$project}->{NAME}) { - print STDERR "Error: Cannot find project <$project>\n"; - next; - } - - $string .= WorkspaceProject ($description, $project . ".dsp", @{$data->{PROJECTS}->{$project}->{DEPENDS}}); - - if ($data->{PROJECTS}->{$project}->{TYPE} eq "library") { - my @empty = (); - $string .= WorkspaceProject ($description. " Static" , $project . "_static.dsp", @empty); - } - } - $string .= <<EOWF; -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - -EOWF - - my $file_name; - - if (defined $data->{WORKSPACE}->{NAME}) { - $file_name = $data->{WORKSPACE}->{NAME}; - } - else { - $file_name = getcwd (); - - if ($file_name =~ m/\/([^\/]*)$/) { - $file_name = $1; - } - } - - $file_name = $file_name . ".dsw"; - - print "Creating Workspace: $file_name\n"; - - my $file_handle = new FileHandle ($file_name, "w"); - binmode $file_handle; - $string =~ s/\n/\r\n/g; - print $file_handle $string; -} - -sub GenerateProjects (\%) -{ - my $self = shift; - my $data = shift; - - foreach my $name (sort keys %{$data->{PROJECTS}}) { - # Expand the IDL files - - PerlSam::Generator::ExpandIDLFiles (%{$data->{PROJECTS}->{$name}}); - - # Store the data in easier variables - - my $description = $data->{PROJECTS}->{$name}->{DESCRIPTION}; - my $target = $data->{PROJECTS}->{$name}->{TARGET}; - my $type = $data->{PROJECTS}->{$name}->{TYPE}; - my $export = ""; - my $include = ""; - - if (defined $data->{PROJECTS}->{$name}->{LIBINFO}->{EXPORT}) { - $export = $data->{PROJECTS}->{$name}->{LIBINFO}->{EXPORT}; - } - - if (defined $data->{PROJECTS}->{$name}->{LIBINFO}->{INCLUDE}) { - $include = $data->{PROJECTS}->{$name}->{LIBINFO}->{INCLUDE}; - } - - if (!defined $data->{PROJECTS}->{$name}->{LIBS}) { - @{$data->{PROJECTS}->{$name}->{LIBS}} = []; - } - - if ($type eq "executable") - { - my $string = GenerateExeProject (%{$data->{PROJECTS}->{$name}}); - - my $file_name = $name . ".dsp"; - - print "Creating Project: $file_name\n"; - - my $file_handle = new FileHandle ($file_name, "w"); - binmode $file_handle; - $string =~ s/\n/\r\n/g; - print $file_handle $string; - } - elsif ($type eq "library") { - my $string; - my $file_name; - my $file_handle; - - $string = GenerateDLLProject (%{$data->{PROJECTS}->{$name}}); - - $file_name = $name . ".dsp"; - - print "Creating Project: $file_name\n"; - - $file_handle = new FileHandle ($file_name, "w"); - binmode $file_handle; - $string =~ s/\n/\r\n/g; - print $file_handle $string; - $file_handle->close (); - - my %newdata = %{$data->{PROJECTS}->{$name}}; - - %newdata->{DESCRIPTION} .= " Static"; - - $string = GenerateLIBProject (%newdata); - - $file_name = $name . "_static.dsp"; - - print "Creating Project: $file_name\n"; - - $file_handle = new FileHandle ($file_name, "w"); - binmode $file_handle; - $string =~ s/\n/\r\n/g; - print $file_handle $string; - - } - else { - print STDERR "Error: Unrecognized type <$type> for $name\n"; - next; - } - } -} - -############################################################################### -# Internal Methods - -sub GenerateExeProject (\%) -{ - my $data = shift; - - my @configs = ('Win32 Release', 'Win32 Debug'); - my $type = 'executable'; - - my $string = ProjectHeader (%{$data}, @configs, 0); - - my $libraries = PerlSam::Generator::ExpandLibraries (@{$data->{LIBS}}); - - my $debug_link_opts; - my $release_link_opts; - - foreach my $lib (split / /, $libraries) { - $debug_link_opts .= $lib . "d.lib "; - $release_link_opts .= $lib . ".lib "; - } - - if ($data->{INSTALL} eq 'yes') { - my $bindir = PerlSam::Generator::ConvertPathToRelative ('/bin'); - $debug_link_opts .= "/out:\"$bindir/$data->{TARGET}.exe\""; - $release_link_opts .= "/out:\"$bindir/Release/$data->{TARGET}.exe\""; - } - else { - $debug_link_opts .= "/out:\"$data->{TARGET}.exe\""; - $release_link_opts .= "/out:\"$data->{TARGET}.exe\""; - } - - $debug_link_opts =~ s/\s$//; - $release_link_opts =~ s/\s$//; - - my $cpp_opts = ""; - - my $dirs = PerlSam::Generator::ExpandIncludeDirs (@{$data->{LIBS}}); - my $include_dirs = PerlSam::Generator::ConvertPathToRelative ($dirs); - foreach my $dir (split / /, $include_dirs) { - $cpp_opts .= "/I \"$dir\" "; - } - - $cpp_opts =~ s/ $//; - - $string .= "!IF \"\$(CFG)\" == \"$data->{DESCRIPTION} - Win32 Release\"\n\n"; - $string .= ConfigSection ({TYPE => $type, - OUTPUTDIR => %tempdirs->{'Win32 Release'} . "\\$data->{NAME}", - INTERDIR => %tempdirs->{'Win32 Release'} . "\\$data->{NAME}", - ADDCPPOPTS => $cpp_opts, - ADDLINKOPTS => $release_link_opts}); - $string .= "!ELSEIF \"\$(CFG)\" == \"$data->{DESCRIPTION} - Win32 Debug\"\n\n"; - $string .= ConfigSection ({TYPE => $type, - OUTPUTDIR => '', - INTERDIR => %tempdirs->{'Win32 Debug'} . "\\$data->{NAME}", - DEBUG => 1, - ADDCPPOPTS => $cpp_opts, - ADDLINKOPTS => $debug_link_opts}); - $string .= "!ENDIF\n\n"; - - $string .= "# Begin Target\n\n"; - - foreach my $config (@configs) { - $string .= "# Name \"$data->{DESCRIPTION} - $config\"\n"; - } - - $string .= ProjectAllGroups ($data->{DESCRIPTION}, %{$data->{SOURCES}}, @configs); - $string .= ProjectFooter (); - - return $string; -} - -sub GenerateDLLProject (\%) -{ - my $data = shift; - - my @configs = ('Win32 MFC Release', 'Win32 MFC Debug', 'Win32 Release', 'Win32 Debug'); - my $type = 'library'; - - my $export = ""; - my $include = ""; - - if (defined $data->{LIBINFO}->{EXPORT}) { - $export = $data->{LIBINFO}->{EXPORT}; - } - - if (defined $data->{LIBINFO}->{INCLUDE}) { - $include = $data->{LIBINFO}->{INCLUDE}; - } - - my $string = ProjectHeader (%{$data}, @configs, 0); - - my $libraries = PerlSam::Generator::ExpandLibraries (@{$data->{LIBS}}); - - my $mfc_debug_link_opts; - my $mfc_release_link_opts; - my $debug_link_opts; - my $release_link_opts; - - foreach my $lib (split / /, $libraries) { - $mfc_debug_link_opts .= $lib . "mfcd.lib "; - $mfc_release_link_opts .= $lib . "mfc.lib "; - $debug_link_opts .= $lib . "d.lib "; - $release_link_opts .= $lib . ".lib "; - } - - my $bindir = PerlSam::Generator::ConvertPathToRelative ("/bin") . "/"; - - $mfc_debug_link_opts .= "/out:\"$bindir$data->{TARGET}" . "mfcd.dll\" "; - $mfc_release_link_opts .= "/out:\"$bindir$data->{TARGET}" . "mfc.dll\" "; - $debug_link_opts .= "/out:\"$bindir$data->{TARGET}" . "d.dll\" "; - $release_link_opts .= "/out:\"$bindir$data->{TARGET}.dll\" "; - - $mfc_debug_link_opts =~ s/\s$//; - $mfc_release_link_opts =~ s/\s$//; - $debug_link_opts =~ s/\s$//; - $release_link_opts =~ s/\s$//; - - my $cpp_opts = ""; - - foreach my $ex (split / /, $export) { - $cpp_opts .= "/D \"" . $ex . "_BUILD_DLL\" "; - } - - my $include_dirs = PerlSam::Generator::ExpandIncludeDirs (@{$data->{LIBS}}); - $include_dirs = PerlSam::Generator::ConvertPathToRelative ($include_dirs); - foreach my $dir (split / /, $include_dirs) { - $cpp_opts .= "/I \"$dir\" "; - } - - if ($cpp_opts !~ m/\/I "$include"/) { - $cpp_opts .= "/I \"$include\" "; - } - - $cpp_opts =~ s/ $//; - - $string .= "!IF \"\$(CFG)\" == \"$data->{DESCRIPTION} - Win32 MFC Release\"\n\n"; - $string .= ConfigSection ({TYPE => $type, - OUTPUTDIR => '', - INTERDIR => %tempdirs->{'Win32 MFC Release'} . "\\$data->{NAME}", - ADDCPPOPTS => $cpp_opts . " /D ACE_HAS_MFC=1", - ADDLINKOPTS => $mfc_release_link_opts}); - $string .= "!ELSEIF \"\$(CFG)\" == \"$data->{DESCRIPTION} - Win32 MFC Debug\"\n\n"; - $string .= ConfigSection ({TYPE => $type, - OUTPUTDIR => '', - INTERDIR => %tempdirs->{'Win32 MFC Debug'} . "\\$data->{NAME}", - DEBUG => 1, - ADDCPPOPTS => $cpp_opts . " /D ACE_HAS_MFC=1", - ADDLINKOPTS => $mfc_debug_link_opts}); - $string .= "!ELSEIF \"\$(CFG)\" == \"$data->{DESCRIPTION} - Win32 Release\"\n\n"; - $string .= ConfigSection ({TYPE => $type, - OUTPUTDIR => '', - INTERDIR => %tempdirs->{'Win32 Release'} . "\\$data->{NAME}", - ADDCPPOPTS => $cpp_opts, - ADDLINKOPTS => $release_link_opts}); - $string .= "!ELSEIF \"\$(CFG)\" == \"$data->{DESCRIPTION} - Win32 Debug\"\n\n"; - $string .= ConfigSection ({TYPE => $type, - OUTPUTDIR => '', - INTERDIR => %tempdirs->{'Win32 Debug'} . "\\$data->{NAME}", - DEBUG => 1, - ADDCPPOPTS => $cpp_opts, - ADDLINKOPTS => $debug_link_opts}); - $string .= "!ENDIF\n\n"; - - $string .= "# Begin Target\n\n"; - - foreach my $config (@configs) { - $string .= "# Name \"$data->{DESCRIPTION} - $config\"\n"; - } - - $string .= ProjectAllGroups ($data->{DESCRIPTION}, - %{$data->{SOURCES}}, - @configs); - $string .= ProjectFooter (); - - return $string; -} - -sub GenerateLIBProject (\%) -{ - my $data = shift; - - my @configs = ('Win32 Static Release', 'Win32 Static Debug'); - my $type = 'static library'; - my $include = ""; - my $namespace = ""; - - if (defined $data->{LIBINFO}->{INCLUDE}) { - $include = $data->{LIBINFO}->{INCLUDE}; - } - - if (defined $data->{LIBINFO}->{NAMESPACE}) { - $namespace = $data->{LIBINFO}->{NAMESPACE}; - } - - my $string = ProjectHeader (%{$data}, @configs, 1); - - my $debug_link_opts; - my $release_link_opts; - - $debug_link_opts .= "/out:\"$data->{TARGET}sd.lib\" "; - $release_link_opts .= "/out:\"$data->{TARGET}s.lib\" "; - - my $cpp_opts = ""; - - my $include_dirs = PerlSam::Generator::ExpandIncludeDirs (@{$data->{LIBS}}); - $include_dirs = PerlSam::Generator::ConvertPathToRelative ($include_dirs); - - foreach my $dir (split / /, $include_dirs) { - $cpp_opts .= "/I \"$dir\" "; - } - - if ($cpp_opts !~ m/\/I "$include"/) { - $cpp_opts .= "/I \"$include\" "; - } - - if ($#{$data->{LIBS}} > 0 || $namespace eq "ACE") { - $cpp_opts .= "/D \"ACE_AS_STATIC_LIBS\" "; - } - - if ($#{$data->{LIBS}} > 0 || $namespace eq "TAO") { - $cpp_opts .= "/D \"TAO_AS_STATIC_LIBS\" "; - } - - my $export = ''; - if (defined $data->{LIBINFO}->{EXPORT}) { - $export = $data->{LIBINFO}->{EXPORT}; - } - foreach my $ex (split / /, $export) { - $cpp_opts .= "/D \"" . $ex . "_HAS_DLL=0\" "; - } - - $cpp_opts =~ s/ $//; - - $string .= "!IF \"\$(CFG)\" == \"$data->{DESCRIPTION} - Win32 Static Release\"\n\n"; - $string .= ConfigSection ({TYPE => $type, - OUTPUTDIR => '', - INTERDIR => %tempdirs->{'Win32 Release'} . "\\$data->{NAME}", - ADDCPPOPTS => $cpp_opts, - ADDLINKOPTS => $release_link_opts}); - $string .= "!ELSEIF \"\$(CFG)\" == \"$data->{DESCRIPTION} - Win32 Static Debug\"\n\n"; - $string .= ConfigSection ({TYPE => $type, - OUTPUTDIR => '', - INTERDIR => %tempdirs->{'Win32 Debug'} . "\\$data->{NAME}", - DEBUG => 1, - ADDCPPOPTS => $cpp_opts, - ADDLINKOPTS => $debug_link_opts}); - $string .= "!ENDIF\n\n"; - - $string .= "# Begin Target\n\n"; - - foreach my $config (@configs) { - $string .= "# Name \"$data->{DESCRIPTION} - $config\"\n"; - } - - $string .= ProjectAllGroups ($data->{DESCRIPTION}, - %{$data->{SOURCES}}, - @configs); - $string .= ProjectFooter (); - - return $string; -} - -sub WorkspaceProject ($$\@) -{ - my $name = shift; - my $file = shift; - my $depends = shift; - my $string; - - $string .= "###############################################################################\n\n"; - $string .= "Project: \"$name\"=.\\$file - Package Owner=<4>\n\n"; - $string .= "Package=<5>\n"; - $string .= "{{{\n"; - $string .= "}}}\n\n"; - $string .= "Package=<4>\n"; - $string .= "{{{\n"; - - foreach my $dep (@{$depends}) { - $string .= " Begin Project Dependency\n"; - $string .= " Project_Dep_Name $dep\n"; - $string .= " End Project Dependency\n"; - } - - $string .= "}}}\n\n"; - - return $string; -} - -sub ProjectHeader (\%\@$) -{ - my $data = shift; - my $configs = shift; - my $static = shift; - - my $default_config = (reverse @{$configs})[0]; - - my $string = ""; - - # Standard header. Do not edit? heh heh - - $string .= "# Microsoft Developer Studio Project File - Name=\"$data->{DESCRIPTION}\" - Package Owner=<4>\n"; - $string .= "# Microsoft Developer Studio Generated Build File, Format Version 6.00\n"; - $string .= "# ** DO NOT EDIT **\n"; - $string .= "\n"; - - # Pick a target - - $string .= "# TARGTYPE \"Win32 (x86) Dynamic-Link Library\" 0x0102\n" if ($data->{TYPE} eq "library" && !$static); - $string .= "# TARGTYPE \"Win32 (x86) Console Application\" 0x0103\n" if ($data->{TYPE} eq "executable"); - $string .= "# TARGTYPE \"Win32 (x86) Static Library\" 0x0104\n" if ($data->{TYPE} eq "library" && $static); - $string .= "\n"; - - # Next block of dsp goodness - - $string .= <<EOPH1; -CFG=$data->{DESCRIPTION} - $default_config -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "$data->{NAME}.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "$data->{NAME}.mak" CFG="$data->{DESCRIPTION} - $default_config" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -EOPH1 - - # Now we need to output the list of configs possible - - my $target = "Unknown"; - $target = "Win32 (x86) Dynamic-Link Library" if ($data->{TYPE} eq "library" && !$static); - $target = "Win32 (x86) Console Application" if ($data->{TYPE} eq "executable"); - $target = "Win32 (x86) Static Library" if ($data->{TYPE} eq "library" && $static); - - foreach my $config (@{$configs}) { - $string .= "!MESSAGE \"$data->{DESCRIPTION} - $config\" (based on \"$target\")\n"; - } - - # More goodness - - $string .= <<EOPH2; -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -EOPH2 - return $string; -} - -sub ProjectAllGroups ($\%\@) -{ - my $description = shift; - my $sources = shift; - my $configs = shift; - - my $string; - - $string .= ProjectGroup ($description, - "Source Files", - "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90", - %{$sources}, - @{$configs}); - $string .= ProjectGroup ($description, - "Header Files", - "h;hpp;hxx;hm;fi;fd", - %{$sources}, - @{$configs}); - $string .= ProjectGroup ($description, - "IDL Files", - "idl;pidl", - %{$sources}, - @{$configs}); - $string .= ProjectGroup ($description, - "Inline Files", - "inl;i", - %{$sources}, - @{$configs}); - $string .= ProjectGroup ($description, - "Resource Files", - "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe", - %{$sources}, - @{$configs}); - return $string; -} - -sub ProjectGroup ($$$\%\@) -{ - my $description = shift; - my $name = shift; - my $filter = shift; - my $data = shift; - my $configs = shift; - my $string; - - $string .= "# Begin Group \"$name\"\n"; - $string .= "\n"; - $string .= "# PROP Default_Filter \"$filter\"\n"; - - foreach my $source (sort keys %{$data}) { - my $ext = ""; - if ($source =~ m/\.([^\.]*)$/) { - $ext = $1; - } - - if ($filter =~ m/^$ext;/ || - $filter =~ m/;$ext;/ || - $filter =~ m/;$ext$/ || - $filter =~ m/^$ext$/) - { - $string .= ProjectSource ($description, $source, %{$data->{$source}}, @{$configs}); - } - } - $string .= "# End Group\n"; - return $string; -} - -sub ProjectSource ($$\%\@) -{ - my $description = shift; - my $file = shift; - my $data = shift; - my $configs = shift; - my $string; - - $file =~ s/\//\\/g; - - if ($file !~ m/\\/) { - $file = ".\\" . $file; - } - - $string .= "# Begin Source File\n\nSOURCE=$file\n"; - - if (defined $data->{TYPE} && lc ($data->{TYPE}) eq 'template') { - $string .= "# PROP Exclude_From_Build 1\n"; - } - - if ($file =~ m/(.*)\.idl$/) { - my $idl = $file; - my $idlroot = $1; - my $taoidl_opts; - - if ($idlroot =~ m/([^\\]*)$/) { - $idlroot = $1; - } - - if (defined $data->{OPTS}) { - $taoidl_opts = $data->{OPTS}; - } - else { - $taoidl_opts = "-Ge 1"; - } - - - my $first = 1; - foreach my $config (@{$configs}) { - my $taoidl_path = PerlSam::Generator::ConvertPathToRelative('/bin/' . %tempdirs->{$config} . '/tao_idl.exe'); - - # Special case for Win32 Debug - if ($config eq "Win32 Debug") { - $taoidl_path = PerlSam::Generator::ConvertPathToRelative('/bin/tao_idl.exe'); - } - - $taoidl_path =~ s/\//\\/g; - - if ($first) { - $first = 0; - $string .= "!IF \"\$(CFG)\" == \"$description - $config\"\n\n" - } - else { - $string .= "!ELSEIF \"\$(CFG)\" == \"$description - $config\"\n\n" - } - $string .= <<EOPS -USERDEP__IDL_="$taoidl_path" - -# Begin Custom Build - Invoking TAO's IDL Compiler on \$(InputPath) -InputPath=$idl -InputName=$idlroot - -BuildCmds= \\ - $taoidl_path $taoidl_opts \$(InputName).idl - -"\$(InputName)C.h" : \$(SOURCE) "\$(INTDIR)" "\$(OUTDIR)" - \$(BuildCmds) - -"\$(InputName)C.i" : \$(SOURCE) "\$(INTDIR)" "\$(OUTDIR)" - \$(BuildCmds) - -"\$(InputName)C.cpp" : \$(SOURCE) "\$(INTDIR)" "\$(OUTDIR)" - \$(BuildCmds) - -"\$(InputName)S.h" : \$(SOURCE) "\$(INTDIR)" "\$(OUTDIR)" - \$(BuildCmds) - -"\$(InputName)S.i" : \$(SOURCE) "\$(INTDIR)" "\$(OUTDIR)" - \$(BuildCmds) - -"\$(InputName)S.cpp" : \$(SOURCE) "\$(INTDIR)" "\$(OUTDIR)" - \$(BuildCmds) - -"\$(InputName)S_T.h" : \$(SOURCE) "\$(INTDIR)" "\$(OUTDIR)" - \$(BuildCmds) - -"\$(InputName)S_T.i" : \$(SOURCE) "\$(INTDIR)" "\$(OUTDIR)" - \$(BuildCmds) - -"\$(InputName)S_T.cpp" : \$(SOURCE) "\$(INTDIR)" "\$(OUTDIR)" - \$(BuildCmds) -# End Custom Build - -EOPS - } - - $string .= "!ENDIF\n"; - } - - $string .= "# End Source File\n"; - - return $string; -} - -sub ProjectFooter () -{ - return <<EOPF; -# End Target -# End Project -EOPF -} - -sub ConfigSection (%) -{ - my $data = shift; - - my $type = $data->{TYPE}; - $type = "" if (!defined $type); - - my $output_dir = "Output"; - my $inter_dir = "Output"; - my $target_dir = ""; - my $base_cpp_opts = "/nologo /W3 /GX /D \"WIN32\" /D \"_WINDOWS\" /D \"_CONSOLE\" /D \"_MBCS\" /FD /c"; - my $base_link_opts = "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386"; - my $use_debug_libs = 0; - my $debug_macro = "NDEBUG"; - my $other_cpp_opts = "/D \"NDEBUG\" /O2 /MD "; - my $link_opts = "/nologo /subsystem:console /machine:I386 "; - - if ($type eq "library") { - $base_link_opts = "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /machine:I386"; - $link_opts = "/nologo /dll /machine:I386 "; - } - - if (defined $data->{DEBUG} && $data->{DEBUG} == 1) { - $use_debug_libs = 1; - $debug_macro = "_DEBUG"; - $other_cpp_opts = "/D \"_DEBUG\" /Od /MDd "; - $base_cpp_opts .= " /Gm /Zi"; - $base_link_opts .= " /debug /pdbtype:sept"; - $link_opts .= "/debug /pdbtype:sept "; - } - - if ($type eq "static library") { - $base_link_opts = "/nologo "; - $link_opts = "/nologo "; - - if (defined $data->{DEBUG} && $data->{DEBUG} == 1) { - $other_cpp_opts = "/D \"_DEBUG\" /Od /Gy /MDd "; - } - else { - $other_cpp_opts = "/D \"NDEBUG\" /O1 /MD "; - } - } - - # Override defaults - - $output_dir = $data->{OUTPUTDIR} if (defined $data->{OUTPUTDIR}); - $inter_dir = $data->{INTERDIR} if (defined $data->{INTERDIR}); - $target_dir = $data->{TARGETDIR} if (defined $data->{TARGETDIR}); - $other_cpp_opts = $data->{CPPOPTS} if (defined $data->{CPPOPTS}); - $link_opts = $data->{LINKOPTS} if (defined $data->{LINKOPTS}); - - $other_cpp_opts .= $data->{ADDCPPOPTS} if (defined $data->{ADDCPPOPTS}); - $link_opts .= $data->{ADDLINKOPTS} if (defined $data->{ADDLINKOPTS}); - - my $string = <<EOCS1; -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries $use_debug_libs -# PROP BASE Output_Dir "$output_dir" -# PROP BASE Intermediate_Dir "$inter_dir" -# PROP BASE Target_Dir "$target_dir" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries $use_debug_libs -# PROP Output_Dir "$output_dir" -# PROP Intermediate_Dir "$inter_dir" -EOCS1 - - $string .= "# PROP Ignore_Export_Lib 0\n" if ($type ne "static library"); - - $string .= <<EOCS2; -# PROP Target_Dir "$target_dir" -# ADD BASE CPP $base_cpp_opts -# ADD CPP $base_cpp_opts $other_cpp_opts -EOCS2 - - if ($type ne "static library") { - $string .= "# ADD BASE MTL /nologo /D \"$debug_macro\" /mktyplib203 /win32\n"; - $string .= "# ADD MTL /nologo /D \"$debug_macro\" /mktyplib203 /win32\n"; - } - - $string .= <<EOCS3; -# ADD BASE RSC /l 0x409 /d "$debug_macro" -# ADD RSC /l 0x409 /d "$debug_macro" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -EOCS3 - - if ($type eq "static library") { - $string .= "LIB32=link.exe -lib\n"; - $string .= "# ADD BASE LIB32 $base_link_opts\n"; - $string .= "# ADD LIB32 $link_opts\n"; - } - else { - $string .= "LINK32=link.exe\n"; - $string .= "# ADD BASE LINK32 $base_link_opts\n"; - $string .= "# ADD LINK32 $link_opts \n"; - } - - $string .= "\n"; - - return $string; -} - -1; diff --git a/samwise/PerlSam/Generator/View.pm b/samwise/PerlSam/Generator/View.pm deleted file mode 100644 index 8f7361d771c..00000000000 --- a/samwise/PerlSam/Generator/View.pm +++ /dev/null @@ -1,42 +0,0 @@ -# $Id$ - -package PerlSam::Generator::View; - -use Data::Dumper; -use strict; - -############################################################################### -# Constructor - -sub new (@) -{ - my $proto = shift; - my $class = ref ($proto) || $proto; - my $self = {}; - - bless ($self, $class); - return $self; -} - -############################################################################### -# Methods - -sub GenerateWorkspace (\%) -{ - my $self = shift; - my $data = shift; - - print "-----Workspace\n"; - print Dumper ($data->{WORKSPACE}); -} - -sub GenerateProjects (\%) -{ - my $self = shift; - my $data = shift; - - print "-----Projects\n"; - print Dumper ($data->{PROJECTS}); -} - -1;
\ No newline at end of file diff --git a/samwise/PerlSam/Generator/VisualAge.pm b/samwise/PerlSam/Generator/VisualAge.pm deleted file mode 100644 index ccf38e07e8a..00000000000 --- a/samwise/PerlSam/Generator/VisualAge.pm +++ /dev/null @@ -1,118 +0,0 @@ -# $Id$ - -package PerlSam::Generator::VisualAge; - -use Cwd; -use Data::Dumper; -use File::Basename; -use FileHandle; -use strict; - -############################################################################### -# Forward Declarations - - -############################################################################### -# Constructor - -sub new (@) -{ - my $proto = shift; - my $class = ref ($proto) || $proto; - my $self = {}; - - bless ($self, $class); - return $self; -} - -############################################################################### -# Methods - -sub GenerateWorkspace (\%) -{ - my $self = shift; - my $data = shift; - - my $string; - - $string .= "//\n"; - $string .= "//\n"; - $string .= "// \$Id\$\n"; - $string .= "//\n"; - $string .= "// Visual Age C++ 5 super-project generated by the Samwise Compiler\n"; - $string .= "//\n"; - $string .= "//\n"; - $string .= "\n"; - - foreach my $project (PerlSam::Generator::ProjectOrder (%{$data})) { - $string .= "subproject $project, icc \"".$project.".icc\", ics \"".$project.".ics\"\n"; - $string .= "{\n"; - $string .= "}\n"; - $string .= "\n"; - } - - $string .= "build all\n"; - $string .= "{\n"; - foreach my $project (PerlSam::Generator::ProjectOrder (%{$data})) { - $string .= "use $project\n"; - } - $string .= "}\n"; - - my $file_name; - - if (defined $data->{WORKSPACE}->{NAME}) { - $file_name = $data->{WORKSPACE}->{NAME}; - } - else { - $file_name = getcwd (); - - if ($file_name =~ m/\/([^\/]*)$/) { - $file_name = $1; - } - } - - $file_name = $file_name . ".icp"; - - print "Creating Workspace: $file_name\n"; - - my $file_handle = new FileHandle ($file_name, "w"); - binmode $file_handle; - $string =~ s/\n/\r\n/g; - print $file_handle $string; -} - -sub GenerateProjects (\%) -{ - my $self = shift; - my $data = shift; - - foreach my $project (sort keys %{$data->{PROJECTS}}) { - my $string; - my $description = $data->{PROJECTS}->{$project}->{DESCRIPTION}; - my $target = $data->{PROJECTS}->{$project}->{TARGET}; - my $type = $data->{PROJECTS}->{$project}->{TYPE}; - - my $file_name = $project . ".icc"; - - my $string; - $string .= "//\n"; - $string .= "// Visual Age C++ 5 Project file generated by the Samwise Compiler\n"; - $string .= "//\n"; - - my $ace_root = PerlSam::Generator::ConvertPathToRelative ("/"); - - $string .= "include \"".$ace_root."samwise/makeinclude/vacpp_setup.icc\"\n"; - $string .= "option\n"; - $string .= " link(libSearchPath,),\n"; - - print "Creating Project: $file_name\n"; - - # my $file_handle = new FileHandle ($file_name, "w"); - # print $file_handle $string; - } -} - -############################################################################### -# Internal Methods - -1; |