| 235 |
dpurdie |
1 |
#
|
|
|
2 |
# Module name : BORLAND
|
|
|
3 |
# Module type : Makefile system
|
|
|
4 |
# Compiler(s) : ANSI C
|
|
|
5 |
# Environment(s): WIN32
|
|
|
6 |
#
|
|
|
7 |
# Description:
|
|
|
8 |
# Borland C/C++ Builder for WIN32
|
|
|
9 |
#............................................................................#
|
|
|
10 |
|
|
|
11 |
use strict;
|
|
|
12 |
use warnings;
|
|
|
13 |
|
|
|
14 |
################################################################################
|
|
|
15 |
# Globals
|
|
|
16 |
#
|
|
|
17 |
my $toolset_version;
|
|
|
18 |
|
|
|
19 |
##############################################################################
|
|
|
20 |
# ToolsetInit()
|
|
|
21 |
# Runtime initialisation
|
|
|
22 |
#
|
|
|
23 |
##############################################################################
|
|
|
24 |
|
|
|
25 |
ToolsetInit();
|
|
|
26 |
|
|
|
27 |
sub ToolsetInit
|
|
|
28 |
{
|
|
|
29 |
|
|
|
30 |
#.. Parse arguments (Toolset arguments)
|
|
|
31 |
#
|
|
|
32 |
Debug( "Borland(@::ScmToolsetArgs)" );
|
|
|
33 |
|
|
|
34 |
foreach $_ ( @::ScmToolsetArgs ) {
|
|
|
35 |
if (/^--Version=(.*)/) { # MS SDK Version
|
|
|
36 |
$toolset_version = $1;
|
|
|
37 |
|
|
|
38 |
} else {
|
|
|
39 |
Message( "Borland toolset: unknown option $_ -- ignored\n" );
|
|
|
40 |
}
|
|
|
41 |
}
|
|
|
42 |
|
|
|
43 |
#.. Parse arguments (platform arguments)
|
|
|
44 |
#
|
|
|
45 |
Debug( "Borland(@::ScmPlatformArgs)" );
|
|
|
46 |
|
|
|
47 |
foreach $_ ( @::ScmPlatformArgs ) {
|
|
|
48 |
if (/^--product=(.*)/) { # GBE product
|
|
|
49 |
|
|
|
50 |
} elsif (/^--Version=(.*)/) { # MS SDK Version
|
|
|
51 |
$toolset_version = $1;
|
|
|
52 |
|
|
|
53 |
} else {
|
|
|
54 |
Message( "Borland toolset: unknown platform argument $_ -- ignored\n" );
|
|
|
55 |
}
|
|
|
56 |
}
|
|
|
57 |
|
|
|
58 |
#.. Validate SDK version
|
|
|
59 |
# Currently only one is supported
|
|
|
60 |
# 1) Borland C++ Builder 6 installed
|
|
|
61 |
#
|
|
|
62 |
Error( "Unknown version: $toolset_version" ) if ( defined $toolset_version );
|
|
|
63 |
|
|
|
64 |
|
|
|
65 |
#.. Standard.rul requirements
|
|
|
66 |
#
|
|
|
67 |
$::s = 'asm';
|
|
|
68 |
$::o = 'obj';
|
|
|
69 |
$::a = 'lib';
|
|
|
70 |
$::so = 'dll';
|
|
|
71 |
$::exe = '.exe';
|
|
|
72 |
|
|
|
73 |
#.. Toolset configuration
|
|
|
74 |
#
|
|
|
75 |
$::ScmToolsetVersion = "1.0.0"; # our version
|
|
|
76 |
$::ScmToolsetGenerate = 0; # generate optional
|
|
|
77 |
|
|
|
78 |
#.. define Borland C/C++ environment
|
|
|
79 |
Init( "borlandc" );
|
|
|
80 |
ToolsetDefines( "borland.def" );
|
|
|
81 |
ToolsetRequire( "exctags" ); # and Exuberant Ctags
|
|
|
82 |
ToolsetRules( "borland.rul" );
|
|
|
83 |
ToolsetRules( "standard.rul" );
|
|
|
84 |
|
|
|
85 |
#.. define PCLint envrionment
|
|
|
86 |
# ToolsetRequire( "pclint" ); # using pclint
|
|
|
87 |
# PlatformDefine ("LINT_COFILE\t= co-msc60.lnt");
|
|
|
88 |
# PlatformDefine ("LINT_PRJ_FILE\t=lint.borland");
|
|
|
89 |
|
|
|
90 |
#.. Cleanup rules
|
|
|
91 |
# None at the moment as we only build projects
|
|
|
92 |
#
|
|
|
93 |
return 1;
|
|
|
94 |
}
|
|
|
95 |
|
|
|
96 |
########################################################################
|
|
|
97 |
#
|
|
|
98 |
# Generate a project from the provided project file
|
|
|
99 |
#
|
|
|
100 |
# Arguments : $name - Base name of the project
|
|
|
101 |
# $solution - Path to the project file
|
|
|
102 |
# $pArgs - Project specific options
|
|
|
103 |
#
|
|
|
104 |
# Process a Borland Project file by:
|
|
|
105 |
# 1) Convert .bpr to a Borland .mak file
|
|
|
106 |
# 2) Invoke Borland make on the .mak file
|
|
|
107 |
# Must change to the directory of the target project
|
|
|
108 |
# Need to create "ilink32.cfg" in the project directory
|
|
|
109 |
# to set the '/Lib/Release'
|
|
|
110 |
#
|
|
|
111 |
########################################################################
|
|
|
112 |
|
|
|
113 |
my $project_defines_done = 0;
|
|
|
114 |
sub ToolsetPROJECT
|
|
|
115 |
{
|
|
|
116 |
my( $name, $solution ,$pArgs ) = @_;
|
|
|
117 |
my @cleanfiles;
|
|
|
118 |
my $cname = $name;
|
|
|
119 |
$cname =~ s~\..+$~~;
|
|
|
120 |
my $logfile = "$cname\$(GBE_TYPE).log";
|
|
|
121 |
my $makefile = "$cname.jats.mak";
|
|
|
122 |
my $basedir = StripFileExt( $solution ) || '.';
|
|
|
123 |
|
|
|
124 |
#
|
|
|
125 |
# Some existing projects are in directories that have a 'space'
|
|
|
126 |
# Fix this by creating a path that uses a '?' wildcard instead of
|
|
|
127 |
# a space.
|
|
|
128 |
#
|
|
|
129 |
my $solution_path = $solution;
|
|
|
130 |
$solution_path =~ s~ ~\?~g;
|
|
|
131 |
|
|
|
132 |
#
|
|
|
133 |
# Process options
|
|
|
134 |
#
|
|
|
135 |
foreach ( @$pArgs ) {
|
|
|
136 |
if ( m~^--CleanDir=(.+)~ ) {
|
|
|
137 |
my $path = ($basedir) ? "$basedir/$1" : $1;
|
|
|
138 |
push @cleanfiles, "$path/*";
|
|
|
139 |
|
|
|
140 |
} elsif ( m~^--CleanFiles=(.+)~ ) {
|
|
|
141 |
my $path = ($basedir) ? "$basedir/$1" : $1;
|
|
|
142 |
push @cleanfiles, $path;
|
|
|
143 |
|
|
|
144 |
} else {
|
|
|
145 |
Message( "bcb PROJECT: unknown option $_ -- ignored\n" );
|
|
|
146 |
}
|
|
|
147 |
}
|
|
|
148 |
|
|
|
149 |
my ($io) = ToolsetPrinter::New();
|
|
|
150 |
|
|
|
151 |
#
|
|
|
152 |
# One time only definitions
|
|
|
153 |
#
|
|
|
154 |
unless( $project_defines_done )
|
|
|
155 |
{
|
|
|
156 |
$project_defines_done = 1;
|
|
|
157 |
$io->PrtLn( "ifeq \"\$(DEBUG)\" \"1\"");
|
|
|
158 |
$io->PrtLn( "\techo Borland Builder Projects do not build for debug");
|
|
|
159 |
$io->PrtLn( "\techo The project setting are used and should for release");
|
|
|
160 |
$io->PrtLn( "\techo exit 1");
|
|
|
161 |
$io->PrtLn( "endif");
|
|
|
162 |
$io->Newline();
|
|
|
163 |
}
|
|
|
164 |
|
|
|
165 |
#
|
|
|
166 |
# Generate the recipe to create the project
|
|
|
167 |
# Use the set_WIN32.sh file to extend the DLL search path
|
|
|
168 |
#
|
|
|
169 |
$io->Label( "Build project", $name );
|
|
|
170 |
$io->PrtLn( "Project_$name: $solution_path \$(INTERFACEDIR)/set_$::ScmPlatform.sh" );
|
|
|
171 |
$io->PrtLn( "\t\$(call MakeProject,$name,$basedir,$makefile,$logfile)" );
|
|
|
172 |
$io->Newline();
|
|
|
173 |
|
|
|
174 |
#
|
|
|
175 |
# Generate the recipe to clean the project
|
|
|
176 |
# Delete the contents of the listed files and directories
|
|
|
177 |
# Delete the log file
|
|
|
178 |
# Delete the generated makefile
|
|
|
179 |
# Delete the generated ilink32.cfg file
|
|
|
180 |
#
|
|
|
181 |
$io->Label( "Clean project", $name );
|
|
|
182 |
$io->PrtLn( "ProjectClean_$name: $solution_path" );
|
|
|
183 |
push @cleanfiles, $logfile, $makefile, "$basedir/ilink32.cfg";
|
|
|
184 |
$io->Prt( "\t-\$(XX_PRE)\$(GBE_PERL) -Mjats_runtime -e rm_f -- ");
|
|
|
185 |
$io->Prt( " \\\n\t\t\"$_\"" ) foreach ( @cleanfiles );
|
|
|
186 |
$io->Newline();
|
|
|
187 |
}
|
|
|
188 |
|
|
|
189 |
|
|
|
190 |
#.. Successful termination
|
|
|
191 |
1;
|
|
|
192 |
|