| 263 |
dpurdie |
1 |
########################################################################
|
|
|
2 |
# Copyright (C) 2008 ERG Limited, All rights reserved
|
|
|
3 |
#
|
|
|
4 |
# Module name : PHARLAP.PL
|
|
|
5 |
# Module type : JATS TOOLSET
|
|
|
6 |
# Compiler(s) : Perl
|
|
|
7 |
# Environment(s): JATS
|
|
|
8 |
#
|
|
|
9 |
# Description : PharLap (and VC6) for PHARLAP
|
|
|
10 |
#
|
|
|
11 |
# Based on the WIN32 toolset
|
|
|
12 |
# Pharlap uses the MS V6 compiler
|
|
|
13 |
# but provides its own linker
|
|
|
14 |
#
|
|
|
15 |
# Notes : The Pharlap linker does not support PDB files
|
|
|
16 |
#
|
|
|
17 |
# Shared Library (DLL) support has not bee implemented
|
|
|
18 |
# Not currently needed
|
|
|
19 |
#
|
|
|
20 |
# Building via Visual Studio Project is to be discouraged.
|
|
|
21 |
# The linker intrerface requires:
|
|
|
22 |
# 1) Great care
|
|
|
23 |
# 2) Hacking of the Visual Studio install
|
|
|
24 |
#
|
|
|
25 |
#......................................................................#
|
|
|
26 |
|
|
|
27 |
use strict;
|
|
|
28 |
use warnings;
|
|
|
29 |
|
|
|
30 |
#
|
|
|
31 |
# Global data
|
|
|
32 |
#
|
|
|
33 |
my $target_file_lib; # Last library built
|
|
|
34 |
my $target_file_dll; # Last dll built
|
|
|
35 |
my $target_file_exe; # Last program built
|
|
|
36 |
|
|
|
37 |
my $toolset_name = 'pharlap'; # Toolset name : Error reporting
|
|
|
38 |
|
|
|
39 |
##############################################################################
|
|
|
40 |
# Version information
|
|
|
41 |
#
|
|
|
42 |
my $toolset_info;
|
|
|
43 |
my $toolset_version = 'PHARLAP.10.1';
|
|
|
44 |
my %ToolsetVersion =
|
|
|
45 |
(
|
|
|
46 |
'PHARLAP.10.1' => { 'def' => 'PHARLAP.def' ,
|
|
|
47 |
'buildcmd' => 'msdev =DSW= /make "ALL - =TYPE=" /useenv /out =LOG=' ,
|
|
|
48 |
'cleancmd' => 'msdev =DSW= /make "ALL - =TYPE=" /clean /useenv' ,
|
|
|
49 |
'tmp' => 'vc60',
|
|
|
50 |
'VSCOMPILER' => '1',
|
|
|
51 |
},
|
|
|
52 |
);
|
|
|
53 |
|
|
|
54 |
|
|
|
55 |
##############################################################################
|
|
|
56 |
# ToolsetInit()
|
|
|
57 |
# Runtime initialisation
|
|
|
58 |
#
|
|
|
59 |
##############################################################################
|
|
|
60 |
|
|
|
61 |
ToolsetInit();
|
|
|
62 |
|
|
|
63 |
sub ToolsetInit
|
|
|
64 |
{
|
|
|
65 |
|
|
|
66 |
#.. Parse arguments (Toolset arguments)
|
|
|
67 |
#
|
|
|
68 |
Debug( "$toolset_name(@::ScmToolsetArgs)" );
|
|
|
69 |
|
|
|
70 |
foreach $_ ( @::ScmToolsetArgs ) {
|
|
|
71 |
if (/^--Version=(.*)/) { # MS SDK Version
|
|
|
72 |
$toolset_version = $1;
|
|
|
73 |
|
|
|
74 |
} else {
|
|
|
75 |
Message( "$toolset_name toolset: unknown option $_ -- ignored\n" );
|
|
|
76 |
}
|
|
|
77 |
}
|
|
|
78 |
|
|
|
79 |
#.. Parse arguments (platform arguments)
|
|
|
80 |
#
|
|
|
81 |
Debug( "$toolset_name(@::ScmPlatformArgs)" );
|
|
|
82 |
|
|
|
83 |
foreach $_ ( @::ScmPlatformArgs ) {
|
|
|
84 |
if (/^--product=(.*)/) { # GBE product
|
|
|
85 |
|
|
|
86 |
} elsif (/^--Version=(.*)/) { # MS SDK Version
|
|
|
87 |
$toolset_version = $1;
|
|
|
88 |
|
|
|
89 |
} else {
|
|
|
90 |
Message( "$toolset_name toolset: unknown platform argument $_ -- ignored\n" );
|
|
|
91 |
}
|
|
|
92 |
}
|
|
|
93 |
|
|
|
94 |
#.. Validate SDK version
|
|
|
95 |
# Currently only one version is supported
|
|
|
96 |
# 1) PHARLAP.10.1 - As provided via Visual Studio and PharLap 10.1
|
|
|
97 |
#
|
|
|
98 |
$toolset_info = $ToolsetVersion{$toolset_version};
|
|
|
99 |
Error( "toolset_name: Unknown version: $toolset_version" ) unless ( defined $toolset_info );
|
|
|
100 |
|
|
|
101 |
|
|
|
102 |
#.. Standard.rul requirements
|
|
|
103 |
#
|
|
|
104 |
$::s = 'asm';
|
|
|
105 |
$::o = 'obj';
|
|
|
106 |
$::a = 'lib';
|
|
|
107 |
$::so = 'dll';
|
|
|
108 |
$::exe = '.exe';
|
|
|
109 |
|
|
|
110 |
#.. Toolset configuration
|
|
|
111 |
#
|
|
|
112 |
$::ScmToolsetVersion = "1.0.0"; # our version
|
|
|
113 |
$::ScmToolsetGenerate = 0; # generate optional
|
|
|
114 |
$::ScmToolsetProgDependancies = 0; # handle Prog dependancies myself
|
|
|
115 |
|
|
|
116 |
#.. define Visual C/C+ environment
|
|
|
117 |
Init( "visualc" );
|
|
|
118 |
ToolsetDefines( $toolset_info->{'def'} );
|
|
|
119 |
PlatformDefine ("VSCOMPILER\t= $toolset_info->{'VSCOMPILER'}" );
|
|
|
120 |
ToolsetRequire( "exctags" ); # and Exuberant Ctags
|
|
|
121 |
ToolsetRules( "pharlap.rul" );
|
|
|
122 |
ToolsetRules( "standard.rul" );
|
|
|
123 |
|
|
|
124 |
#.. define PCLint envrionment
|
|
|
125 |
ToolsetRequire( "pclint" ); # using pclint
|
|
|
126 |
PlatformDefine ("LINT_COFILE\t= co-msc60.lnt");
|
|
|
127 |
PlatformDefine ("LINT_PRJ_FILE\t=lint.visualc");
|
|
|
128 |
|
|
|
129 |
#.. Cleanup rules
|
|
|
130 |
#
|
|
|
131 |
ToolsetGenerate( "\$(OBJDIR)/$toolset_info->{'tmp'}.idb" ); # vc60.idb
|
|
|
132 |
ToolsetGenerate( "\$(OBJDIR)/$toolset_info->{'tmp'}.pch" );
|
|
|
133 |
ToolsetGenerate( "\$(OBJDIR)/$toolset_info->{'tmp'}.pdb" );
|
|
|
134 |
|
|
|
135 |
|
|
|
136 |
|
|
|
137 |
#.. Extend the CompilerOption directive
|
|
|
138 |
# Create a standard data structure
|
|
|
139 |
# This is a hash of hashes
|
|
|
140 |
# The first hash is keyed by CompileOption keyword
|
|
|
141 |
# The second hash contains pairs of values to set or remove
|
|
|
142 |
#
|
|
|
143 |
%::ScmToolsetCompilerOptions =
|
|
|
144 |
(
|
|
|
145 |
#
|
|
|
146 |
# Control the thread model to use
|
|
|
147 |
# This will affect the compiler options and the linker options
|
|
|
148 |
#
|
|
|
149 |
);
|
|
|
150 |
|
|
|
151 |
#
|
|
|
152 |
# Set default options
|
|
|
153 |
#
|
|
|
154 |
}
|
|
|
155 |
|
|
|
156 |
##############################################################################
|
|
|
157 |
# ToolsetPostprocess
|
|
|
158 |
# Process collected data as the makefile is generated
|
|
|
159 |
# This, optional, routine is called from within MakefileGenerate()
|
|
|
160 |
# It allows the toolset to massage any of the collected data before
|
|
|
161 |
# the makefile is finally closed created
|
|
|
162 |
#
|
|
|
163 |
##############################################################################
|
|
|
164 |
|
|
|
165 |
sub ToolsetPostprocess
|
|
|
166 |
{
|
|
|
167 |
MakeHeader('Toolset Postprocessed Information');
|
|
|
168 |
|
|
|
169 |
#
|
|
|
170 |
# Add values to the perl environment
|
|
|
171 |
# May be used by post processing tools to create Visual Studio Projects
|
|
|
172 |
#
|
|
|
173 |
$::TS_sbr_support = 1;
|
|
|
174 |
|
|
|
175 |
#
|
|
|
176 |
# Prioritorise target: EXE, DLL, LIB
|
|
|
177 |
#
|
|
|
178 |
for my $tgt ( $target_file_exe, $target_file_dll, $target_file_lib )
|
|
|
179 |
{
|
|
|
180 |
if ( $tgt )
|
|
|
181 |
{
|
|
|
182 |
$::TS_target_file = $tgt;
|
|
|
183 |
last;
|
|
|
184 |
}
|
|
|
185 |
}
|
|
|
186 |
}
|
|
|
187 |
|
|
|
188 |
|
|
|
189 |
###############################################################################
|
|
|
190 |
# ToolsetCTAGS()
|
|
|
191 |
# This subroutine takes the user options and builds the rules
|
|
|
192 |
# required to build the CTAGS database.
|
|
|
193 |
#
|
|
|
194 |
# Arguments:
|
|
|
195 |
# --xxx No arguments currently defined
|
|
|
196 |
#
|
|
|
197 |
# Output:
|
|
|
198 |
# [ctags:]
|
|
|
199 |
# $(EXCTAGS)
|
|
|
200 |
#
|
|
|
201 |
###############################################################################
|
|
|
202 |
|
|
|
203 |
sub ToolsetCTAGS
|
|
|
204 |
{
|
|
|
205 |
EXCTAGS( @_ );
|
|
|
206 |
}
|
|
|
207 |
|
|
|
208 |
|
|
|
209 |
###############################################################################
|
|
|
210 |
# ToolsetCC( $source, $obj, \@args )
|
|
|
211 |
# This subroutine takes the user options and builds the rule(s)
|
|
|
212 |
# required to compile the source file 'source' to 'obj'
|
|
|
213 |
#
|
|
|
214 |
###############################################################################
|
|
|
215 |
|
|
|
216 |
sub ToolsetCC
|
|
|
217 |
{
|
|
|
218 |
ToolsetCC_common( "CC", @_ );
|
|
|
219 |
}
|
|
|
220 |
|
|
|
221 |
sub ToolsetCC_common
|
|
|
222 |
{
|
|
|
223 |
my( $name, $source, $obj, $pArgs ) = @_;
|
|
|
224 |
my( $cflags );
|
|
|
225 |
|
|
|
226 |
foreach $_ ( @$pArgs ) {
|
|
|
227 |
if (/--Shared$/) { # Building a 'shared' object
|
|
|
228 |
$cflags = "$cflags \$(SHCFLAGS)";
|
|
|
229 |
|
|
|
230 |
} else {
|
|
|
231 |
Message( "$toolset_name $name: unknown option $_ -- ignored\n" );
|
|
|
232 |
}
|
|
|
233 |
}
|
|
|
234 |
|
|
|
235 |
MakePrint( "\n\t\$($name)\n" );
|
|
|
236 |
MakePadded( 4, "\$(OBJDIR)/$obj.$::o:", "\tCFLAGS +=$cflags\n" )
|
|
|
237 |
if ( $cflags ); # object specific CFLAGS
|
|
|
238 |
|
|
|
239 |
#
|
|
|
240 |
# Remove possible Source Browser Files and source file
|
|
|
241 |
#
|
|
|
242 |
ToolsetGenerate( "\$(OBJDIR)/$obj.sbr" );
|
|
|
243 |
ToolsetGenerate( "\$(OBJDIR)/$obj.src" );
|
|
|
244 |
MakePrint( "\n" );
|
|
|
245 |
}
|
|
|
246 |
|
|
|
247 |
|
|
|
248 |
###############################################################################
|
|
|
249 |
# ToolsetCCDepend( $depend, \@sources )
|
|
|
250 |
# This subroutine takes the user options and builds the
|
|
|
251 |
# rule(s) required to build the dependencies for the source
|
|
|
252 |
# files 'sources' to 'depend'.
|
|
|
253 |
#
|
|
|
254 |
###############################################################################
|
|
|
255 |
|
|
|
256 |
sub ToolsetCCDepend
|
|
|
257 |
{
|
|
|
258 |
MakePrint( "\t\$(CCDEPEND)\n" );
|
|
|
259 |
}
|
|
|
260 |
|
|
|
261 |
|
|
|
262 |
###############################################################################
|
|
|
263 |
# ToolsetCXX( $source, $obj, \@args )
|
|
|
264 |
# This subroutine takes the user options and builds the rule(s)
|
|
|
265 |
# required to compile the source file 'source' to 'obj'
|
|
|
266 |
#
|
|
|
267 |
###############################################################################
|
|
|
268 |
|
|
|
269 |
sub ToolsetCXX
|
|
|
270 |
{
|
|
|
271 |
ToolsetCC_common( "CXX", @_ );
|
|
|
272 |
}
|
|
|
273 |
|
|
|
274 |
###############################################################################
|
|
|
275 |
# ToolsetCXXDepend( $depend, \@sources )
|
|
|
276 |
# This subroutine takes the user options and builds the
|
|
|
277 |
# rule(s) required to build the dependencies for the source
|
|
|
278 |
# files 'sources' to 'depend'.
|
|
|
279 |
#
|
|
|
280 |
###############################################################################
|
|
|
281 |
|
|
|
282 |
sub ToolsetCXXDepend
|
|
|
283 |
{
|
| 287 |
dpurdie |
284 |
ToolsetCCDepend();
|
| 263 |
dpurdie |
285 |
}
|
|
|
286 |
|
|
|
287 |
|
|
|
288 |
###############################################################################
|
|
|
289 |
# ToolsetAS( $source, $obj, \@args )
|
|
|
290 |
# This subroutine takes the user options and builds the rule(s)
|
|
|
291 |
# required to compile the source file 'source' to 'obj'
|
|
|
292 |
#
|
|
|
293 |
###############################################################################
|
|
|
294 |
|
|
|
295 |
sub ToolsetAS
|
|
|
296 |
{
|
|
|
297 |
MakePrint( "\n\t\$(AS)\n" );
|
|
|
298 |
}
|
|
|
299 |
|
|
|
300 |
sub ToolsetASDepend
|
|
|
301 |
{
|
|
|
302 |
}
|
|
|
303 |
|
|
|
304 |
###############################################################################
|
|
|
305 |
# ToolsetAR( $name, \@args, \@objs )
|
|
|
306 |
# This subroutine takes the user options and builds the rules
|
|
|
307 |
# required to build the library 'name'.
|
|
|
308 |
#
|
|
|
309 |
# Arguments:
|
|
|
310 |
# --Def=name Library definition module
|
|
|
311 |
#
|
|
|
312 |
# Output:
|
|
|
313 |
# [ $(LIBDIR)/name$.${a}: .... ]
|
|
|
314 |
# $(AR)
|
|
|
315 |
#
|
|
|
316 |
###############################################################################
|
|
|
317 |
|
|
|
318 |
sub ToolsetAR
|
|
|
319 |
{
|
|
|
320 |
my( $name, $pArgs, $pObjs ) = @_;
|
|
|
321 |
my( $def );
|
|
|
322 |
my ( $res, @reslist );
|
|
|
323 |
my $lib_base = "\$(LIBDIR)/${name}\$(GBE_TYPE)";
|
|
|
324 |
my $lib_name = "$lib_base.${a}";
|
|
|
325 |
|
|
|
326 |
|
|
|
327 |
#.. Parse arguments
|
|
|
328 |
#
|
|
|
329 |
$def = ""; # options
|
|
|
330 |
$res = "";
|
|
|
331 |
|
|
|
332 |
foreach $_ ( @$pArgs ) {
|
|
|
333 |
if (/^--Def=(.*)/) { # library definition
|
|
|
334 |
$def = "$1";
|
|
|
335 |
|
|
|
336 |
} elsif (/^--Resource=(.*)/) { # Resource definition
|
|
|
337 |
($res, @reslist) = ToolsetRClist( "$name", $1 );
|
|
|
338 |
|
|
|
339 |
} else { # unknown
|
|
|
340 |
Message( "$toolset_name AR: unknown option $_ -- ignored\n" );
|
|
|
341 |
}
|
|
|
342 |
}
|
|
|
343 |
|
|
|
344 |
#.. Resource Creation
|
|
|
345 |
#
|
|
|
346 |
MakePrint( "#.. Library Resource ($name)\n\n" );
|
|
|
347 |
ToolsetRCrecipe( $res, @reslist )
|
|
|
348 |
if ( $res );
|
|
|
349 |
|
|
|
350 |
#.. Target
|
|
|
351 |
#
|
|
|
352 |
MakePrint( "#.. Library ($name)\n\n" ); # label
|
|
|
353 |
|
|
|
354 |
MakePrint( "$lib_name:\tLIBDEF=$def\n" ) if ($def);
|
|
|
355 |
MakeEntry( "$lib_name:\t", "", "\\\n\t\t", ".$::o", @$pObjs );
|
|
|
356 |
MakePrint( "\\\n\t\t$def" ) if ($def);
|
|
|
357 |
MakePrint( "\\\n\t\t$res" ) if ($res);
|
|
|
358 |
MakePrint( "\n\t\$(AR)" );
|
|
|
359 |
|
|
|
360 |
#
|
|
|
361 |
# Track the name of the possible target file
|
|
|
362 |
# Used when creating Visual Studio projects
|
|
|
363 |
#
|
|
|
364 |
$target_file_lib = $lib_name;
|
|
|
365 |
|
|
|
366 |
}
|
|
|
367 |
|
|
|
368 |
|
|
|
369 |
###############################################################################
|
|
|
370 |
# ToolsetARLINT( $name, \@args, \@objs )
|
|
|
371 |
# This subroutine takes the user options and builds the rules
|
|
|
372 |
# required to build the library 'name'.
|
|
|
373 |
#
|
|
|
374 |
# Arguments:
|
|
|
375 |
# --xxx No arguments currently defined
|
|
|
376 |
#
|
|
|
377 |
# Output:
|
|
|
378 |
# [ $(LIBDIR)/name$_lint: .... ]
|
|
|
379 |
# $(ARLINT)
|
|
|
380 |
#
|
|
|
381 |
###############################################################################
|
|
|
382 |
|
|
|
383 |
sub ToolsetARLINT
|
|
|
384 |
{
|
|
|
385 |
PCLintAR( @_ );
|
|
|
386 |
}
|
|
|
387 |
|
|
|
388 |
|
|
|
389 |
###############################################################################
|
|
|
390 |
# ToolsetARMerge( $name, \@args, \@libs )
|
|
|
391 |
# This subroutine takes the user options and builds the rules
|
|
|
392 |
# required to build the library 'name' by merging the specified
|
|
|
393 |
# libaries
|
|
|
394 |
#
|
|
|
395 |
# Arguments:
|
|
|
396 |
# --xxx No arguments currently defined
|
|
|
397 |
#
|
|
|
398 |
# Output:
|
|
|
399 |
# [ $(LIBDIR)/name$.${a}: .... ]
|
|
|
400 |
# ...
|
|
|
401 |
#
|
|
|
402 |
###############################################################################
|
|
|
403 |
|
|
|
404 |
sub ToolsetARMerge
|
|
|
405 |
{
|
|
|
406 |
my ($name, $pArgs, $pLibs) = @_;
|
|
|
407 |
MakePrint( "\n\t\$(ARMERGE)\n\n" );
|
|
|
408 |
}
|
|
|
409 |
|
|
|
410 |
###############################################################################
|
|
|
411 |
# Function : ToolsetLD
|
|
|
412 |
#
|
|
|
413 |
# Description : Takes the user options and builds the rules required to
|
|
|
414 |
# link the program 'name'.
|
|
|
415 |
#
|
|
|
416 |
# Inputs : $name - base name of the program
|
|
|
417 |
# $pArgs - Ref to program arguments
|
|
|
418 |
# $pObjs - Ref to program objects
|
|
|
419 |
# $pLibs - Ref to program library list
|
|
|
420 |
#
|
|
|
421 |
# Returns : Nothing
|
|
|
422 |
#
|
|
|
423 |
# Output: : Rules and recipes to create a program
|
|
|
424 |
# Create program rules and recipes
|
|
|
425 |
# Create linker input script
|
|
|
426 |
# Create library dependency list
|
|
|
427 |
# Include library dependency information
|
|
|
428 |
#
|
|
|
429 |
sub ToolsetLD
|
|
|
430 |
{
|
|
|
431 |
my ( $name, $pArgs, $pObjs, $pLibs ) = @_;
|
|
|
432 |
my ( $res, @reslist );
|
|
|
433 |
my @cmd_files;
|
|
|
434 |
|
|
|
435 |
#.. Parse arguments
|
|
|
436 |
#
|
|
|
437 |
foreach ( @$pArgs ) {
|
|
|
438 |
if (/^--Resource=(.*)/) { # Resource definition
|
|
|
439 |
($res, @reslist) = ToolsetRClist( $name, $1 );
|
|
|
440 |
|
|
|
441 |
} elsif (/^--CmdFile=(.+)/) {
|
|
|
442 |
push @cmd_files, MakeSrcResolve($1);
|
|
|
443 |
|
|
|
444 |
} else {
|
|
|
445 |
Message( "$toolset_name LD: unknown option $_ -- ignored\n" );
|
|
|
446 |
|
|
|
447 |
}
|
|
|
448 |
}
|
|
|
449 |
|
|
|
450 |
#.. Names of important files
|
|
|
451 |
#
|
|
|
452 |
my $base = "\$(BINDIR)/${name}";
|
|
|
453 |
my $full = $base . $::exe;
|
|
|
454 |
my $map = $base . '.map';
|
|
|
455 |
|
|
|
456 |
|
|
|
457 |
#.. Cleanup rules
|
|
|
458 |
#
|
|
|
459 |
# ld Linker command file
|
|
|
460 |
# map Map file
|
|
|
461 |
# ilk Microsoft Linker Database
|
|
|
462 |
# res Compiled resource script
|
|
|
463 |
#
|
|
|
464 |
ToolsetGenerate( $map );
|
|
|
465 |
ToolsetGenerate( $base . '.ld' );
|
|
|
466 |
ToolsetGenerate( $base . '.ilk' );
|
|
|
467 |
|
|
|
468 |
#.. Linker command
|
|
|
469 |
#
|
|
|
470 |
my ($io) = ToolsetPrinter::New();
|
| 335 |
dpurdie |
471 |
my $dep = $io->SetLdTarget( $name );
|
| 263 |
dpurdie |
472 |
|
|
|
473 |
$io->Prt( "$full : $dep " );
|
|
|
474 |
$io->Entry( "", "", "\\\n\t", ".$::o ", @$pObjs );
|
|
|
475 |
$io->Prt( "\\\n\t$res " ) if ( $res );
|
|
|
476 |
$io->Prt( "\n\t\$(LD)\n\n" );
|
|
|
477 |
|
|
|
478 |
|
|
|
479 |
#.. Linker command file
|
|
|
480 |
#
|
|
|
481 |
# Now piece together a variable $(name_ld) which ends up in
|
|
|
482 |
# the command file linking the application.
|
|
|
483 |
#
|
|
|
484 |
$io->SetTag( "${name}_ld" ); # macro tag
|
|
|
485 |
$io->Label( "Linker commands", $name ); # label
|
|
|
486 |
|
|
|
487 |
$io->Cmd( "\@\$(subst /,\\\\,$_)" ) foreach (@cmd_files);
|
|
|
488 |
$io->Cmd( "-exe \$(subst /,\\\\,$full)" );
|
|
|
489 |
$io->Cmd( "-cvsymbols" );
|
|
|
490 |
$io->Cmd( "-map \$(subst /,\\\\,$map)" );
|
|
|
491 |
$io->Cmd( "\$(subst /,\\\\,$res)" ) if ( $res );
|
|
|
492 |
|
|
|
493 |
$io->ObjList( $name, $pObjs, \&ToolsetObjRecipe ); # object list
|
|
|
494 |
$io->LibList( $name, $pLibs, \&ToolsetLibRecipe ); # library list
|
|
|
495 |
$io->Newline();
|
|
|
496 |
|
| 335 |
dpurdie |
497 |
#.. Dependency link,
|
|
|
498 |
# Create a library dependency file
|
|
|
499 |
# Create command file to build applicaton dependency list
|
|
|
500 |
# from the list of dependent libraries
|
|
|
501 |
#
|
|
|
502 |
# Create makefile directives to include the dependency
|
|
|
503 |
# list into the makefile.
|
|
|
504 |
#
|
|
|
505 |
$io->DepRules( $pLibs, \&ToolsetLibRecipe, $full );
|
|
|
506 |
$io->LDDEPEND();
|
| 263 |
dpurdie |
507 |
|
|
|
508 |
#.. Compile up the resource file
|
|
|
509 |
#
|
|
|
510 |
ToolsetRCrecipe( $res, @reslist )
|
|
|
511 |
if ( $res );
|
|
|
512 |
|
|
|
513 |
#.. Package up the program
|
|
|
514 |
#
|
|
|
515 |
PackageProgAddFiles ( $name, $full );
|
|
|
516 |
|
|
|
517 |
#
|
|
|
518 |
# Track the name of the possible target file
|
|
|
519 |
# Used when creating Visual Studio projects
|
|
|
520 |
#
|
|
|
521 |
$target_file_exe = $full;
|
|
|
522 |
}
|
|
|
523 |
|
|
|
524 |
|
|
|
525 |
###############################################################################
|
|
|
526 |
# ToolsetLD( $name, \@args, \@objs, \@libraries, \@csrc, \@cxxsrc )
|
|
|
527 |
# This subroutine takes the user options and builds the rules
|
|
|
528 |
# required to lint the program 'name'.
|
|
|
529 |
#
|
|
|
530 |
# Arguments:
|
|
|
531 |
# (none)
|
|
|
532 |
#
|
|
|
533 |
# Output:
|
|
|
534 |
# [ $(BINDIR)/$name_lint: .... ]
|
|
|
535 |
# $(LDLINT)
|
|
|
536 |
#
|
|
|
537 |
###############################################################################
|
|
|
538 |
|
|
|
539 |
sub ToolsetLDLINT
|
|
|
540 |
{
|
|
|
541 |
PCLintLD( @_ );
|
|
|
542 |
}
|
|
|
543 |
|
|
|
544 |
|
|
|
545 |
########################################################################
|
|
|
546 |
#
|
|
|
547 |
# Generate a linker object recipe. This is a helper function used
|
|
|
548 |
# within this toolset.
|
|
|
549 |
#
|
|
|
550 |
# Arguments:
|
|
|
551 |
# $io I/O stream
|
|
|
552 |
#
|
|
|
553 |
# $target Name of the target
|
|
|
554 |
#
|
|
|
555 |
# $obj Library specification
|
|
|
556 |
#
|
|
|
557 |
########################################################################
|
|
|
558 |
|
|
|
559 |
sub ToolsetObjRecipe
|
|
|
560 |
{
|
|
|
561 |
my ($io, $target, $obj) = @_;
|
|
|
562 |
|
|
|
563 |
$io->Cmd( "\$(subst /,\\\\,\$(strip $obj)).$::o" );
|
|
|
564 |
}
|
|
|
565 |
|
|
|
566 |
|
|
|
567 |
########################################################################
|
|
|
568 |
#
|
|
|
569 |
# Generate a linker/depend library recipe. This is a helper function
|
|
|
570 |
# used within this toolset.
|
|
|
571 |
#
|
|
|
572 |
# Arguments:
|
|
|
573 |
# $io I/O stream
|
|
|
574 |
#
|
|
|
575 |
# $target Name of the target
|
|
|
576 |
#
|
|
|
577 |
# $lib Library specification
|
|
|
578 |
#
|
|
|
579 |
# $dp If building a depend list, the full target name.
|
|
|
580 |
#
|
|
|
581 |
########################################################################
|
|
|
582 |
|
|
|
583 |
sub ToolsetLibRecipe
|
|
|
584 |
{
|
|
|
585 |
my ($io, $target, $lib, $dp) = @_;
|
|
|
586 |
|
|
|
587 |
if ( !defined($dp) ) { # linker
|
|
|
588 |
$io->Cmd( "\$(subst /,\\\\,\$(strip $lib)).$::a" );
|
|
|
589 |
|
|
|
590 |
} else { # depend
|
|
|
591 |
$io->Cmd( "$dp:\t@(vlib2,$lib,LIB)" );
|
|
|
592 |
}
|
|
|
593 |
}
|
|
|
594 |
|
|
|
595 |
|
|
|
596 |
########################################################################
|
|
|
597 |
#
|
|
|
598 |
# Parse resource file data
|
|
|
599 |
# This is a helper function used within this toolset
|
|
|
600 |
#
|
|
|
601 |
# Arguments : $1 BaseName
|
|
|
602 |
# $2 The users resource list
|
|
|
603 |
# This is a list of comma seperated files
|
|
|
604 |
# The first file is the main resource script
|
|
|
605 |
#
|
|
|
606 |
# Returns : An array of resource files with full pathnames
|
|
|
607 |
# [0] = The output file
|
|
|
608 |
# [1] = The input file
|
|
|
609 |
# [..] = Other input files
|
|
|
610 |
#
|
|
|
611 |
########################################################################
|
|
|
612 |
|
|
|
613 |
sub ToolsetRClist
|
|
|
614 |
{
|
|
|
615 |
my ($name, $files) = @_;
|
|
|
616 |
my @result;
|
|
|
617 |
|
|
|
618 |
#
|
|
|
619 |
# Generate the name of the output file
|
|
|
620 |
#
|
|
|
621 |
push @result, "\$(OBJDIR)/$name.res";
|
|
|
622 |
|
|
|
623 |
#
|
|
|
624 |
# Process each user file
|
|
|
625 |
#
|
| 279 |
dpurdie |
626 |
for (split( '\s*,\s*', $files ))
|
| 263 |
dpurdie |
627 |
{
|
|
|
628 |
#
|
|
|
629 |
# Locate the file.
|
|
|
630 |
# If it is a generate file so it will be in the SRCS hash
|
|
|
631 |
# Other wise the use will have to use Src to locate the file
|
|
|
632 |
#
|
|
|
633 |
push @result, MakeSrcResolve($_);
|
|
|
634 |
}
|
|
|
635 |
|
|
|
636 |
#
|
|
|
637 |
# Return the array to the user
|
|
|
638 |
#
|
|
|
639 |
return @result;
|
|
|
640 |
}
|
|
|
641 |
|
|
|
642 |
|
|
|
643 |
########################################################################
|
|
|
644 |
#
|
|
|
645 |
# Generate a resource file recipe
|
|
|
646 |
# This is a helper function used within this tool
|
|
|
647 |
#
|
|
|
648 |
# Arguments : $1 Output resource file
|
|
|
649 |
# .. Input resource files
|
|
|
650 |
#
|
|
|
651 |
########################################################################
|
|
|
652 |
|
|
|
653 |
sub ToolsetRCrecipe
|
|
|
654 |
{
|
|
|
655 |
my ($out, @in) = @_;
|
|
|
656 |
|
|
|
657 |
#
|
|
|
658 |
# Cleanup
|
|
|
659 |
#
|
|
|
660 |
ToolsetGenerate( $out );
|
|
|
661 |
|
|
|
662 |
#
|
|
|
663 |
# Recipe
|
|
|
664 |
#
|
|
|
665 |
MakePrint( "\n#.. Compile Resource file: $out\n\n" );
|
|
|
666 |
MakePrint( "$out:\t\$(GBE_PLATFORM).mk\n" );
|
|
|
667 |
MakeEntry( "$out:\t", "", "\\\n\t\t", " ", @in );
|
|
|
668 |
MakePrint( "\n\t\$(RC)\n" );
|
|
|
669 |
MakePrint( "\n" );
|
|
|
670 |
}
|
|
|
671 |
|
|
|
672 |
########################################################################
|
|
|
673 |
#
|
|
|
674 |
# Generate a project from the provided project solution file
|
|
|
675 |
# This is aimed at .NET work
|
|
|
676 |
#
|
|
|
677 |
# Arguments : $name - Base name of the project
|
|
|
678 |
# $solution - Path to the solutionn file
|
|
|
679 |
# $pArgs - Project specific options
|
|
|
680 |
#
|
|
|
681 |
########################################################################
|
|
|
682 |
|
|
|
683 |
my $project_defines_done = 0;
|
|
|
684 |
sub ToolsetPROJECT
|
|
|
685 |
{
|
|
|
686 |
my( $name, $solution ,$pArgs ) = @_;
|
|
|
687 |
my $buildcmd = $toolset_info->{'buildcmd'};
|
|
|
688 |
my $cleancmd = $toolset_info->{'cleancmd'};
|
| 343 |
dpurdie |
689 |
my $release = 'RELEASE';
|
|
|
690 |
my $debug = 'DEBUG';
|
| 263 |
dpurdie |
691 |
|
|
|
692 |
#
|
|
|
693 |
# Process options
|
|
|
694 |
#
|
|
|
695 |
foreach ( @$pArgs ) {
|
| 343 |
dpurdie |
696 |
if ( m/^--TargetProd*=(.+)/ ) {
|
|
|
697 |
$release = $1;
|
|
|
698 |
|
|
|
699 |
} elsif ( m/^--TargetDebug=(.+)/ ) {
|
|
|
700 |
$debug = $1;
|
|
|
701 |
|
|
|
702 |
} else {
|
|
|
703 |
Message( "$toolset_name PROJECT: unknown option $_ -- ignored\n" );
|
|
|
704 |
}
|
| 263 |
dpurdie |
705 |
}
|
|
|
706 |
|
|
|
707 |
my ($io) = ToolsetPrinter::New();
|
|
|
708 |
|
|
|
709 |
#
|
|
|
710 |
# Setup toolset pecific difinitions. Once
|
|
|
711 |
#
|
|
|
712 |
unless( $project_defines_done )
|
|
|
713 |
{
|
|
|
714 |
$project_defines_done = 1;
|
| 343 |
dpurdie |
715 |
$io->PrtLn( 'project_target = $(if $(findstring 1,$(DEBUG)),$2,$1)' );
|
| 263 |
dpurdie |
716 |
$io->Newline();
|
|
|
717 |
}
|
|
|
718 |
|
|
|
719 |
#
|
|
|
720 |
# Process the build and clean commands
|
|
|
721 |
# Substitute arguments
|
|
|
722 |
# =TYPE=
|
|
|
723 |
# =LOG=
|
|
|
724 |
# =DSW=
|
|
|
725 |
#
|
| 343 |
dpurdie |
726 |
$buildcmd =~ s~=TYPE=~"\$(call project_target,$release,$debug)"~g;
|
| 263 |
dpurdie |
727 |
$buildcmd =~ s~=LOG=~$name\$(GBE_TYPE).log~g;
|
|
|
728 |
$buildcmd =~ s~=DSW=~$solution~g;
|
|
|
729 |
|
| 343 |
dpurdie |
730 |
$cleancmd =~ s~=TYPE=~"\$(call project_target,$release,$debug)"~g;
|
| 263 |
dpurdie |
731 |
$cleancmd =~ s~=LOG=~$name\$(GBE_TYPE).log~g;
|
|
|
732 |
$cleancmd =~ s~=DSW=~$solution~g;
|
|
|
733 |
|
|
|
734 |
#
|
|
|
735 |
# Generate the recipe to create the project
|
| 343 |
dpurdie |
736 |
# Use the set_<PLATFORM>.sh file to extend the DLL search path
|
| 263 |
dpurdie |
737 |
#
|
|
|
738 |
$io->Label( "Build project", $name );
|
|
|
739 |
$io->PrtLn( "Project_$name: $solution \$(INTERFACEDIR)/set_$::ScmPlatform.sh" );
|
|
|
740 |
|
|
|
741 |
$io->PrtLn( "\t\$(XX_PRE)( \$(rm) -f $name\$(GBE_TYPE).log; \\" );
|
|
|
742 |
$io->PrtLn( "\t. \$(INTERFACEDIR)/set_$::ScmPlatform.sh; \\" );
|
|
|
743 |
$io->PrtLn( "\t\$(show_environment); \\" );
|
|
|
744 |
$io->PrtLn( "\t$buildcmd; \\" );
|
|
|
745 |
$io->PrtLn( "\tret=\$\$?; \\" );
|
|
|
746 |
$io->PrtLn( "\t\$(GBE_BIN)/cat $name\$(GBE_TYPE).log; \\" );
|
|
|
747 |
$io->PrtLn( "\texit \$\$ret )" );
|
|
|
748 |
$io->Newline();
|
|
|
749 |
|
|
|
750 |
#
|
|
|
751 |
# Generate the recipe to clean the project
|
|
|
752 |
#
|
|
|
753 |
$io->Label( "Clean project", $name );
|
|
|
754 |
$io->PrtLn( "ProjectClean_$name: $solution" );
|
|
|
755 |
$io->PrtLn( "\t-\$(XX_PRE)$cleancmd" );
|
|
|
756 |
$io->PrtLn( "\t-\$(XX_PRE)\$(rm) -f $name\$(GBE_TYPE).log" );
|
|
|
757 |
$io->Newline();
|
|
|
758 |
|
|
|
759 |
}
|
|
|
760 |
|
|
|
761 |
|
|
|
762 |
#.. Successful termination
|
|
|
763 |
1;
|
|
|
764 |
|