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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
package BorlandWorkspaceCreator;
# ************************************************************
# Description : A Borland Workspace (Makefile.bor) creator
# Author : Chad Elliott
# Create Date : 7/02/2002
# ************************************************************
# ************************************************************
# Pragmas
# ************************************************************
use strict;
use File::Basename;
use BorlandProjectCreator;
use WorkspaceCreator;
use vars qw(@ISA);
@ISA = qw(WorkspaceCreator);
# ************************************************************
# Subroutine Section
# ************************************************************
sub workspace_file_name {
my($self) = shift;
if ($self->make_coexistence()) {
return $self->get_modified_workspace_name('Makefile', '.bor');
}
else {
return $self->get_modified_workspace_name('Makefile', '');
}
}
sub workspace_per_project {
#my($self) = shift;
return 1;
}
sub pre_workspace {
my($self) = shift;
my($fh) = shift;
my($crlf) = $self->crlf();
print $fh '#----------------------------------------------------------------------------', $crlf,
'# Borland Workspace', $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,
"# $0 @ARGV", $crlf,
'#----------------------------------------------------------------------------', $crlf,
$crlf;
}
sub write_project_targets {
my($self) = shift;
my($fh) = shift;
my($target) = shift;
my($list) = shift;
my($crlf) = $self->crlf();
foreach my $project (@$list) {
my($dir) = dirname($project);
my($chdir) = 0;
my($back) = '';
## 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($count) = ($dir =~ tr/\///);
if ($dir =~ /^\.\.\//) {
$back = ('../' x $count) . basename($self->getcwd());
}
else {
$back = ('../' x ($count + 1));
}
}
print $fh ($chdir ? "\t\@cd $dir$crlf" : '') .
"\t\$(MAKE) -\$(MAKEFLAGS) \$(MAKE_FLAGS) -f " . basename($project) . " $target$crlf" .
($chdir ? "\t\@cd $back$crlf" : '');
}
}
sub write_comps {
my($self) = shift;
my($fh) = shift;
my($projects) = $self->get_projects();
my($pjs) = $self->get_project_info();
my(%targnum) = ();
my(@list) = $self->number_target_deps($projects, $pjs, \%targnum);
my($crlf) = $self->crlf();
print $fh "!include <\$(ACE_ROOT)\\include\\makeinclude\\make_flags.bor>$crlf";
## Print out the "all" target
print $fh $crlf . 'all:';
foreach my $project (@list) {
print $fh " $$pjs{$project}->[0]";
}
print $fh $crlf;
## Print out all other targets here
foreach my $target ('clean', 'realclean', 'install') {
print $fh $crlf .
"$target\:$crlf";
$self->write_project_targets($fh, $target, \@list);
}
## Print out each target separately
foreach my $project (@list) {
print $fh $crlf . $$pjs{$project}->[0] . ':';
if (defined $targnum{$project}) {
foreach my $number (@{$targnum{$project}}) {
print $fh " $$pjs{$list[$number]}->[0]";
}
}
print $fh $crlf;
$self->write_project_targets($fh, 'all', [ $project ]);
}
## Print out the project_name_list target
print $fh $crlf . "project_name_list:$crlf";
foreach my $project (sort @list) {
print $fh "\t\@echo $$pjs{$project}->[0]$crlf";
}
}
1;
|