Subversion Repositories DevTools

Rev

Rev 255 | Rev 275 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 255 Rev 261
Line 42... Line 42...
42
#   Options
42
#   Options
43
#
43
#
44
my $opt_debug   = $ENV{'GBE_DEBUG'};        # Allow global debug
44
my $opt_debug   = $ENV{'GBE_DEBUG'};        # Allow global debug
45
my $opt_verbose = $ENV{'GBE_VERBOSE'};      # Allow global verbose
45
my $opt_verbose = $ENV{'GBE_VERBOSE'};      # Allow global verbose
46
my $opt_help = 0;
46
my $opt_help = 0;
47
my $opt_manual = 0;
-
 
48
my $opt_silent = 1;
47
my $opt_silent = 1;
49
my $opt_default;
48
my $opt_default;
50
 
49
 
51
#
50
#
52
#   Global variables
51
#   Global variables
Line 113... Line 112...
113
    'help'                  => { 'tag' => 0, 'local' => \&DoHelp },
112
    'help'                  => { 'tag' => 0, 'local' => \&DoHelp },
114
    'rebuild'               => { 'tag' => 0, 'local' => \&TestMakeFiles },
113
    'rebuild'               => { 'tag' => 0, 'local' => \&TestMakeFiles },
115
    'makefiles'             => { 'tag' => 0, 'local' => \&TestMakeFiles },
114
    'makefiles'             => { 'tag' => 0, 'local' => \&TestMakeFiles },
116
    'unmakefiles'           => { 'tag' => 0, 'local' => \&UnMakeFiles },
115
    'unmakefiles'           => { 'tag' => 0, 'local' => \&UnMakeFiles },
117
    'make_init'             => { 'tag' => 1, 'nomakecheck' => 1, 'common' => 3, },
116
    'make_init'             => { 'tag' => 1, 'nomakecheck' => 1, 'common' => 3, },
118
    'make_dir'              => { 'tag' => 1, 'nomakecheck' => 1 },
-
 
119
    'generate'              => { 'tag' => 1 },
117
    'generate'              => { 'tag' => 1 },
120
    'install_hdr'           => { 'tag' => 1 },
118
    'install_hdr'           => { 'tag' => 1 },
121
    'depend'                => { 'tag' => 1, 'unless' => 'NODEPEND' },
119
    'depend'                => { 'tag' => 1, 'unless' => ['NODEPEND','EXPERT'] },
122
    'make_lib'              => { 'tag' => 1, 'IFLAG' => 1 },
120
    'make_lib'              => { 'tag' => 1, 'IFLAG' => 1 },
-
 
121
    'make_mlib'             => { 'tag' => 1, 'IFLAG' => 1 },
123
    'install_lib'           => { 'tag' => 1, 'IFLAG' => 1 },
122
    'install_lib'           => { 'tag' => 1, 'IFLAG' => 1 },
124
    'make_install_shlib'    => { 'tag' => 1, 'IFLAG' => 2 },
123
    'make_install_shlib'    => { 'tag' => 1, 'IFLAG' => 2 },
125
    'make_prog'             => { 'tag' => 1, 'IFLAG' => 3 },
124
    'make_prog'             => { 'tag' => 1, 'IFLAG' => 3 },
126
    'make_test'             => { 'tag' => 1, 'IFLAG' => 3 },
125
    'make_test'             => { 'tag' => 1, 'IFLAG' => 3 },
127
    'install_prog'          => { 'tag' => 1, 'IFLAG' => 3 },
126
    'install_prog'          => { 'tag' => 1, 'IFLAG' => 3 },
128
    'install_class'         => { 'tag' => 1 },
127
    'install_class'         => { 'tag' => 1 },
129
    'package'               => { 'tag' => 1, 'IFLAG' => 3 },
128
    'package'               => { 'tag' => 1, 'IFLAG' => 3 },
130
    'deploy'                => { 'tag' => 1, 'IFLAG' => 1 },
129
    'deploy'                => { 'tag' => 1, 'IFLAG' => 1 },
131
 
130
 
132
    #
131
    #
-
 
132
    #   Special
-
 
133
    #   make_dir is directly invoked by jmake. It doesn't need
-
 
134
    #   to be a part of a command sequence
-
 
135
    #
-
 
136
    'make_dir'              => { 'nomakecheck' => 1, 'tag' => 1 },
-
 
137
 
-
 
138
    #
133
    #   Basic commands, that appear to be unused in composite commands
139
    #   Basic commands, that appear to be unused in composite commands
134
    #   Not too sure why
140
    #   Not too sure why
135
    #
141
    #
136
    'make_script'           => { 'commands' => [], 'tag' => 1 },
142
    'make_script'           => { 'commands' => [], 'tag' => 1 },
137
 
143
 
Line 150... Line 156...
150
    
156
    
151
    'clean'                 => { 'nomakecheck' => 1},
157
    'clean'                 => { 'nomakecheck' => 1},
152
    'clobber'               => { 'nomakecheck' => 1},
158
    'clobber'               => { 'nomakecheck' => 1},
153
    'rmlitter'              => { 'nomakecheck' => 1},
159
    'rmlitter'              => { 'nomakecheck' => 1},
154
    'unbuild'               => { 'nomakecheck' => 1},
160
    'unbuild'               => { 'nomakecheck' => 1},
155
    'undepend'              => { 'nomakecheck' => 1},
161
    'undepend'              => { 'nomakecheck' => 1 , 'tag' => 'depend'},
156
    'ungenerate'            => { 'nomakecheck' => 1},
162
    'ungenerate'            => { 'nomakecheck' => 1 , 'tag' => 'generate'},
157
    'uninstall'             => { 'nomakecheck' => 1},
163
    'uninstall'             => { 'nomakecheck' => 1},
158
    'uninstall_class'       => { 'nomakecheck' => 1},
164
    'uninstall_class'       => { 'nomakecheck' => 1},
159
    'uninstall_hdr'         => { 'nomakecheck' => 1},
165
    'uninstall_hdr'         => { 'nomakecheck' => 1 , 'tag' => 'install_hdr'},
160
    'uninstall_lib'         => { 'nomakecheck' => 1},
166
    'uninstall_lib'         => { 'nomakecheck' => 1 , 'tag' => 'install_lib'},
161
    'uninstall_prog'        => { 'nomakecheck' => 1},
167
    'uninstall_prog'        => { 'nomakecheck' => 1 , 'tag' => 'install_prog'},
162
    'unmake_lib'            => { 'nomakecheck' => 1},
168
    'unmake_lib'            => { 'nomakecheck' => 1 , 'tag' => 'make_mlib'},
-
 
169
    'unmake_mlib'           => { 'nomakecheck' => 1 , 'tag' => 'make_mlib'},
163
    'unmake_prog'           => { 'nomakecheck' => 1},
170
    'unmake_prog'           => { 'nomakecheck' => 1 , 'tag' => 'make_prog'},
164
    'unmake_script'         => { 'nomakecheck' => 1},
171
    'unmake_script'         => { 'nomakecheck' => 1 , 'tag' => 'make_script'},
165
    'unmake_test'           => { 'nomakecheck' => 1},
172
    'unmake_test'           => { 'nomakecheck' => 1 , 'tag' => 'make_test'},
166
    'unobj'                 => { 'nomakecheck' => 1},
173
    'unobj'                 => { 'nomakecheck' => 1},
167
    'unpackage'             => { 'nomakecheck' => 1},
174
    'unpackage'             => { 'nomakecheck' => 1 , 'tag' => 'package'},
168
    'make_undir'            => { 'nomakecheck' => 1},
175
    'unmake_dir'            => { 'nomakecheck' => 1 , 'tag' => 'make_dir'},
169
 
176
 
170
    );
177
    );
171
#    DebugDumpData ("Commands", \%commands);
178
#    DebugDumpData ("Commands", \%commands);
172
 
179
 
173
#-------------------------------------------------------------------------------
180
#-------------------------------------------------------------------------------
Line 180... Line 187...
180
 
187
 
181
#
188
#
182
#   Parse the user options
189
#   Parse the user options
183
#
190
#
184
my $result = GetOptions (
191
my $result = GetOptions (
185
                "help+"         => \$opt_help,              # flag, multiple use allowed
192
                "help:+"        => \$opt_help,              # flag, multiple use allowed
186
                "manual"        => \$opt_manual,            # flag, multiple use allowed
193
                "manual:3"      => \$opt_help,              # flag, multiple use allowed
187
                "verbose+"      => \$opt_verbose,           # flag, multiple use allowed
194
                "verbose:+"     => \$opt_verbose,           # flag, multiple use allowed
188
                "d|debug+"      => \$opt_debug,             # flag, multiple use allowed
195
                "d|debug:+"     => \$opt_debug,             # flag, multiple use allowed
189
                "default=s"     => \$opt_default,           # string
196
                "default=s"     => \$opt_default,           # string
190
                );
197
                );
191
 
198
 
192
                #
199
                #
193
                #   UPDATE THE DOCUMENTATION AT THE END OF THIS FILE !!!
200
                #   UPDATE THE DOCUMENTATION AT THE END OF THIS FILE !!!
Line 195... Line 202...
195
 
202
 
196
#
203
#
197
#   Process help and manual options
204
#   Process help and manual options
198
#
205
#
199
pod2usage(-verbose => 0, -message => "Version: $VERSION")  if ($opt_help == 1  || ! $result);
206
pod2usage(-verbose => 0, -message => "Version: $VERSION")  if ($opt_help == 1  || ! $result);
200
pod2usage(-verbose => 1)  if ($opt_help == 2 );
207
pod2usage(-verbose => 1)  if ( $opt_help == 2 );
201
pod2usage(-verbose => 2)  if ($opt_manual || ($opt_help > 2));
208
pod2usage(-verbose => 2)  if ( $opt_help > 2 );
202
 
209
 
203
#
210
#
204
#   Configure the error reporting process now that we have the user options
211
#   Configure the error reporting process now that we have the user options
205
#
212
#
206
ErrorConfig( 'name'    => 'Make',
213
ErrorConfig( 'name'    => 'Make',
Line 455... Line 462...
455
        $do_debug  = 0;
462
        $do_debug  = 0;
456
    }
463
    }
457
 
464
 
458
    #
465
    #
459
    #   Some commands can be suppressed by options
466
    #   Some commands can be suppressed by options
-
 
467
    #   These are an array of options
460
    #
468
    #
461
    if ( exists $commands{$cmd}{'unless'}  )
469
    if ( exists $commands{$cmd}{'unless'}  )
462
    {
470
    {
463
        my $check = $commands{$cmd}{'unless'};
471
        foreach my $check ( @{$commands{$cmd}{'unless'}} )
464
        if ( exists $defs{$check} && $defs{$check} )
-
 
465
        {
472
        {
-
 
473
            if ( exists $defs{$check} && $defs{$check} )
-
 
474
            {
466
            Verbose2 ("Skipping: $cmd because $check");
475
                Verbose2 ("Skipping: $cmd because $check");
467
            return;
476
                return;
-
 
477
            }
468
        }
478
        }
469
    }
479
    }
470
 
480
 
471
    #
481
    #
472
    #   Interecpt commands that are handled locally
482
    #   Interecpt commands that are handled locally
Line 610... Line 620...
610
        #
620
        #
611
        if ( $tag )
621
        if ( $tag )
612
        {
622
        {
613
            unless ( exists $Tags->{$dir}{full}{$target}{'%MakeTags'}{$tag} )
623
            unless ( exists $Tags->{$dir}{full}{$target}{'%MakeTags'}{$tag} )
614
            {
624
            {
615
                Verbose2 ("Skipping $cmd in $dir");
625
                Verbose2 ("Skipping $cmd in $dir for $tag");
616
                next;
626
                next;
617
            }
627
            }
618
        }
628
        }
619
 
629
 
620
        #
630
        #
621
        #   common mode == 2
631
        #   common mode == 2
622
        #   Only process target ONCE for each platform
632
        #   Only process target ONCE for each platform
623
        #   Don't care when its used
633
        #   Don't care when its used
624
        #
634
        #
625
        if ( exists $commands{$cmd}{common} && $commands{$cmd}{common} & 2 )
635
        if ( exists $commands{$cmd}{'common'} && $commands{$cmd}{'common'} & 2 )
626
        {
636
        {
627
            if ( $common_cmd{$cmd}{$target} )
637
            if ( $common_cmd{$cmd}{$target} )
628
            {
638
            {
629
                Verbose2 "Already performed $cmd for $target";
639
                Verbose2 "Already performed $cmd for $target";
630
                next;
640
                next;
Line 633... Line 643...
633
        }
643
        }
634
 
644
 
635
        #
645
        #
636
        #   Is the build limited to only debug or production
646
        #   Is the build limited to only debug or production
637
        #
647
        #
638
        unless ( exists $commands{$cmd}{common} )
648
        unless ( exists $commands{$cmd}{'common'} )
639
        {
649
        {
640
            if ( $do_debug == 0 ) {
650
            if ( $do_debug == 0 ) {
641
                next unless ( $Tags->{$dir}{platforms}{$target}{prod} );
651
                next unless ( $Tags->{$dir}{platforms}{$target}{prod} );
642
                $text = 'P';
652
                $text = 'P';
643
 
653
 
Line 657... Line 667...
657
        #   Build up the make command line
667
        #   Build up the make command line
658
        #   Examine command specfic flags
668
        #   Examine command specfic flags
659
        #
669
        #
660
        my @args = @defs;
670
        my @args = @defs;
661
        push @args, "IFLAG=$commands{$cmd}{IFLAG}" if ( exists $commands{$cmd}{IFLAG} );
671
        push @args, "IFLAG=$commands{$cmd}{IFLAG}" if ( exists $commands{$cmd}{IFLAG} );
662
        push @args, "NOSCMDEPEND=1" if ( exists $commands{$cmd}{nomakecheck} );
672
        push @args, "NOSCMDEPEND=1";
663
 
673
 
664
        my $cdir = CleanDirName ($dir);
674
        my $cdir = CleanDirName ($dir);
665
        my @make_command;
675
        my @make_command;
666
        push @make_command, "$ENV{GBE_BIN}/xmake";
676
        push @make_command, "$ENV{GBE_BIN}/xmake";
667
        push @make_command, "-s" if $opt_silent;
677
        push @make_command, "-s" if $opt_silent;
Line 932... Line 942...
932
    return if ( $Tags->{$dir}{root} );
942
    return if ( $Tags->{$dir}{root} );
933
 
943
 
934
    #
944
    #
935
    #   Try to rebuild the makefile
945
    #   Try to rebuild the makefile
936
    #
946
    #
937
    my @args;
-
 
938
    push @args, '--expert' if ($ScmExpert);
-
 
939
    push @args, "--interface=$::ScmInterface";
-
 
940
    push @args, '-F';
-
 
941
 
-
 
942
    chdir $dir || Error ("Cannot change directory to $dir");
947
    chdir $dir || Error ("Cannot change directory to $dir");
943
    my $result = System ('--NoExit',$ENV{GBE_PERL}, 'makefile.pl', $::ScmRoot, $makelib, @args );
948
    my $result = System ('--NoExit', $ENV{GBE_PERL}, 'makefile.pl',
-
 
949
                            $::ScmRoot, $makelib, "--interface=$::ScmInterface" );
944
    chdir $::Cwd || Error ("Cannot change directory to $::Cwd");
950
    chdir $::Cwd || Error ("Cannot change directory to $::Cwd");
945
 
951
 
946
    #
952
    #
947
    #   Re-read the tags database
953
    #   Re-read the tags database
948
    #
954
    #
Line 950... Line 956...
950
 
956
 
951
    #
957
    #
952
    #   Flag that makefiles have been modified
958
    #   Flag that makefiles have been modified
953
    #
959
    #
954
    $update = 1;
960
    $update = 1;
955
    $build_error = 1 if ( $result && $result != 10 );
961
    $build_error = 1 if ( $result );
956
}
962
}
957
 
963
 
958
#-------------------------------------------------------------------------------
964
#-------------------------------------------------------------------------------
959
# Function        : UnMakeFiles
965
# Function        : UnMakeFiles
960
#
966
#
Line 1296... Line 1302...
1296
#-------------------------------------------------------------------------------
1302
#-------------------------------------------------------------------------------
1297
# Function        : ExpandComposite
1303
# Function        : ExpandComposite
1298
#
1304
#
1299
# Description     : Expand a command via composite command expansion
1305
# Description     : Expand a command via composite command expansion
1300
#                   A composite command may contain other composite commands
1306
#                   A composite command may contain other composite commands
-
 
1307
#                   Detect, as an error, recursive expansions
1301
#
1308
#
1302
# Inputs          : $cmd    - command to expand
1309
# Inputs          : $cmd    - command to expand
1303
#
1310
#
1304
# Returns         : An array of commands
1311
# Returns         : An array of commands
1305
#
1312
#
1306
sub ExpandComposite
1313
sub ExpandComposite
1307
{
1314
{
1308
    my ($cmd) = @_;
1315
    my ($cmd) = @_;
1309
    my @cmds;
1316
    my @cmds;
1310
    my @scmds = $cmd;
1317
    my @scmds = $cmd;
-
 
1318
    my %seen;
1311
    while ( @scmds )
1319
    while ( @scmds )
1312
    {
1320
    {
1313
        my $cmd = shift @scmds;
1321
        my $cmd = shift @scmds;
1314
        if ( exists $composite_commands{$cmd} )
1322
        if ( exists $composite_commands{$cmd} )
1315
        {
1323
        {
-
 
1324
 
-
 
1325
            Error ("Internal. Recursion in composite command definitions: $cmd")
-
 
1326
                if ($seen{$cmd});
-
 
1327
 
1316
            @scmds = (@{$composite_commands{$cmd}}, @scmds);
1328
            @scmds = (@{$composite_commands{$cmd}}, @scmds);
-
 
1329
            $seen{$cmd} = 1;
1317
        }
1330
        }
1318
        else
1331
        else
1319
        {
1332
        {
1320
            push @cmds, $cmd;
1333
            push @cmds, $cmd;
1321
        }
1334
        }
Line 1347... Line 1360...
1347
 
1360
 
1348
 Where flags are of the form Name=Value
1361
 Where flags are of the form Name=Value
1349
    SHOWENV=1           - Show make environment
1362
    SHOWENV=1           - Show make environment
1350
    LEAVETMP=1          - Leave temp working files
1363
    LEAVETMP=1          - Leave temp working files
1351
    NODEPEND=1          - Ignore dependency checking
1364
    NODEPEND=1          - Ignore dependency checking
-
 
1365
    EXPERT=1            - Ignore dependency on makefiles
1352
    OPTIONS=[opt]       - Maketime options [args,allargs,filter...]
1366
    OPTIONS=[opt]       - Maketime options [args,allargs,filter...]
1353
 
1367
 
1354
 Valid targets include:
1368
 Valid targets include:
1355
    all                 - build and install everything(p*)
1369
    all                 - build and install everything(p*)
1356
    build               - build everything (pu)
1370
    build               - build everything (pu)
Line 1405... Line 1419...
1405
This options specifies the default target if none is provided on the command
1419
This options specifies the default target if none is provided on the command
1406
line. Used by the jats wrapper to simplify processing.
1420
line. Used by the jats wrapper to simplify processing.
1407
 
1421
 
1408
=back
1422
=back
1409
 
1423
 
-
 
1424
=head1 TARGETS
-
 
1425
 
-
 
1426
Targets are described above.
-
 
1427
 
-
 
1428
Most targets support three modifiers. These can be used in conjunction with each
1410
FLAGS
1429
other.
1411
 
1430
 
1412
=over 8
1431
=over 8
1413
 
1432
 
-
 
1433
=item undo
-
 
1434
 
-
 
1435
Many target operation can be undone by prefixing the tarhet with 'un' ie:
-
 
1436
uninstall.
-
 
1437
 
-
 
1438
=item platform prefix
-
 
1439
 
-
 
1440
Many target operations can be limited to one platform by prefixing the target
-
 
1441
with a valid platform name and an underscore. ie WIN32_all
-
 
1442
 
-
 
1443
=item build postfix. prod or debug
-
 
1444
 
-
 
1445
Many targets operations can be limited toi either production of debug by
-
 
1446
adding '_prod' or '_debug' to the target. ie 'install_debug'
-
 
1447
 
-
 
1448
=back
-
 
1449
 
-
 
1450
=head1 FLAGS
-
 
1451
 
1414
Flags are in the form TAG=value. This is a format that it used as they will be
1452
Flags are in the form TAG=value. This is a format that it used as they will be
1415
passed directly to the underlying makefiles. The recognised flags are:
1453
passed directly to the underlying makefiles. The recognised flags are:
1416
 
1454
 
-
 
1455
=over 8
-
 
1456
 
1417
=item B<SHOWENV=1>
1457
=item B<SHOWENV=1>
1418
 
1458
 
1419
This flag will force the 'Environment' to be displayed before commands are executed
1459
This flag will force the 'Environment' to be displayed before commands are executed
1420
 
1460
 
1421
=item B<LEAVETMP=1>
1461
=item B<LEAVETMP=1>
Line 1425... Line 1465...
1425
=item B<NODEPEND=1>
1465
=item B<NODEPEND=1>
1426
 
1466
 
1427
This flag will supress dependency checking. Makefiles will not be created when
1467
This flag will supress dependency checking. Makefiles will not be created when
1428
the makefile.pl is changed. Source files will not be scanned for header files.
1468
the makefile.pl is changed. Source files will not be scanned for header files.
1429
 
1469
 
-
 
1470
=item B<EXPERT=1>
-
 
1471
 
-
 
1472
This flag will supress dependency checking between object files and the
-
 
1473
generated makefile. This option can be used while test building a large build
-
 
1474
when the makefile has been rebuilt but the user does not wish all the object
-
 
1475
files to be rebuilt.
-
 
1476
 
1430
=item B<OPTIONS=list,list>
1477
=item B<OPTIONS=list,list>
1431
 
1478
 
1432
This flags passes a list of comma seperated options into the makefile. The exact
1479
This flags passes a list of comma seperated options into the makefile. The exact
1433
set of available options is target specific. Refer to the JATS manual.
1480
set of available options is target specific. Refer to the JATS manual.
1434
 
1481