Update pin_base.mpb
[MPC.git] / modules / BMakeWorkspaceCreator.pm
bloba95b9604f37a5bf320ba56d2cc1255e87f80d564
1 package BMakeWorkspaceCreator;
3 # ************************************************************
4 # Description : A Borland Make Workspace (Makefile) creator
5 # Author : Chad Elliott
6 # Create Date : 2/03/2004
7 # ************************************************************
9 # ************************************************************
10 # Pragmas
11 # ************************************************************
13 use strict;
15 use BMakeProjectCreator;
16 use MakeWorkspaceBase;
17 use WinWorkspaceBase;
18 use WorkspaceCreator;
19 use BorlandPropertyBase;
21 use vars qw(@ISA);
22 @ISA = qw(MakeWorkspaceBase WinWorkspaceBase WorkspaceCreator
23 BorlandPropertyBase);
25 # ************************************************************
26 # Data Section
27 # ************************************************************
29 ## Borland Make's maximum line length
30 my $max_line_length = 32767;
31 my $targets = 'clean generated realclean $(CUSTOM_TARGETS)';
33 # ************************************************************
34 # Subroutine Section
35 # ************************************************************
37 sub workspace_file_extension {
38 #my $self = shift;
39 return '.bmak';
43 sub workspace_file_name {
44 my $self = shift;
45 return $self->get_modified_workspace_name('Makefile', '.bmak');
49 sub pre_workspace {
50 my($self, $fh) = @_;
51 $self->workspace_preamble($fh, $self->crlf(),
52 'Borland Workspace Makefile',
53 '');
57 sub write_project_targets {
58 my($self, $fh, $crlf, $target, $list, $and) = @_;
59 my $cwd = $self->getcwd();
61 ## Print out a make command for each project
62 foreach my $project (@$list) {
63 my $dir = $self->mpc_dirname($project);
64 $dir =~ s/\//\\/g;
65 my $chdir = ($dir ne '.');
67 print $fh "\t", ($chdir ? "\$(COMSPEC) /c \"cd $dir $and " : ''),
68 "\$(MAKE) -\$(MAKEFLAGS) -f ",
69 $self->mpc_basename($project), " $target",
70 ($chdir ? '"' : ''), $crlf;
75 sub write_comps {
76 my($self, $fh, $creator) = @_;
77 my %targnum;
78 my $pjs = $self->get_project_info();
79 my @list = $self->number_target_deps($self->get_projects(), $pjs,
80 \%targnum, 0);
81 my $crlf = $self->crlf();
83 ## Set up the custom targets
84 print $fh '!ifndef CUSTOM_TARGETS', $crlf,
85 'CUSTOM_TARGETS=_EMPTY_TARGET_', $crlf,
86 '!endif', $crlf;
88 ## Translate each project name
89 my %trans;
90 foreach my $project (@list) {
91 $trans{$project} = $$pjs{$project}->[ProjectCreator::PROJECT_NAME];
94 ## Send all the information to our base class method
95 $self->write_named_targets($fh, $crlf, \%targnum, \@list,
96 $targets, '', '', \%trans, undef,
97 $creator->get_and_symbol(), $max_line_length);
101 sub get_properties {
102 my $self = shift;
104 ## Create the map of properties that we support.
105 my $props = {};
107 ## Merge in properties from all base projects
108 foreach my $base (@ISA) {
109 my $func = $base . '::get_properties';
110 my $p = $self->$func();
111 foreach my $key (keys %$p) {
112 $$props{$key} = $$p{$key};
116 return $props;