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