Subversion Repositories DevTools

Rev

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

Rev Author Line No. Line
227 dpurdie 1
########################################################################
2
# Copyright (C) 2007 ERG Limited, All rights reserved
3
#
4
# Module name   : jats.sh
5
# Module type   : Makefile system
6
# Compiler(s)   : n/a
7
# Environment(s): jats
8
#
9
# Description   : Top level Makefile supervisor
10
#                 The function of this program is to call the target makefiles
11
#                 in a sutable manner.
12
#
13
# History       : Once upon a time this was done with another makefile and
14
#                 some really ugle shell, embedded within the makefile
15
#                 This had a number of limitations, including
16
#                   - Limited to makefile command line syntax
17
#                   - Overly complex makefile
18
#                   - Slow execution
19
#
20
# Usage:
21
#
22
#......................................................................#
23
 
255 dpurdie 24
require 5.006_001;
227 dpurdie 25
use strict;
26
use warnings;
27
 
28
use Pod::Usage;                             # For help support
29
use JatsError;
30
use JatsSystem;
31
use JatsEnv;
32
use JatsMakeInfo;
33
use ReadBuildConfig qw(:All);
34
use Getopt::Long;
35
use FileUtils;
36
use ArrayHashUtils;
37
use JatsDPackage;
38
 
39
my $VERSION = "1.0.0";                      # Update this
40
 
41
#
42
#   Options
43
#
44
my $opt_debug   = $ENV{'GBE_DEBUG'};        # Allow global debug
45
my $opt_verbose = $ENV{'GBE_VERBOSE'};      # Allow global verbose
46
my $opt_help = 0;
47
my $opt_silent = 1;
48
my $opt_default;
49
 
50
#
51
#   Global variables
52
#
53
our %cf_info;
54
our $GBE_TOOLS;                             # Base of tools
55
our $GBE_ABT;                               # Optional ABT indication
56
our $GBE_PLATFORM;                          # Optional GBE_PLATFORM
57
our $ScmInterface;                          # Current interface directory
58
our $ScmRoot;                               # Build root
59
 
60
my $Tags;                                   # Reference to hash of tags
61
my %defs;                                   # Make definitions
62
my @defs;                                   # Make definitions
63
my @targets;                                # Make targets
64
my $makelib;                                # Path to makelib.pl
65
my $update = 0;                             # Makefiles updated
66
my $build_error = 0;                        # Build Error encountered
67
my $tlen = 4;                               # Max length of targets
68
my %common_cmd;                             # Short circuit some commands
69
my %gbe_platform;                           # Nice form of GBE_PLATFORM
70
 
71
#
72
#   Known commands
73
#   A hash of known commands an information about the commands
74
#       common      - Command is not executed for Debug and Production
75
#                     Flags: 1 - Command not executed for debug+prod
76
#                     Flags: 2 - Command is only executed ONCE per platform
77
#       local       - The command is handled locally.
78
#       nomakecheck - Don't check for makefile being out of date
79
#       IFLAG       - iteration flag,
80
#                       0   No external dependencies.
81
#                       1   Source dependency list.
82
#                       2   Shared library dependency list.
83
#                       3   Application dependency list.
84
#   Note:   gmake attempts to build includes prior to invoking other
85
#   rules when the source is non-existent, which can/do fail as a
86
#   result of the prereq rules not being executed, the IFLAG inhabits
87
#   includes during these prereq rules.
88
#
89
my %composite_commands = (
90
    #
91
    #   Composite commands
92
    #
93
    'all'                   => [ 'install', 'package', 'deploy' ] ,
94
    'install'               => [ 'build' ] ,
95
    'build'                 => [ 'mkdepends', 'generate', 'install_hdr', 'depend',
96
                                 'make_lib', 'install_lib', 'make_install_shlib',
97
                                 'make_prog', 'make_test', 'install_prog', 'install_class' ] ,
98
    'lint'                  => [ 'mkdepends', 'generate_debug', 'install_hdr_debug',
99
                                 'lint_lib', 'lint_shlib', 'lint_prog' ] ,
100
    'ctags'                 => [ 'mkdepends', 'generate_debug', 'ctags_debug' ] ,
101
    'test'                  => [ 'make_test' ] ,
102
    'mkdepends'             => [ 'makefiles', 'make_init'] ,
103
 
104
    );
105
 
106
my %commands = (
107
    #
108
    #   Basic commands / phases of the build process
109
    #   This should be a list of all known makefile commands
110
    #
111
    'make_usage'            => { 'tag' => 0, 'local' => \&DoHelp },
112
    'help'                  => { 'tag' => 0, 'local' => \&DoHelp },
113
    'rebuild'               => { 'tag' => 0, 'local' => \&TestMakeFiles },
114
    'makefiles'             => { 'tag' => 0, 'local' => \&TestMakeFiles },
115
    'unmakefiles'           => { 'tag' => 0, 'local' => \&UnMakeFiles },
116
    'make_init'             => { 'tag' => 1, 'nomakecheck' => 1, 'common' => 3, },
117
    'generate'              => { 'tag' => 1 },
118
    'install_hdr'           => { 'tag' => 1 },
261 dpurdie 119
    'depend'                => { 'tag' => 1, 'unless' => ['NODEPEND','EXPERT'] },
227 dpurdie 120
    'make_lib'              => { 'tag' => 1, 'IFLAG' => 1 },
261 dpurdie 121
    'make_mlib'             => { 'tag' => 1, 'IFLAG' => 1 },
227 dpurdie 122
    'install_lib'           => { 'tag' => 1, 'IFLAG' => 1 },
123
    'make_install_shlib'    => { 'tag' => 1, 'IFLAG' => 2 },
124
    'make_prog'             => { 'tag' => 1, 'IFLAG' => 3 },
125
    'make_test'             => { 'tag' => 1, 'IFLAG' => 3 },
126
    'install_prog'          => { 'tag' => 1, 'IFLAG' => 3 },
127
    'install_class'         => { 'tag' => 1 },
128
    'package'               => { 'tag' => 1, 'IFLAG' => 3 },
129
    'deploy'                => { 'tag' => 1, 'IFLAG' => 1 },
130
 
131
    #
261 dpurdie 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
    #
227 dpurdie 139
    #   Basic commands, that appear to be unused in composite commands
140
    #   Not too sure why
141
    #
142
    'make_script'           => { 'commands' => [], 'tag' => 1 },
143
 
144
    #
145
    #   Lint related targets
146
    #
147
    'lint_lib',             => { 'tag' => 'make_lib'            , 'IFLAG' => 1 },
148
    'lint_shlib',           => { 'tag' => 'make_install_shlib'  , 'IFLAG' => 2 },
149
    'lint_prog'             => { 'tag' => 'make_prog'           , 'IFLAG' => 3 },
150
 
151
    #
152
    #   Following commands should NOT be a part of a composite command
153
    #
154
    'run_tests'             => { 'nomakecheck' => 1, 'tag' => 1, 'IFLAG' => 3},
155
    'run_unit_tests'        => { 'nomakecheck' => 1, 'tag' => 1, 'IFLAG' => 3},
156
 
157
    'clean'                 => { 'nomakecheck' => 1},
158
    'clobber'               => { 'nomakecheck' => 1},
159
    'rmlitter'              => { 'nomakecheck' => 1},
160
    'unbuild'               => { 'nomakecheck' => 1},
261 dpurdie 161
    'undepend'              => { 'nomakecheck' => 1 , 'tag' => 'depend'},
162
    'ungenerate'            => { 'nomakecheck' => 1 , 'tag' => 'generate'},
227 dpurdie 163
    'uninstall'             => { 'nomakecheck' => 1},
164
    'uninstall_class'       => { 'nomakecheck' => 1},
261 dpurdie 165
    'uninstall_hdr'         => { 'nomakecheck' => 1 , 'tag' => 'install_hdr'},
166
    'uninstall_lib'         => { 'nomakecheck' => 1 , 'tag' => 'install_lib'},
167
    'uninstall_prog'        => { 'nomakecheck' => 1 , 'tag' => 'install_prog'},
168
    'unmake_lib'            => { 'nomakecheck' => 1 , 'tag' => 'make_mlib'},
169
    'unmake_mlib'           => { 'nomakecheck' => 1 , 'tag' => 'make_mlib'},
170
    'unmake_prog'           => { 'nomakecheck' => 1 , 'tag' => 'make_prog'},
171
    'unmake_script'         => { 'nomakecheck' => 1 , 'tag' => 'make_script'},
172
    'unmake_test'           => { 'nomakecheck' => 1 , 'tag' => 'make_test'},
227 dpurdie 173
    'unobj'                 => { 'nomakecheck' => 1},
261 dpurdie 174
    'unpackage'             => { 'nomakecheck' => 1 , 'tag' => 'package'},
175
    'unmake_dir'            => { 'nomakecheck' => 1 , 'tag' => 'make_dir'},
227 dpurdie 176
 
177
    );
178
#    DebugDumpData ("Commands", \%commands);
179
 
180
#-------------------------------------------------------------------------------
181
# Function        : Mainline Entry Point
182
#
183
# Description     :
184
#
185
# Inputs          :
186
#
187
 
188
#
189
#   Parse the user options
190
#
191
my $result = GetOptions (
261 dpurdie 192
                "help:+"        => \$opt_help,              # flag, multiple use allowed
193
                "manual:3"      => \$opt_help,              # flag, multiple use allowed
194
                "verbose:+"     => \$opt_verbose,           # flag, multiple use allowed
195
                "d|debug:+"     => \$opt_debug,             # flag, multiple use allowed
227 dpurdie 196
                "default=s"     => \$opt_default,           # string
197
                );
198
 
199
                #
200
                #   UPDATE THE DOCUMENTATION AT THE END OF THIS FILE !!!
201
                #
202
 
203
#
204
#   Process help and manual options
205
#
206
pod2usage(-verbose => 0, -message => "Version: $VERSION")  if ($opt_help == 1  || ! $result);
261 dpurdie 207
pod2usage(-verbose => 1)  if ( $opt_help == 2 );
208
pod2usage(-verbose => 2)  if ( $opt_help > 2 );
227 dpurdie 209
 
210
#
211
#   Configure the error reporting process now that we have the user options
212
#
213
ErrorConfig( 'name'    => 'Make',
214
             'verbose' => $opt_verbose,
215
             'debug'   => $opt_debug );
216
 
217
#
218
#   Configure the 'System' process so that it will terminate on any error
219
#   and not report the complete command line
220
#
221
SystemConfig ( 'ExitOnError' => 2);
222
 
223
#
224
#   Extract non-option commands
225
#   Much of this is for backward compatability
226
#   Support the following arguments
227
#       XXXXX=yyyy      Makefile Definition
228
#       -XXXX           Flags passed to make
229
#       XXXX            Raw target name
230
#
231
foreach my $arg ( @ARGV )
232
{
233
    Verbose2 ("Arg: $arg");
234
    if ( $arg =~ m~(\w+)=(.+)~ ) {
235
        $defs{uc($1)} = $2;
236
 
237
    } elsif ( $arg =~ m/^-/ ) {
238
        push @defs, $arg;
239
 
240
    } else {
241
        push @targets, $arg;
242
 
243
    }
244
}
245
 
246
#
247
#   Misc. Initialisation
248
#
249
InitFileUtils();
250
 
251
EnvImport( 'GBE_TOOLS' );
252
$makelib = "$GBE_TOOLS/makelib.pl";
253
Error ("Cannot locate JATS file: $makelib") unless ( -f $makelib );
254
 
255
EnvImportOptional ( 'GBE_ABT' );
256
EnvImportOptional ( 'GBE_PLATFORM' );
257
 
258
#
259
#   Validate user options
260
#
261
@targets = ($opt_default)
262
    if ( $opt_default && ! @targets);
263
Error ("No make targets specified" ) unless ( @targets );
264
 
265
#
266
#   Build the @defs array
267
#   This is a set of definitions passed to the makefiles
268
#   It is created on the fly to allow command line options to modify the definitions
269
#
270
foreach  ( sort keys %defs )
271
{
272
    next if ( m~^DEBUG$~i );                    # Naughty user
273
    push @defs, "$_=$defs{$_}";                 # Makefile defs are XXXX=aaaa
274
}
275
 
276
#
277
#   Look for OPTIONS=*args* and disable the silent make operation
278
#   This will allow the make to output messages
279
#
280
if (( exists $defs{OPTIONS} && $defs{OPTIONS} =~ m/args/ ) || $opt_verbose || $opt_debug )
281
{
282
    $opt_silent = 0;
283
}
284
 
285
#
286
#   Process GBE_PLATFORM and create a usable hash
287
#
288
if ( $GBE_PLATFORM )
289
{
290
    Verbose2 ("GBE_PLATFORM: $GBE_PLATFORM");
291
    $gbe_platform{$_} = 1 foreach ( split( / /, $GBE_PLATFORM ) );
239 dpurdie 292
    $gbe_platform{GENERIC} = 1;
227 dpurdie 293
}
294
 
295
#
296
#   Read in the local Makefile.gbe file
297
#   This will provide a path to the interface directory
298
#
299
ReadMakeInfo();
300
 
301
#
302
#   Read in the global build variables
303
#
304
ReadBuildConfig( "$::ScmRoot/$::ScmInterface" );
305
 
306
#
307
#   Determine the max size of the target name
308
#   Makes a nice display
309
#
310
foreach ( @BUILDPLATFORMS )
311
{
312
    my $len = length ($_);
313
    $tlen = $len if ( $len > $tlen );
314
}
315
 
316
#-------------------------------------------------------------------------------
317
#   Scan the list of targets and perform 'alias' expansion
318
#   targets are of the form
319
#       platform_command_type
320
#       Where:
321
#           type        may be _prod or _debug or not present
322
#           command     may be either a composite command or a simple command
323
#           platform    may be a platform or an alias
324
#
325
#
326
foreach my $arg ( @targets )
327
{
328
    my $suffix = '';
329
    my @commands;
330
    my @platforms;
331
 
332
    #
333
    #   Remove the only available suffix ( _debug | _prod )
334
    #   Also detect commnads of debug or prod
335
    #
336
    if ( $arg =~ m~(.+)_(debug)$~ ) {
337
        $suffix = $2;
338
        $arg = $1;
339
    } elsif ( $arg =~ m~(.+)_(prod)$~ ) {
340
        $suffix = $2;
341
        $arg = $1;
342
    } elsif ( $arg eq 'debug' ) {
343
        $suffix = $arg;
344
        $arg = '';
345
    } elsif ( $arg eq 'prod' ) {
346
        $suffix = $arg;
347
        $arg = '';
348
    }
349
 
350
    #
351
    #   Remove valid make commands from the remaining argument
352
    #   Have a hash of all known makefile commands
353
    #
354
    foreach my $cmd ( keys %composite_commands, keys %commands )
355
    {
356
        if ( $arg eq $cmd )
357
        {
358
            @commands = ExpandComposite($cmd);
359
            $arg = '';
360
        }
361
        elsif ( $arg =~ m~(.+)_($cmd)$~ )
362
        {
363
            $arg = $1;
364
            @commands = ExpandComposite($2);
365
            last;
366
        }
367
    }
368
 
369
    #
370
    #   See of we can extract an platform alias from the command
371
    #   Rip into target + command
372
    #
373
    if ( $arg )
374
    {
375
        if ( exists $ScmBuildAliases{$arg}  )
376
        {
377
            @platforms =  split (/ /, $ScmBuildAliases{$arg} );
378
        }
379
        elsif ( exists $ScmBuildPlatforms{$arg} )
380
        {
381
            @platforms = ($arg);
382
        }
383
        else
384
        {
385
            if ( @commands )
386
            {
387
                Error ("Unknown target: $arg");
388
            }
389
            else
390
            {
391
                Message ("Unknown command. Passed to make: $arg");
392
                @commands = $arg;
393
            }
394
        }
395
    }
396
 
397
    #
398
    #   Insert defaults
399
    #
400
    @platforms = @DEFBUILDPLATFORMS
401
        unless ( @platforms );
402
 
403
    @commands = ExpandComposite('all')
404
        unless ( @commands);
405
 
406
    #
407
    #   Perform GBE_PLATFORM filtering
408
    #
239 dpurdie 409
    @platforms = grep ( exists $gbe_platform{$_} , @platforms )
410
        if ( %gbe_platform );
227 dpurdie 411
 
412
    Error ("No platforms to be processed. Check GBE_PLATFORM")
413
        unless ( @platforms );
414
 
415
    #
416
    #   Iterate commands over platforms
417
    #
418
    foreach my $cmd ( @commands )
419
    {
420
        PerformCommand (\@platforms, $cmd, $suffix );
421
    }
422
}
423
 
424
#
425
#   All done
426
#
427
exit (0);
428
 
429
#-------------------------------------------------------------------------------
430
# Function        : PerformCommand
431
#
432
# Description     : Perform the make on a platform command
433
#
434
# Inputs          : $platform_ref   - platforms to process
435
#                   $cmd            - simple make command
436
#                   $suffix         - debug,prod,none
437
#
438
# Returns         : 
439
#
440
sub PerformCommand
441
{
442
    my ($platform_ref, $cmd, $suffix) = @_;
443
    my $do_prod = 1;
444
    my $do_debug = 1;
445
 
446
    #
447
    #   Clean up some ugly commands from lint and ctags
448
    #
449
    if ( $cmd =~ m~(.+)_(debug)$~ )
450
    {
451
        $cmd = $1;
452
        $suffix = $2;
453
    }
454
    Verbose2 ("Processing Target: $cmd, $suffix");
455
 
456
    #
457
    #   Limit command to production or debug
458
    #
459
    if ( $suffix eq 'debug' ) {
460
        $do_prod  = 0;
461
    } elsif ( $suffix eq 'prod' ) {
462
        $do_debug  = 0;
463
    }
464
 
465
    #
466
    #   Some commands can be suppressed by options
261 dpurdie 467
    #   These are an array of options
227 dpurdie 468
    #
469
    if ( exists $commands{$cmd}{'unless'}  )
470
    {
261 dpurdie 471
        foreach my $check ( @{$commands{$cmd}{'unless'}} )
227 dpurdie 472
        {
261 dpurdie 473
            if ( exists $defs{$check} && $defs{$check} )
474
            {
475
                Verbose2 ("Skipping: $cmd because $check");
476
                return;
477
            }
227 dpurdie 478
        }
479
    }
480
 
481
    #
482
    #   Interecpt commands that are handled locally
483
    #
484
    if ( exists $commands{$cmd}{'local'} )
485
    {
486
        $commands{$cmd}{'local'}( $cmd, $platform_ref );
487
        return;
488
    }
489
 
490
    #
491
    #   Process and recurse directory tree
492
    #
493
    Verbose ("Processing: $cmd, @{$platform_ref}");
494
 
495
    #
496
    #   Determine the local tag name and state
497
    #   The tag is used to short circuit makefile commands in recursive makes
498
    #   It greatly reduces the work required
499
    #
500
    #   Many commands have a tag that is the same as the command, but a few don't
501
    #
502
    my $tag = 0;
503
    if ( exists $commands{$cmd}{tag}  )
504
    {
505
        $tag = $commands{$cmd}{tag};
506
        $tag = $cmd if ( $tag eq '1' );
507
    }
508
 
509
    if ( $commands{$cmd}{'common'} )
510
    {
511
        InvokeSubMake( $::Cwd, $platform_ref ,$cmd, $tag, 1 );
512
    }
513
    else
514
    {
515
        InvokeSubMake( $::Cwd, $platform_ref ,$cmd, $tag, 1 ) if $do_debug;
516
        InvokeSubMake( $::Cwd, $platform_ref ,$cmd, $tag, 0 ) if $do_prod;
517
    }
518
}
519
 
520
#-------------------------------------------------------------------------------
521
# Function        : InvokeSubMake
522
#
523
# Description     : Build recursion
524
#                   Determine if there is anything to be done for the current
525
#                   target within a specified directory
526
#
527
# Inputs          : $dir
528
#                   $pref                   - Ref to an array of platforms
529
#                   $cmd
530
#                   $tag
531
#                   $do_prod
532
#
533
# Returns         : 
534
#
535
sub InvokeSubMake
536
{
537
    my ( $dir, $pref, $cmd, $tag, $do_debug) = @_;
538
 
539
    #
540
    #   Ensure the current directory is known to the Tags database
541
    #
542
    $Tags = ReadMaketags( $dir );
543
    Error ("Directory not in tag database", $dir ) unless ( $Tags );
544
 
545
    #
546
    #   Process commands in the current directory
547
    #   If the command is tagged, then we may be able to skip it
548
    #   Otherwise we need to do it
549
    #
550
    InvokeMake( $dir, $pref, $cmd, $tag, $do_debug );
551
 
552
    #
553
    #   Recurse into any subdirectories that may be a part of the build
554
    #
555
    unless ( exists $defs{NORECURSE} && $defs{NORECURSE}  )
556
    {
557
        #
558
        #   Process subdirectories for the current command
559
        #   If the command is tagged, then we may be able to skip it
560
        #   Otherwise we need to do it
561
        #
562
        foreach my $subdir (@{$Tags->{$dir}{subdirs}} )
563
        {
564
 
565
            InvokeSubMake( CleanDirName( "$dir/$subdir"), $pref, $cmd, $tag, $do_debug );
566
        }
567
    }
568
}
569
 
570
#-------------------------------------------------------------------------------
571
# Function        : InvokeMake
572
#
573
# Description     : Actually invoke the make for debug and production as required
574
#
575
# Inputs          : $dir
576
#                   $pref
577
#                   $cmd
578
#                   $tag
579
#                   $do_debug
580
#
581
#
582
# Returns         : 
583
#
584
sub InvokeMake
585
{
586
    my ( $dir, $pref, $cmd, $tag, $do_debug ) = @_;
587
    my $text = 'C';
588
 
279 dpurdie 589
    Verbose2 ("InvokeMake: $dir");
227 dpurdie 590
    #
591
    #   Ensure that the current directory actually has makefile targets
592
    #   Not all makefile.pl create .mk files
593
    #       1) Top-level makefile.pl
594
    #       2) Makefiles that use --NoPlatformBuilds
595
    #
596
    if ( $Tags->{$dir}{root} )
597
    {
598
        Verbose2 "Root directory has no makefiles: $dir";
599
        return;
600
    }
601
 
602
    if ( $Tags->{$dir}{noplatforms} )
603
    {
604
        Verbose2 "No make targets in $dir";
605
        return;
606
    }
607
 
608
    #
609
    #   Process each platform
610
    #
611
    foreach my $target ( @{$pref} )
612
    {
613
        unless ( exists $Tags->{$dir}{platforms}{$target} )
614
        {
615
            Verbose2 "No make targets in $dir, for $target";
616
            next;
617
        }
618
 
619
        #
620
        #   Do we need to do any thing for this target / tag
621
        #
622
        if ( $tag )
623
        {
624
            unless ( exists $Tags->{$dir}{full}{$target}{'%MakeTags'}{$tag} )
625
            {
261 dpurdie 626
                Verbose2 ("Skipping $cmd in $dir for $tag");
227 dpurdie 627
                next;
628
            }
629
        }
630
 
631
        #
632
        #   common mode == 2
633
        #   Only process target ONCE for each platform
634
        #   Don't care when its used
635
        #
261 dpurdie 636
        if ( exists $commands{$cmd}{'common'} && $commands{$cmd}{'common'} & 2 )
227 dpurdie 637
        {
638
            if ( $common_cmd{$cmd}{$target} )
639
            {
640
                Verbose2 "Already performed $cmd for $target";
641
                next;
642
            }
643
            $common_cmd{$cmd}{$target} = 1;
644
        }
645
 
646
        #
647
        #   Is the build limited to only debug or production
648
        #
261 dpurdie 649
        unless ( exists $commands{$cmd}{'common'} )
227 dpurdie 650
        {
651
            if ( $do_debug == 0 ) {
652
                next unless ( $Tags->{$dir}{platforms}{$target}{prod} );
653
                $text = 'P';
654
 
655
            } elsif  ( $do_debug == 1 ) {
656
                next unless ( $Tags->{$dir}{platforms}{$target}{debug} );
657
                $text = 'D';
658
            }
659
        }
660
 
661
        #
662
        #   Final sanity test
663
        #   Must have the makefile. We should have detected this error before now
664
        #
665
        Error ("Makefile not found - $target") unless ( -f "$dir/$target.mk" );
666
 
667
        #
275 dpurdie 668
        #   Export data into the user environment
669
        #   Allows underlying tools to locate data files with little effort
670
        #
671
        $ENV{'GBE_MAKE_TYPE'} = $text;                  # P or D or C
672
        $ENV{'GBE_MAKE_TARGET'} = $target;              # Target platform
673
        $ENV{'GBE_MAKE_CFG'} = $Tags->{$dir}{config};   # Ref to config data
674
        $ENV{'GBE_MAKE_CMD'} = $cmd;                    # Make phase
675
 
676
        #
227 dpurdie 677
        #   Build up the make command line
678
        #   Examine command specfic flags
679
        #
680
        my @args = @defs;
681
        push @args, "IFLAG=$commands{$cmd}{IFLAG}" if ( exists $commands{$cmd}{IFLAG} );
261 dpurdie 682
        push @args, "NOSCMDEPEND=1";
227 dpurdie 683
 
684
        my $cdir = CleanDirName ($dir);
685
        my @make_command;
686
        push @make_command, "$ENV{GBE_BIN}/xmake";
687
        push @make_command, "-s" if $opt_silent;
688
        push @make_command, "--no-print-directory";
689
        push @make_command, "-C", $cdir unless ( $cdir eq $::Cwd );
690
        push @make_command, "-f", "$target.mk";
691
        push @make_command, @args;
692
        push @make_command, 'make_dir' unless exists $commands{$cmd}{nomakecheck} ;
693
        push @make_command, $cmd;
694
 
695
        Message ( sprintf ("[$text] %-${tlen}s, $cmd, $cdir", $target ));
696
        System (@make_command, "DEBUG=$do_debug" );
697
    }
698
}
699
 
700
#-------------------------------------------------------------------------------
701
# Function        : TestMakeFiles
702
#
703
# Description     : Test all the makefile dependent files to see if any of the
704
#                   makefiles need to be rebuilt.
705
#
706
#                   Walk the directory tree looking for makefiles to be
707
#                   rebuilt.
708
#
709
# Inputs          : $cmd            - Current command
710
#                   $pref           - Ref to an array of platforms
711
#
712
# Returns         : 
713
#
714
sub TestMakeFiles
715
{
716
    my ( $cmd, $pref ) = @_;
717
    Verbose ("Test makefile dependencies");
718
 
719
    #
720
    #   Read in the Tag file for the current directory
721
    #   This will provide the current list of subdirectories
722
    #
723
    #   Process Test the current makefiles, then test any subdirs
724
    #
725
    TestSubMake( $cmd, $Cwd, $pref );
726
 
727
    #
728
    #   Report build errors
729
    #   Done after all makefiles have been processed
730
    #
731
    if ( $build_error )
732
    {
733
        Error ("Error creating makefiles. Errors previously reported");
734
    }
735
 
736
    #
737
    #   Post makefile build processing
738
    #   Only required if a files have been re-built
739
    #
740
    if ( $update )
741
    {
742
        #
743
        #   Sanity test the makefile structure
744
        #   Ensure that makefiles have only one parent.
745
        #
746
        TestParents();
747
 
748
        #
749
        #   Sanity test the installed and packaged files
750
        #   Generate warnings and errors if a file if packaged from two
751
        #   locations
752
        #
753
        TestPackages();
754
 
755
        #
756
        #   Generate DPACKAGE file if required
757
        #
758
        JatsDPackage::DPackageGenerate( $::ScmRoot, $::ScmInterface  );
759
    }
760
 
761
    #
762
    #
763
    #   Check that the build.pl file is not newer that the tags file
764
    #   This will not be an error, but it will be a nagging warning
765
    #
766
    my @build_warn;
767
    my $bstamp = -M "$::ScmRoot/$ScmBuildSrc";
768
    my $tstamp = -M "$::ScmRoot/Makefile.gbe";
769
 
770
    push @build_warn, "Missing: Makefile.gbe" unless ( defined $tstamp );
771
    push @build_warn, "Modified build file ($ScmBuildSrc)" if ( $tstamp && $bstamp < $tstamp );
772
    if ( @build_warn )
773
    {
774
        Warning ("The build file is newer than the generated files",
775
                 "The project needs to be built for these changes to be included",
776
                 @build_warn );
777
    }
778
}
779
 
780
#-------------------------------------------------------------------------------
781
# Function        : TestSubMake
782
#
783
# Description     : Test the makefiles in the current directory
784
#                   Recurse into subdirectories
785
#
786
# Inputs          : $cmd            - Current command
787
#                   $dir            - Directory to test
788
#                   $pref           - Ref to an array of platforms
789
#
790
# Returns         : 
791
#
792
sub TestSubMake
793
{
794
    my ($cmd, $dir, $pref ) = @_;
795
 
796
    $Tags = ReadMaketags( $dir, 1 );
797
    unless ( $Tags )
798
    {
799
        Verbose2 ("TestSubMake :Directory not in tag database", $dir );
800
        MakeBuild( $dir);
801
    }
802
    else
803
    {
804
        TestMake( $cmd, $dir, $pref );
805
    }
806
 
807
    #
808
    #   Recurse into any subdirectories that may be a part of the build
809
    #
810
    unless ( exists $defs{NORECURSE} && $defs{NORECURSE}  )
811
    {
812
        foreach my $subdir (@{$Tags->{$dir}{subdirs}} )
813
        {
814
            TestSubMake( $cmd, CleanDirName( "$dir/$subdir"), $pref );
815
        }
816
    }
817
}
818
 
819
#-------------------------------------------------------------------------------
820
# Function        : TestMake
821
#
822
# Description     : Test the makefiles component files
823
#                   and determine if the makefile(s) need to be rebuilt
824
#
825
# Inputs          : $cmd            - Current command
826
#                   $dir            - Directory to test
827
#                   $pref           - Ref to an array of platforms
828
#
829
# Returns         : 
830
#
831
sub TestMake
832
{
833
    my ( $cmd, $dir, $pref ) = @_;
834
    my @must_rebuild;
835
 
836
    if ( $cmd eq 'rebuild' )
837
    {
838
        MakeBuild( $dir);
839
        return;
840
    }
841
 
842
    #
843
    #   Check that the local makefile.pl is not newer than
844
    #   the Tags file. Not all makefile.pl's create .mk files
845
    #
846
    my $mstamp = -M "$dir/makefile.pl";
847
    my $tstamp = -M "$dir/Makefile.gbe";
848
 
849
    unless ( defined $tstamp )
850
    {
851
        UniquePush (\@must_rebuild, "Missing: $dir/Makefile.gbe");
852
    }
853
 
854
    if ( $mstamp && $mstamp < $tstamp  )
855
    {
856
        UniquePush (\@must_rebuild, "Updated: $dir/makefile.pl");
857
    }
858
    else
859
    {
860
        if ( $Tags->{$dir}{root} )
861
        {
862
            Verbose2 "TestMake: Root directory has no makefiles: $dir";
863
            return;
864
        }
865
 
866
        if ( $Tags->{$dir}{noplatforms} )
867
        {
868
            Verbose2 "TestMake: No make targets in $dir";
869
            return;
870
        }
871
 
872
        #
873
        #   Process only the required build targets
874
        #
875
        foreach my $tgt ( keys %{$Tags->{$dir}{platforms}}   )
876
        {
877
            next if ( %gbe_platform && not exists $gbe_platform{$tgt} );
878
            #
879
            #   Locate all the makefile dependent files
880
            #
881
            my $data = $Tags->{$dir}{full}{$tgt}{'@ScmDepends'};
882
            if ( $data )
883
            {
884
                Verbose2 ("Processing: $dir : $tgt");
885
                my $base_stamp = -M "$dir/$tgt.mk";
886
                unless ( defined $base_stamp )
887
                {
888
                    UniquePush (\@must_rebuild, "Missing: $dir/$tgt.mk");
889
                }
890
                else
891
                {
892
                    foreach my $file ( "$dir/makefile.pl" ,@$data )
893
                    {
894
                        $file = "$dir/$file" if ( $file =~ m~^\.~ );
895
                        my $stamp = -M $file;
896
                        if ( defined $stamp )
897
                        {
898
                            Verbose3 ("Timestamp: $stamp, $file");
899
                            if ( $stamp < $base_stamp  )
900
                            {
901
                                UniquePush (\@must_rebuild, $file);
902
                            }
903
                        }
904
                        else
905
                        {
906
                            UniquePush (\@must_rebuild, "Missing: $file");
907
                        }
908
                    }
909
                }
910
            }
911
            else
912
            {
913
                Warning ("No dependency information for: $tgt in $dir");
914
            }
915
        }
916
    }
917
 
918
    if ( @must_rebuild )
919
    {
920
        my @display;
921
        push (@display, CleanDirName($_) ) foreach ( @must_rebuild );
922
        Message ("One or more JATS source or internal files have changed, Makefiles will be rebuilt",
923
                  "Target is: $dir",
924
                  @display );
925
        MakeBuild ($dir);
926
    }
927
    return;
928
}
929
 
930
#-------------------------------------------------------------------------------
931
# Function        : MakeBuild
932
#
933
# Description     : Rebuild the makefiles in the specified directory
934
#                   This does not involve recursion - thats already been
935
#                   done.
936
#
937
#                   Once the makefiles have been re-built the tags database
938
#                   must be read in again as it may have changed.
939
#
940
# Inputs          : 
941
#
942
# Returns         : 
943
#
944
sub MakeBuild
945
{
946
    my ($dir) = @_;
947
 
948
    #
949
    #   No makefiles to build in the root directory
950
    #   Can't rebuild the top-level Makefile.gbe file
951
    #
952
    return if ( $Tags->{$dir}{root} );
953
 
954
    #
955
    #   Try to rebuild the makefile
956
    #
957
    chdir $dir || Error ("Cannot change directory to $dir");
261 dpurdie 958
    my $result = System ('--NoExit', $ENV{GBE_PERL}, 'makefile.pl',
959
                            $::ScmRoot, $makelib, "--interface=$::ScmInterface" );
227 dpurdie 960
    chdir $::Cwd || Error ("Cannot change directory to $::Cwd");
961
 
962
    #
963
    #   Re-read the tags database
964
    #
965
    $Tags = ReadMaketags( $dir, 2 );
966
 
967
    #
968
    #   Flag that makefiles have been modified
969
    #
970
    $update = 1;
261 dpurdie 971
    $build_error = 1 if ( $result );
227 dpurdie 972
}
973
 
974
#-------------------------------------------------------------------------------
975
# Function        : UnMakeFiles
976
#
977
# Description     : Delete generated makefiles and control files
978
#
979
# Inputs          : $cmd            - Current command
980
#                   $pref           - Ref to an array of platforms
981
#
982
# Returns         : 
983
#
984
sub UnMakeFiles
985
{
986
    #
987
    #   Recurse down the tree
988
    #   Recurse, then performs operations in the current directory
989
    #
990
    sub UnSubMakeFiles
991
    {
992
        my ($dir) = @_;
993
        $Tags = ReadMaketags( $dir, 1 );
994
        foreach my $subdir (@{$Tags->{$dir}{subdirs}} )
995
        {
996
            UnSubMakeFiles( CleanDirName( "$dir/$subdir") );
997
        }
998
        UnMake( $dir );
999
    }
1000
 
1001
    #
1002
    #   Delete makefiles in the current directory
1003
    #
1004
    sub UnMake
1005
    {
1006
        my ($dir) = @_;
1007
        Verbose("Unmake in $dir");
1008
        foreach my $tgt ( keys %{$Tags->{$dir}{platforms}}   )
1009
        {
1010
            Verbose2("Unmake. Delete ${tgt}.mk");
1011
            unlink ("$dir/${tgt}.mk");
1012
        }
1013
        unlink ("$dir/Makefile.gbe");
1014
        Verbose2("Unmake. Delete Makefile.gbe");
1015
    }
1016
 
1017
    #
1018
    #   Depth first recursion through the tree
1019
    #
1020
    UnSubMakeFiles ( $Cwd );
1021
}
1022
 
1023
#-------------------------------------------------------------------------------
1024
# Function        : TestParents
1025
#
1026
# Description     : Ensure that each makefile node has exactly one parent
1027
#                   Prevent the user from creating recursive loops
1028
#
1029
# Inputs          : 
1030
#
1031
# Returns         : 
1032
#
1033
my %parents;
1034
sub TestParents
1035
{
1036
    Verbose ("Test makefile parents");
1037
    #
1038
    #   Init the hash. Command may be invoked multiple times
1039
    #
1040
    %parents = ();
1041
 
1042
    #
1043
    #   Recurse down the tree
1044
    #   Recurse, then performs operations in the current directory
1045
    #
1046
    sub RecurseDown
1047
    {
1048
        my ($dir) = @_;
1049
        $Tags = ReadMaketags( $dir, 1 );
1050
        Verbose2("TestParents in $dir");
1051
        foreach my $subdir (@{$Tags->{$dir}{subdirs}} )
1052
        {
1053
            my $subdir = CleanDirName( "$dir/$subdir");
1054
            push @{$parents{$subdir}}, $dir;
1055
            RecurseDown( $subdir );
1056
        }
1057
    }
1058
 
1059
    #
1060
    #   Depth first recursion through the tree
1061
    #
1062
    RecurseDown ( $Cwd );
1063
 
1064
    #
1065
    #   Test for only one parent
1066
    #   The root makefile won't have any
1067
    #
1068
    foreach my $dir ( sort keys %{$Tags} )
1069
    {
1070
        my $count = $#{$parents{$dir}};
1071
        if ( $count > 0 )
1072
        {
1073
            if ( defined($GBE_ABT) )
1074
            {
1075
                Warning ("Error supressed by ABT");
1076
                Warning ("makefile.pl with multiple parents",
1077
                         "makefile.pl in: $dir",
1078
                         "Parented by:", @{$parents{$dir}} );
1079
            }
1080
            else
1081
            {
1082
                unlink $Tags->{$dir}{config};
1083
                Error ("makefile.pl with multiple parents",
1084
                       "makefile.pl in: $dir",
1085
                       "Parented by:", @{$parents{$dir}} );
1086
            }
1087
        }
1088
    }
1089
}
1090
 
1091
#-------------------------------------------------------------------------------
1092
# Function        : TestPackages
1093
#
1094
# Description     : Ensure that files that are packaged and installed are
1095
#                   only done from one makefile. Warn if the same file
1096
#                   is being packaged from multiple makefiles.
1097
#
1098
# Inputs          : 
1099
#
1100
# Returns         : 
1101
#
1102
my %test_packages;
1103
sub TestPackages
1104
{
1105
    Verbose ("Test packaged files");
1106
    #
1107
    #   Init the hash. Command may be invoked multiple times
1108
    #
1109
    %test_packages = ();
1110
 
1111
    #
1112
    #   Recurse down the tree
1113
    #   Recurse, then performs operations in the current directory
1114
    #
1115
    sub TRecurseDown
1116
    {
1117
        my ($dir) = @_;
1118
        Verbose2("TestPackages in $dir");
1119
        $Tags = ReadMaketags( $dir, 1 );
1120
        #
1121
        #   Process makefile
1122
        #   Examine all the %PACKAGE_xxx and %INSTALL_xxx fields thare listed
1123
        #   in the @PACKAGE_VARS and @INSTALL_VARS array
1124
        #
1125
        foreach my $target ( keys %{$Tags->{$dir}{platforms}}   )
1126
        {
1127
            next if ( %gbe_platform && not exists $gbe_platform{$target} );
1128
            foreach my $field ( @{$Tags->{$dir}{full}{$target}{'@PACKAGE_VARS'}},
1129
                                @{$Tags->{$dir}{full}{$target}{'@INSTALL_VARS'}} )
1130
            {
1131
                foreach my $entry ( keys %{$Tags->{$dir}{full}{$target}{$field}} )
1132
                {
1133
                    Verbose3("TestPackages: $target, File: $entry");
1134
                    push @{$test_packages{$target}{$entry}}, $dir;
1135
                }
1136
            }
1137
        }
1138
 
1139
        #
1140
        #   Process subdirectories too
1141
        #
1142
        foreach my $subdir (@{$Tags->{$dir}{subdirs}} )
1143
        {
1144
            TRecurseDown( CleanDirName( "$dir/$subdir") );
1145
        }
1146
    }
1147
 
1148
 
1149
 
1150
    #
1151
    #   Depth first recursion through the tree
1152
    #
1153
    TRecurseDown ( $Cwd );
1154
 
1155
    #
1156
    #   Test and report files that are packaged in different makefiles
1157
    #   There are two issues:
1158
    #       1) Not good practice
1159
    #       2) May be different files
1160
    #   The warning message is a bit ugly - but it shouldn't pop up often.
1161
    #
1162
#    DebugDumpData ("test_packages", \%test_packages);
1163
 
1164
    foreach my $target ( sort keys %test_packages )
1165
    {
1166
        foreach my $file ( sort keys %{$test_packages{$target}} )
1167
        {
1168
            #
1169
            #   The descpkg file is known to be packaged from multiple dirs
1170
            #
1171
            next if ( $file =~ m~/descpkg~ );
1172
            if ( $#{$test_packages{$target}{$file}} > 0 )
1173
            {
1174
                Warning ("File is packaged or installed from multiple makefiles",
1175
                         "Target: $target, Packaged file: $file",
1176
                         "Packaged from the following directories:", @{$test_packages{$target}{$file}} );
1177
            }
1178
        }
1179
    }
1180
}
1181
 
1182
 
1183
#-------------------------------------------------------------------------------
1184
# Function        : DoHelp
1185
#
1186
# Description     : Display basic help information
1187
#
1188
# Inputs          : None
1189
#
1190
# Returns         :
1191
#
1192
sub DoHelp
1193
{
1194
 
1195
#
1196
#   Display basic usage information
1197
#
1198
    pod2usage(-verbose => 0,
1199
              -message => "Version: $VERSION",
1200
              -exitval => 'NOEXIT');
1201
 
1202
    print "Platform targets\n";
1203
    foreach ( sort keys %BUILDINFO )
1204
    {
1205
        print "    $_\n";
1206
    }
1207
 
1208
    my @alias = sort keys %ScmBuildAliases;
1209
    if ( $#alias >=0 )
1210
    {
1211
        print "Alias targets\n";
1212
        foreach ( @alias )
1213
        {
1214
            print "    $_   - $ScmBuildAliases{$_}\n";
1215
        }
1216
    }
1217
}
1218
 
1219
#-------------------------------------------------------------------------------
1220
# Function        : ReadMaketags
1221
#
1222
# Description     : Read in the global make tags data base
1223
#                   This contains information on all the components within
1224
#                   the build. The tags allow recursive makes to be pruned.
1225
#
1226
#                   The file may change while the build is running
1227
#                   It can be read multiple times
1228
#
1229
# Inputs          : $dir            - Directory entry to read
1230
#                   $test           - 1: Read if available
1231
#                                     2: Force read
1232
#
1233
# Returns         : Reference to the tag data for the requested directory
1234
#                   Will error if no available
1235
#
1236
our %cf_minfo;
1237
our %cf_minfo2;
1238
my %tag_data;
1239
sub ReadMaketags
1240
{
1241
    my ($dir, $test) = @_;
1242
 
1243
    #
1244
    #   Force data re-aquisition
1245
    #
1246
    delete $tag_data{$dir}
1247
        if ( $test && $test == 2 );
1248
 
1249
    #
1250
    #   Do we already have the entry
1251
    #
1252
    return \%tag_data
1253
        if ( exists ($tag_data{$dir} ));
1254
 
1255
    #
1256
    #   If the entry is not known, then re-read the index file
1257
    #
1258
    unless ( $::cf_filelist{$dir} )
1259
    {
1260
        my $index_file = "$::ScmRoot/$::ScmInterface/Makefile.cfg";
1261
        Error ("Makefile index missing. Rebuild required") unless ( -f $index_file );
1262
 
1263
        #
1264
        #   Kill the entry in %INC to force the file to be read in
1265
        #
1266
        $::cf_filelist = ();
1267
        delete $INC{ $index_file };
1268
        require $index_file;
1269
    }
1270
 
1271
    my $cfg_filen = $::cf_filelist{$dir};
1272
    unless ( $cfg_filen )
1273
    {
1274
        return undef
1275
            if ( $test );
1276
        Error ("Makefile index entry missing: $dir. Rebuild required");
1277
    }
1278
 
1279
 
1280
    #
1281
    #   Read in all the Makefile_x.cfg files
1282
    #
1283
    %cf_minfo = ();
1284
    %cf_minfo2 = ();
1285
    my $cfg_file = "$::ScmRoot/$::ScmInterface/$cfg_filen";
1286
 
1287
    unless ( -f $cfg_file )
1288
    {
1289
        return undef
1290
            if ( $test );
1291
        Error ("Make data file missing: $cfg_file. Rebuild required");
1292
    }
1293
 
1294
    delete $INC{ $cfg_file };
1295
    require $cfg_file;
1296
 
1297
    Error ("Makefile info2 not present")
1298
        unless ( keys %::cf_info2 );
1299
 
1300
    Error ("Makefile info2 incorrect version. Rebuild required")
1301
        unless ( exists $::cf_info2{version} && $::cf_info2{version} eq 1 );
1302
 
1303
    %{$tag_data{$dir}} = %::cf_info2;
1304
    $tag_data{$dir}{config} = $cfg_file;
1305
    %{$tag_data{$dir}{full}} = %::cf_info;
1306
 
1307
#DebugDumpData ("ReadMaketags", $tag_data{$dir});
1308
    return \%tag_data;
1309
 
1310
}
1311
 
1312
#-------------------------------------------------------------------------------
1313
# Function        : ExpandComposite
1314
#
1315
# Description     : Expand a command via composite command expansion
1316
#                   A composite command may contain other composite commands
261 dpurdie 1317
#                   Detect, as an error, recursive expansions
227 dpurdie 1318
#
1319
# Inputs          : $cmd    - command to expand
1320
#
1321
# Returns         : An array of commands
1322
#
1323
sub ExpandComposite
1324
{
1325
    my ($cmd) = @_;
1326
    my @cmds;
1327
    my @scmds = $cmd;
261 dpurdie 1328
    my %seen;
227 dpurdie 1329
    while ( @scmds )
1330
    {
1331
        my $cmd = shift @scmds;
1332
        if ( exists $composite_commands{$cmd} )
1333
        {
261 dpurdie 1334
 
1335
            Error ("Internal. Recursion in composite command definitions: $cmd")
1336
                if ($seen{$cmd});
1337
 
227 dpurdie 1338
            @scmds = (@{$composite_commands{$cmd}}, @scmds);
261 dpurdie 1339
            $seen{$cmd} = 1;
227 dpurdie 1340
        }
1341
        else
1342
        {
1343
            push @cmds, $cmd;
1344
        }
1345
    }
1346
 
1347
    return @cmds;
1348
}
1349
 
1350
 
1351
#-------------------------------------------------------------------------------
1352
#   Documentation
1353
#
1354
 
1355
=pod
1356
 
1357
=head1 NAME
1358
 
1359
jmake - JATS make support tool
1360
 
1361
=head1 SYNOPSIS
1362
 
1363
 Usage: jats make [options][targets][flags]
1364
 
1365
 Where options:
1366
    -h, -h -h, -man     - Help messages with increasing verbosity
1367
    -verbose            - Verbose operation
1368
    -debug              - Debug operation
1369
    -default=target     - Default 'target' if none is supplied
1370
 
1371
 Where flags are of the form Name=Value
1372
    SHOWENV=1           - Show make environment
1373
    LEAVETMP=1          - Leave temp working files
1374
    NODEPEND=1          - Ignore dependency checking
261 dpurdie 1375
    EXPERT=1            - Ignore dependency on makefiles
227 dpurdie 1376
    OPTIONS=[opt]       - Maketime options [args,allargs,filter...]
1377
 
1378
 Valid targets include:
1379
    all                 - build and install everything(p*)
1380
    build               - build everything (pu)
1381
    debug               - build all things for debug (pu)
1382
    prod                - build all things for production (pu)
1383
    install             - install public components (pu*)
1384
    lint                - lints the source (assumes debug)(p)
1385
    package             - build all packages (pu*)
1386
    package-{set}       - build specific package (see below) (pu*)
1387
    run_tests           - Run the tests specified in the makefile
1388
    run_unit_tests      - Run the automatic unit tests specified in the makefile
1389
    deploy              - Run the deployment scripts (p*)
1390
    rebuild             - recursively rebuild makefiles
1391
    depend              - construct the dependencies (u*)
1392
    rmlitter            - remove build litter (core, tmp and err) (*)
1393
    clean               - delete generate, obj, libraries and programs (p*)
1394
    clobber             - delete everything which can be remade (p*)
1395
    help                - A list of alias and platforms
1396
 
1397
      (u) undo target available (ie uninstall)
1398
      (p) optional [platform_] prefix targets (ie XXX_build)
1399
      (*) optional [_debug|_prod] postfix targets (ie clean_debug)
1400
 
1401
 
1402
=head1 OPTIONS
1403
 
1404
=over 8
1405
 
1406
=item B<-help>
1407
 
1408
Print a brief help message and exits.
1409
 
1410
=item B<-help -help>
1411
 
1412
Print a detailed help message with an explanation for each option.
1413
 
1414
=item B<-man>
1415
 
1416
Prints the manual page and exits.
1417
 
1418
=item B<-verbose>
1419
 
1420
Increase the level of verbosity of the program execution
1421
 
1422
=item B<-debug>
1423
 
1424
Increase the debug output during program execution
1425
 
1426
 
1427
=item B<-default=target>
1428
 
1429
This options specifies the default target if none is provided on the command
1430
line. Used by the jats wrapper to simplify processing.
1431
 
1432
=back
1433
 
261 dpurdie 1434
=head1 TARGETS
227 dpurdie 1435
 
261 dpurdie 1436
Targets are described above.
1437
 
1438
Most targets support three modifiers. These can be used in conjunction with each
1439
other.
1440
 
227 dpurdie 1441
=over 8
1442
 
261 dpurdie 1443
=item undo
1444
 
1445
Many target operation can be undone by prefixing the tarhet with 'un' ie:
1446
uninstall.
1447
 
1448
=item platform prefix
1449
 
1450
Many target operations can be limited to one platform by prefixing the target
1451
with a valid platform name and an underscore. ie WIN32_all
1452
 
1453
=item build postfix. prod or debug
1454
 
1455
Many targets operations can be limited toi either production of debug by
1456
adding '_prod' or '_debug' to the target. ie 'install_debug'
1457
 
1458
=back
1459
 
1460
=head1 FLAGS
1461
 
227 dpurdie 1462
Flags are in the form TAG=value. This is a format that it used as they will be
1463
passed directly to the underlying makefiles. The recognised flags are:
1464
 
261 dpurdie 1465
=over 8
1466
 
227 dpurdie 1467
=item B<SHOWENV=1>
1468
 
1469
This flag will force the 'Environment' to be displayed before commands are executed
1470
 
1471
=item B<LEAVETMP=1>
1472
 
1473
This flag will cause temp files, created by the build process, to notr be deleted.
1474
 
1475
=item B<NODEPEND=1>
1476
 
1477
This flag will supress dependency checking. Makefiles will not be created when
1478
the makefile.pl is changed. Source files will not be scanned for header files.
1479
 
261 dpurdie 1480
=item B<EXPERT=1>
1481
 
1482
This flag will supress dependency checking between object files and the
1483
generated makefile. This option can be used while test building a large build
1484
when the makefile has been rebuilt but the user does not wish all the object
1485
files to be rebuilt.
1486
 
227 dpurdie 1487
=item B<OPTIONS=list,list>
1488
 
1489
This flags passes a list of comma seperated options into the makefile. The exact
1490
set of available options is target specific. Refer to the JATS manual.
1491
 
1492
 
1493
=back