summaryrefslogtreecommitdiff
path: root/modules/NMakeWorkspaceCreator.pm
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2002-07-09 12:30:46 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2002-07-09 12:30:46 +0000
commitc952551333647f0412a4817a3b627362789f2ae1 (patch)
tree17c7ecd01392d50d657d8416113aa072a9941971 /modules/NMakeWorkspaceCreator.pm
downloadMPC-c952551333647f0412a4817a3b627362789f2ae1.tar.gz
ChangeLogTag: Tue Jul 9 07:24:06 2002 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'modules/NMakeWorkspaceCreator.pm')
-rw-r--r--modules/NMakeWorkspaceCreator.pm84
1 files changed, 84 insertions, 0 deletions
diff --git a/modules/NMakeWorkspaceCreator.pm b/modules/NMakeWorkspaceCreator.pm
new file mode 100644
index 00000000..fc0e4fb5
--- /dev/null
+++ b/modules/NMakeWorkspaceCreator.pm
@@ -0,0 +1,84 @@
+package NMakeWorkspaceCreator;
+
+# ************************************************************
+# Description : A NMake Workspace (Makefile) creator
+# Author : Chad Elliott
+# Create Date : 6/10/2002
+# ************************************************************
+
+# ************************************************************
+# Pragmas
+# ************************************************************
+
+use strict;
+use File::Basename;
+
+use NMakeProjectCreator;
+use WorkspaceCreator;
+
+use vars qw(@ISA);
+@ISA = qw(WorkspaceCreator);
+
+# ************************************************************
+# Subroutine Section
+# ************************************************************
+
+
+sub crlf {
+ my($self) = shift;
+ return $self->windows_crlf();
+}
+
+
+sub workspace_file_name {
+ my($self) = shift;
+ return "Makefile";
+}
+
+
+sub pre_workspace {
+ my($self) = shift;
+ my($fh) = shift;
+ my($crlf) = $self->crlf();
+
+ print $fh "# Microsoft Developer Studio Generated NMAKE File$crlf$crlf";
+}
+
+
+sub write_comps {
+ my($self) = shift;
+ my($fh) = shift;
+ my($projects) = $self->get_projects();
+ my($pjs) = $self->get_project_info();
+ my(@list) = $self->sort_dependencies($projects, $pjs);
+ my($crlf) = $self->crlf();
+
+ print $fh "ALL:$crlf";
+ foreach my $project (@list) {
+ my($dir) = dirname($project);
+ my($chdir) = 0;
+ my($back) = 1;
+
+ ## If the directory isn't "." then we need
+ ## to figure out how to get back to our starting point
+ if ($dir ne ".") {
+ $chdir = 1;
+ my($length) = length($dir);
+ for(my $i = 0; $i < $length; $i++) {
+ if (substr($dir, $i, 1) eq "/") {
+ $back++;
+ }
+ }
+ }
+
+ ## These commands will work. In practicality, only the
+ ## default configuration can be built at the top level.
+ print $fh ($chdir ? "\tcd $dir$crlf" : "") .
+ "\t\$(MAKE) /f " . basename($project) . " CFG=\"\$(CFG)\"$crlf" .
+ ($chdir ? "\tcd " . ("../" x $back) . $crlf : "");
+ }
+}
+
+
+
+1;