Subversion Repositories DevTools

Rev

Rev 5709 | Rev 6177 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
227 dpurdie 1
# -*- mode: perl; tabs: 8; indent-width: 4; show-tabs: yes; -*-
5709 dpurdie 2
# Copyright (c) VIX TECHNOLOGY (AUST) LTD
227 dpurdie 3
#
4
# Module name   : Makelib.pl
5
# Module type   : Makefile system
6
#
7
# Description:
8
#       This modules builds the primary makefile for each directory,
9
#       used in conjunction with Makelib.pl2.  The produced makefile
10
#       acts as a frontend to platform builds.
11
#
12
# Notes:
13
#
14
#                       *** DO NOT DETAB ***
15
#
16
#       Beware the use of space v's tab characters within the
17
#       makefile generation sessions.
18
#
19
#.........................................................................#
20
 
255 dpurdie 21
require 5.006_001;
227 dpurdie 22
use strict;
23
use warnings;
261 dpurdie 24
use Getopt::Long;
263 dpurdie 25
use JatsError;
227 dpurdie 26
use JatsEnv;
27
use JatsMakeInfo qw(:create);
6133 dpurdie 28
use ToolsetFiles;
227 dpurdie 29
 
30
our $MakelibVersion         = "2.33";           # makelib.pl version
31
 
3967 dpurdie 32
our $ScmRoot;
227 dpurdie 33
our $ScmSrcDir              = "";
34
our $ScmMakelib             = "";
35
our @ScmDepends             = ();
36
our $ScmExpert              = 0;
37
our $ScmAll                 = 0;
38
our $ProjectBase            = "";               # Base of the user's project
39
our $ScmInterface           = "interface";
40
 
41
our @SUBDIRS                = ();
42
our @PLATFORMS              = ();
43
our %PLATFORMARGS           = ();
44
our @DEFINES                = "";
45
our @RULES                  = ();
46
 
47
our %PACKAGE_DIST           = ();
48
 
49
our $ROOTMAKEFILE           = 0;
50
our $PLATFORMINCLUDED       = 0;
51
our @BUILDPLATFORMS         = ();
52
 
263 dpurdie 53
our $GBE_CONFIG;
54
our $GBE_TOOLS;
55
our $GBE_PERL;
227 dpurdie 56
 
57
#.. Running under 'buildlib.pl' ?
331 dpurdie 58
#       This will be the 'require .../makelib.pl' that is present in
59
#       the build.pl files. Yes, its overly complicated, but it was
60
#       the way it was done.
227 dpurdie 61
#
62
unless ( $::ScmBuildlib )
63
{
64
    MakeLibInit();
65
}
66
 
67
sub MakeLibInit
68
{
261 dpurdie 69
    #.. Test environment
70
    #
227 dpurdie 71
    EnvImport( "GBE_BIN" );
72
    EnvImport( "GBE_PERL" );
73
    EnvImport( "GBE_TOOLS" );
74
    EnvImport( "GBE_CONFIG" );
75
    EnvImport( "GBE_MACHTYPE" );
76
 
261 dpurdie 77
    #.. Common stuff
78
    #
227 dpurdie 79
    require "$::GBE_TOOLS/common.pl";
80
 
81
    CommonInit( "makelib " );
82
    Debug( "version:   $MakelibVersion" );
83
 
261 dpurdie 84
    #.. Parse command line
85
    #       makefile.pl  rootdir Makelib.pl [options ...]
86
    #
87
    Verbose ("Command Line: @ARGV");
88
    my $opt_help = 0;
89
    my $result = GetOptions (
90
                "help+"         => \$opt_help,
91
                "interface=s"   => \$::ScmInterface,
92
                );
93
 
94
    MLUsage() if ( $opt_help || !$result );
95
 
96
    #
97
    #   Needs 2 command line arguments
98
    #
227 dpurdie 99
    $::ScmRoot    = StripDrive( ${ARGV[0]} );
279 dpurdie 100
    $::ScmRoot    = '/./' if ( $::ScmRoot eq '/'  );    # Prevent leading '//'
227 dpurdie 101
    $::ProjectBase= $::ScmRoot;
102
    $::ScmMakelib = ${ARGV[1]};
103
 
104
    Debug( "ARGV:      @ARGV" );
105
    Debug( "Root:      $::ScmRoot" );
106
    Debug( "Makelib:   $::ScmMakelib" );
107
 
261 dpurdie 108
    #.. Get the stuff from the platform definition file
109
    #
227 dpurdie 110
    ConfigLoad();
111
 
261 dpurdie 112
    #.. Get the stuff from the package definition file
113
    #
227 dpurdie 114
    require "$::ScmRoot/package.pl"
115
        if ( -f "$::ScmRoot/package.pl" );
116
}
117
 
118
#   MLUsage ---
119
#       Makelib command line usage.
120
#..
121
 
122
sub MLUsage
123
{
261 dpurdie 124
    Error ( "Usage: perl makefile.pl <ROOTDIR> <makelib.pl> [options ...]",
125
            "Valid options:",
126
            "   --help            Display Help",
127
            "   --interface=name  Set interface directory",
128
            );
227 dpurdie 129
}
130
 
131
#-------------------------------------------------------------------------------
132
# Function        : SubDir
133
#
134
# Description     : Recurse into the specified sub directories
135
#                   This is one of the very few directives in a 'makefile.pl'
136
#                   that is processed by this script - all the others are
137
#                   processed by makelib.pl2.
138
#
139
#                   This directive MUST appear before the 'Platform' directive
140
#
141
# Inputs          : List of sub directories to visit
142
#
143
# Returns         : Nothing
144
#
145
sub SubDir
146
{
147
    my( @NewDirs );
148
    Debug( "SubDir(@_)" );
149
    Error ("Directive 'SubDir' not allowed in this context") if ( $::ScmBuildlib  );
150
 
151
    #
152
    #   Support different constructs:
153
    #       'dir1 dir2'
154
    #       'dir1','dir2'
155
    #
156
    @NewDirs = map { split /\s+/ } @_;
157
    @NewDirs = grep { defined $_ } @NewDirs;
158
 
159
    foreach my $ThisDir ( @NewDirs )
160
    {
2450 dpurdie 161
        $ThisDir =~ s~/+$~~;
227 dpurdie 162
        Warning ("SubDir contains a '\\' character: $ThisDir" )
163
            if ( $ThisDir =~ m~\\~);
164
 
165
        if ( grep /^$ThisDir$/, @::SUBDIRS )
166
        {
167
            Warning( "Duplicate SubDir '$ThisDir' -- ignored." );
168
            next;
169
        }
170
        if ( ! ( -e $ThisDir and -d $ThisDir ) )
171
        {
172
            Error( "SubDir(): Subdirectory not found: '$ThisDir'",
173
                   "Current directory: $::Cwd" );
174
        }
175
        if ( ! -f $ThisDir . '/makefile.pl' )
176
        {
177
            Error( "SubDir(): makefile.pl not found in subdirectory: '$ThisDir'",
178
                   "Current directory: $::Cwd" );
179
        }
180
 
181
        push(@::SUBDIRS, $ThisDir);
6133 dpurdie 182
        ToolsetFiles::AddDir($ThisDir, 'SubDir');
227 dpurdie 183
    }
184
}
185
 
186
 
187
#-------------------------------------------------------------------------------
188
# Function        : RootMakefile
189
#
190
# Description     : This function is called from buildlib.pl prior to the
191
#                   generation of the root makefile. The Root Makefile is
192
#                   different to the others in this it does not have any platform
193
#                   specific makefiles associated with it. It is simply used to
194
#                   invoke the makefile in the 'src' subdirectory
195
#
196
# Inputs          : None
197
#
198
# Returns         : Nothing
199
#
200
sub RootMakefile
201
{
202
    Error ("Directive 'RootMakefile' not allowed in this context") if ( $::ScmBuildlib  );
203
    $::ROOTMAKEFILE = 1;
204
}
205
 
206
 
207
sub PackageDist
208
{
209
    my( $name, @elements ) = @_;
210
    Error ("Directive 'PackageDist' not allowed in this context") if ( $::ScmBuildlib  );
211
 
212
    foreach ( @elements ) {
213
        HashJoin( \%::PACKAGE_DIST, $;, $name, "$_" );
214
    }
215
}
216
 
217
 
218
sub Define
219
{
220
    Error ("Directive 'Define' not allowed in this context") if ( $::ScmBuildlib  );
221
    push( @::DEFINES, @_ );
222
}
223
 
224
 
225
sub Defines
226
{
227
    my( $path, $script ) = @_;
228
    my( $line );
229
    Error ("Directive 'Defines' not allowed in this context") if ( $::ScmBuildlib  );
230
 
231
    $script = Exists( $path, $script, "Defines" );
285 dpurdie 232
    open( my $fh, '<' ,$script ) ||
227 dpurdie 233
        Error( "cannot open '$script'" );
285 dpurdie 234
    while (<$fh>) {
227 dpurdie 235
        $_ =~ s/\s*(\n|$)//;                    # kill trailing whitespace & nl
236
        push( @::DEFINES, $_ );
237
    }
238
    push( @::ScmDepends, "$script" );           # makefile dependencies
285 dpurdie 239
    close( $fh );
227 dpurdie 240
}
241
 
242
 
243
sub Rule
244
{
245
    Error ("Directive 'Rule' not allowed in this context") if ( $::ScmBuildlib  );
246
    push( @::RULES, @_ );
247
}
248
 
249
 
250
sub Rules
251
{
252
    Error ("Directive 'Rules' not allowed in this context") if ( $::ScmBuildlib  );
253
    my( $path, $script ) = @_;
254
    my( $line );
255
 
256
    $script = Exists( $path, $script, "Rules" );
285 dpurdie 257
    open( my $fh, '<' ,$script ) ||
227 dpurdie 258
        Error( "cannot open '$script'" );
285 dpurdie 259
    while (<$fh>) {
227 dpurdie 260
        $_ =~ s/\s*(\n|$)//;                    # kill trailing whitespace & nl
261
        push( @::RULES, $_ );
262
    }
263
    push( @::ScmDepends, "$script" );           # makefile dependencies
285 dpurdie 264
    close( $fh );
227 dpurdie 265
}
266
 
267
#-------------------------------------------------------------------------------
268
# Function        : Platform
269
#
270
# Description     : Within "makelib.pl" the Platform directive is processed
271
#                   in such a manner as to trigger the verification and
272
#                   generation of Makefile and xxxxx.mk files in the tree
273
#                   below the makefile.pl
274
#
275
# Inputs          : A list of platforms for which the body of the makefile.pl
276
#                   are to be processed + GBE_PLATFORM
277
#
278
#                   "*", ...            - A wildcard for all platforms
279
#                                         Options include
280
#                                           --Targets (Not Products)
281
#                                           --Products
282
#                                           --NoPlatformBuilds
283
#                                           !xxx - Exclude a platform
284
#
285
#                   "--NoPlatformBuilds"
286
#
287
#                   "xxx"[, "yyy"]*     - A list of platforms and aliases
288
#
289
#                   "!xxx"              - A platform to be excluded
290
#
291
# Returns         :
292
#
293
sub Platform
294
{
295
    my ( @platforms ) = @_;
285 dpurdie 296
    my $exitVal;
297
    my $platform;
227 dpurdie 298
    my $noplatforms = 0;
299
    my $defplatforms = 0;
300
    my %platforms;
301
 
302
    Debug( "Platform(@_)" );
303
    Error ("Directive 'Platform' not allowed in this context") if ( $::ScmBuildlib  );
304
 
305
    #
306
    #   Import user platform specification (GBE_PLATFORM)
307
    #   Note: This is also used by the Makefile and it cannot be
308
    #         alias expanded or sanitised. Its not really really useful
309
    #
367 dpurdie 310
    #   Only use GBE_PLATFORM if the user has not specified to build ALL makefiles.
227 dpurdie 311
    #
312
    my %filter;
313
    my $filter_present = 0;
314
 
315
    if (  $::ScmAll == 0  )
316
    {
239 dpurdie 317
        $filter{GENERIC} = 1;
227 dpurdie 318
        foreach ( split( ' ', $ENV{ "GBE_PLATFORM" } || '' ) )
319
        {
320
            $filter{$_} = 1;
321
            $filter_present = 1;
322
        }
323
    }
324
 
325
    #
326
    #   Expand out the directive platform list (and optional arguments)
327
    #   Expand wildcards and aliases
328
    #
329
    #   Handle format
330
    #       Platform ('*', '--Options', [!Name]);
331
    #       Platform ('--NoPlatformBuilds' );
332
    #       Platform ('Name', '--Options', [!Name] );
333
    #       Platform ('!Name' );
334
    #
335
    #
336
    if ( $platforms[0] && $platforms[0] eq '*' )
337
    {
338
        my( $targets, $products );              # options
339
        my( @args );
340
        my( @exclude );
341
 
342
        $targets = $products = 0;
343
 
285 dpurdie 344
        foreach ( @platforms ) {
227 dpurdie 345
            next if ( /^\*$/);
346
            next if ( /^--Targets$/ && ($targets = 1));
347
            next if ( /^--Products$/ && ($products = 1));
348
            next if ( /^--NoPlatformBuilds/ && ($noplatforms = 1));
349
            next if ( /^--/ && push @args, $_ );
350
            next if ( /^!/  && push @exclude, $_ );
351
            Warning( "Platform: unknown option $_ -- ignored\n" );
352
        }
353
 
354
        #
355
        #   Determine the list of platforms to expand the '*' into
356
        #   The result may be modified by optional arguments
357
        #       --Targets           # Expands to all targets
358
        #       --Products          # Expands to all products
359
        #       OtherWise           # Expands to all build platforms
360
        #
361
        @platforms = ();                        # zap list
362
 
363
                                                # 'all' platforms
364
        push( @platforms, @::DEFBUILDPLATFORMS )
365
            unless ( $targets | $products );
366
 
367
        #
368
        #   Expand the '*' into a list of platforms that are NOT products
369
        #
369 dpurdie 370
        if ( $targets && ( %::ScmBuildPlatforms ) )
227 dpurdie 371
        {                                       # targets
372
            foreach my $key (keys %::ScmBuildPlatforms) {
373
                push( @platforms, $key )
369 dpurdie 374
                    if (! ( %::ScmBuildProducts ) ||
227 dpurdie 375
                            ! scalar $::ScmBuildProducts{ $key } );
376
            }
377
        }
378
 
379
        #
380
        #   Expand the '*' into a list of platforms that are 'products'
381
        #
369 dpurdie 382
        if ( $products && ( %::ScmBuildProducts ) )
227 dpurdie 383
        {                                       # products
384
            foreach my $key (keys %::ScmBuildProducts) {
385
                push( @platforms, $key );
386
            }
387
        }
388
 
389
        #
390
        #   Distribute arguments over all expanded platforms
391
        #
392
        if ( @args )
393
        {
394
            my @baseplatforms;
395
            foreach  ( @platforms )
396
            {
397
                push @baseplatforms, $_, @args;
398
            }
399
            @platforms = @baseplatforms;
400
        }
401
 
402
        #
403
        #   Place the excluded platforms at the end of the list
404
        #
405
        push @platforms, ExpandPlatforms( @exclude );
406
 
407
    }
408
    elsif ( scalar @platforms == 1 && $platforms[0] eq "--NoPlatformBuilds" )
409
    {                                           # short-cut
410
        $noplatforms = 1;
411
        @platforms = @::DEFBUILDPLATFORMS;
412
    }
413
    else
414
    {                                           # aliasing
415
        @platforms = ExpandPlatforms( @platforms );
416
        #
417
        #   Process excluded platform lists
418
        #   Migrate excluded platforms to the end of the list
419
        #
420
        my (@include, @exclude);
421
 
422
        foreach ( @platforms )
423
        {
424
            next if ( m/^!/ && push @exclude, $_ );
425
            push @include, $_;
426
        }
427
 
428
        #
429
        #   If no included platforms have been found then assume that the
430
        #   list is an exclusion list and seed the platform list with
431
        #   a set of defualt platforms - like '*'
432
        #
433
        #
434
        @include = @::DEFBUILDPLATFORMS unless @include;
435
        @platforms = ( @include, @exclude );
436
    }
437
 
438
    $platform = "";                             # current platform
439
 
440
    #
441
    #   Process the directives expanded list of platforms
442
    #
443
 
444
    #
445
    #   Generate a HASH of lowercase known platform names
446
    #   This will be used to quickly validate platform names
447
    #
448
    my %lc_platforms;
449
    foreach  ( @::BUILDPLATFORMS )
450
    {
451
        $lc_platforms{ lc($_) } = $_;
452
    }
453
 
454
FILTER:
455
    foreach $_ ( @platforms )
456
    {
457
        if ( ! /^--(.*)/ )
458
        {
459
            $_ =~ s/^\s*//g;                    # leading white space
460
            $_ =~ s/\s*(\n|$)//;                # trailing white space
461
 
462
 
463
            #
464
            #   Remove specific platforms from the list
465
            #
466
            $defplatforms = 1;
467
            if ( m/!(.*)/ )
468
            {
469
                Verbose( "Excluded platform removed: $1" );
470
                delete $platforms{$1};
471
                next FILTER;
472
            }
473
 
474
 
475
            if ( exists $platforms{$_}  )
476
            {
477
                Warning( "duplicate platform '$_' -- ignored." );
478
                $platform = "";
479
                next FILTER;
480
            }
481
 
482
            #
483
            #   validate 'platform'
484
            #   Allow the user to have a bad case match ( Fred == fred == FRED )
485
            #
486
            my $lc_platform = lc($_);
487
            unless ( exists( $lc_platforms{$lc_platform}  ) )
488
            {
489
                Warning( "Platform '$_' not contained within BuildPlatforms -- ignored." )
490
                    unless ( exists( $::ScmBuildPlatforms{$_} ));
491
                $platform = "";
492
                next FILTER;
493
            }
494
 
495
            $lc_platform = $lc_platforms{$lc_platform};
496
            if ( $_ ne $lc_platform )
497
            {
498
                Warning( "Mixed case usage of platform '$_' -- corrected." );
499
                $_ = $lc_platform;
500
            }
501
 
502
                                                # filter 'platform'
503
            if ( $filter_present  )
504
            {
505
                if ( ! exists $filter{$_} )
506
                {
507
                    Verbose( "GBE_PLATFORM override $_ -- ignored" );
508
                    $platform = "";
509
                    next FILTER;
510
                }
511
            }
512
 
513
            #
514
            #   Platform not filtered out - must be using it.
515
            #
516
            Verbose( "Platform ... $_" );
517
            $platforms{$_} = 1;                 # Add to platform list
518
            $platform = $_;                     # new platform
519
        }
520
 
521
        elsif ( /^--NoPlatformBuilds$/ )
522
        {
523
            $noplatforms = 1;
524
        }
525
 
526
        elsif ( $platform ne "" )
527
        {                                       # other arguments
528
            Verbose( "          .. $_" );
529
 
530
            HashUniqueJoin( \%::PLATFORMARGS, $; , $platform, $1 ) ||
531
                Warning( "Duplicate argument '$platform=$_' -- ignored." );
532
        }
533
    }
534
    #
535
    #   Sort the platforms to ensure that the ordering is consistient throughout
536
    #
537
    @::PLATFORMS = sort keys %platforms;
538
 
539
    #
540
    #   Trap makefiles that don't have any platforms
541
    #   The user 'should' mark these as --NoPlatformBuilds
542
    #
543
    unless ( @::PLATFORMS )
544
    {
545
        Warning( "No platform definitions." )
546
            unless( $noplatforms || $defplatforms);
547
        $noplatforms = 1;
548
    }
549
 
550
#.. Common rules
551
#
552
    my( $file ) = Require( "$::GBE_CONFIG", "Rules", "Common rules " );
553
    push( @::ScmDepends, "$file" );
554
 
555
 
556
#.. Generate primary makefile
557
#
367 dpurdie 558
    $exitVal = Generate( $noplatforms || $::ROOTMAKEFILE );
559
    if ($::ROOTMAKEFILE == 1)
560
    {
561
        Warning ("WARNING: Problem generating Makefile ($exitVal)")
261 dpurdie 562
            if ($exitVal);
227 dpurdie 563
        return ($exitVal);
564
    }
565
 
367 dpurdie 566
    #
567
    #   Not creating the ROOT Makefile
568
    #   Exit the phase. All the work has been done
569
    #
227 dpurdie 570
    Debug( "Platform ExitVal:   $exitVal" );
571
    exit( $exitVal );
572
}
573
 
574
###############################################################################
575
# Private function section.
576
#       The following functions are used INTERNALLY by makelib.pl.
577
#
578
###############################################################################
579
 
580
#-------------------------------------------------------------------------------
581
# Function        : Generate
582
#
583
# Description     : Build makefiles ...
584
#                   Creates the command data files and the per-target .MK files
585
#
586
# Inputs          : $noplatforms    - 1 if this makefile does not have
367 dpurdie 587
#                                       any platforms. Also set for ROOTMAKEFILE
227 dpurdie 588
#
589
# Returns         : $exitVal
590
#
591
sub Generate
592
{
593
    my( $noplatforms ) = @_;
367 dpurdie 594
    my $exitVal = 0;
227 dpurdie 595
 
367 dpurdie 596
    #.. Build all the per-taget makefiles, if any exist
227 dpurdie 597
    #
598
    $exitVal = GeneratePlatforms()
599
        unless ($noplatforms );
600
 
367 dpurdie 601
    #.. Build the common Makefile.gbe
602
    #
227 dpurdie 603
    GenerateMakefile( $noplatforms );
604
    return $exitVal;
605
}
606
 
367 dpurdie 607
#-------------------------------------------------------------------------------
608
# Function        : GeneratePlatforms
227 dpurdie 609
#
367 dpurdie 610
# Description     : Generate all the per-taget makefiles
611
#                   Create all .mk files in the current directory
227 dpurdie 612
#
367 dpurdie 613
#                   Cleanup of unused .mk files is done when the WriteCommonInfo
614
#                   is processed. Makefiles that are no longer used will be purged
6133 dpurdie 615
#                   
616
#                   Invoke makelib.pl2 as
617
#                       perl makefile.pl <root> makelib.pl2 <platform> <interface>
227 dpurdie 618
#
367 dpurdie 619
# Inputs          : None
620
#
621
# Returns         : exitVal
622
#
227 dpurdie 623
sub GeneratePlatforms
624
{
367 dpurdie 625
    my  $exitVal = 0;
626
    my  $exitVal2;
227 dpurdie 627
 
628
    foreach my $platform ( @::PLATFORMS )
629
    {
261 dpurdie 630
        my @CmdLine;
631
        push @CmdLine, $::GBE_PERL, $0, $::ScmRoot;
632
        push @CmdLine, $::ScmMakelib . "2";
633
        push @CmdLine, $platform;
634
        push @CmdLine, "--interface=$::ScmInterface" if ( $::ScmInterface ne "" );
227 dpurdie 635
 
636
        #
637
        #   Insert platform local arguments
638
        #
639
        if ($::PLATFORMARGS{ $platform })
640
        {
261 dpurdie 641
            foreach my $arg (split( /$;/, $::PLATFORMARGS{ $platform } )) {
642
                push @CmdLine,"--arg=$arg";
227 dpurdie 643
            }
644
        }
645
 
261 dpurdie 646
        #
647
        #   Invoke the command
648
        #   Don't use a Shell. Don't need the overhead
649
        #
650
        $exitVal2 = System( '--NoShell', @CmdLine );
227 dpurdie 651
 
261 dpurdie 652
        #
653
        #   Warn on any error
367 dpurdie 654
        #   Overall return code will be set if any platform fails, but we
655
        #   will process all of them first
261 dpurdie 656
        #
657
        if ( $exitVal2 )
658
        {
659
            Warning ("Problem generating $platform.mk in $::Cwd ($exitVal2)");
227 dpurdie 660
            $exitVal = $exitVal2;
661
        }
662
    }
663
 
664
    return $exitVal;
665
}
666
 
667
#-------------------------------------------------------------------------------
668
# Function        : GenerateMakefile
669
#
670
# Description     : Generate the non-platform specific makefile
671
#                   Once upon a time this was a real makefile
4781 dpurdie 672
#                   Now its a simple file and a database as this offers greater
227 dpurdie 673
#                   flexability.
674
#
675
#                   The file, "Makefile.gbe" contains enough info to get to the
676
#                   interface directory.
677
#
678
#                   The "database" is held in the interface directory as
679
#                       Makfile.cfg     - index to locate Makefile_nn.cfg
680
#                       Makefile_nn.cfg - data from a makefile.pl
681
#
682
# Inputs          : $noplatforms        - 1: no platform makefiles in this dir
683
#
684
# Returns         : Nothing
685
#
686
sub GenerateMakefile
687
{
688
    my( $noplatforms ) = @_;
689
    my %platform_info;
690
 
691
    #
692
    #   Determine targets that are limited to either debug or production builds
693
    #   This information may come from several places
694
    #
695
    foreach my $key ( @PLATFORMS )
696
    {
697
        my @args;
698
        UniquePush (\@args, split ( /$;/, $::PLATFORMARGS{$key} ))
699
            if ($::PLATFORMARGS{$key});
700
 
701
        UniquePush (\@args, map { s/^--//; $_} split ( /$;/, $::ScmBuildPlatforms{$key} ))
702
            if($::ScmBuildPlatforms{$key});
703
 
704
        my $hasOnlyProd  =  grep /^OnlyProd/, @args;
705
        my $hasOnlyDebug =  grep /^OnlyDebug/, @args;
706
 
707
        if ( $hasOnlyProd && $hasOnlyDebug )
708
        {
709
            Warning ("Target \"$key\" has both OnlyDebug and OnlyProd options",
710
                     "Both options ignored. Target will be built" );
711
 
712
            $hasOnlyProd = $hasOnlyDebug = 0;
713
        }
714
        $platform_info{$key}{prod}  = 1 unless $hasOnlyDebug;
715
        $platform_info{$key}{debug} = 1 unless $hasOnlyProd;
716
    }
717
 
718
    #
719
    #   Update common information in the Makefile_x.cfg file
720
    #
721
    WriteCommonInfo( \@::SUBDIRS, \%platform_info, $noplatforms, $::ROOTMAKEFILE );
722
 
723
    #
724
    #.. Maintain local information in Makefile.gbe
725
    #   This allows us to locate the interface directory
726
    #
727
    Message "[Control] $::Cwd";
728
    CreateMakeInfo();
729
}
730
 
731
1;
732