diff options
author | elliott_c <ocielliottc@users.noreply.github.com> | 2006-11-29 19:49:03 +0000 |
---|---|---|
committer | elliott_c <ocielliottc@users.noreply.github.com> | 2006-11-29 19:49:03 +0000 |
commit | 95b404f97028aa1566e322398d06e164f130d84c (patch) | |
tree | 90677c47f107b3202953eee49f4e2c64bb079a68 /modules/MakeWorkspaceBase.pm | |
parent | fa54e53866e3e10e839cd379917526f4d021efcd (diff) | |
download | MPC-95b404f97028aa1566e322398d06e164f130d84c.tar.gz |
ChangeLogTag: Wed Nov 29 19:47:15 UTC 2006 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'modules/MakeWorkspaceBase.pm')
-rw-r--r-- | modules/MakeWorkspaceBase.pm | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/modules/MakeWorkspaceBase.pm b/modules/MakeWorkspaceBase.pm new file mode 100644 index 00000000..6f6ff603 --- /dev/null +++ b/modules/MakeWorkspaceBase.pm @@ -0,0 +1,136 @@ +package MakeWorkspaceBase; + +# ************************************************************ +# Description : A Make Workspace base module +# Author : Chad Elliott +# Create Date : 11/21/2006 +# ************************************************************ + +# ************************************************************ +# Pragmas +# ************************************************************ + +use strict; + +# ************************************************************ +# Subroutine Section +# ************************************************************ + +sub workspace_file_prefix { + #my($self) = shift; + return 'Makefile'; +} + + +sub workspace_file_extension { + #my($self) = shift; + return ''; +} + + +sub supports_make_coexistence { + my($self) = shift; + return ($self->workspace_file_extension() ne ''); +} + + +sub workspace_file_name { + my($self) = shift; + return $self->get_modified_workspace_name( + $self->workspace_file_prefix(), + $self->make_coexistence() ? + $self->workspace_file_extension() : ''); +} + + +sub workspace_per_project { + #my($self) = shift; + return 1; +} + + +sub workspace_preamble { + my($self) = shift; + my($fh) = shift; + my($crlf) = shift; + my($name) = shift; + my($id) = shift; + + print $fh '#----------------------------------------------------------------------------', $crlf, + '# ', $name, $crlf, + '#', $crlf, + '# ', $id, $crlf, + '#', $crlf, + '# This file was generated by MPC. Any changes made directly to', $crlf, + '# this file will be lost the next time it is generated.', $crlf, + '#', $crlf, + '# MPC Command:', $crlf, + '# ', $self->create_command_line_string($0, @ARGV), $crlf, + '#', $crlf, + '#----------------------------------------------------------------------------', $crlf, + $crlf; +} + + +sub write_named_targets { + my($self) = shift; + my($fh) = shift; + my($crlf) = shift; + my($targnum) = shift; + my($list) = shift; + my($remain) = shift; + my($targpre) = shift; + my($allpre) = shift; + my($trans) = shift; + my($phony) = shift; + my($andsym) = shift; + my($maxline) = shift; + + ## Print out the "all" target + if (defined $maxline) { + my($all) = 'all:'; + foreach my $project (@$list) { + $all .= " $$trans{$project}"; + } + if (length($all) < $maxline) { + print $fh $crlf, $all; + } + else { + $remain = 'all ' . $remain; + } + } + else { + print $fh $crlf . 'all:'; + foreach my $project (@$list) { + print $fh " $$trans{$project}"; + } + } + + ## Print out all other targets here + print $fh "$crlf$crlf$remain:$crlf"; + $self->write_project_targets($fh, $crlf, + $targpre . '$(@)', $list, $andsym); + + ## Print out each target separately + foreach my $project (@$list) { + print $fh ($phony ? "$crlf.PHONY: $$trans{$project}" : ''), + $crlf, $$trans{$project}, ':'; + if (defined $$targnum{$project}) { + foreach my $number (@{$$targnum{$project}}) { + print $fh " $$trans{$$list[$number]}"; + } + } + print $fh $crlf; + $self->write_project_targets($fh, $crlf, + $targpre . $allpre . 'all', + [ $project ], $andsym); + } + + ## Print out the project_name_list target + print $fh $crlf, "project_name_list:$crlf"; + foreach my $project (sort @$list) { + print $fh "\t\@echo $$trans{$project}$crlf"; + } +} + +1; |