Subversion Repositories DevTools

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
303 dpurdie 1
#
2
# Module name   : vcwce
3
# Module type   : Makefile system
4
# Compiler(s)   : ANSI C
5
# Environment(s): WCE
6
#
7
# Description:
8
#   Visual C/C++ for WCE
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;
343 dpurdie 24
my $toolset_name = 'vcwce';                           # Toolset name : Error reporting
303 dpurdie 25
 
26
##############################################################################
27
#   Toolchain information
335 dpurdie 28
#   Abstract out minor toolchain differences into a data structure
303 dpurdie 29
#
30
my $toolchain_info;
31
my %ToolChainData =
32
    (
33
        'EVC4'      =>  {  'def'        => 'vcwce.def' ,
34
                           'initDef'    => 'vcembedded',
35
                           'wceroot'    => 'Microsoft eMbedded C++ 4.0',
343 dpurdie 36
                           'buildcmd'   => 'evc =DSW= /make =TYPE= /use_env /CEConfig="=CEPLATFORM=" /out =LOG=',
37
                           'cleancmd'   => 'evc =DSW= /make =TYPE= /clean /use_env /CEConfig="=CEPLATFORM="',
303 dpurdie 38
                           'tmp'        => 'vc60',
39
                           'VSCOMPILER' => '1',
343 dpurdie 40
                           'def_targets' => [ 'ALL - RELEASE','ALL - DEBUG' ],
303 dpurdie 41
                           },
42
 
43
 
44
        'VS2005'    =>  {  'def'        => 'vcembedded2005.def' ,
45
                           'initDef'    => 'vcembedded',
46
                           'buildcmd'   => 'devenv =DSW= /build =TYPE= /useenv /out =LOG=' ,
47
                           'cleancmd'   => 'devenv =DSW= /clean =TYPE= /useenv' ,
48
                           'tmp'        => 'vc80',
49
                           'VSCOMPILER' => '2',
50
 
51
                           'wceroot'    => 'Microsoft Visual Studio 8/VC/ce',
52
                           'includes'   => [    '$(WCEROOT)/include',
53
                                                '$(WCEROOT)/atlmfc/include',
54
                                           ],
55
                           'libs'       => [    '$(WCEROOT)/lib/$(WCE_TARGETCPU)',
56
                                                '$(WCEROOT)/atlmfc/lib/$(WCE_TARGETCPU)',
57
                                           ],
357 dpurdie 58
                           'hex_WCEVersion' => 1,
303 dpurdie 59
                           },
60
 
61
    );
62
 
63
 
64
##############################################################################
65
#   ToolsetInit()
66
#       Runtime initialisation
67
#
68
##############################################################################
69
 
357 dpurdie 70
my( $WCEVersion,$WCEVersionTool ) = "";
303 dpurdie 71
my( $WCESubsystem )             = "";
72
my( $WCEPlatform )              = "";
73
my( $WCEPlatformDefine )        = "";
74
my( $WCEPlatformClean )         = "";
75
my( $WCETargetCPU )             = "";
76
my( $WCEHostCPU )               = "";
77
my( $WCEToolchain )             = "";
399 dpurdie 78
my( $WCEPlatformBase )          = "";
303 dpurdie 79
 
80
ToolsetInit();
81
 
82
sub ToolsetInit
83
{
84
    my( $wceroot, $sdkroot );
85
    my( $compiler, $linker, $vstool );
86
    my( @defines ) = ();
87
    my( @cflags, @cflags_debug, @cflags_prod ) = ();
88
    my( @libflags, @ldflags, @ldflags_debug, @ldflags_prod ) = ();
89
    my $is_vs2005;
317 dpurdie 90
    my $default_ehandling = undef;
355 dpurdie 91
    my @pDefines;
303 dpurdie 92
 
93
#.. Standard.rul requirements
94
#
95
    $::s = "asm";
96
    $::o = "obj";
97
    $::a = "lib";
98
    $::so = "dll";
99
    $::exe = ".exe";
100
 
101
#.. Toolset configuration
102
#
103
    $::ScmToolsetVersion = "1.0.0";             # our version
104
    $::ScmToolsetGenerate = 0;                  # generate optional
335 dpurdie 105
    $::ScmToolsetProgDependancies = 0;          # handle Prog dependancies myself
303 dpurdie 106
 
107
#.. Parse arguments
108
#
343 dpurdie 109
    Debug( "$toolset_name(ToolsetArgs=@::ScmToolsetArgs)" );
303 dpurdie 110
 
111
    foreach ( @::ScmToolsetArgs ) {
343 dpurdie 112
        Message( "$toolset_name toolset: unknown option $_ -- ignored\n" );
303 dpurdie 113
    }
114
 
343 dpurdie 115
    Debug( "$toolset_name(PlatformArgs=@::ScmPlatformArgs)" );
303 dpurdie 116
 
117
    foreach ( @::ScmPlatformArgs ) {
118
        if (/^--Version=(.*)/) {                # OS Version
399 dpurdie 119
            $WCEVersion     = $1;
303 dpurdie 120
 
121
        } elsif (/^--SDK=(.*)/) {               # SDK
399 dpurdie 122
            $WCEPlatform    = $1;
303 dpurdie 123
 
399 dpurdie 124
        } elsif (/^--SdkBase=(.*)/) {           # SdkBase
125
            $WCEPlatformBase = $1;
126
 
303 dpurdie 127
        } elsif (/^--Target=(.*)/) {            # CPU
399 dpurdie 128
            $WCETargetCPU   = $1;
303 dpurdie 129
 
130
        } elsif (/^--Host=(.*)/) {              # Emulator host CPU
399 dpurdie 131
            $WCEHostCPU     = $1;
303 dpurdie 132
 
133
        } elsif (/^--Toolchain=(.*)/) {         # Toolchain
399 dpurdie 134
            $WCEToolchain   = $1;
303 dpurdie 135
 
136
        } elsif (/^--product=(.*)/) {           # GBE product
137
 
138
        } elsif (/^--NoDinkumware/) {           # Deprecated switch
355 dpurdie 139
 
140
        } elsif (/^--Define=(.*)/ ) {
141
            push @pDefines, '-D' . $1;
142
 
303 dpurdie 143
        } else {
343 dpurdie 144
            Message( "$toolset_name toolset: unknown platform argument $_ -- ignored\n" );
303 dpurdie 145
        }
146
    }
147
 
148
#.. Select toolchain, based on targetCPU
149
#       1) EVC            - As provided via Embedded Visual C++
150
#       2) VS2005         - As provided via VS2005
151
#
152
    $toolchain_info = $ToolChainData{$WCEToolchain};
153
    Error( "Unknown Toolchain: $WCEToolchain" ) unless ( defined $toolchain_info );
154
    $is_vs2005 = ($toolchain_info->{'VSCOMPILER'} == 2);
155
 
156
#
157
#   The following table shows the processors that eMbedded Visual C++
158
#   currently supports.
159
#
160
#   ARM         ARMV4, ARMV4I, ARMV4T
161
#   MIPS        MIPSII, MIPSII_FP, MIPSIV, MIPSIV_FP, MIPS16
162
#   Hitachi     SH3, SH4
163
#   x86         x86, x86 emulation
164
#..
343 dpurdie 165
    Error ("TOOLSET/$toolset_name - Version undefined")
303 dpurdie 166
        if ($WCEVersion eq "");
167
 
343 dpurdie 168
    Error ("TOOLSET/$toolset_name - SDK undefined")
303 dpurdie 169
        if ($WCEPlatform eq "");
170
 
343 dpurdie 171
    Error ("TOOLSET/$toolset_name - TargetCPU undefined")
303 dpurdie 172
        if ($WCETargetCPU eq "");
173
 
343 dpurdie 174
    Error ("TOOLSET/$toolset_name - HostCPU undefined")
303 dpurdie 175
        if ($WCEPlatform eq "emulator" && $WCEHostCPU eq "");
176
 
343 dpurdie 177
    Error ("TOOLSET/$toolset_name - Toolchain undefined")
303 dpurdie 178
        unless ( $WCEToolchain );
179
 
180
 
181
# .. Generate CE Platform definition based on the selected SDK
182
#    The following is a list of known defintions for some SDKs
183
#    In the EVC studio these are $(CePlatform)
184
#..
185
    my %PlatformSDKDefinitions =
186
    (
187
        'H/PC 2000'         => 'WIN32_PLATFORM_HPC2000',
188
        'H/PC Pro 2.11'     => 'WIN32_PLATFORM_HPCPRO',
189
        'Pocket PC'         => 'WIN32_PLATFORM_PSPC',
190
        'Pocket PC 2002'    => 'WIN32_PLATFORM_PSPC=310',
191
        'POCKET PC 2003'    => 'WIN32_PLATFORM_PSPC=400',
192
        'Smartphone 2002'   => 'WIN32_PLATFORM_WFSP=100',
193
        'IT-3000'           => 'WCE_PLATFORM_PX780J_ARMV4I',
194
        'PCM7220'           => 'WCE_PLATFORM_SOCERXS',
195
        'ADVANTECH_X86_420' => 'WCE_PLATFORM_ADVANTECH_X86_420',
196
        'SOM_4450_2'        => 'WCE_PLATFORM_SOM_4450_2',
197
        'adv_som_4455_wlan' => 'WCE_PLATFORM_adv_som_4455_wlan',
198
        'PsionTeklogixCE420'=> 'WCE_PLATFORM_STANDARDSDK',
199
        'PsionTeklogixCE500'=> 'WCE_PLATFORM_STANDARDSDK',
200
        'PA961'             => 'WCE_PLATFORM_PA961',
201
        'PA962'             => 'WCE_PLATFORM_PA962',
202
        'PA962 WINCE 500'   => 'WCE_PLATFORM_PA962',
399 dpurdie 203
        'M81B_SDK'          => 'WCE_PLATFORM_M81B',         # Just made this one up
204
        'PocketPC'          => 'WIN32_PLATFORM_PSPC',
303 dpurdie 205
    );
206
 
399 dpurdie 207
    unless ( $WCEPlatform eq 'NONE' )
208
    {
209
        $WCEPlatformDefine = $PlatformSDKDefinitions{$WCEPlatform};
303 dpurdie 210
 
399 dpurdie 211
        Error ("TOOLSET/$toolset_name - SDK not defined. Extend table",
212
               "SDK: $WCEPlatform" )
213
            unless ( defined $WCEPlatformDefine );
303 dpurdie 214
 
399 dpurdie 215
        $WCEPlatformClean = $WCEPlatform;
216
        $WCEPlatformClean =~ s/\s/_/g;
217
    }
218
    else
219
    {
220
        $WCEPlatform = '.';
221
    }
303 dpurdie 222
 
223
    $WCESubsystem = "windowsce," . int($WCEVersion/100) . "." . $WCEVersion%100
224
        if ( !defined($WCESubsystem) || $WCESubsystem eq "" );
225
 
226
        push( @ldflags,     '-debug:full' ) unless ($is_vs2005);
227
        push( @ldflags,     '-debug' )      if ($is_vs2005);
228
 
229
#.. Select toolchain info , based on targetCPU
230
 
231
    if ( $WCETargetCPU eq "armv4" ) {
232
        $compiler           = "clarm";
233
        $linker             = "link";
234
        $vstool             = "x86_arm";
317 dpurdie 235
        $default_ehandling  = 1;
303 dpurdie 236
 
237
        @defines            = ( '-DARM', '-D_ARM_', '-DARMV4' );
238
 
317 dpurdie 239
        @cflags             = ( '-QRarch4' );
303 dpurdie 240
        @cflags             = ( '/GS-' )           if ($is_vs2005);
241
        @cflags_debug       = ( '-M$(CECrtDebug)' )unless ($is_vs2005);
242
        @cflags_prod        = ( '-M$(CECrtMT)' )   unless ($is_vs2005);
243
 
244
        push( @ldflags,     '-base:0x00010000' );
245
        push( @ldflags,     '-stack:0x10000,0x1000' );
246
        push( @ldflags,     '-entry:WinMainCRTStartup' );
247
        push( @ldflags,     '$(CENoDefaultLib)' );
248
        push( @ldflags,     '-Subsystem:$(CESubsystem)' );
249
        push( @ldflags,     '-align:4096' );
250
        push( @ldflags,     '-MACHINE:ARM' );
251
        push( @ldflags,     'commctrl.lib' );
252
        push( @ldflags,     'coredll.lib' );
253
        push( @ldflags,     'aygshell.lib' );
254
        push( @ldflags,     '$(CEx86Corelibc)' ) if ($is_vs2005);
255
 
256
        push( @libflags,    '-MACHINE:ARM' );
257
 
258
    } elsif ( $WCETargetCPU eq "armv4i" ) {
259
        $compiler           = "clarm";
260
        $linker             = "link";
261
        $vstool             = "x86_arm";
262
 
263
        @defines            = ( '-DARM', '-D_ARM_', '-DARMV4I' );
264
 
265
        @cflags             = ( '/QRarch4T' );
266
        @cflags             = ( '/QRinterwork-return' );
267
        @cflags             = ( '/GS-' )           if ($is_vs2005);
268
        @cflags_debug       = ( '-M$(CECrtDebug)' )unless ($is_vs2005);
269
        @cflags_prod        = ( '-M$(CECrtMT)' )   unless ($is_vs2005);
270
 
271
        push( @ldflags,     '-base:0x00010000' );
272
        push( @ldflags,     '-stack:0x10000,0x1000' );
273
        push( @ldflags,     '-entry:WinMainCRTStartup' );
274
        push( @ldflags,     '$(CENoDefaultLib)' );
275
        push( @ldflags,     '-nodefaultlib:oldnames.lib' ) if (1);
276
        push( @ldflags,     '-Subsystem:$(CESubsystem)' );
277
        push( @ldflags,     '-MACHINE:THUMB' );
278
        push( @ldflags,     'commctrl.lib' );
279
        push( @ldflags,     'coredll.lib' );
280
        push( @ldflags,     '$(CEx86Corelibc)' ) if ($is_vs2005);
281
 
282
        push( @libflags,    '-MACHINE:THUMB' );
283
 
284
 
399 dpurdie 285
    } elsif ( $WCETargetCPU eq 'armv5t' ) {
286
        Error ('armv5t only supported under VS2005') unless ( $is_vs2005 );
287
        $compiler           = 'cl';
288
        $linker             = 'link';
289
        $vstool             = 'x86_arm';
290
        $WCETargetCPU       = 'armv4i';
291
 
292
        push  (@defines,    '-DARM', '-D_ARM_', '-DARMV5T');
293
 
294
        push (@cflags,      '/QRarch5t' );
295
        push (@cflags,      '/GS-' );
296
        push (@cflags,      '/Zl' );
297
 
298
        #push( @ldflags,     '-base:0x00010000' );
299
        push( @ldflags,     '/Manifest:no' );
300
        push( @ldflags,     '-stack:0x10000,0x1000' );
301
        push( @ldflags,     '-entry:WinMainCRTStartup' );
302
        push( @ldflags,     '$(CENoDefaultLib)' );
303
        push( @ldflags,     '-nodefaultlib:oldnames.lib' ) if (1);
304
        push( @ldflags,     '-Subsystem:$(CESubsystem)' );
305
        push( @ldflags,     '-MACHINE:THUMB' );
306
        push( @ldflags,     'commctrl.lib' );
307
        push( @ldflags,     'coredll.lib' );
308
        push( @ldflags,     '$(CEx86Corelibc)' );
309
 
310
        push( @libflags,    '-MACHINE:THUMB' );
311
 
312
 
313
 
303 dpurdie 314
    } elsif ( $WCETargetCPU eq "armv4t" ) {
315
        $compiler           = "clthumb";
316
        $linker             = "link";
317
        $vstool             = "x86_arm";
318
 
319
        @cflags             = ( '/QRarch4t' );
320
        @defines            = ( '-DARM', '-D_ARM_', '-DARMV4T' );
321
 
322
    } elsif ( $WCETargetCPU eq "mips16" ) {
323
        $compiler           = "clmips";
324
        $linker             = "link";
325
        $vstool             = "x86_mips";
326
 
327
        @cflags             = ( '/QMmips16' );
328
        @defines            = ( '-DMIPS', '-D_MIPS_' );
329
 
330
    } elsif ( $WCETargetCPU eq "mips16ii" ) {
331
        $compiler           = "clmips";
332
        $linker             = "link";
333
        $vstool             = "x86_mips";
334
 
335
        @cflags             = ( '/QMmips16' );
336
        @defines            = ( '-DMIPS', '-D_MIPS_' );
337
 
338
    } elsif ( $WCETargetCPU eq "mipsii_fp" ) {
339
        $compiler           = "clmips";
340
        $linker             = "link";
341
 
342
        @cflags             = ( '/QMFWCE' );
343
        @defines            = ( '-DMIPS', '-D_MIPS_' );
344
 
345
    } elsif ( $WCETargetCPU eq "mipsiv" ) {
346
        $compiler           = "clmips";
347
        $linker             = "link";
348
        $vstool             = "x86_mips";
349
 
350
        @defines            = ( '-DMIPS', '-D_MIPS_' );
351
 
352
    } elsif ( $WCETargetCPU eq "mipsiv_fp" ) {
353
        $compiler           = "clmips";
354
        $linker             = "link";
355
 
356
        @cflags             = ( '/QMFWCE' );
357
        @defines            = ( '-DMIPS', '-D_MIPS_' );
358
 
359
    } elsif ( $WCETargetCPU eq "sh3" ) {
360
        if ( $WCEVersion >= 400 ) {             # SDK specific
361
            $compiler       = "clsh";
362
        } else {
363
            $compiler       = "shcl";
364
        }
365
        $linker             = "link";
366
        $vstool             = "x86_sh";
367
 
368
        @cflags             = ( '-Qsh3' );
369
        @defines            = ( '-DSHx', '-DSH3', '-D_SH3_' );
370
 
371
    } elsif ( $WCETargetCPU eq "sh4" ) {
372
        if ( $WCEVersion >= 400 ) {             # SDK specific
373
            $compiler       = "clsh";
374
        } else {
375
            $compiler       = "shcl";
376
        }
377
        $linker             = "link";
378
        $vstool             = "x86_sh";
379
 
380
        @cflags             = ( '-Qsh4' );
381
        @defines            = ( '-DSHx', '-DSH4', '-D_SH4_' );
382
 
383
    } elsif ( $WCETargetCPU eq "x86" ) {
384
        $compiler           = "cl";
385
        $linker             = "link";
386
        $vstool             = "x86_cex86";
387
 
388
        @cflags             = ( '-Gs8192', '-GF' );
389
        @defines            = ( '-D_X86_', '-Dx86', '-D_i386_' );
390
 
391
        push( @ldflags, '-section:.shared,rws' );
392
        push( @ldflags, '-base:0x00100000' );
393
        push( @ldflags, '-stack:0x10000,0x1000' );
394
        push( @ldflags, '-entry:WinMainCRTStartup' );
395
        push( @ldflags, '-Subsystem:$(CESubsystem)' );
396
        push( @ldflags, '-MACHINE:IX86' );
397
        push( @ldflags, '$(CENoDefaultLib)' );
398
        push( @ldflags, '-nodefaultlib:oldnames.lib' );
399
        push( @ldflags, '$(CEx86Corelibc)' );
400
        push( @ldflags, 'coredll.lib' );
401
        push( @ldflags, 'commctrl.lib' );
402
        push( @ldflags, 'aygshell.lib' );
403
 
404
        push( @libflags,'-MACHINE:IX86' );
405
 
406
    } elsif ( $WCETargetCPU eq "emulator" ) {
407
 
408
        if ( $WCEHostCPU eq "x86" ) {
409
            $compiler       = "cl";
410
            $linker         = "link";
411
            $vstool         = "x86_cex86";
317 dpurdie 412
            $default_ehandling  = 1;
303 dpurdie 413
 
414
            @defines        = ( '-D_X86_', '-Dx86', '-D_i386_' );
415
 
317 dpurdie 416
            @cflags         = ( '-Gs8192', '-GF' );
303 dpurdie 417
 
418
            push( @ldflags, '-base:0x00010000' );
419
            push( @ldflags, '-stack:0x10000,0x1000' );
420
            push( @ldflags, '-entry:WinMainCRTStartup' );
421
            push( @ldflags, '-Subsystem:$(CESubsystem)' );
422
            push( @ldflags, '-MACHINE:IX86' );
423
            push( @ldflags, '$(CENoDefaultLib)' );
424
            push( @ldflags, '-nodefaultlib:oldnames.lib' );
425
            push( @ldflags, '$(CEx86Corelibc)' );
426
            push( @ldflags, 'commctrl.lib' );
427
            push( @ldflags, 'coredll.lib' );
428
            push( @ldflags, 'aygshell.lib' );
429
 
430
            push( @libflags,'-MACHINE:IX86' );
431
 
432
        } else {
343 dpurdie 433
            Error ("TOOLSET/$toolset_name - unknown HostCPU '$WCEHostCPU'");
303 dpurdie 434
        }
435
 
436
    } else {
343 dpurdie 437
        Error ("TOOLSET/$toolset_name - unknown TargetCPU '$WCETargetCPU'");
303 dpurdie 438
    }
439
 
355 dpurdie 440
    #
441
    #   Append any platform specific definitions
442
    #
443
    push @defines, @pDefines;
444
 
303 dpurdie 445
#.. Define eMebbed C/C+ environment
446
#
447
 
448
    #
449
    #   Determine the toolchain root
450
    #   Currently these are within ProgramFiles
451
    #
452
    $wceroot = $toolchain_info->{'wceroot'};
453
 
454
    #
357 dpurdie 455
    #   The VS2005 toolchain uses a hex value for WCEVersion
456
    #
457
    $WCEVersionTool = $WCEVersion;
458
    $WCEVersionTool = '0X' . $WCEVersion if ( $toolchain_info->{'hex_WCEVersion'} );
459
 
460
 
461
    #
303 dpurdie 462
    #   Determine SDK root
463
    #   Currently these are well known
464
    #
399 dpurdie 465
    if ( $WCEPlatformBase )
466
    {
467
        $sdkroot = $WCEPlatformBase.'/'.$WCEPlatform;
468
    }
469
    else
470
    {
471
        $sdkroot = 'Windows CE Tools/wce'.$WCEVersion.'/'.$WCEPlatform;
472
    }
303 dpurdie 473
 
474
    Debug( "\twceroot           = $wceroot" );
475
    Debug( "\tsdkroot           = $sdkroot" );
476
    Debug( "\tWCEVersion        = $WCEVersion" );
477
    Debug( "\tWCESubsystem      = $WCESubsystem" );
478
    Debug( "\tWCEPlatform       = $WCEPlatform" );
479
    Debug( "\tWCEPlatformDefine = $WCEPlatformDefine" );
480
    Debug( "\tWCEPlatformClean  = $WCEPlatformClean" );
481
    Debug( "\tWCETargetCPU      = $WCETargetCPU" );
482
    Debug( "\tWCEHostCPU        = $WCEHostCPU" );
483
    Debug( "\tWCEToolchain      = $WCEToolchain" );
484
 
485
    PlatformDefine( "
486
#################################################
487
# Default paths, toolchain and flags
488
#
489
#..
490
 
491
PROGRAMFILES        ?= C:/Program Files
492
 
493
ifndef WCEROOT
494
WCEROOT		:= \$(PROGRAMFILES)/" . $wceroot ."
495
export WCEROOT
496
endif
497
 
498
ifndef SDKROOT
499
SDKROOT		:= \$(PROGRAMFILES)/" . $sdkroot ."
500
export SDKROOT
501
endif
502
 
503
WCE_VSTOOL           := $vstool
357 dpurdie 504
WCE_VERSION          := $WCEVersionTool
303 dpurdie 505
WCE_SUBSYSTEM        := $WCESubsystem
506
WCE_PLATFORM         := $WCEPlatform
507
WCE_PLATFORM_SDK_DEF := $WCEPlatformDefine
508
WCE_PLATFORM2        := $WCEPlatformClean
509
WCE_TARGETCPU        := $WCETargetCPU
510
WCE_HOSTCPU	         := $WCEHostCPU
511
 
512
CESubsystem          := \$(WCE_SUBSYSTEM)
513
CEVersion            := \$(WCE_VERSION)
514
CEPlatform           := \$(WCE_PLATFORM)
515
");
516
 
517
if ( $WCEVersion < 201 ) {
518
    PlatformDefine( '
519
CECrtDebug	:= Ld
520
CECrtMT		:= T
521
CENoDefaultLib	:= \
522
		-nodefaultlib:corelibc.lib
523
CEx86Corelibc	:=
524
');
525
} else {
526
    PlatformDefine( '
527
CECrtDebug	:= C
528
CECrtMT		:= C
529
CENoDefaultLib	:= \\
530
		-nodefaultlib:libc.lib\
531
		-nodefaultlib:libcd.lib\
532
		-nodefaultlib:libcmt.lib\
533
		-nodefaultlib:libcmtd.lib\
534
		-nodefaultlib:msvcrt.lib\
535
		-nodefaultlib:msvcrtd.lib
536
CEx86Corelibc	:= corelibc.lib
537
' );
538
}
539
 
307 dpurdie 540
if ( $is_vs2005 )
541
{
542
    PlatformDefine( '
543
CENoDefaultLib	+= \\
544
		-nodefaultlib:secchk.lib\
545
		-nodefaultlib:ccrtrtti.lib
546
' );
547
}
548
 
303 dpurdie 549
#
550
#   WinCe development platform specifics
551
#       Encode Toolset paths as they contain spaces
552
#       These will be decoded later
553
#
554
PlatformEntry( "vc_includes\t=", "\n", "\\\n\t" . '$(call encodepath,', ')', @{$toolchain_info->{'includes'}} );
555
PlatformEntry( "vc_libs\t="    , "\n", "\\\n\t" . '$(call encodepath,', ')', @{$toolchain_info->{'libs'}} );
556
 
557
    PlatformDefine( "WCE_EMULATOR\t".   ":= 1" )
558
        if ( $WCETargetCPU eq "emulator" );
559
 
560
    PlatformEntry( "WCE_DEFINES\t=",    "\n", "\\\n\t", "", @defines )
561
        if ( scalar @defines );
562
 
563
    PlatformEntry( "WCE_CFLAGS\t=",     "\n", "\\\n\t", "", @cflags )
564
        if ( scalar @cflags );
565
 
566
    PlatformEntry( "WCE_CFLAGSD\t=",    "\n", "\\\n\t", "", @cflags_debug )
567
        if ( scalar @cflags_debug );
568
 
569
    PlatformEntry( "WCE_CFLAGSP\t=",    "\n", "\\\n\t", "", @cflags_prod )
570
        if ( scalar @cflags_prod );
571
 
572
    PlatformEntry( "WCE_LDFLAGS\t=",    "\n", "\\\n\t", "", @ldflags )
573
        if ( scalar @ldflags );
574
 
575
    PlatformEntry( "WCE_LIBFLAGS\t=",    "\n", "\\\n\t", "", @libflags )
576
        if ( scalar @libflags );
577
 
578
    PlatformEntry( "WCE_LDFLAGSD\t=",   "\n", "\\\n\t", "", @ldflags_debug )
579
        if ( scalar @ldflags_debug );
580
 
581
    PlatformEntry( "WCE_LDFLAGSP\t=",   "\n", "\\\n\t", "", @ldflags_prod )
582
        if ( scalar @ldflags_prod );
583
 
584
if ( $is_vs2005 )
585
{
586
    $compiler = 'cl';
587
    $linker = 'link';
588
}
589
    PlatformDefine( "
590
WCE_CC		:= $compiler
591
WCE_LINK	:= $linker
592
" );
593
 
594
    Init( $toolchain_info->{'initDef'} );
595
    ToolsetDefines( $toolchain_info->{'def'} );
596
    PlatformDefine ("VSCOMPILER\t= $toolchain_info->{'VSCOMPILER'}" );
597
    ToolsetRules( "vcwce.rul" );
598
    ToolsetRules( "standard.rul" );
599
 
600
#.. define PCLint envrionment
601
    ToolsetRequire( "pclint" );                 # using pclint
602
    PlatformDefine ("LINT_COFILE\t= co-msc60.lnt");
603
    PlatformDefine ("LINT_PRJ_FILE\t=lint.vcembedded");
604
 
605
#.. Cleanup rules
606
#
607
    ToolsetGenerate( "\$(OBJDIR)/$toolchain_info->{'tmp'}.idb" );
608
    ToolsetGenerate( "\$(OBJDIR)/$toolchain_info->{'tmp'}.pch" );
609
    ToolsetGenerate( "\$(OBJDIR)/$toolchain_info->{'tmp'}.pdb" );
610
    ToolsetGenerate( "\$(PDB)" );
611
    ToolsetGenerate( "\$(PDB).tmp" );
612
 
613
 
614
#
615
#   The PDB files need to be compiled up with absolute paths to the source files
616
#   The easiest way to do this is with the makefile rules created with absolute
617
#   paths. Set a global flag to enable this option
618
#
619
    $::UseAbsObjects = 1;
620
 
621
 
622
#.. Extend the CompilerOption directive
623
#   Create a standard data structure
624
#   This is a hash of hashes
625
#       The first hash is keyed by CompileOption keyword
626
#       The second hash contains pairs of values to set or remove
627
#
628
    %::ScmToolsetCompilerOptions =
629
    (
630
        'rtti'               => { 'USE_RTTI', 1 },
631
        'nopdb'              => { 'PDB_NONE', 1 },
632
        'pdb'                => { 'PDB_NONE', undef },
317 dpurdie 633
        'exceptions'         => { 'USE_HANDLING', 1 },
634
        'noexceptions'       => { 'USE_HANDLING', undef },
303 dpurdie 635
    );
636
 
637
    #
638
    #   Set default options
317 dpurdie 639
    #       USE_HANDLING - not always the same default
303 dpurdie 640
    #
317 dpurdie 641
    $::ScmCompilerOpts{'USE_HANDLING'} = $default_ehandling;
303 dpurdie 642
}
643
 
644
##############################################################################
645
#   ToolsetPreprocess()
646
#       Process collected data before the makefile is generated
647
#       This, optional, routine is called from within MakefileGenerate()
648
#       It allows the toolset to massage any of the collected data before
649
#       the makefile is created
650
#
651
##############################################################################
652
sub ToolsetPreprocess
653
{
654
    #
655
    #   Extract the current state of PDB_NONE
656
    #   Are PDB files to be constructed.
657
    #
658
    $pdb_none = $::ScmCompilerOpts{'PDB_NONE'};
659
}
660
 
661
##############################################################################
662
#   ToolsetPostprocess
663
#       Process collected data as the makefile is generated
664
#       This, optional, routine is called from within MakefileGenerate()
665
#       It allows the toolset to massage any of the collected data before
666
#       the makefile is finally closed created
667
#
668
##############################################################################
669
 
670
sub ToolsetPostprocess
671
{
672
    MakeHeader('Toolset Postprocessed Information');
673
 
674
    #
675
    #   Specify the name of the global PDB file. This is used for all
676
    #   compiles other than those associated with building a DLL
677
    #
678
    #   The name of the PDB will be based on either
679
    #       The name of base package
680
    #       The name of the first static library created
681
    #
682
 
683
MakePrint("
684
#
685
#   Export the name of the common PDB file
686
#   All compiler information will be placed in this file
687
#   The name of the file MUST be the same as the name of the output library
688
#
689
PDB		= \$(OBJDIR)/$pdb_file\$(GBE_TYPE).pdb
690
" );
691
 
692
    #
693
    #   Add values to the perl environment
694
    #   May be used by post processing tools to create Visual Studio Projects
695
    #
696
    $::TS_pdb_file = "\$(OBJDIR)/$pdb_file\$(GBE_TYPE).pdb" unless( $pdb_none );
697
    $::TS_sbr_support = 1;
698
 
699
    #
700
    #   Prioritorise target: EXE, DLL, LIB
701
    #
702
    for my $tgt ( $target_file_exe, $target_file_dll, $target_file_lib  )
703
    {
704
        if ( $tgt )
705
        {
706
            $::TS_target_file = $tgt;
707
            last;
708
        }
709
    }
710
}
711
 
712
###############################################################################
713
#   ToolsetCC( $source, $obj, \@args )
714
#       This subroutine takes the user options and builds the rule(s)
715
#       required to compile the source file 'source' to 'obj'
716
#
717
###############################################################################
718
 
719
sub ToolsetCC
720
{
721
    ToolsetCC_common( "CC", @_ );
722
}
723
 
724
sub ToolsetCC_common
725
{
726
    my( $name, $source, $obj, $pArgs ) = @_;
727
    my( $cflags, $pdb );
728
 
729
    foreach $_ ( @$pArgs ) {
730
        if (/--Shared$/) {                      # Building a 'shared' object
731
            $cflags = "$cflags \$(SHCFLAGS)";
732
            $pdb = $::SHOBJ_LIB{$obj}
733
                if (exists $::SHOBJ_LIB{$obj} );
734
 
735
        } else {
343 dpurdie 736
            Message( "$toolset_name $name: unknown option $_ -- ignored\n" );
303 dpurdie 737
        }
738
    }
739
 
740
    MakePrint( "\n\t\$($name)\n" );
741
    MakePadded( 4, "\$(OBJDIR)/$obj.$::o:", "\tCFLAGS +=$cflags\n" )
742
        if ( $cflags );                         # object specific CFLAGS
743
 
744
    if ( $pdb && !$pdb_none )
745
    {
746
        #
747
        #   Determine the name of the PDB file
748
        #   If we are building a shared library then the name of the PDB
749
        #   MUST NOT be the same as the name of the library as there is
750
        #   some stange interaction with the linker ( 50% of the time )
751
        #   This is OK as the file will not be published
752
        #
753
        #   If building a static library then create a PDB of the same
754
        #   name as it may be published directly.
755
        #
756
        my $pdb_file;
757
        if ($cflags )
758
        {
759
            $pdb_file = "\$(OBJDIR)/${pdb}\$(GBE_TYPE)_shlib.pdb";
760
        }
761
        else
762
        {
763
            $pdb_file = "\$(OBJDIR)/${pdb}\$(GBE_TYPE).pdb";
764
        }    
765
 
766
        MakePadded( 4, "\$(OBJDIR)/$obj.$::o:", "\tPDB = $pdb_file\n" );
767
        ToolsetGenerate( $pdb_file );
768
        ToolsetGenerate( $pdb_file . ".tmp" );
769
    }
770
 
771
    #
772
    #   Remove possible Source Browser Files
773
    #
774
    ToolsetGenerate( "\$(OBJDIR)/$obj.sbr" );
775
    MakePrint( "\n" );
776
}
777
 
778
 
779
###############################################################################
780
#   ToolsetCCDepend( $depend, \@sources )
781
#       This subroutine takes the user options and builds the
782
#       rule(s) required to build the dependencies for the source
783
#       files 'sources' to 'depend'.
784
#
785
###############################################################################
786
 
787
sub ToolsetCCDepend
788
{
789
    MakePrint( "\t\$(CCDEPEND)\n" );
790
}
791
 
792
 
793
###############################################################################
794
#   ToolsetCXX( $source, $obj, \@args )
795
#       This subroutine takes the user options and builds the rule(s)
796
#       required to compile the source file 'source' to 'obj'
797
#
798
###############################################################################
799
 
800
sub ToolsetCXX
801
{
802
    ToolsetCC_common( "CXX", @_ );
803
}
804
 
805
###############################################################################
806
#   ToolsetCXXDepend( $depend, \@sources )
807
#       This subroutine takes the user options and builds the
808
#       rule(s) required to build the dependencies for the source
809
#       files 'sources' to 'depend'.
810
#
811
###############################################################################
812
 
813
sub ToolsetCXXDepend
814
{
335 dpurdie 815
    ToolsetCCDepend();
303 dpurdie 816
}
817
 
818
 
819
###############################################################################
820
#   ToolsetAS( $source, $obj, \@args )
821
#       This subroutine takes the user options and builds the rule(s)
822
#       required to compile the source file 'source' to 'obj'
823
#
824
###############################################################################
825
 
826
sub ToolsetAS
827
{
828
    MakePrint( "\n\t\$(AS)\n" );
829
}
830
 
831
sub ToolsetASDepend
832
{
833
}
834
 
835
###############################################################################
836
#   ToolsetAR( $name, \@args, \@objs )
837
#       This subroutine takes the user options and builds the rules
838
#       required to build the library 'name'.
839
#
840
#   Arguments:
841
#       --Def=name              Library definition module
842
#
843
#   Output:
844
#       [ $(LIBDIR)/name$.${a}:   .... ]
845
#           $(AR)
846
#
847
###############################################################################
848
 
849
sub ToolsetAR
850
{
851
    my( $name, $pArgs, $pObjs ) = @_;
852
    my( $def );
853
    my ( $res, @reslist );
854
    my $lib_base = "\$(LIBDIR)/${name}\$(GBE_TYPE)";
855
    my $lib_name = "$lib_base.${a}";
856
 
857
 
858
#.. Parse arguments
859
#
860
    $def = "";                                  # options
861
    $res = "";
862
 
863
    foreach $_ ( @$pArgs ) {
864
        if (/^--Def=(.*)/) {                    # library definition
865
            $def = "$1";
866
 
867
        } elsif (/^--Resource=(.*)/) {          # Resource definition
868
            ($res, @reslist) = ToolsetRClist( "$name", $1 );
869
 
870
        } else {                                # unknown
343 dpurdie 871
            Message( "$toolset_name AR: unknown option $_ -- ignored\n" );
303 dpurdie 872
        }
873
    }
874
 
875
#.. Resource Creation
876
#
877
    MakePrint( "#.. Library Resource ($name)\n\n" );
878
    ToolsetRCrecipe( $res, @reslist )
879
        if ( $res );
880
 
881
#.. Target
882
#
883
    MakePrint( "#.. Library ($name)\n\n" );     # label
884
 
885
    MakePrint( "$lib_name:\tLIBDEF=$def\n" ) if ($def);
886
    MakeEntry( "$lib_name:\t", "", "\\\n\t\t", ".$::o", @$pObjs );
887
    MakePrint( "\\\n\t\t$def" ) if ($def);
888
    MakePrint( "\\\n\t\t$res" ) if ($res);
889
    MakePrint( "\n\t\$(AR)" );
890
 
891
#
892
#   Track the name of the possible target file
893
#   Used when creating Visual Studio projects
894
#
895
    $target_file_lib = $lib_name;
896
 
897
#
898
#   To assist in debugging the static library it is nice to
899
#   keep the PDB file used to build the library, with the library.
900
#
901
#   If the library is being packaged or installed then add the PDB
902
#   file to the package / installation
903
#
904
#   NOTE: Due to the limitations of JATS/MicroSoft only one static
905
#   library can be built with a PDB file. The name of the PDB file
906
#   will be taken from the first static library encountered
907
#
908
    unless ( $pdb_first_lib )
909
    {
910
        $pdb_first_lib = $name;
911
        $pdb_file = $name;
912
    }
913
    else
914
    {
915
        Warning( "Multiple static libraries created with a common PDB file: $pdb_file, $name" )
916
            unless( $pdb_none );
917
    }
918
 
919
    PackageLibAddFiles( $name, "\$(OBJDIR)/$pdb_file\$(GBE_TYPE).pdb", "Class=debug" )
920
        unless( $pdb_none );
921
}
922
 
923
 
924
###############################################################################
925
#   ToolsetARLINT( $name, \@args, \@objs )
926
#       This subroutine takes the user options and builds the rules
927
#       required to build the library 'name'.
928
#
929
#   Arguments:
930
#       --xxx                   No arguments currently defined
931
#
932
#   Output:
933
#       [ $(LIBDIR)/name$_lint:   .... ]
934
#           $(ARLINT)
935
#
936
###############################################################################
937
 
938
sub ToolsetARLINT
939
{
940
    PCLintAR( @_ );
941
}
942
 
943
 
944
###############################################################################
945
#   ToolsetARMerge( $name, \@args, \@libs )
946
#       This subroutine takes the user options and builds the rules
947
#       required to build the library 'name' by merging the specified
948
#       libaries
949
#
950
#   Arguments:
951
#       --xxx                   No arguments currently defined
952
#
953
#   Output:
954
#       [ $(LIBDIR)/name$.${a}:   .... ]
955
#           ...
956
#
957
###############################################################################
958
 
959
sub ToolsetARMerge
960
{
961
    my ($name, $pArgs, $pLibs) = @_;
962
    MakePrint( "\n\t\$(ARMERGE)\n\n" );
963
 
964
    #
965
    #   Package up the PDB's with the library
966
    #   Note: The PDBs will be found in the OBJDIR
967
    #
968
    unless( $pdb_none )
969
    {
970
        for ( @{$pLibs} )
971
        {
972
            s~\$\(LIBDIR\)~\$(OBJDIR)~;
973
            PackageLibAddFiles( $name, "$_\$(GBE_TYPE).pdb", "Class=debug" );
974
        }
975
    }
976
}
977
 
978
 
979
###############################################################################
980
#   ToolsetSHLD $name, \@args, \@objs, \@libraries, $ver )
981
#       This subroutine takes the user options and builds the rules
982
#       required to link a shared library
983
#
984
#   Arguments:
985
#       --Def=xxxx.def[,opts]           # Definition file
986
#           --MutualDll                 # SubOption: Generate a Mutual DLL
987
#       --MutualDll                     # Generate a Mutual DLL (requires --Def=xxx)
988
#       --StubOnly                      # Only generate the stub library (requires --Def=xxx)
989
#       --Resource=xxxx.rc              # Resource file
990
#       --ResourceOnly                  # Only resources in this DLL
991
#       --Implib                        # Alternate ruleset
992
#       --NoPDB                         # Do not package the PDB file
993
#       --NoImplib                      # Do not package the import library
994
#       --Entry=xxxxx                   # Entry point
995
#       --NoAddLibs                     # Do not add libraries
996
#
997
#   Output:
998
#
999
#       There is two supported rule sets differentiated by --Implib
1000
#       The two are very similar and generated exportable files of:
1001
#
1002
#       --Implib
1003
#           ${name}.lib         - Stub lib adresses the versioned DLL
1004
#           ${name}.${ver}.dll
1005
#
1006
#       Default
1007
#           ${name}.lib         - Stub lib addresses UN-versioned DLL
1008
#           ${name}.dll
1009
#           ${name}.${ver}.dll
1010
#
1011
#       Note: Each DLL has an associated PDB file
1012
#
1013
#       Generation is identical for both rulesets. The default form does
1014
#       not export any stub library associated with the versioned DLL.
1015
#
1016
#   Implementation notes
1017
#   The process of creating a DLL and associated import library (LIB) is
1018
#
1019
#           ${name}.${ver}.dep
1020
#           ${name}.${ver}.pdb          - Exported
1021
#           ${name}.${ver}.ilk
1022
#           ${name}.${ver}.dll          - Exported
1023
#           ${name}.${ver}.map
1024
#           ${name}.lib                 - Exported + Optional
1025
#           ${name}.exp
1026
#
1027
#       Where:    lib = name
1028
#
1029
#       #.. Rules ($lib)
1030
#
1031
#       $(LIBDIR)/${lib}.lib:               $(LIBDIR)/${lib}.${ver}.dll
1032
#       $(LIBDIR)/${lib}.pdb:               $(LIBDIR)/${lib}.${ver}.dll
1033
#       $(LIBDIR)/${lib}.${ver}.pdb:        $(LIBDIR)/${lib}.${ver}.dll
1034
#
1035
#       $(LIBDIR)/${lib}.${ver}.dep:        SHBASE=${name}
1036
#       $(LIBDIR)/${lib}.${ver}.dep:        SHNAME=${lib}.${ver}
1037
#       $(LIBDIR)/${lib}.${ver}.dep:        \$(LIBDIR)
1038
#       $(LIBDIR)/${lib}.${ver}.dep:        Makefile
1039
#           $(SHLDDEPEND)
1040
#
1041
#       $(LIBDIR)/${lib}.${ver}.${so}:      SHBASE=${name}
1042
#       $(LIBDIR)/${lib}.${ver}.${so}:      SHNAME=${lib}.${ver}
1043
#       $(LIBDIR)/${lib}.${ver}.${so}:      CFLAGS+=$(SHCFLAGS)
1044
#       $(LIBDIR)/${lib}.${ver}.${so}:      CXXLAGS+=$(SHCXXFLAGS)
1045
#       $(LIBDIR)/${lib}.${ver}.${so}:      ${def}
1046
#       $(LIBDIR)/${lib}.${ver}.${so}:      $(OBJDIR)/${name} \
1047
#                       object list ... \
1048
#                       $(LIBDIR)/${lib}.${ver}.dep
1049
#           $(SHLD)
1050
#           @$(cp) -f $(LIBDIR)/${lib}.${ver}.pdb $(LIBDIR)/${lib}.pdb
1051
#
1052
#       ifneq "$(findstring $(IFLAG),23)" ""
1053
#       -include        "$(LIBDIR)/${lib}.${ver}.dep"
1054
#       endif
1055
#
1056
#       #.. Linker commands ($lib)
1057
#
1058
#       ${lib}_ld       += ...
1059
#               standard flags                          \
1060
#               -implib:$${lib}.lib
1061
#
1062
#       #.. Linker commands ($lib)
1063
#
1064
#       ${lib}_shdp     += ...
1065
#
1066
###############################################################################
1067
 
1068
sub ToolsetSHLD
1069
{
1070
    our( $name, $pArgs, $pObjs, $pLibs, $ver ) = @_;
1071
    our( $def, $mutual_dll, $res, @reslist, $doimplib, $stub_only );
1072
    our( $no_implib, $no_pdb, $resource_only );
1073
    our( $entry, $noaddlibs );
1074
 
1075
#.. Parse arguments
1076
#
1077
    $def = "";                                  # options
1078
    $doimplib = 0;
1079
    $res = "";
1080
    $no_pdb = $pdb_none;
1081
 
1082
    foreach $_ ( @$pArgs ) {
1083
        if (/^--Def=(.*?)(\,(.*))?$/) {         # Library definition
1084
            #
1085
            #   Locate the Def file.
1086
            #   If it is a generate file so it will be in the SRCS hash
1087
            #   Otherwise the user will have to use Src to locate the file
1088
            #
1089
            $def = MakeSrcResolve($1);
1090
 
1091
            #
1092
            #   Process sub options to --Def
1093
            #
1094
            next unless ($2);
1095
            if ( $3 =~ /^--MutualDll$/ ) {
1096
                $mutual_dll = 1;
1097
            } else {
343 dpurdie 1098
                Message( "$toolset_name SHLD: unknown option $_ -- ignored\n" );
303 dpurdie 1099
            }
1100
 
1101
        } elsif (/^--Resource=(.*)/) {          # Resource definition
1102
            ($res, @reslist) = ToolsetRClist( "$name/$name", $1 );
1103
 
1104
        } elsif (/^--ResourceOnly/) {          # Resource definition
1105
            $resource_only = 1;
1106
 
1107
        } elsif (/^--Implib$/) {
1108
            $doimplib = 1;
1109
 
1110
        } elsif (/^--NoImplib$/) {
1111
            $no_implib = 1;
1112
 
1113
        } elsif (/^--NoPDB$/) {
1114
            $no_pdb = 1;
1115
 
1116
        } elsif (/^--Entry=(.*)/) {
1117
            $entry = $1;
1118
 
1119
        } elsif (/^--NoAddLib/) {
1120
            $noaddlibs = 1;
1121
 
1122
        } elsif (/^--MutualDll$/) {
1123
            $mutual_dll = 1;
1124
 
1125
        } elsif (/^--Stubonly/) {
1126
            $stub_only = 1;
1127
 
1128
        } else {                                # unknown
343 dpurdie 1129
            Message( "$toolset_name SHLD: unknown option $_ -- ignored\n" );
303 dpurdie 1130
        }
1131
    }
1132
 
1133
    #
1134
    #   Sanity test
1135
    #
343 dpurdie 1136
    Error ("$toolset_name SHLD:Stubonly option requires --Def=file ")
303 dpurdie 1137
        if ( $stub_only && ! $def );
1138
 
343 dpurdie 1139
    Error ("$toolset_name SHLD:MutualDll option requires --Def=file ")
303 dpurdie 1140
        if ( $mutual_dll && ! $def );
1141
 
1142
 
1143
 
1144
#.. Build rules
1145
#
1146
#   base    -   Basic name of the DLL
1147
#   name    -   Name of the Export library (Optional)
1148
#   lib     -   Name of the DLL
1149
#
1150
    sub BuildSHLD
1151
    {
1152
        my ($base, $name, $lib) = @_;
1153
        my $full = $lib.".$::so";
1154
        my $link_with_def;
1155
 
1156
    #.. Cleanup rules
1157
    #
1158
    #   ld      Linker command file
1159
    #   map     Map file
1160
    #   pdb     Microsoft C/C++ program database
1161
    #   ilk     Microsoft Linker Database
1162
    #
1163
        ToolsetGenerate( "\$(LIBDIR)/${lib}.ld" );
1164
        ToolsetGenerate( "\$(LIBDIR)/${lib}.map" );
1165
        ToolsetGenerate( "\$(LIBDIR)/${lib}.exp" );
1166
        ToolsetGenerate( "\$(LIBDIR)/${lib}.ilk" );
1167
        ToolsetGenerate( "\$(LIBDIR)/${full}" );
1168
 
1169
    #.. Linker rules
1170
    #
1171
        my ($io) = ToolsetPrinter::New();
1172
 
1173
        my $import_lib;
1174
        my $export_file;
1175
 
1176
        if ( $name && $def && ($mutual_dll || $stub_only ) )
1177
        {
1178
            #
1179
            #   Creating an Export library from user .DEF file
1180
            #   It is possible to create the stub library in the LIB phase
1181
            #   which allows DLLs with mutual imports
1182
            #
1183
            $io->Label( "Import(stub) library for mutual exports", $name );
1184
            $export_file = "\$(LIBDIR)/${name}.exp";
1185
 
1186
            #
1187
            #   Rules and recipe to generate the stub library
1188
            #
1189
            $io->Prt( "\$(LIBDIR)/${name}.exp:\t\$(LIBDIR)/${name}.${a}\n" );
1190
            $io->Prt( "\$(LIBDIR)/${name}.${a}:\tLIBDEF=$def\n" );
1191
            $io->Prt( "\$(LIBDIR)/${name}.${a}:\tLIBNAME=$lib\n" );
1192
            $io->Entry( "\$(LIBDIR)/${name}.${a}: \\\n\t\t\$(OBJDIR)/${base}",
1193
                                            "", " \\\n\t\t", ".$::o", @$pObjs );
1194
            $io->Prt( " \\\n\t\t$def" );
1195
            $io->Prt( "\n\t\t\$(AR)\n" );
1196
            $io->Newline();
1197
 
1198
            #
1199
            #   Files to be cleanup up
1200
            #
1201
            ToolsetGenerate( "\$(LIBDIR)/${name}.exp" );
1202
            ToolsetGenerate( "\$(LIBDIR)/${name}.${a}" );
1203
 
1204
            #
1205
            #   If the DLL is being packaged/installed then add the static
1206
            #   stub library to the packaging lists as a static library
1207
            #   This will allow the stub library to be installed with the
1208
            #   static libraries and thus allow DLL's with mutual imports
1209
            #
1210
            PackageShlibAddLibFiles ($base, "\$(LIBDIR)/${name}.${a}" )
1211
                unless ($resource_only);
1212
 
1213
            #
1214
            #   Add the stub library to the list of libraries being created
1215
            #   Note: Don't do if not created with .DEF file
1216
            #
1217
            push @::LIBS, $base;
1218
 
1219
        }
1220
        else
1221
        {
1222
            #
1223
            #   The stub library is created as part of the DLL generation
1224
            #   Whether we like it or not - so we need to control the name
1225
            #   and location
1226
            #
1227
            my $slname = ($name) ? $name : $lib;
1228
            $import_lib = "\$(LIBDIR)/${slname}.${a}";
1229
 
1230
            $io->Label( "Import(stub) library", $slname );
1231
            $io->Prt( "$import_lib:\t\$(LIBDIR)/${full}\n" );
1232
            $io->Newline();
1233
 
1234
            ToolsetGenerate( $import_lib );
1235
            ToolsetGenerate( "\$(LIBDIR)/${slname}.exp" );
1236
 
1237
            #
1238
            #   Package the generated stub library, if it is being
1239
            #   created on request.
1240
            #
1241
            #   Package it with the shared libaries and not the static
1242
            #   libraries as it will be created with the shared library
1243
            #
1244
            PackageShlibAddFiles ($base, $import_lib, 'Class=lib' )
1245
                if ($name && ! $no_implib && ! $resource_only);
1246
 
1247
            #
1248
            #   Indicate that we will be linking with a DEF file
1249
            #
1250
            $link_with_def = 1 if ( $def );
1251
        }
1252
 
1253
        #
1254
        #   If we are only creating a stub library, then the hard work has been
1255
        #   done.
1256
        #
1257
        return
1258
            if ($stub_only);
1259
 
1260
        $io->Label( "Shared library", $name );
1261
 
1262
        #
1263
        #   The process of creating a DLL will generate PDB file
1264
        #   Control the name of the PDB file
1265
        #
1266
        my $pdb_file = "\$(LIBDIR)/${lib}.pdb";
1267
        unless( $no_pdb )
1268
        {
1269
            $io->Prt( "$pdb_file:\t\$(LIBDIR)/${full}\n" );
1270
            ToolsetGenerate( $pdb_file );
1271
        }
1272
 
1273
        #
1274
        #   Package the PDB file up with the DLL
1275
        #   Package the DLL - now that we know its proper name
1276
        #
1277
        PackageShlibAddFiles( $base, $pdb_file, 'Class=debug' ) unless $no_pdb ;
1278
        PackageShlibAddFiles( $base, "\$(LIBDIR)/${full}" );
1279
 
1280
        #
1281
        #   Generate Shared Library dependency information
1282
        #
335 dpurdie 1283
        my $dep = $io->SetShldTarget( $lib );
303 dpurdie 1284
 
1285
        #
1286
        #   Generate rules and recipes to create the body of the shared
1287
        #   library. Several build variables are overiden when creating
1288
        #   a shared library.
1289
        #
1290
        $io->Prt( "\$(LIBDIR)/${full}:\tSHBASE=${lib}\n" );
1291
        $io->Prt( "\$(LIBDIR)/${full}:\tSHNAME=${lib}\n" );
1292
        $io->Prt( "\$(LIBDIR)/${full}:\tCFLAGS+=\$(SHCFLAGS)\n" );
1293
        $io->Prt( "\$(LIBDIR)/${full}:\tCXXLAGS+=\$(SHCXXFLAGS)\n" );
1294
        $io->Prt( "\$(LIBDIR)/${full}:\t$export_file\n" ) if ($export_file );
1295
        $io->Prt( "\$(LIBDIR)/${full}:\t$res\n" ) if ( $res );
1296
 
335 dpurdie 1297
        $io->Entry( "\$(LIBDIR)/${full}: $dep \\\n\t\t\$(OBJDIR)/${base}",
303 dpurdie 1298
            "", " \\\n\t\t", ".$::o", @$pObjs );
1299
 
1300
        $io->Prt( " \\\n\t\t$def" ) if ( $link_with_def );
335 dpurdie 1301
        $io->Prt( "\n\t\$(SHLD)\n" );
303 dpurdie 1302
 
1303
        $io->Newline();
1304
 
1305
        #.. Linker command file
1306
        #
1307
        #       Now the fun part... piecing together a variable ${name}_shld
1308
        #       which ends up in the command file.
1309
        #
1310
        $io->SetTag( "${lib}_shld" );          # command tag
1311
 
1312
        $io->Label( "Linker commands", $name ); # label
1313
 
1314
        $io->Cmd( "-dll" );
1315
        $io->Cmd( "-noentry" )if ($resource_only);
1316
        $io->Cmd( "-def:$def" ) if ($link_with_def);
1317
        $io->Cmd( "-out:\$(subst /,\\\\,\$(LIBDIR)/${full})" );
1318
        $io->Cmd( "-implib:\$(subst /,\\\\,$import_lib)" ) if ($import_lib);
1319
        $io->Cmd( "-pdb:\$(subst /,\\\\,$pdb_file)" ) unless ( $no_pdb );
1320
        $io->Cmd( "-debug:none" )                     if ($no_pdb);
1321
        $io->Cmd( "-pdb:none" )                       if ($no_pdb);
1322
        $io->Cmd( "-entry:$entry" )                   if ($entry);
1323
        $io->Cmd( "-map:\$(subst /,\\\\,\$(LIBDIR)/${lib}).map" );
1324
        $io->Cmd( "\$(subst /,\\\\,$res)" ) if ( $res );
1325
        $io->Cmd( "\$(subst /,\\\\,$export_file)" ) if ( $export_file );
1326
 
1327
                                                # object list
1328
        $io->ObjList( $name, $pObjs, \&ToolsetObjRecipe );
1329
 
1330
                                                # library list
1331
        $io->LibList( $name, $pLibs, \&ToolsetLibRecipe );
1332
 
1333
        $io->Newline();
1334
 
1335
        #.. Dependency link,
335 dpurdie 1336
        #   Create a library dependency file
1337
        #       Create command file to build applicaton dependency list
1338
        #       from the list of dependent libraries
303 dpurdie 1339
        #
335 dpurdie 1340
        #       Create makefile directives to include the dependency
1341
        #       list into the makefile.
303 dpurdie 1342
        #
335 dpurdie 1343
        $io->DepRules( $pLibs, \&ToolsetLibRecipe, "\$(LIBDIR)/${full}" );
1344
        $io->SHLDDEPEND( $name, $lib );
303 dpurdie 1345
    }
1346
 
1347
    ToolsetLibStd( $pLibs )                    # push standard libraries
1348
        unless ( $noaddlibs );
1349
 
1350
    if ( $doimplib ) {
1351
        #
1352
        #   --Implib flavor will create
1353
        #       a) Import library   $name$(GBE_TYPE).lib
1354
        #       b) Versioned DLL    $name$(GBE_TYPE).xx.xx.xx.dll
1355
        #
1356
        $target_file_dll = "\$(LIBDIR)/$name\$(GBE_TYPE).$ver.$::so";
1357
        BuildSHLD(
1358
            "$name",                        # Base Name
1359
            "$name\$(GBE_TYPE)",            # Name of Export Lib
1360
            "$name\$(GBE_TYPE).$ver");      # Name of the DLL + PDB
1361
 
1362
    } else {
1363
        #
1364
        #   Original flavor will create
1365
        #       a) Import library   $name$(GBE_TYPE).lib    ---+
1366
        #       b) Unversioned DLL  $name$(GBE_TYPE).dll    <--+
1367
        #       c) Versioned DLL    $name$(GBE_TYPE).xx.xx.xx.dll
1368
        #
1369
        MakePrint(
1370
            "# .. Versioned image\n\n".
1371
            "\$(LIBDIR)/${name}\$(GBE_TYPE).$::so:\t".
1372
            "\$(LIBDIR)/${name}\$(GBE_TYPE).$ver.$::so\n".
1373
            "\n" );
1374
 
1375
        $target_file_dll = "\$(LIBDIR)/$name\$(GBE_TYPE).$::so";
1376
        BuildSHLD( "$name", "$name\$(GBE_TYPE)" , "$name\$(GBE_TYPE)" );
1377
        BuildSHLD( "$name", ""                  , "$name\$(GBE_TYPE).$ver" );
1378
    }
1379
 
1380
    #.. Resource File
1381
    #
1382
    ToolsetRCrecipe( $res, @reslist )
1383
        if ( $res );
1384
}
1385
 
1386
 
1387
###############################################################################
1388
#   ToolsetSHLDLINT $name, \@args, \@objs, \@libraries )
1389
#       This subroutine takes the user options and builds the rules
1390
#       required to lint the program 'name'.
1391
#
1392
#   Arguments:
1393
#       (none)
1394
#
1395
#   Output:
1396
#       [ $(LIBDIR)/$name_lint:   .... ]
1397
#           $(SHLIBLINT)
1398
#
1399
###############################################################################
1400
 
1401
sub ToolsetSHLDLINT
1402
{
1403
    PCLintSHLIB( @_ );
1404
}
1405
 
1406
 
1407
###############################################################################
335 dpurdie 1408
# Function        : ToolsetLD
303 dpurdie 1409
#
335 dpurdie 1410
# Description     : Takes the user options and builds the rules required to
1411
#                   link the program 'name'.
303 dpurdie 1412
#
335 dpurdie 1413
# Inputs          : $name           - base name of the program
1414
#                   $pArgs          - Ref to program arguments
1415
#                   $pObjs          - Ref to program objects
1416
#                   $pLibs          - Ref to program library list
303 dpurdie 1417
#
335 dpurdie 1418
# Returns         : Nothing
303 dpurdie 1419
#
335 dpurdie 1420
# Output:         : Rules and recipes to create a program
1421
#                       Create program rules and recipes
1422
#                       Create linker input script
1423
#                       Create library dependency list
1424
#                       Include library dependency information
303 dpurdie 1425
#
1426
sub ToolsetLD
1427
{
1428
    my ( $name, $pArgs, $pObjs, $pLibs ) = @_;
1429
    my ( $res, @reslist );
1430
    my $no_pdb =$pdb_none;
1431
    our( $entry, $noaddlibs );
1432
 
1433
#.. Parse arguments
1434
#
1435
    foreach ( @$pArgs ) {
1436
        if (/^--Resource=(.*)/) {               # Resource definition
1437
            ($res, @reslist) = ToolsetRClist( $name, $1 );
1438
 
1439
        } elsif (/^--NoPDB$/) {
1440
            $no_pdb = 1;
1441
 
1442
        } elsif (/^--Entry=(.*)/) {
1443
            $entry = $1;
1444
 
1445
        } elsif (/^--NoAddLib/) {
1446
            $noaddlibs = 1;
1447
 
1448
        } else {
343 dpurdie 1449
            Message( "$toolset_name LD: unknown option $_ -- ignored\n" );
303 dpurdie 1450
 
1451
        }
1452
    }
1453
 
335 dpurdie 1454
#.. Names of important files
1455
#
1456
    my $base = "\$(BINDIR)/${name}";
1457
    my $full = $base . $::exe;
1458
    my $map  = $base . '.map';
1459
    my $pdb  = $base . '.pdb';
1460
 
1461
 
303 dpurdie 1462
#.. Cleanup rules
1463
#
1464
#   ld      Linker command file
1465
#   map     Map file
1466
#   pdb     Microsoft C/C++ program database
1467
#   ilk     Microsoft Linker Database
1468
#   res     Compiled resource script
1469
#
335 dpurdie 1470
    ToolsetGenerate( $map );
1471
    ToolsetGenerate( $pdb );
1472
    ToolsetGenerate( $base . '.ld' );
1473
    ToolsetGenerate( $base . '.ilk' );
303 dpurdie 1474
 
335 dpurdie 1475
#.. Toolset Printer
303 dpurdie 1476
#
1477
    my ($io) = ToolsetPrinter::New();
335 dpurdie 1478
    my $dep = $io->SetLdTarget( $name );
303 dpurdie 1479
 
335 dpurdie 1480
#
1481
#.. Linker command
1482
#
1483
    $io->Prt( "$full : $dep " );
1484
    $io->Entry( "", "", "\\\n\t", ".$::o ", @$pObjs );
1485
    $io->Prt( "\\\n\t$res " ) if ( $res );
1486
    $io->Prt( "\n\t\$(LD)\n\n" );
303 dpurdie 1487
 
1488
#.. Linker command file
1489
#
1490
#       Now piece together a variable $(name_ld) which ends up in
1491
#       the command file linking the application.
1492
#
1493
    $io->SetTag( "${name}_ld" );                # macro tag
1494
 
1495
    $io->Label( "Linker commands", $name );     # label
1496
 
335 dpurdie 1497
    $io->Cmd( "-out:\$(subst /,\\\\,$full)" );
1498
    $io->Cmd( "-pdb:\$(subst /,\\\\,$pdb)" )        unless ($no_pdb);
2429 dpurdie 1499
    $io->Cmd( "-debug:none" )                       if ($no_pdb);
1500
    $io->Cmd( "-pdb:none" )                         if ($no_pdb);
1501
    $io->Cmd( "-entry:$entry" )                     if ($entry);
335 dpurdie 1502
    $io->Cmd( "-map:\$(subst /,\\\\,$map)" );
1503
    $io->Cmd( "\$(subst /,\\\\,$res)" )             if ( $res );
303 dpurdie 1504
 
335 dpurdie 1505
    ToolsetLibStd( $pLibs ) unless ( $noaddlibs );      # push standard libraries
1506
    $io->ObjList( $name, $pObjs, \&ToolsetObjRecipe );  # object list
1507
    $io->LibList( $name, $pLibs, \&ToolsetLibRecipe );  # library list
303 dpurdie 1508
    $io->Newline();
1509
 
335 dpurdie 1510
    #.. Dependency link,
1511
    #   Create a library dependency file
1512
    #       Create command file to build applicaton dependency list
1513
    #       from the list of dependent libraries
1514
    #
1515
    #       Create makefile directives to include the dependency
1516
    #       list into the makefile.
1517
    #
1518
    $io->DepRules( $pLibs, \&ToolsetLibRecipe, $full );
1519
    $io->LDDEPEND();
303 dpurdie 1520
 
1521
#.. Compile up the resource file
1522
#
1523
    ToolsetRCrecipe( $res, @reslist )
1524
        if ( $res );
1525
 
1526
#.. Package up the PDB file with the program
1527
#
335 dpurdie 1528
    PackageProgAddFiles ( $name, $full );
1529
    PackageProgAddFiles ( $name, $pdb, "Class=debug" ) unless ( $no_pdb );
303 dpurdie 1530
 
1531
#
1532
#   Track the name of the possible target file
1533
#   Used when creating Visual Studio projects
1534
#
335 dpurdie 1535
    $target_file_exe = $full;
303 dpurdie 1536
}
1537
 
1538
 
1539
###############################################################################
1540
#   ToolsetLD( $name, \@args, \@objs, \@libraries, \@csrc, \@cxxsrc )
1541
#       This subroutine takes the user options and builds the rules
1542
#       required to lint the program 'name'.
1543
#
1544
#   Arguments:
1545
#       (none)
1546
#
1547
#   Output:
1548
#       [ $(BINDIR)/$name_lint:   .... ]
1549
#           $(LDLINT)
1550
#
1551
###############################################################################
1552
 
1553
sub ToolsetLDLINT
1554
{
1555
    PCLintLD( @_ );
1556
}
1557
 
1558
 
1559
########################################################################
1560
#
1561
#   Push standard "system" libraries. This is a helper function
1562
#   used within this toolset.
1563
#
1564
#   Arguments:
1565
#       $plib       Reference to library array.
1566
#
1567
########################################################################
1568
 
1569
sub ToolsetLibStd
1570
{
1571
    my ($plib) = @_;
1572
 
1573
    #
1574
    #   Only add libraries if required
1575
    #
1576
    return unless( $::ScmCompilerOpts{'ADDLINKLIBS'} );
1577
 
1578
}
1579
 
1580
 
1581
########################################################################
1582
#
1583
#   Generate a linker object recipe.  This is a helper function used 
1584
#   within this toolset.
1585
#
1586
#   Arguments:
1587
#       $io         I/O stream
1588
#
1589
#       $target     Name of the target
1590
#
1591
#       $obj        Library specification
1592
#
1593
########################################################################
1594
 
1595
sub ToolsetObjRecipe
1596
{
1597
    my ($io, $target, $obj) = @_;
1598
 
1599
    $io->Cmd( "\$(subst /,\\\\,\$(strip $obj)).$::o" );
1600
}
1601
 
1602
 
1603
########################################################################
1604
#
1605
#   Generate a linker/depend library recipe.  This is a helper function
1606
#   used within this toolset.
1607
#
1608
#   Arguments:
1609
#       $io         I/O stream
1610
#
1611
#       $target     Name of the target
1612
#
1613
#       $lib        Library specification
1614
#
1615
#       $dp         If building a depend list, the full target name.
1616
#
1617
########################################################################
1618
 
1619
sub ToolsetLibRecipe
1620
{
1621
    my ($io, $target, $lib, $dp) = @_;
1622
 
1623
    return                                      # ignore (compat)
1624
        if ( $lib eq "rt" ||        $lib eq "thread" ||
1625
             $lib eq "pthread" ||   $lib eq "nsl" ||
1626
             $lib eq "socket" );
1627
 
1628
    if ( !defined($dp) ) {                      # linker
1629
        $io->Cmd( "\$(subst /,\\\\,\$(strip $lib)).$::a" );
1630
 
1631
    } else {                                    # depend
1632
        $io->Cmd( "$dp:\t@(vlib2,$lib,LIB)" );
1633
    }
1634
}
1635
 
1636
 
1637
########################################################################
1638
#
1639
#   Parse resource file data
1640
#   This is a helper function used within this toolset
1641
#
1642
#   Arguments   : $1  BaseName
1643
#                 $2  The users resource list
1644
#                     This is a list of comma seperated files
1645
#                     The first file is the main resource script
1646
#
1647
#   Returns     : An array of resource files with full pathnames
1648
#                 [0] = The output file
1649
#                 [1] = The input file
1650
#                 [..] = Other input files
1651
#
1652
########################################################################
1653
 
1654
sub ToolsetRClist
1655
{
1656
    my ($name, $files) = @_;
1657
    my @result;
1658
 
1659
    #
1660
    #   Generate the name of the output file
1661
    #
1662
    push @result, "\$(OBJDIR)/$name.res";
1663
 
1664
    #
1665
    #   Process each user file
1666
    #
335 dpurdie 1667
    for (split( '\s*,\s*', $files ))
303 dpurdie 1668
    {
1669
        #
1670
        #   Locate the file.
1671
        #   If it is a generate file so it will be in the SRCS hash
1672
        #   Other wise the use will have to use Src to locate the file
1673
        #
1674
        push @result, MakeSrcResolve($_);
1675
    }
1676
 
1677
    #
1678
    #   Return the array to the user
1679
    #
1680
    return @result;
1681
}
1682
 
1683
 
1684
########################################################################
1685
#
1686
#   Generate a resource file recipe
1687
#   This is a helper function used within this tool
1688
#
1689
#   Arguments   : $1  Output resource file
1690
#                 ..  Input resource files
1691
#
1692
########################################################################
1693
 
1694
sub ToolsetRCrecipe
1695
{
1696
    my ($out, @in) = @_;
1697
 
1698
    #
1699
    #   Cleanup
1700
    #
1701
    ToolsetGenerate( $out );
1702
 
1703
    #
1704
    #   Recipe
1705
    #
1706
    MakePrint( "\n#.. Compile Resource file: $out\n\n" );
1707
    MakePrint( "$out:\t\$(GBE_PLATFORM).mk\n" );
1708
    MakeEntry( "$out:\t", "", "\\\n\t\t", " ", @in );
1709
    MakePrint( "\n\t\$(RC)\n" );
1710
    MakePrint( "\n" );
1711
}
1712
 
1713
########################################################################
1714
#
1715
#   Generate a project from the provided project file
1716
#
1717
#   Arguments   : $name             - Base name of the project
1718
#                 $project          - Path to the project file
1719
#                 $pArgs            - Project specific options
1720
#
1721
########################################################################
1722
 
1723
my $project_defines_done = 0;
1724
sub ToolsetPROJECT
1725
{
1726
    my( $name, $project, $pArgs ) = @_;
1727
    my $buildcmd = $toolchain_info->{'buildcmd'};
1728
    my $cleancmd = $toolchain_info->{'cleancmd'};
343 dpurdie 1729
    my $release = ${$toolchain_info->{'def_targets'}}[0] || 'RELEASE';
1730
    my $debug =   ${$toolchain_info->{'def_targets'}}[1] || 'DEBUG';
303 dpurdie 1731
 
1732
    #
1733
    #   Process options
1734
    #
1735
    foreach ( @$pArgs ) {
343 dpurdie 1736
        if ( m/^--TargetProd*=(.+)/ ) {
1737
            $release = $1;
1738
 
1739
        } elsif ( m/^--TargetDebug=(.+)/ ) {
1740
            $debug = $1;
1741
 
1742
        } else {
1743
            Message( "$toolset_name PROJECT: unknown option $_ -- ignored\n" );
1744
        }
303 dpurdie 1745
    }
343 dpurdie 1746
 
303 dpurdie 1747
    my ($io) = ToolsetPrinter::New();
1748
 
1749
    #
343 dpurdie 1750
    #   Setup toolset specific difinitions. Once
303 dpurdie 1751
    #
1752
    unless( $project_defines_done )
1753
    {
1754
        $project_defines_done = 1;
343 dpurdie 1755
        $io->PrtLn( 'project_target = $(if $(findstring 1,$(DEBUG)),$2,$1)' );
303 dpurdie 1756
        $io->Newline();
1757
    }
1758
 
1759
    #
1760
    #   Process the build and clean commands
1761
    #       Substitute arguments
1762
    #           =TYPE=
1763
    #           =LOG=
1764
    #           =DSW=
1765
    #           =CEPLATFORM=
1766
    #
343 dpurdie 1767
    $buildcmd =~ s~=TYPE=~"\$(call project_target,$release,$debug)"~g;
303 dpurdie 1768
    $buildcmd =~ s~=LOG=~$name\$(GBE_TYPE).log~g;
1769
    $buildcmd =~ s~=DSW=~$project~g;
1770
    $buildcmd =~ s~=CEPLATFORM=~\$(WCE_PLATFORM)~g;
1771
 
343 dpurdie 1772
    $cleancmd =~ s~=TYPE=~"\$(call project_target,$release,$debug)"~g;
303 dpurdie 1773
    $cleancmd =~ s~=LOG=~$name\$(GBE_TYPE).log~g;
1774
    $cleancmd =~ s~=DSW=~$project~g;
1775
    $cleancmd =~ s~=CEPLATFORM=~\$(WCE_PLATFORM)~g;
1776
 
1777
    #
1778
    #   Generate the recipe to create the project
1779
    #
1780
    $io->Label( "Build project", $name );
1781
    $io->PrtLn( "Project_$name: $project" );
1782
    $io->PrtLn( "\t\$(XX_PRE)( \$(rm) -f $name\$(GBE_TYPE).log; \\" );
1783
    $io->PrtLn( "\t\$(show_environment); \\" );
1784
    $io->PrtLn( "\t$buildcmd; \\" );
1785
    $io->PrtLn( "\tret=\$\$?; \\" );
1786
    $io->PrtLn( "\t\$(GBE_BIN)/cat $name\$(GBE_TYPE).log; \\" );
1787
    $io->PrtLn( "\texit \$\$ret )" );
1788
    $io->Newline();
1789
 
1790
    #
1791
    #   Generate the recipe to clean the project
1792
    #
1793
    $io->Label( "Clean project", $name );
1794
    $io->PrtLn( "ProjectClean_$name: $project" );
1795
    $io->PrtLn( "\t-\$(XX_PRE)$cleancmd" );
1796
    $io->PrtLn( "\t-\$(XX_PRE)\$(rm) -f $name\$(GBE_TYPE).log" );
1797
    $io->Newline();
1798
 
1799
}
1800
 
1801
 
1802
#.. Successful termination
1803
1;
1804