summaryrefslogtreecommitdiff
path: root/samwise/PerlSam/Generator/Automake.pm
diff options
context:
space:
mode:
Diffstat (limited to 'samwise/PerlSam/Generator/Automake.pm')
-rw-r--r--samwise/PerlSam/Generator/Automake.pm264
1 files changed, 0 insertions, 264 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;