| 227 |
dpurdie |
1 |
#
|
|
|
2 |
# Module name : vcwin32
|
|
|
3 |
# Module type : Makefile system
|
|
|
4 |
# Compiler(s) : ANSI C
|
|
|
5 |
# Environment(s): WIN32
|
|
|
6 |
#
|
|
|
7 |
# Description:
|
|
|
8 |
# Visual C/C++ for WIN32
|
|
|
9 |
#
|
|
|
10 |
#............................................................................#
|
|
|
11 |
|
|
|
12 |
use strict;
|
|
|
13 |
use warnings;
|
|
|
14 |
|
|
|
15 |
#
|
|
|
16 |
# Global data
|
|
|
17 |
#
|
|
|
18 |
my $pdb_file = "\$(GBE_PBASE)";
|
|
|
19 |
my $pdb_first_lib;
|
|
|
20 |
my $target_file_lib;
|
|
|
21 |
my $target_file_dll;
|
|
|
22 |
my $target_file_exe;
|
|
|
23 |
my $pdb_none;
|
|
|
24 |
|
|
|
25 |
##############################################################################
|
|
|
26 |
# Version information
|
|
|
27 |
#
|
|
|
28 |
my $toolset_info;
|
|
|
29 |
my $toolset_version = 'MSVC6';
|
|
|
30 |
my %ToolsetVersion =
|
|
|
31 |
(
|
| 255 |
dpurdie |
32 |
'MSVC6' => { 'def' => 'vcwin32.def' ,
|
|
|
33 |
'buildcmd' => 'msdev =DSW= /make "ALL - =TYPE=" /useenv /out =LOG=' ,
|
|
|
34 |
'cleancmd' => 'msdev =DSW= /make "ALL - =TYPE=" /clean /useenv' ,
|
|
|
35 |
'tmp' => 'vc60',
|
|
|
36 |
'VSCOMPILER' => '1',
|
|
|
37 |
},
|
| 227 |
dpurdie |
38 |
|
| 255 |
dpurdie |
39 |
'MS.NET2003' => { 'def' => 'vcwin32_net2003.def' ,
|
|
|
40 |
'buildcmd' => 'devenv =DSW= /build =TYPE= /useenv /out =LOG=' ,
|
|
|
41 |
'cleancmd' => 'devenv =DSW= /clean =TYPE= /useenv' ,
|
|
|
42 |
'tmp' => 'vc70',
|
|
|
43 |
'VSCOMPILER' => '2',
|
|
|
44 |
},
|
|
|
45 |
|
|
|
46 |
'MS.NET2005' => { 'def' => 'vcwin32_net2005.def' ,
|
|
|
47 |
'buildcmd' => 'devenv =DSW= /build =TYPE= /useenv /out =LOG=' ,
|
|
|
48 |
'cleancmd' => 'devenv =DSW= /clean =TYPE= /useenv' ,
|
|
|
49 |
'tmp' => 'vc80',
|
|
|
50 |
'VSCOMPILER' => '3',
|
|
|
51 |
'GenManifest' => '1',
|
|
|
52 |
},
|
| 227 |
dpurdie |
53 |
);
|
|
|
54 |
|
|
|
55 |
|
|
|
56 |
##############################################################################
|
|
|
57 |
# ToolsetInit()
|
|
|
58 |
# Runtime initialisation
|
|
|
59 |
#
|
|
|
60 |
##############################################################################
|
|
|
61 |
|
|
|
62 |
ToolsetInit();
|
|
|
63 |
|
|
|
64 |
sub ToolsetInit
|
|
|
65 |
{
|
|
|
66 |
|
|
|
67 |
#.. Parse arguments (Toolset arguments)
|
|
|
68 |
#
|
|
|
69 |
Debug( "vcwin32(@::ScmToolsetArgs)" );
|
|
|
70 |
|
|
|
71 |
foreach $_ ( @::ScmToolsetArgs ) {
|
|
|
72 |
if (/^--Version=(.*)/) { # MS SDK Version
|
|
|
73 |
$toolset_version = $1;
|
|
|
74 |
|
|
|
75 |
} else {
|
|
|
76 |
Message( "vcwin32 toolset: unknown option $_ -- ignored\n" );
|
|
|
77 |
}
|
|
|
78 |
}
|
|
|
79 |
|
|
|
80 |
#.. Parse arguments (platform arguments)
|
|
|
81 |
#
|
|
|
82 |
Debug( "vcwin32(@::ScmPlatformArgs)" );
|
|
|
83 |
|
|
|
84 |
foreach $_ ( @::ScmPlatformArgs ) {
|
|
|
85 |
if (/^--product=(.*)/) { # GBE product
|
|
|
86 |
|
|
|
87 |
} elsif (/^--Version=(.*)/) { # MS SDK Version
|
|
|
88 |
$toolset_version = $1;
|
|
|
89 |
|
|
|
90 |
} elsif (/^--NoDinkumware/) { # Dinkumware package test
|
|
|
91 |
|
|
|
92 |
} else {
|
|
|
93 |
Message( "vcwin32 toolset: unknown platform argument $_ -- ignored\n" );
|
|
|
94 |
}
|
|
|
95 |
}
|
|
|
96 |
|
|
|
97 |
#.. Validate SDK version
|
| 255 |
dpurdie |
98 |
# Currently three versions are supported
|
| 227 |
dpurdie |
99 |
# 1) MSVC6 - As provided via Visual Studio
|
|
|
100 |
# 2) MSVS.net 2003 - Used to create .NET applications
|
| 255 |
dpurdie |
101 |
# 2) MSVS.net 2005 - Used to create .NET applications
|
| 227 |
dpurdie |
102 |
#
|
|
|
103 |
$toolset_info = $ToolsetVersion{$toolset_version};
|
|
|
104 |
Error( "Unknown version: $toolset_version" ) unless ( defined $toolset_info );
|
|
|
105 |
|
|
|
106 |
|
|
|
107 |
#.. Standard.rul requirements
|
|
|
108 |
#
|
|
|
109 |
$::s = 'asm';
|
|
|
110 |
$::o = 'obj';
|
|
|
111 |
$::a = 'lib';
|
|
|
112 |
$::so = 'dll';
|
|
|
113 |
$::exe = '.exe';
|
|
|
114 |
|
|
|
115 |
#.. Toolset configuration
|
|
|
116 |
#
|
|
|
117 |
$::ScmToolsetVersion = "1.0.0"; # our version
|
|
|
118 |
$::ScmToolsetGenerate = 0; # generate optional
|
| 261 |
dpurdie |
119 |
$::ScmToolsetProgDependancies = 0; # handle Prog dependancies myself
|
| 227 |
dpurdie |
120 |
|
|
|
121 |
#.. define Visual C/C+ environment
|
|
|
122 |
Init( "visualc" );
|
|
|
123 |
ToolsetDefines( $toolset_info->{'def'} );
|
| 255 |
dpurdie |
124 |
PlatformDefine ("VSCOMPILER\t= $toolset_info->{'VSCOMPILER'}" );
|
| 227 |
dpurdie |
125 |
ToolsetRequire( "exctags" ); # and Exuberant Ctags
|
|
|
126 |
ToolsetRules( "vcwin32.rul" );
|
|
|
127 |
ToolsetRules( "standard.rul" );
|
|
|
128 |
|
|
|
129 |
#.. define PCLint envrionment
|
|
|
130 |
ToolsetRequire( "pclint" ); # using pclint
|
|
|
131 |
PlatformDefine ("LINT_COFILE\t= co-msc60.lnt");
|
|
|
132 |
PlatformDefine ("LINT_PRJ_FILE\t=lint.visualc");
|
|
|
133 |
|
|
|
134 |
#.. Cleanup rules
|
|
|
135 |
#
|
|
|
136 |
ToolsetGenerate( "\$(OBJDIR)/$toolset_info->{'tmp'}.idb" ); # vc60.idb
|
|
|
137 |
ToolsetGenerate( "\$(OBJDIR)/$toolset_info->{'tmp'}.pch" );
|
|
|
138 |
ToolsetGenerate( "\$(OBJDIR)/$toolset_info->{'tmp'}.pdb" );
|
|
|
139 |
ToolsetGenerate( "\$(PDB)" );
|
|
|
140 |
ToolsetGenerate( "\$(PDB).tmp" );
|
|
|
141 |
|
|
|
142 |
|
|
|
143 |
#
|
|
|
144 |
# The PDB files need to be compiled up with absolute paths to the source files
|
|
|
145 |
# The easiest way to do this is with the makefile rules created with absolute
|
|
|
146 |
# paths. Set a global flag to enable this option
|
|
|
147 |
#
|
|
|
148 |
$::UseAbsObjects = 1;
|
|
|
149 |
|
|
|
150 |
|
|
|
151 |
#.. Extend the CompilerOption directive
|
|
|
152 |
# Create a standard data structure
|
|
|
153 |
# This is a hash of hashes
|
|
|
154 |
# The first hash is keyed by CompileOption keyword
|
|
|
155 |
# The second hash contains pairs of values to set or remove
|
|
|
156 |
#
|
|
|
157 |
%::ScmToolsetCompilerOptions =
|
|
|
158 |
(
|
|
|
159 |
#
|
|
|
160 |
# Control the thread model to use
|
|
|
161 |
# This will affect the compiler options and the linker options
|
|
|
162 |
#
|
|
|
163 |
'multithread_static' => { 'THREADMODE' , 'T' }, # -MT
|
|
|
164 |
'multithread_dll' => { 'THREADMODE' , 'D' }, # -MD Default
|
|
|
165 |
'multithread_none' => { 'THREADMODE' , 'L' }, # -ML
|
|
|
166 |
|
|
|
167 |
'subsystem:windows' => { 'LDSUBSYSTEM' , 'windows' },
|
|
|
168 |
'subsystem:console' => { 'LDSUBSYSTEM' , 'console' },
|
|
|
169 |
|
|
|
170 |
'rtti' => { 'USE_RTTI', 1 },
|
|
|
171 |
'nopdb' => { 'PDB_NONE', 1 },
|
|
|
172 |
'pdb' => { 'PDB_NONE', undef },
|
|
|
173 |
'noaddlibs' => { 'ADDLINKLIBS' , undef }, # Don't add link libs
|
|
|
174 |
'addlibs' => { 'ADDLINKLIBS' , '1' }, # default
|
|
|
175 |
'noprecompilehdrs' => { 'PRECOMPILEHDRS' , undef }, # Don't precompile headers
|
|
|
176 |
'precompilehdrs' => { 'PRECOMPILEHDRS' , '1' }, # default
|
|
|
177 |
|
|
|
178 |
#
|
|
|
179 |
# Mimic some of the behavior of version-1 JATS
|
|
|
180 |
#
|
|
|
181 |
'jats_v1' => { 'USE_JATS_V1' => '1' },
|
|
|
182 |
);
|
|
|
183 |
|
|
|
184 |
#
|
|
|
185 |
# Set default options
|
|
|
186 |
#
|
|
|
187 |
$::ScmCompilerOpts{'THREADMODE'} = 'D';
|
|
|
188 |
$::ScmCompilerOpts{'ADDLINKLIBS'} = '1';
|
|
|
189 |
$::ScmCompilerOpts{'PRECOMPILEHDRS'} = '1';
|
|
|
190 |
}
|
|
|
191 |
|
|
|
192 |
##############################################################################
|
|
|
193 |
# ToolsetPreprocess()
|
|
|
194 |
# Process collected data before the makefile is generated
|
|
|
195 |
# This, optional, routine is called from within MakefileGenerate()
|
|
|
196 |
# It allows the toolset to massage any of the collected data before
|
|
|
197 |
# the makefile is created
|
|
|
198 |
#
|
|
|
199 |
##############################################################################
|
|
|
200 |
sub ToolsetPreprocess
|
|
|
201 |
{
|
|
|
202 |
#
|
|
|
203 |
# Extract the current state of PDB_NONE
|
|
|
204 |
# Are PDB files to be constructed.
|
|
|
205 |
#
|
|
|
206 |
$pdb_none = $::ScmCompilerOpts{'PDB_NONE'};
|
|
|
207 |
}
|
|
|
208 |
|
|
|
209 |
##############################################################################
|
|
|
210 |
# ToolsetPostprocess
|
|
|
211 |
# Process collected data as the makefile is generated
|
|
|
212 |
# This, optional, routine is called from within MakefileGenerate()
|
|
|
213 |
# It allows the toolset to massage any of the collected data before
|
|
|
214 |
# the makefile is finally closed created
|
|
|
215 |
#
|
|
|
216 |
##############################################################################
|
|
|
217 |
|
|
|
218 |
sub ToolsetPostprocess
|
|
|
219 |
{
|
| 267 |
dpurdie |
220 |
MakeHeader('Toolset Postprocessed Information');
|
| 227 |
dpurdie |
221 |
|
|
|
222 |
#
|
|
|
223 |
# Specify the name of the global PDB file. This is used for all
|
|
|
224 |
# compiles other than those associated with building a DLL
|
|
|
225 |
#
|
|
|
226 |
# The name of the PDB will be based on either
|
|
|
227 |
# The name of base package
|
|
|
228 |
# The name of the first static library created
|
|
|
229 |
#
|
|
|
230 |
|
|
|
231 |
MakePrint("
|
|
|
232 |
#
|
|
|
233 |
# Export the name of the common PDB file
|
|
|
234 |
# All compiler information will be placed in this file
|
|
|
235 |
# The name of the file MUST be the same as the name of the output library
|
|
|
236 |
#
|
|
|
237 |
PDB = \$(OBJDIR)/$pdb_file\$(GBE_TYPE).pdb
|
|
|
238 |
" );
|
|
|
239 |
|
|
|
240 |
#
|
|
|
241 |
# Add values to the perl environment
|
|
|
242 |
# May be used by post processing tools to create Visual Studio Projects
|
|
|
243 |
#
|
|
|
244 |
$::TS_pdb_file = "\$(OBJDIR)/$pdb_file\$(GBE_TYPE).pdb" unless( $pdb_none );
|
|
|
245 |
$::TS_sbr_support = 1;
|
|
|
246 |
|
|
|
247 |
#
|
|
|
248 |
# Prioritorise target: EXE, DLL, LIB
|
|
|
249 |
#
|
|
|
250 |
for my $tgt ( $target_file_exe, $target_file_dll, $target_file_lib )
|
|
|
251 |
{
|
|
|
252 |
if ( $tgt )
|
|
|
253 |
{
|
|
|
254 |
$::TS_target_file = $tgt;
|
|
|
255 |
last;
|
|
|
256 |
}
|
|
|
257 |
}
|
|
|
258 |
}
|
|
|
259 |
|
|
|
260 |
|
|
|
261 |
###############################################################################
|
|
|
262 |
# ToolsetCTAGS()
|
|
|
263 |
# This subroutine takes the user options and builds the rules
|
|
|
264 |
# required to build the CTAGS database.
|
|
|
265 |
#
|
|
|
266 |
# Arguments:
|
|
|
267 |
# --xxx No arguments currently defined
|
|
|
268 |
#
|
|
|
269 |
# Output:
|
|
|
270 |
# [ctags:]
|
|
|
271 |
# $(EXCTAGS)
|
|
|
272 |
#
|
|
|
273 |
###############################################################################
|
|
|
274 |
|
|
|
275 |
sub ToolsetCTAGS
|
|
|
276 |
{
|
|
|
277 |
EXCTAGS( @_ );
|
|
|
278 |
}
|
|
|
279 |
|
|
|
280 |
|
|
|
281 |
###############################################################################
|
|
|
282 |
# ToolsetCC( $source, $obj, \@args )
|
|
|
283 |
# This subroutine takes the user options and builds the rule(s)
|
|
|
284 |
# required to compile the source file 'source' to 'obj'
|
|
|
285 |
#
|
|
|
286 |
###############################################################################
|
|
|
287 |
|
|
|
288 |
sub ToolsetCC
|
|
|
289 |
{
|
|
|
290 |
ToolsetCC_common( "CC", @_ );
|
|
|
291 |
}
|
|
|
292 |
|
|
|
293 |
sub ToolsetCC_common
|
|
|
294 |
{
|
|
|
295 |
my( $name, $source, $obj, $pArgs ) = @_;
|
|
|
296 |
my( $cflags, $pdb );
|
|
|
297 |
|
|
|
298 |
foreach $_ ( @$pArgs ) {
|
|
|
299 |
if (/--Shared$/) { # Building a 'shared' object
|
|
|
300 |
$cflags = "$cflags \$(SHCFLAGS)";
|
|
|
301 |
$pdb = $::SHOBJ_LIB{$obj}
|
|
|
302 |
if (exists $::SHOBJ_LIB{$obj} );
|
|
|
303 |
|
|
|
304 |
} else {
|
|
|
305 |
Message( "vcwin32 $name: unknown option $_ -- ignored\n" );
|
|
|
306 |
}
|
|
|
307 |
}
|
|
|
308 |
|
|
|
309 |
MakePrint( "\n\t\$($name)\n" );
|
|
|
310 |
MakePadded( 4, "\$(OBJDIR)/$obj.$::o:", "\tCFLAGS +=$cflags\n" )
|
|
|
311 |
if ( $cflags ); # object specific CFLAGS
|
|
|
312 |
|
|
|
313 |
if ( $pdb && !$pdb_none )
|
|
|
314 |
{
|
|
|
315 |
#
|
|
|
316 |
# Determine the name of the PDB file
|
|
|
317 |
# If we are building a shared library then the name of the PDB
|
|
|
318 |
# MUST NOT be the same as the name of the library as there is
|
|
|
319 |
# some stange interaction with the linker ( 50% of the time )
|
|
|
320 |
# This is OK as the file will not be published
|
|
|
321 |
#
|
|
|
322 |
# If building a static library then create a PDB of the same
|
|
|
323 |
# name as it may be published directly.
|
|
|
324 |
#
|
|
|
325 |
my $pdb_file;
|
|
|
326 |
if ($cflags )
|
|
|
327 |
{
|
|
|
328 |
$pdb_file = "\$(OBJDIR)/${pdb}\$(GBE_TYPE)_shlib.pdb";
|
|
|
329 |
}
|
|
|
330 |
else
|
|
|
331 |
{
|
|
|
332 |
$pdb_file = "\$(OBJDIR)/${pdb}\$(GBE_TYPE).pdb";
|
|
|
333 |
}
|
|
|
334 |
|
|
|
335 |
MakePadded( 4, "\$(OBJDIR)/$obj.$::o:", "\tPDB = $pdb_file\n" );
|
|
|
336 |
ToolsetGenerate( $pdb_file );
|
|
|
337 |
ToolsetGenerate( $pdb_file . ".tmp" );
|
|
|
338 |
}
|
|
|
339 |
|
|
|
340 |
#
|
|
|
341 |
# Remove possible Source Browser Files
|
|
|
342 |
#
|
|
|
343 |
ToolsetGenerate( "\$(OBJDIR)/$obj.sbr" );
|
|
|
344 |
MakePrint( "\n" );
|
|
|
345 |
}
|
|
|
346 |
|
|
|
347 |
|
|
|
348 |
###############################################################################
|
|
|
349 |
# ToolsetCCDepend( $depend, \@sources )
|
|
|
350 |
# This subroutine takes the user options and builds the
|
|
|
351 |
# rule(s) required to build the dependencies for the source
|
|
|
352 |
# files 'sources' to 'depend'.
|
|
|
353 |
#
|
|
|
354 |
###############################################################################
|
|
|
355 |
|
|
|
356 |
sub ToolsetCCDepend
|
|
|
357 |
{
|
|
|
358 |
MakePrint( "\t\$(CCDEPEND)\n" );
|
|
|
359 |
}
|
|
|
360 |
|
|
|
361 |
|
|
|
362 |
###############################################################################
|
|
|
363 |
# ToolsetCXX( $source, $obj, \@args )
|
|
|
364 |
# This subroutine takes the user options and builds the rule(s)
|
|
|
365 |
# required to compile the source file 'source' to 'obj'
|
|
|
366 |
#
|
|
|
367 |
###############################################################################
|
|
|
368 |
|
|
|
369 |
sub ToolsetCXX
|
|
|
370 |
{
|
|
|
371 |
ToolsetCC_common( "CXX", @_ );
|
|
|
372 |
}
|
|
|
373 |
|
|
|
374 |
###############################################################################
|
|
|
375 |
# ToolsetCXXDepend( $depend, \@sources )
|
|
|
376 |
# This subroutine takes the user options and builds the
|
|
|
377 |
# rule(s) required to build the dependencies for the source
|
|
|
378 |
# files 'sources' to 'depend'.
|
|
|
379 |
#
|
|
|
380 |
###############################################################################
|
|
|
381 |
|
|
|
382 |
sub ToolsetCXXDepend
|
|
|
383 |
{
|
| 287 |
dpurdie |
384 |
ToolsetCCDepend();
|
| 227 |
dpurdie |
385 |
}
|
|
|
386 |
|
|
|
387 |
|
|
|
388 |
###############################################################################
|
|
|
389 |
# ToolsetAS( $source, $obj, \@args )
|
|
|
390 |
# This subroutine takes the user options and builds the rule(s)
|
|
|
391 |
# required to compile the source file 'source' to 'obj'
|
|
|
392 |
#
|
|
|
393 |
###############################################################################
|
|
|
394 |
|
|
|
395 |
sub ToolsetAS
|
|
|
396 |
{
|
|
|
397 |
MakePrint( "\n\t\$(AS)\n" );
|
|
|
398 |
}
|
|
|
399 |
|
|
|
400 |
sub ToolsetASDepend
|
|
|
401 |
{
|
|
|
402 |
}
|
|
|
403 |
|
|
|
404 |
###############################################################################
|
|
|
405 |
# ToolsetAR( $name, \@args, \@objs )
|
|
|
406 |
# This subroutine takes the user options and builds the rules
|
|
|
407 |
# required to build the library 'name'.
|
|
|
408 |
#
|
|
|
409 |
# Arguments:
|
|
|
410 |
# --Def=name Library definition module
|
|
|
411 |
#
|
|
|
412 |
# Output:
|
|
|
413 |
# [ $(LIBDIR)/name$.${a}: .... ]
|
|
|
414 |
# $(AR)
|
|
|
415 |
#
|
|
|
416 |
###############################################################################
|
|
|
417 |
|
|
|
418 |
sub ToolsetAR
|
|
|
419 |
{
|
|
|
420 |
my( $name, $pArgs, $pObjs ) = @_;
|
|
|
421 |
my( $def );
|
|
|
422 |
my ( $res, @reslist );
|
|
|
423 |
my $lib_base = "\$(LIBDIR)/${name}\$(GBE_TYPE)";
|
|
|
424 |
my $lib_name = "$lib_base.${a}";
|
|
|
425 |
|
|
|
426 |
|
|
|
427 |
#.. Parse arguments
|
|
|
428 |
#
|
|
|
429 |
$def = ""; # options
|
|
|
430 |
$res = "";
|
|
|
431 |
|
|
|
432 |
foreach $_ ( @$pArgs ) {
|
|
|
433 |
if (/^--Def=(.*)/) { # library definition
|
|
|
434 |
$def = "$1";
|
|
|
435 |
|
|
|
436 |
} elsif (/^--Resource=(.*)/) { # Resource definition
|
|
|
437 |
($res, @reslist) = ToolsetRClist( "$name", $1 );
|
|
|
438 |
|
|
|
439 |
} else { # unknown
|
|
|
440 |
Message( "vcwin32 AR: unknown option $_ -- ignored\n" );
|
|
|
441 |
}
|
|
|
442 |
}
|
|
|
443 |
|
|
|
444 |
#.. Resource Creation
|
|
|
445 |
#
|
|
|
446 |
MakePrint( "#.. Library Resource ($name)\n\n" );
|
|
|
447 |
ToolsetRCrecipe( $res, @reslist )
|
|
|
448 |
if ( $res );
|
|
|
449 |
|
|
|
450 |
#.. Target
|
|
|
451 |
#
|
|
|
452 |
MakePrint( "#.. Library ($name)\n\n" ); # label
|
|
|
453 |
|
|
|
454 |
MakePrint( "$lib_name:\tLIBDEF=$def\n" ) if ($def);
|
|
|
455 |
MakeEntry( "$lib_name:\t", "", "\\\n\t\t", ".$::o", @$pObjs );
|
|
|
456 |
MakePrint( "\\\n\t\t$def" ) if ($def);
|
|
|
457 |
MakePrint( "\\\n\t\t$res" ) if ($res);
|
|
|
458 |
MakePrint( "\n\t\$(AR)" );
|
|
|
459 |
|
|
|
460 |
#
|
|
|
461 |
# Track the name of the possible target file
|
|
|
462 |
# Used when creating Visual Studio projects
|
|
|
463 |
#
|
|
|
464 |
$target_file_lib = $lib_name;
|
|
|
465 |
|
|
|
466 |
#
|
|
|
467 |
# To assist in debugging the static library it is nice to
|
|
|
468 |
# keep the PDB file used to build the library, with the library.
|
|
|
469 |
#
|
|
|
470 |
# If the library is being packaged or installed then add the PDB
|
|
|
471 |
# file to the package / installation
|
|
|
472 |
#
|
|
|
473 |
# NOTE: Due to the limitations of JATS/MicroSoft only one static
|
|
|
474 |
# library can be built with a PDB file. The name of the PDB file
|
|
|
475 |
# will be taken from the first static library encountered
|
|
|
476 |
#
|
|
|
477 |
unless ( $pdb_first_lib )
|
|
|
478 |
{
|
|
|
479 |
$pdb_first_lib = $name;
|
|
|
480 |
$pdb_file = $name;
|
|
|
481 |
}
|
|
|
482 |
else
|
|
|
483 |
{
|
|
|
484 |
Warning( "Multiple static libraries created with a common PDB file: $pdb_file, $name" )
|
|
|
485 |
unless( $pdb_none );
|
|
|
486 |
}
|
|
|
487 |
|
|
|
488 |
PackageLibAddFiles( $name, "\$(OBJDIR)/$pdb_file\$(GBE_TYPE).pdb", "Class=debug" )
|
|
|
489 |
unless( $pdb_none );
|
|
|
490 |
}
|
|
|
491 |
|
|
|
492 |
|
|
|
493 |
###############################################################################
|
|
|
494 |
# ToolsetARLINT( $name, \@args, \@objs )
|
|
|
495 |
# This subroutine takes the user options and builds the rules
|
|
|
496 |
# required to build the library 'name'.
|
|
|
497 |
#
|
|
|
498 |
# Arguments:
|
|
|
499 |
# --xxx No arguments currently defined
|
|
|
500 |
#
|
|
|
501 |
# Output:
|
|
|
502 |
# [ $(LIBDIR)/name$_lint: .... ]
|
|
|
503 |
# $(ARLINT)
|
|
|
504 |
#
|
|
|
505 |
###############################################################################
|
|
|
506 |
|
|
|
507 |
sub ToolsetARLINT
|
|
|
508 |
{
|
|
|
509 |
PCLintAR( @_ );
|
|
|
510 |
}
|
|
|
511 |
|
|
|
512 |
|
|
|
513 |
###############################################################################
|
|
|
514 |
# ToolsetARMerge( $name, \@args, \@libs )
|
|
|
515 |
# This subroutine takes the user options and builds the rules
|
|
|
516 |
# required to build the library 'name' by merging the specified
|
|
|
517 |
# libaries
|
|
|
518 |
#
|
|
|
519 |
# Arguments:
|
|
|
520 |
# --xxx No arguments currently defined
|
|
|
521 |
#
|
|
|
522 |
# Output:
|
|
|
523 |
# [ $(LIBDIR)/name$.${a}: .... ]
|
|
|
524 |
# ...
|
|
|
525 |
#
|
|
|
526 |
###############################################################################
|
|
|
527 |
|
|
|
528 |
sub ToolsetARMerge
|
|
|
529 |
{
|
|
|
530 |
my ($name, $pArgs, $pLibs) = @_;
|
|
|
531 |
MakePrint( "\n\t\$(ARMERGE)\n\n" );
|
|
|
532 |
|
|
|
533 |
#
|
|
|
534 |
# Package up the PDB's with the library
|
|
|
535 |
# Note: The PDBs will be found in the OBJDIR
|
|
|
536 |
#
|
|
|
537 |
unless( $pdb_none )
|
|
|
538 |
{
|
|
|
539 |
for ( @{$pLibs} )
|
|
|
540 |
{
|
|
|
541 |
s~\$\(LIBDIR\)~\$(OBJDIR)~;
|
|
|
542 |
PackageLibAddFiles( $name, "$_\$(GBE_TYPE).pdb", "Class=debug" );
|
|
|
543 |
}
|
|
|
544 |
}
|
|
|
545 |
}
|
|
|
546 |
|
|
|
547 |
|
|
|
548 |
###############################################################################
|
| 289 |
dpurdie |
549 |
# ToolsetSHLD $name, \@args, \@objs, \@libraries, $_ver )
|
| 227 |
dpurdie |
550 |
# This subroutine takes the user options and builds the rules
|
|
|
551 |
# required to link a shared library
|
|
|
552 |
#
|
|
|
553 |
# Arguments:
|
|
|
554 |
# --Def=xxxx.def[,opts] # Definition file
|
|
|
555 |
# --MutualDll # SubOption: Generate a Mutual DLL
|
|
|
556 |
# --MutualDll # Generate a Mutual DLL (requires --Def=xxx)
|
|
|
557 |
# --StubOnly # Only generate the stub library (requires --Def=xxx)
|
|
|
558 |
# --Resource=xxxx.rc # Resource file
|
|
|
559 |
# --ResourceOnly # Only resources in this DLL
|
|
|
560 |
# --Implib # Alternate ruleset
|
|
|
561 |
# --NoPDB # Do not package the PDB file
|
|
|
562 |
# --NoImplib # Do not package the import library
|
|
|
563 |
# --Entry=xxxxx # Entry point
|
|
|
564 |
# --NoAddLibs # Do not add libraries
|
|
|
565 |
#
|
|
|
566 |
# Output:
|
|
|
567 |
#
|
|
|
568 |
# There is two supported rule sets differentiated by --Implib
|
|
|
569 |
# The two are very similar and generated exportable files of:
|
|
|
570 |
#
|
|
|
571 |
# --Implib
|
|
|
572 |
# ${name}.lib - Stub lib adresses the versioned DLL
|
|
|
573 |
# ${name}.${ver}.dll
|
|
|
574 |
#
|
|
|
575 |
# Default
|
|
|
576 |
# ${name}.lib - Stub lib addresses UN-versioned DLL
|
|
|
577 |
# ${name}.dll
|
|
|
578 |
# ${name}.${ver}.dll
|
|
|
579 |
#
|
|
|
580 |
# Note: Each DLL has an associated PDB file
|
|
|
581 |
#
|
|
|
582 |
# Generation is identical for both rulesets. The default form does
|
|
|
583 |
# not export any stub library associated with the versioned DLL.
|
|
|
584 |
#
|
|
|
585 |
# Implementation notes
|
|
|
586 |
# The process of creating a DLL and associated import library (LIB) is
|
|
|
587 |
#
|
|
|
588 |
# ${name}.${ver}.dep
|
|
|
589 |
# ${name}.${ver}.pdb - Exported
|
|
|
590 |
# ${name}.${ver}.ilk
|
|
|
591 |
# ${name}.${ver}.dll - Exported
|
|
|
592 |
# ${name}.${ver}.map
|
|
|
593 |
# ${name}.lib - Exported + Optional
|
|
|
594 |
# ${name}.exp
|
|
|
595 |
#
|
|
|
596 |
# Where: lib = name
|
|
|
597 |
#
|
|
|
598 |
# #.. Rules ($lib)
|
|
|
599 |
#
|
|
|
600 |
# $(LIBDIR)/${lib}.lib: $(LIBDIR)/${lib}.${ver}.dll
|
|
|
601 |
# $(LIBDIR)/${lib}.pdb: $(LIBDIR)/${lib}.${ver}.dll
|
|
|
602 |
# $(LIBDIR)/${lib}.${ver}.pdb: $(LIBDIR)/${lib}.${ver}.dll
|
|
|
603 |
#
|
|
|
604 |
# $(LIBDIR)/${lib}.${ver}.dep: SHBASE=${name}
|
|
|
605 |
# $(LIBDIR)/${lib}.${ver}.dep: SHNAME=${lib}.${ver}
|
|
|
606 |
# $(LIBDIR)/${lib}.${ver}.dep: \$(LIBDIR)
|
|
|
607 |
# $(LIBDIR)/${lib}.${ver}.dep: Makefile
|
|
|
608 |
# $(SHLDDEPEND)
|
|
|
609 |
#
|
|
|
610 |
# $(LIBDIR)/${lib}.${ver}.${so}: SHBASE=${name}
|
|
|
611 |
# $(LIBDIR)/${lib}.${ver}.${so}: SHNAME=${lib}.${ver}
|
|
|
612 |
# $(LIBDIR)/${lib}.${ver}.${so}: CFLAGS+=$(SHCFLAGS)
|
|
|
613 |
# $(LIBDIR)/${lib}.${ver}.${so}: CXXLAGS+=$(SHCXXFLAGS)
|
|
|
614 |
# $(LIBDIR)/${lib}.${ver}.${so}: ${def}
|
|
|
615 |
# $(LIBDIR)/${lib}.${ver}.${so}: $(OBJDIR)/${name} \
|
|
|
616 |
# object list ... \
|
|
|
617 |
# $(LIBDIR)/${lib}.${ver}.dep
|
|
|
618 |
# $(SHLD)
|
|
|
619 |
# @$(cp) -f $(LIBDIR)/${lib}.${ver}.pdb $(LIBDIR)/${lib}.pdb
|
|
|
620 |
#
|
|
|
621 |
# ifneq "$(findstring $(IFLAG),23)" ""
|
|
|
622 |
# -include "$(LIBDIR)/${lib}.${ver}.dep"
|
|
|
623 |
# endif
|
|
|
624 |
#
|
|
|
625 |
# #.. Linker commands ($lib)
|
|
|
626 |
#
|
|
|
627 |
# ${lib}_ld += ...
|
|
|
628 |
# standard flags \
|
|
|
629 |
# -implib:$${lib}.lib
|
|
|
630 |
#
|
|
|
631 |
# #.. Linker commands ($lib)
|
|
|
632 |
#
|
|
|
633 |
# ${lib}_shdp += ...
|
|
|
634 |
#
|
|
|
635 |
###############################################################################
|
|
|
636 |
|
|
|
637 |
sub ToolsetSHLD
|
|
|
638 |
{
|
| 289 |
dpurdie |
639 |
our( $name, $pArgs, $pObjs, $pLibs, $_ver ) = @_;
|
| 227 |
dpurdie |
640 |
our( $def, $mutual_dll, $res, @reslist, $doimplib, $stub_only );
|
|
|
641 |
our( $no_implib, $no_pdb, $resource_only );
|
|
|
642 |
our( $entry, $noaddlibs );
|
|
|
643 |
|
|
|
644 |
#.. Parse arguments
|
|
|
645 |
#
|
|
|
646 |
$def = ""; # options
|
|
|
647 |
$doimplib = 0;
|
|
|
648 |
$res = "";
|
|
|
649 |
$no_pdb = $pdb_none;
|
|
|
650 |
|
|
|
651 |
foreach $_ ( @$pArgs ) {
|
|
|
652 |
if (/^--Def=(.*?)(\,(.*))?$/) { # Library definition
|
|
|
653 |
#
|
|
|
654 |
# Locate the Def file.
|
|
|
655 |
# If it is a generate file so it will be in the SRCS hash
|
|
|
656 |
# Otherwise the user will have to use Src to locate the file
|
|
|
657 |
#
|
|
|
658 |
$def = MakeSrcResolve($1);
|
|
|
659 |
|
|
|
660 |
#
|
|
|
661 |
# Process sub options to --Def
|
|
|
662 |
#
|
|
|
663 |
next unless ($2);
|
|
|
664 |
if ( $3 =~ /^--MutualDll$/ ) {
|
|
|
665 |
$mutual_dll = 1;
|
|
|
666 |
} else {
|
|
|
667 |
Message( "vcwin32 SHLD: unknown option $_ -- ignored\n" );
|
|
|
668 |
}
|
|
|
669 |
|
|
|
670 |
} elsif (/^--Resource=(.*)/) { # Resource definition
|
|
|
671 |
($res, @reslist) = ToolsetRClist( "$name/$name", $1 );
|
|
|
672 |
|
|
|
673 |
} elsif (/^--ResourceOnly/) { # Resource definition
|
|
|
674 |
$resource_only = 1;
|
|
|
675 |
|
|
|
676 |
} elsif (/^--Implib$/) {
|
|
|
677 |
$doimplib = 1;
|
|
|
678 |
|
|
|
679 |
} elsif (/^--NoImplib$/) {
|
|
|
680 |
$no_implib = 1;
|
|
|
681 |
|
|
|
682 |
} elsif (/^--NoPDB$/) {
|
|
|
683 |
$no_pdb = 1;
|
|
|
684 |
|
|
|
685 |
} elsif (/^--Entry=(.*)/) {
|
|
|
686 |
$entry = $1;
|
|
|
687 |
|
|
|
688 |
} elsif (/^--NoAddLib/) {
|
|
|
689 |
$noaddlibs = 1;
|
|
|
690 |
|
|
|
691 |
} elsif (/^--MutualDll$/) {
|
|
|
692 |
$mutual_dll = 1;
|
|
|
693 |
|
|
|
694 |
} elsif (/^--Stubonly/) {
|
|
|
695 |
$stub_only = 1;
|
|
|
696 |
} else { # unknown
|
|
|
697 |
Message( "vcwin32 SHLD: unknown option $_ -- ignored\n" );
|
|
|
698 |
}
|
|
|
699 |
}
|
|
|
700 |
|
|
|
701 |
#
|
|
|
702 |
# Sanity test
|
|
|
703 |
#
|
|
|
704 |
Error ("vcwin32 SHLD:Stubonly option requires --Def=file ")
|
|
|
705 |
if ( $stub_only && ! $def );
|
|
|
706 |
|
|
|
707 |
Error ("vcwin32 SHLD:MutualDll option requires --Def=file ")
|
|
|
708 |
if ( $mutual_dll && ! $def );
|
|
|
709 |
|
|
|
710 |
|
|
|
711 |
|
|
|
712 |
#.. Build rules
|
|
|
713 |
#
|
|
|
714 |
# base - Basic name of the DLL
|
|
|
715 |
# name - Name of the Export library (Optional)
|
|
|
716 |
# lib - Name of the DLL
|
|
|
717 |
#
|
|
|
718 |
sub BuildSHLD
|
|
|
719 |
{
|
|
|
720 |
my ($base, $name, $lib) = @_;
|
|
|
721 |
my $full = $lib.".$::so";
|
|
|
722 |
my $link_with_def;
|
|
|
723 |
|
|
|
724 |
#.. Cleanup rules
|
|
|
725 |
#
|
|
|
726 |
# dep Dependency file
|
|
|
727 |
# ld Linker command file
|
|
|
728 |
# map Map file
|
|
|
729 |
# pdb Microsoft C/C++ program database
|
|
|
730 |
# ilk Microsoft Linker Database
|
|
|
731 |
#
|
|
|
732 |
ToolsetGenerate( "\$(LIBDIR)/${lib}.ld" );
|
|
|
733 |
ToolsetGenerate( "\$(LIBDIR)/${lib}.dep" );
|
|
|
734 |
ToolsetGenerate( "\$(LIBDIR)/${lib}.map" );
|
|
|
735 |
ToolsetGenerate( "\$(LIBDIR)/${lib}.exp" );
|
|
|
736 |
ToolsetGenerate( "\$(LIBDIR)/${lib}.ilk" );
|
|
|
737 |
ToolsetGenerate( "\$(LIBDIR)/${full}" );
|
| 255 |
dpurdie |
738 |
ToolsetGenerate( "\$(LIBDIR)/${full}.manifest" ) if $toolset_info->{'GenManifest'};
|
| 227 |
dpurdie |
739 |
|
|
|
740 |
#.. Linker rules
|
|
|
741 |
#
|
|
|
742 |
my ($io) = ToolsetPrinter::New();
|
|
|
743 |
|
|
|
744 |
my $import_lib;
|
|
|
745 |
my $export_file;
|
|
|
746 |
|
|
|
747 |
if ( $name && $def && ($mutual_dll || $stub_only ) )
|
|
|
748 |
{
|
|
|
749 |
#
|
|
|
750 |
# Creating an Export library from user .DEF file
|
|
|
751 |
# It is possible to create the stub library in the LIB phase
|
|
|
752 |
# which allows DLLs with mutual imports
|
|
|
753 |
#
|
|
|
754 |
$io->Label( "Import(stub) library for mutual exports", $name );
|
|
|
755 |
$export_file = "\$(LIBDIR)/${name}.exp";
|
|
|
756 |
|
|
|
757 |
#
|
|
|
758 |
# Rules and recipe to generate the stub library
|
|
|
759 |
#
|
|
|
760 |
$io->Prt( "\$(LIBDIR)/${name}.exp:\t\$(LIBDIR)/${name}.${a}\n" );
|
|
|
761 |
$io->Prt( "\$(LIBDIR)/${name}.${a}:\tLIBDEF=$def\n" );
|
|
|
762 |
$io->Prt( "\$(LIBDIR)/${name}.${a}:\tLIBNAME=$lib\n" );
|
|
|
763 |
$io->Entry( "\$(LIBDIR)/${name}.${a}: \\\n\t\t\$(OBJDIR)/${base}",
|
|
|
764 |
"", " \\\n\t\t", ".$::o", @$pObjs );
|
|
|
765 |
$io->Prt( " \\\n\t\t$def" );
|
|
|
766 |
$io->Prt( "\n\t\t\$(AR)\n" );
|
|
|
767 |
$io->Newline();
|
|
|
768 |
|
|
|
769 |
#
|
|
|
770 |
# Files to be cleanup up
|
|
|
771 |
#
|
|
|
772 |
ToolsetGenerate( "\$(LIBDIR)/${name}.exp" );
|
|
|
773 |
ToolsetGenerate( "\$(LIBDIR)/${name}.${a}" );
|
|
|
774 |
|
|
|
775 |
#
|
|
|
776 |
# If the DLL is being packaged/installed then add the static
|
|
|
777 |
# stub library to the packaging lists as a static library
|
|
|
778 |
# This will allow the stub library to be installed with the
|
|
|
779 |
# static libraries and thus allow DLL's with mutual imports
|
|
|
780 |
#
|
|
|
781 |
PackageShlibAddLibFiles ($base, "\$(LIBDIR)/${name}.${a}" )
|
|
|
782 |
unless ($resource_only);
|
|
|
783 |
|
|
|
784 |
#
|
|
|
785 |
# Add the stub library to the list of libraries being created
|
|
|
786 |
# Note: Don't do if not created with .DEF file
|
|
|
787 |
#
|
|
|
788 |
push @::LIBS, $base;
|
|
|
789 |
|
|
|
790 |
}
|
|
|
791 |
else
|
|
|
792 |
{
|
|
|
793 |
#
|
|
|
794 |
# The stub library is created as part of the DLL generation
|
|
|
795 |
# Whether we like it or not - so we need to control the name
|
|
|
796 |
# and location
|
|
|
797 |
#
|
|
|
798 |
my $slname = ($name) ? $name : $lib;
|
|
|
799 |
$import_lib = "\$(LIBDIR)/${slname}.${a}";
|
|
|
800 |
|
|
|
801 |
$io->Label( "Import(stub) library", $slname );
|
|
|
802 |
$io->Prt( "$import_lib:\t\$(LIBDIR)/${full}\n" );
|
|
|
803 |
$io->Newline();
|
|
|
804 |
|
|
|
805 |
ToolsetGenerate( $import_lib );
|
|
|
806 |
ToolsetGenerate( "\$(LIBDIR)/${slname}.exp" );
|
|
|
807 |
|
|
|
808 |
#
|
|
|
809 |
# Package the generated stub library, if it is being
|
|
|
810 |
# created on request.
|
|
|
811 |
#
|
|
|
812 |
# Package it with the shared libaries and not the static
|
|
|
813 |
# libraries as it will be created with the shared library
|
|
|
814 |
#
|
|
|
815 |
PackageShlibAddFiles ($base, $import_lib, 'Class=lib' )
|
|
|
816 |
if ($name && ! $no_implib && ! $resource_only);
|
|
|
817 |
|
|
|
818 |
#
|
|
|
819 |
# Indicate that we will be linking with a DEF file
|
|
|
820 |
#
|
|
|
821 |
$link_with_def = 1 if ( $def );
|
|
|
822 |
}
|
|
|
823 |
|
|
|
824 |
#
|
|
|
825 |
# If we are only creating a stub library, then the hard work has been
|
|
|
826 |
# done.
|
|
|
827 |
#
|
|
|
828 |
return
|
|
|
829 |
if ($stub_only);
|
|
|
830 |
|
|
|
831 |
$io->Label( "Shared library", $name );
|
|
|
832 |
|
|
|
833 |
#
|
|
|
834 |
# The process of creating a DLL will generate PDB file
|
|
|
835 |
# Control the name of the PDB file
|
|
|
836 |
#
|
|
|
837 |
my $pdb_file = "\$(LIBDIR)/${lib}.pdb";
|
|
|
838 |
unless( $no_pdb )
|
|
|
839 |
{
|
|
|
840 |
$io->Prt( "$pdb_file:\t\$(LIBDIR)/${full}\n" );
|
|
|
841 |
ToolsetGenerate( $pdb_file );
|
|
|
842 |
}
|
|
|
843 |
|
|
|
844 |
#
|
|
|
845 |
# Package the PDB file up with the DLL
|
|
|
846 |
# Package the DLL - now that we know its proper name
|
|
|
847 |
#
|
|
|
848 |
PackageShlibAddFiles( $base, $pdb_file, 'Class=debug' ) unless $no_pdb ;
|
|
|
849 |
PackageShlibAddFiles( $base, "\$(LIBDIR)/${full}" );
|
|
|
850 |
|
|
|
851 |
#
|
|
|
852 |
# Generate Shared Library dependency information
|
|
|
853 |
#
|
|
|
854 |
$io->SHLDDEPEND( $lib, $name, $lib ); # std SHLDDEPEND rules
|
|
|
855 |
|
|
|
856 |
#
|
|
|
857 |
# Generate rules and recipes to create the body of the shared
|
|
|
858 |
# library. Several build variables are overiden when creating
|
|
|
859 |
# a shared library.
|
|
|
860 |
#
|
|
|
861 |
$io->Prt( "\$(LIBDIR)/${full}:\tSHBASE=${lib}\n" );
|
|
|
862 |
$io->Prt( "\$(LIBDIR)/${full}:\tSHNAME=${lib}\n" );
|
|
|
863 |
$io->Prt( "\$(LIBDIR)/${full}:\tCFLAGS+=\$(SHCFLAGS)\n" );
|
|
|
864 |
$io->Prt( "\$(LIBDIR)/${full}:\tCXXLAGS+=\$(SHCXXFLAGS)\n" );
|
|
|
865 |
$io->Prt( "\$(LIBDIR)/${full}:\t$export_file\n" ) if ($export_file );
|
|
|
866 |
$io->Prt( "\$(LIBDIR)/${full}:\t$res\n" ) if ( $res );
|
|
|
867 |
|
| 261 |
dpurdie |
868 |
$io->Entry( "\$(LIBDIR)/${full}: \$(LIBDIR)/${lib}.dep \\\n\t\t\$(OBJDIR)/${base}",
|
| 227 |
dpurdie |
869 |
"", " \\\n\t\t", ".$::o", @$pObjs );
|
|
|
870 |
|
|
|
871 |
$io->Prt( " \\\n\t\t$def" ) if ( $link_with_def );
|
| 261 |
dpurdie |
872 |
$io->Prt( "\n\t\$(SHLD)\n" );
|
| 227 |
dpurdie |
873 |
|
|
|
874 |
$io->Newline();
|
|
|
875 |
|
|
|
876 |
#.. Linker command file
|
|
|
877 |
#
|
|
|
878 |
# Now the fun part... piecing together a variable ${name}_shld
|
|
|
879 |
# which ends up in the command file.
|
|
|
880 |
#
|
|
|
881 |
$io->SetTag( "${lib}_shld" ); # command tag
|
|
|
882 |
|
|
|
883 |
$io->Label( "Linker commands", $name ); # label
|
|
|
884 |
|
|
|
885 |
$io->Cmd( "-dll" );
|
|
|
886 |
$io->Cmd( "-noentry" )if ($resource_only);
|
|
|
887 |
$io->Cmd( "-machine:IX86" );
|
|
|
888 |
$io->Cmd( "-base:0x10000000" );
|
|
|
889 |
$io->Cmd( "-def:$def" ) if ($link_with_def);
|
|
|
890 |
$io->Cmd( "-out:\$(subst /,\\\\,\$(LIBDIR)/${full})" );
|
|
|
891 |
$io->Cmd( "-implib:\$(subst /,\\\\,$import_lib)" ) if ($import_lib);
|
|
|
892 |
$io->Cmd( "-pdb:\$(subst /,\\\\,$pdb_file)" ) unless ( $no_pdb );
|
|
|
893 |
$io->Cmd( "-debug:none" ) if ($no_pdb);
|
|
|
894 |
$io->Cmd( "-pdb:none" ) if ($no_pdb);
|
|
|
895 |
$io->Cmd( "-entry:$entry" ) if ($entry);
|
|
|
896 |
$io->Cmd( "-map:\$(subst /,\\\\,\$(LIBDIR)/${lib}).map" );
|
|
|
897 |
$io->Cmd( "-nodefaultlib:LIBC" );
|
|
|
898 |
$io->Cmd( "\$(subst /,\\\\,$res)" ) if ( $res );
|
|
|
899 |
$io->Cmd( "\$(subst /,\\\\,$export_file)" ) if ( $export_file );
|
|
|
900 |
|
|
|
901 |
# object list
|
|
|
902 |
$io->ObjList( $name, $pObjs, \&ToolsetObjRecipe );
|
|
|
903 |
|
|
|
904 |
# library list
|
|
|
905 |
$io->LibList( $name, $pLibs, \&ToolsetLibRecipe );
|
|
|
906 |
|
|
|
907 |
$io->Newline();
|
|
|
908 |
|
|
|
909 |
#.. Dependency link,
|
|
|
910 |
#
|
|
|
911 |
# Now piece together a variable $(name_dp) which ends up in
|
|
|
912 |
# the command file building the application dependency list.
|
|
|
913 |
#
|
|
|
914 |
$io->SetTag( "${lib}_shdp" ); # command tag
|
|
|
915 |
|
|
|
916 |
$io->DepRules( $name, $pLibs, # library depends rules
|
|
|
917 |
\&ToolsetLibRecipe, "\$(LIBDIR)/${full}" );
|
|
|
918 |
|
|
|
919 |
$io->Newline();
|
|
|
920 |
}
|
|
|
921 |
|
|
|
922 |
ToolsetLibStd( $pLibs ) # push standard libraries
|
|
|
923 |
unless ( $noaddlibs );
|
|
|
924 |
|
|
|
925 |
if ( $doimplib ) {
|
|
|
926 |
#
|
|
|
927 |
# --Implib flavor will create
|
|
|
928 |
# a) Import library $name$(GBE_TYPE).lib
|
|
|
929 |
# b) Versioned DLL $name$(GBE_TYPE).xx.xx.xx.dll
|
|
|
930 |
#
|
| 289 |
dpurdie |
931 |
$target_file_dll = "\$(LIBDIR)/$name\$(GBE_TYPE).$_ver.$::so";
|
| 227 |
dpurdie |
932 |
BuildSHLD(
|
| 289 |
dpurdie |
933 |
"$name", # Base Name
|
|
|
934 |
"$name\$(GBE_TYPE)", # Name of Export Lib
|
|
|
935 |
"$name\$(GBE_TYPE).$_ver"); # Name of the DLL + PDB
|
| 227 |
dpurdie |
936 |
|
|
|
937 |
} else {
|
|
|
938 |
#
|
|
|
939 |
# Original flavor will create
|
|
|
940 |
# a) Import library $name$(GBE_TYPE).lib ---+
|
|
|
941 |
# b) Unversioned DLL $name$(GBE_TYPE).dll <--+
|
|
|
942 |
# c) Versioned DLL $name$(GBE_TYPE).xx.xx.xx.dll
|
|
|
943 |
#
|
|
|
944 |
MakePrint(
|
|
|
945 |
"# .. Versioned image\n\n".
|
| 289 |
dpurdie |
946 |
"\$(LIBDIR)/${name}\$(GBE_TYPE).$_ver.$::so:\t".
|
| 227 |
dpurdie |
947 |
"\$(LIBDIR)/${name}\$(GBE_TYPE).$::so\n".
|
|
|
948 |
"\n" );
|
|
|
949 |
|
|
|
950 |
$target_file_dll = "\$(LIBDIR)/$name\$(GBE_TYPE).$::so";
|
| 289 |
dpurdie |
951 |
BuildSHLD( "$name", "" , "$name\$(GBE_TYPE).$_ver" );
|
| 227 |
dpurdie |
952 |
BuildSHLD( "$name", "$name\$(GBE_TYPE)" , "$name\$(GBE_TYPE)" );
|
|
|
953 |
}
|
|
|
954 |
|
|
|
955 |
#.. Resource File
|
|
|
956 |
#
|
|
|
957 |
ToolsetRCrecipe( $res, @reslist )
|
|
|
958 |
if ( $res );
|
|
|
959 |
}
|
|
|
960 |
|
|
|
961 |
|
|
|
962 |
###############################################################################
|
|
|
963 |
# ToolsetSHLDLINT $name, \@args, \@objs, \@libraries )
|
|
|
964 |
# This subroutine takes the user options and builds the rules
|
|
|
965 |
# required to lint the program 'name'.
|
|
|
966 |
#
|
|
|
967 |
# Arguments:
|
|
|
968 |
# (none)
|
|
|
969 |
#
|
|
|
970 |
# Output:
|
|
|
971 |
# [ $(LIBDIR)/$name_lint: .... ]
|
|
|
972 |
# $(SHLIBLINT)
|
|
|
973 |
#
|
|
|
974 |
###############################################################################
|
|
|
975 |
|
|
|
976 |
sub ToolsetSHLDLINT
|
|
|
977 |
{
|
|
|
978 |
PCLintSHLIB( @_ );
|
|
|
979 |
}
|
|
|
980 |
|
|
|
981 |
###############################################################################
|
| 261 |
dpurdie |
982 |
# Function : ToolsetLD
|
| 227 |
dpurdie |
983 |
#
|
| 261 |
dpurdie |
984 |
# Description : Takes the user options and builds the rules required to
|
|
|
985 |
# link the program 'name'.
|
| 227 |
dpurdie |
986 |
#
|
| 261 |
dpurdie |
987 |
# Inputs : $name - base name of the program
|
|
|
988 |
# $pArgs - Ref to program arguments
|
|
|
989 |
# $pObjs - Ref to program objects
|
|
|
990 |
# $pLibs - Ref to program library list
|
| 227 |
dpurdie |
991 |
#
|
| 261 |
dpurdie |
992 |
# Returns : Nothing
|
| 227 |
dpurdie |
993 |
#
|
| 261 |
dpurdie |
994 |
# Output: : Rules and recipes to create a program
|
|
|
995 |
# Create program rules and recipes
|
|
|
996 |
# Create linker input script
|
|
|
997 |
# Create library dependency list
|
|
|
998 |
# Include library dependency information
|
| 227 |
dpurdie |
999 |
#
|
|
|
1000 |
sub ToolsetLD
|
|
|
1001 |
{
|
|
|
1002 |
my ( $name, $pArgs, $pObjs, $pLibs ) = @_;
|
|
|
1003 |
my ( $res, @reslist );
|
|
|
1004 |
my $no_pdb =$pdb_none;
|
|
|
1005 |
our( $entry, $noaddlibs );
|
|
|
1006 |
|
|
|
1007 |
#.. Parse arguments
|
|
|
1008 |
#
|
|
|
1009 |
foreach ( @$pArgs ) {
|
|
|
1010 |
if (/^--Resource=(.*)/) { # Resource definition
|
|
|
1011 |
($res, @reslist) = ToolsetRClist( $name, $1 );
|
|
|
1012 |
|
|
|
1013 |
} elsif (/^--NoPDB$/) {
|
|
|
1014 |
$no_pdb = 1;
|
|
|
1015 |
|
|
|
1016 |
} elsif (/^--Entry=(.*)/) {
|
|
|
1017 |
$entry = $1;
|
|
|
1018 |
|
|
|
1019 |
} elsif (/^--NoAddLib/) {
|
|
|
1020 |
$noaddlibs = 1;
|
|
|
1021 |
|
|
|
1022 |
} else {
|
|
|
1023 |
Message( "vcwin32 LD: unknown option $_ -- ignored\n" );
|
|
|
1024 |
|
|
|
1025 |
}
|
|
|
1026 |
}
|
|
|
1027 |
|
| 261 |
dpurdie |
1028 |
#.. Names of important files
|
|
|
1029 |
#
|
|
|
1030 |
my $base = "\$(BINDIR)/${name}";
|
|
|
1031 |
my $full = $base . $::exe;
|
|
|
1032 |
my $map = $base . '.map';
|
|
|
1033 |
my $pdb = $base . '.pdb';
|
|
|
1034 |
my $dep = $base . '.dep';
|
|
|
1035 |
|
|
|
1036 |
|
| 227 |
dpurdie |
1037 |
#.. Cleanup rules
|
|
|
1038 |
#
|
| 255 |
dpurdie |
1039 |
# dep Dependency file
|
|
|
1040 |
# ld Linker command file
|
|
|
1041 |
# map Map file
|
|
|
1042 |
# pdb Microsoft C/C++ program database
|
|
|
1043 |
# ilk Microsoft Linker Database
|
|
|
1044 |
# res Compiled resource script
|
| 261 |
dpurdie |
1045 |
# exe.manifest Manifest file (VS2005)
|
| 227 |
dpurdie |
1046 |
#
|
| 261 |
dpurdie |
1047 |
ToolsetGenerate( $dep );
|
|
|
1048 |
ToolsetGenerate( $map );
|
|
|
1049 |
ToolsetGenerate( $pdb );
|
|
|
1050 |
ToolsetGenerate( $base . '.ld' );
|
|
|
1051 |
ToolsetGenerate( $base . '.ilk' );
|
|
|
1052 |
ToolsetGenerate( $full . '.manifest' ) if $toolset_info->{'GenManifest'};
|
| 227 |
dpurdie |
1053 |
|
|
|
1054 |
#.. Linker command
|
|
|
1055 |
#
|
|
|
1056 |
my ($io) = ToolsetPrinter::New();
|
|
|
1057 |
|
| 261 |
dpurdie |
1058 |
$io->Prt( "$full : $dep " );
|
|
|
1059 |
$io->Entry( "", "", "\\\n\t", ".$::o ", @$pObjs );
|
|
|
1060 |
$io->Prt( "\\\n\t$res " ) if ( $res );
|
|
|
1061 |
$io->Prt( "\n\t\$(LD)\n\n" );
|
| 227 |
dpurdie |
1062 |
|
|
|
1063 |
|
|
|
1064 |
#.. Linker command file
|
|
|
1065 |
#
|
|
|
1066 |
# Now piece together a variable $(name_ld) which ends up in
|
|
|
1067 |
# the command file linking the application.
|
|
|
1068 |
#
|
|
|
1069 |
$io->SetTag( "${name}_ld" ); # macro tag
|
|
|
1070 |
|
|
|
1071 |
$io->Label( "Linker commands", $name ); # label
|
|
|
1072 |
|
| 261 |
dpurdie |
1073 |
$io->Cmd( "-out:\$(subst /,\\\\,$full)" );
|
|
|
1074 |
$io->Cmd( "-pdb:\$(subst /,\\\\,$pdb)" ) unless ($no_pdb);
|
|
|
1075 |
$io->Cmd( "-debug:none" ) if ($no_pdb);
|
|
|
1076 |
$io->Cmd( "-pdb:none" ) if ($no_pdb);
|
|
|
1077 |
$io->Cmd( "-entry:$entry" ) if ($entry);
|
|
|
1078 |
$io->Cmd( "-map:\$(subst /,\\\\,$map)" );
|
| 227 |
dpurdie |
1079 |
$io->Cmd( "-nodefaultlib:LIBC" );
|
|
|
1080 |
$io->Cmd( "-machine:IX86" );
|
| 261 |
dpurdie |
1081 |
$io->Cmd( "\$(subst /,\\\\,$res)" ) if ( $res );
|
| 227 |
dpurdie |
1082 |
|
| 261 |
dpurdie |
1083 |
ToolsetLibStd( $pLibs ) unless ( $noaddlibs ); # push standard libraries
|
|
|
1084 |
$io->ObjList( $name, $pObjs, \&ToolsetObjRecipe ); # object list
|
|
|
1085 |
$io->LibList( $name, $pLibs, \&ToolsetLibRecipe ); # library list
|
|
|
1086 |
$io->Newline();
|
| 227 |
dpurdie |
1087 |
|
| 261 |
dpurdie |
1088 |
#.. Library dependency information
|
|
|
1089 |
# Rules to include a .dep file when required
|
|
|
1090 |
#
|
|
|
1091 |
$io->LDDEPEND( $name );
|
| 227 |
dpurdie |
1092 |
|
|
|
1093 |
#.. Dependencies
|
|
|
1094 |
#
|
|
|
1095 |
# Now piece together a variable $(name_dp) which ends up in
|
|
|
1096 |
# the command file building the application dependency list.
|
|
|
1097 |
#
|
| 261 |
dpurdie |
1098 |
$io->SetTag( "${name}_dp" ); # macro tag
|
|
|
1099 |
$io->DepRules( $name, $pLibs, \&ToolsetLibRecipe, $full ); # library depends rules
|
| 227 |
dpurdie |
1100 |
$io->Newline();
|
|
|
1101 |
|
|
|
1102 |
#.. Compile up the resource file
|
|
|
1103 |
#
|
|
|
1104 |
ToolsetRCrecipe( $res, @reslist )
|
|
|
1105 |
if ( $res );
|
|
|
1106 |
|
| 261 |
dpurdie |
1107 |
#.. Package up the program and the PDB
|
| 227 |
dpurdie |
1108 |
#
|
| 261 |
dpurdie |
1109 |
PackageProgAddFiles ( $name, $full );
|
|
|
1110 |
PackageProgAddFiles ( $name, $pdb, "Class=debug" ) unless ( $no_pdb );
|
| 227 |
dpurdie |
1111 |
|
|
|
1112 |
#
|
|
|
1113 |
# Track the name of the possible target file
|
|
|
1114 |
# Used when creating Visual Studio projects
|
|
|
1115 |
#
|
| 261 |
dpurdie |
1116 |
$target_file_exe = $full;
|
| 227 |
dpurdie |
1117 |
}
|
|
|
1118 |
|
|
|
1119 |
|
|
|
1120 |
###############################################################################
|
|
|
1121 |
# ToolsetLD( $name, \@args, \@objs, \@libraries, \@csrc, \@cxxsrc )
|
|
|
1122 |
# This subroutine takes the user options and builds the rules
|
|
|
1123 |
# required to lint the program 'name'.
|
|
|
1124 |
#
|
|
|
1125 |
# Arguments:
|
|
|
1126 |
# (none)
|
|
|
1127 |
#
|
|
|
1128 |
# Output:
|
|
|
1129 |
# [ $(BINDIR)/$name_lint: .... ]
|
|
|
1130 |
# $(LDLINT)
|
|
|
1131 |
#
|
|
|
1132 |
###############################################################################
|
|
|
1133 |
|
|
|
1134 |
sub ToolsetLDLINT
|
|
|
1135 |
{
|
|
|
1136 |
PCLintLD( @_ );
|
|
|
1137 |
}
|
|
|
1138 |
|
|
|
1139 |
|
|
|
1140 |
########################################################################
|
|
|
1141 |
#
|
|
|
1142 |
# Push standard "system" libraries. This is a helper function
|
|
|
1143 |
# used within this toolset.
|
|
|
1144 |
#
|
|
|
1145 |
# Arguments:
|
|
|
1146 |
# $plib Reference to library array.
|
|
|
1147 |
#
|
|
|
1148 |
########################################################################
|
|
|
1149 |
|
|
|
1150 |
sub ToolsetLibStd
|
|
|
1151 |
{
|
|
|
1152 |
my ($plib) = @_;
|
|
|
1153 |
|
|
|
1154 |
#
|
|
|
1155 |
# Only add libraries if required
|
|
|
1156 |
#
|
|
|
1157 |
return unless( $::ScmCompilerOpts{'ADDLINKLIBS'} );
|
|
|
1158 |
|
|
|
1159 |
|
|
|
1160 |
#
|
|
|
1161 |
# Appears to be a kludge that no one is happy to remove
|
|
|
1162 |
# If we are inluding cs or csx libraries then add some more
|
|
|
1163 |
#
|
|
|
1164 |
foreach (@$plib) {
|
|
|
1165 |
if ( $_ eq 'csx$(GBE_TYPE)' || $_ eq 'cs$(GBE_TYPE)' )
|
|
|
1166 |
{ # .. core services
|
|
|
1167 |
UniquePush( $plib, "KERNEL32" );
|
|
|
1168 |
UniquePush( $plib, "WINUX32\$(GBE_TYPE)" );
|
|
|
1169 |
UniquePush( $plib, "WS2_32" );
|
|
|
1170 |
last;
|
|
|
1171 |
}
|
|
|
1172 |
}
|
|
|
1173 |
|
|
|
1174 |
#
|
|
|
1175 |
# Multithreaded DLL
|
|
|
1176 |
#
|
|
|
1177 |
push @$plib, "--ifeq=THREADMODE:D";
|
|
|
1178 |
push @$plib, "--ifdebug";
|
|
|
1179 |
push @$plib, "MSVCRTD";
|
|
|
1180 |
|
|
|
1181 |
push @$plib, "--ifeq=THREADMODE:D";
|
|
|
1182 |
push @$plib, "--ifprod";
|
|
|
1183 |
push @$plib, "MSVCRT";
|
|
|
1184 |
|
|
|
1185 |
#
|
|
|
1186 |
# Static Multithread library
|
|
|
1187 |
#
|
|
|
1188 |
push @$plib, "--ifeq=THREADMODE:T";
|
|
|
1189 |
push @$plib, "--ifdebug";
|
|
|
1190 |
push @$plib, "LIBCMTD";
|
|
|
1191 |
|
|
|
1192 |
push @$plib, "--ifeq=THREADMODE:T";
|
|
|
1193 |
push @$plib, "--ifprod";
|
|
|
1194 |
push @$plib, "LIBCMT";
|
|
|
1195 |
|
|
|
1196 |
#
|
|
|
1197 |
# User library
|
|
|
1198 |
#
|
|
|
1199 |
push @$plib, "USER32";
|
|
|
1200 |
}
|
|
|
1201 |
|
|
|
1202 |
|
|
|
1203 |
########################################################################
|
|
|
1204 |
#
|
|
|
1205 |
# Generate a linker object recipe. This is a helper function used
|
|
|
1206 |
# within this toolset.
|
|
|
1207 |
#
|
|
|
1208 |
# Arguments:
|
|
|
1209 |
# $io I/O stream
|
|
|
1210 |
#
|
|
|
1211 |
# $target Name of the target
|
|
|
1212 |
#
|
|
|
1213 |
# $obj Library specification
|
|
|
1214 |
#
|
|
|
1215 |
########################################################################
|
|
|
1216 |
|
|
|
1217 |
sub ToolsetObjRecipe
|
|
|
1218 |
{
|
|
|
1219 |
my ($io, $target, $obj) = @_;
|
|
|
1220 |
|
|
|
1221 |
$io->Cmd( "\$(subst /,\\\\,\$(strip $obj)).$::o" );
|
|
|
1222 |
}
|
|
|
1223 |
|
|
|
1224 |
|
|
|
1225 |
########################################################################
|
|
|
1226 |
#
|
|
|
1227 |
# Generate a linker/depend library recipe. This is a helper function
|
|
|
1228 |
# used within this toolset.
|
|
|
1229 |
#
|
|
|
1230 |
# Arguments:
|
|
|
1231 |
# $io I/O stream
|
|
|
1232 |
#
|
|
|
1233 |
# $target Name of the target
|
|
|
1234 |
#
|
|
|
1235 |
# $lib Library specification
|
|
|
1236 |
#
|
|
|
1237 |
# $dp If building a depend list, the full target name.
|
|
|
1238 |
#
|
|
|
1239 |
########################################################################
|
|
|
1240 |
|
|
|
1241 |
sub ToolsetLibRecipe
|
|
|
1242 |
{
|
|
|
1243 |
my ($io, $target, $lib, $dp) = @_;
|
|
|
1244 |
|
|
|
1245 |
return # ignore (compat)
|
|
|
1246 |
if ( $lib eq "rt" || $lib eq "thread" ||
|
|
|
1247 |
$lib eq "pthread" || $lib eq "nsl" ||
|
|
|
1248 |
$lib eq "socket" );
|
|
|
1249 |
|
|
|
1250 |
if ( !defined($dp) ) { # linker
|
|
|
1251 |
$io->Cmd( "\$(subst /,\\\\,\$(strip $lib)).$::a" );
|
|
|
1252 |
|
|
|
1253 |
} else { # depend
|
|
|
1254 |
$io->Cmd( "$dp:\t@(vlib2,$lib,LIB)" );
|
|
|
1255 |
}
|
|
|
1256 |
}
|
|
|
1257 |
|
|
|
1258 |
|
|
|
1259 |
########################################################################
|
|
|
1260 |
#
|
|
|
1261 |
# Parse resource file data
|
|
|
1262 |
# This is a helper function used within this toolset
|
|
|
1263 |
#
|
|
|
1264 |
# Arguments : $1 BaseName
|
|
|
1265 |
# $2 The users resource list
|
|
|
1266 |
# This is a list of comma seperated files
|
|
|
1267 |
# The first file is the main resource script
|
|
|
1268 |
#
|
|
|
1269 |
# Returns : An array of resource files with full pathnames
|
|
|
1270 |
# [0] = The output file
|
|
|
1271 |
# [1] = The input file
|
|
|
1272 |
# [..] = Other input files
|
|
|
1273 |
#
|
|
|
1274 |
########################################################################
|
|
|
1275 |
|
|
|
1276 |
sub ToolsetRClist
|
|
|
1277 |
{
|
|
|
1278 |
my ($name, $files) = @_;
|
|
|
1279 |
my @result;
|
|
|
1280 |
|
|
|
1281 |
#
|
|
|
1282 |
# Generate the name of the output file
|
|
|
1283 |
#
|
|
|
1284 |
push @result, "\$(OBJDIR)/$name.res";
|
|
|
1285 |
|
|
|
1286 |
#
|
|
|
1287 |
# Process each user file
|
|
|
1288 |
#
|
| 279 |
dpurdie |
1289 |
for (split( '\s*,\s*', $files ))
|
| 227 |
dpurdie |
1290 |
{
|
|
|
1291 |
#
|
|
|
1292 |
# Locate the file.
|
|
|
1293 |
# If it is a generate file so it will be in the SRCS hash
|
|
|
1294 |
# Other wise the use will have to use Src to locate the file
|
|
|
1295 |
#
|
|
|
1296 |
push @result, MakeSrcResolve($_);
|
|
|
1297 |
}
|
|
|
1298 |
|
|
|
1299 |
#
|
|
|
1300 |
# Return the array to the user
|
|
|
1301 |
#
|
|
|
1302 |
return @result;
|
|
|
1303 |
}
|
|
|
1304 |
|
|
|
1305 |
|
|
|
1306 |
########################################################################
|
|
|
1307 |
#
|
|
|
1308 |
# Generate a resource file recipe
|
|
|
1309 |
# This is a helper function used within this tool
|
|
|
1310 |
#
|
|
|
1311 |
# Arguments : $1 Output resource file
|
|
|
1312 |
# .. Input resource files
|
|
|
1313 |
#
|
|
|
1314 |
########################################################################
|
|
|
1315 |
|
|
|
1316 |
sub ToolsetRCrecipe
|
|
|
1317 |
{
|
|
|
1318 |
my ($out, @in) = @_;
|
|
|
1319 |
|
|
|
1320 |
#
|
|
|
1321 |
# Cleanup
|
|
|
1322 |
#
|
|
|
1323 |
ToolsetGenerate( $out );
|
|
|
1324 |
|
|
|
1325 |
#
|
|
|
1326 |
# Recipe
|
|
|
1327 |
#
|
|
|
1328 |
MakePrint( "\n#.. Compile Resource file: $out\n\n" );
|
|
|
1329 |
MakePrint( "$out:\t\$(GBE_PLATFORM).mk\n" );
|
|
|
1330 |
MakeEntry( "$out:\t", "", "\\\n\t\t", " ", @in );
|
|
|
1331 |
MakePrint( "\n\t\$(RC)\n" );
|
|
|
1332 |
MakePrint( "\n" );
|
|
|
1333 |
}
|
|
|
1334 |
|
|
|
1335 |
########################################################################
|
|
|
1336 |
#
|
|
|
1337 |
# Generate a project from the provided project solution file
|
|
|
1338 |
# This is aimed at .NET work
|
|
|
1339 |
#
|
|
|
1340 |
# Arguments : $name - Base name of the project
|
|
|
1341 |
# $solution - Path to the solutionn file
|
|
|
1342 |
# $pArgs - Project specific options
|
|
|
1343 |
#
|
|
|
1344 |
########################################################################
|
|
|
1345 |
|
|
|
1346 |
my $project_defines_done = 0;
|
|
|
1347 |
sub ToolsetPROJECT
|
|
|
1348 |
{
|
|
|
1349 |
my( $name, $solution ,$pArgs ) = @_;
|
|
|
1350 |
my $buildcmd = $toolset_info->{'buildcmd'};
|
|
|
1351 |
my $cleancmd = $toolset_info->{'cleancmd'};
|
|
|
1352 |
|
|
|
1353 |
#
|
|
|
1354 |
# Process options
|
|
|
1355 |
#
|
|
|
1356 |
foreach ( @$pArgs ) {
|
| 267 |
dpurdie |
1357 |
Message( "vcwin32 PROJECT: unknown option $_ -- ignored\n" );
|
| 227 |
dpurdie |
1358 |
}
|
|
|
1359 |
|
|
|
1360 |
my ($io) = ToolsetPrinter::New();
|
|
|
1361 |
|
|
|
1362 |
#
|
|
|
1363 |
# Setup toolset pecific difinitions. Once
|
|
|
1364 |
#
|
|
|
1365 |
unless( $project_defines_done )
|
|
|
1366 |
{
|
|
|
1367 |
$project_defines_done = 1;
|
|
|
1368 |
$io->PrtLn( "ifeq \"\$(DEBUG)\" \"1\"");
|
|
|
1369 |
$io->PrtLn( "PROJECT_CMD\t:= DEBUG");
|
|
|
1370 |
$io->PrtLn( "else");
|
|
|
1371 |
$io->PrtLn( "PROJECT_CMD\t:= RELEASE");
|
|
|
1372 |
$io->PrtLn( "endif");
|
|
|
1373 |
$io->Newline();
|
|
|
1374 |
}
|
|
|
1375 |
|
|
|
1376 |
#
|
|
|
1377 |
# Process the build and clean commands
|
|
|
1378 |
# Substitute arguments
|
|
|
1379 |
# =TYPE=
|
|
|
1380 |
# =LOG=
|
|
|
1381 |
# =DSW=
|
|
|
1382 |
#
|
|
|
1383 |
$buildcmd =~ s~=TYPE=~\$\(PROJECT_CMD)~g;
|
|
|
1384 |
$buildcmd =~ s~=LOG=~$name\$(GBE_TYPE).log~g;
|
|
|
1385 |
$buildcmd =~ s~=DSW=~$solution~g;
|
|
|
1386 |
|
|
|
1387 |
$cleancmd =~ s~=TYPE=~\$\(PROJECT_CMD)~g;
|
|
|
1388 |
$cleancmd =~ s~=LOG=~$name\$(GBE_TYPE).log~g;
|
|
|
1389 |
$cleancmd =~ s~=DSW=~$solution~g;
|
|
|
1390 |
|
|
|
1391 |
#
|
|
|
1392 |
# Generate the recipe to create the project
|
|
|
1393 |
# Use the set_WIN32.sh file to extend the DLL search path
|
|
|
1394 |
#
|
|
|
1395 |
$io->Label( "Build project", $name );
|
|
|
1396 |
$io->PrtLn( "Project_$name: $solution \$(INTERFACEDIR)/set_$::ScmPlatform.sh" );
|
|
|
1397 |
|
|
|
1398 |
$io->PrtLn( "\t\$(XX_PRE)( \$(rm) -f $name\$(GBE_TYPE).log; \\" );
|
|
|
1399 |
$io->PrtLn( "\t. \$(INTERFACEDIR)/set_$::ScmPlatform.sh; \\" );
|
| 255 |
dpurdie |
1400 |
$io->PrtLn( "\t\$(show_environment); \\" );
|
| 227 |
dpurdie |
1401 |
$io->PrtLn( "\t$buildcmd; \\" );
|
|
|
1402 |
$io->PrtLn( "\tret=\$\$?; \\" );
|
|
|
1403 |
$io->PrtLn( "\t\$(GBE_BIN)/cat $name\$(GBE_TYPE).log; \\" );
|
|
|
1404 |
$io->PrtLn( "\texit \$\$ret )" );
|
|
|
1405 |
$io->Newline();
|
|
|
1406 |
|
|
|
1407 |
#
|
|
|
1408 |
# Generate the recipe to clean the project
|
|
|
1409 |
#
|
|
|
1410 |
$io->Label( "Clean project", $name );
|
|
|
1411 |
$io->PrtLn( "ProjectClean_$name: $solution" );
|
|
|
1412 |
$io->PrtLn( "\t-\$(XX_PRE)$cleancmd" );
|
|
|
1413 |
$io->PrtLn( "\t-\$(XX_PRE)\$(rm) -f $name\$(GBE_TYPE).log" );
|
|
|
1414 |
$io->Newline();
|
|
|
1415 |
|
|
|
1416 |
}
|
|
|
1417 |
|
|
|
1418 |
|
|
|
1419 |
#.. Successful termination
|
|
|
1420 |
1;
|
|
|
1421 |
|