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
 
589
    #
590
    #   Ensure that the current directory actually has makefile targets
591
    #   Not all makefile.pl create .mk files
592
    #       1) Top-level makefile.pl
593
    #       2) Makefiles that use --NoPlatformBuilds
594
    #
595
    if ( $Tags->{$dir}{root} )
596
    {
597
        Verbose2 "Root directory has no makefiles: $dir";
598
        return;
599
    }
600
 
601
    if ( $Tags->{$dir}{noplatforms} )
602
    {
603
        Verbose2 "No make targets in $dir";
604
        return;
605
    }
606
 
607
    #
608
    #   Process each platform
609
    #
610
    foreach my $target ( @{$pref} )
611
    {
612
        unless ( exists $Tags->{$dir}{platforms}{$target} )
613
        {
614
            Verbose2 "No make targets in $dir, for $target";
615
            next;
616
        }
617
 
618
        #
619
        #   Do we need to do any thing for this target / tag
620
        #
621
        if ( $tag )
622
        {
623
            unless ( exists $Tags->{$dir}{full}{$target}{'%MakeTags'}{$tag} )
624
            {
261 dpurdie 625
                Verbose2 ("Skipping $cmd in $dir for $tag");
227 dpurdie 626
                next;
627
            }
628
        }
629
 
630
        #
631
        #   common mode == 2
632
        #   Only process target ONCE for each platform
633
        #   Don't care when its used
634
        #
261 dpurdie 635
        if ( exists $commands{$cmd}{'common'} && $commands{$cmd}{'common'} & 2 )
227 dpurdie 636
        {
637
            if ( $common_cmd{$cmd}{$target} )
638
            {
639
                Verbose2 "Already performed $cmd for $target";
640
                next;
641
            }
642
            $common_cmd{$cmd}{$target} = 1;
643
        }
644
 
645
        #
646
        #   Is the build limited to only debug or production
647
        #
261 dpurdie 648
        unless ( exists $commands{$cmd}{'common'} )
227 dpurdie 649
        {
650
            if ( $do_debug == 0 ) {
651
                next unless ( $Tags->{$dir}{platforms}{$target}{prod} );
652
                $text = 'P';
653
 
654
            } elsif  ( $do_debug == 1 ) {
655
                next unless ( $Tags->{$dir}{platforms}{$target}{debug} );
656
                $text = 'D';
657
            }
658
        }
659
 
660
        #
661
        #   Final sanity test
662
        #   Must have the makefile. We should have detected this error before now
663
        #
664
        Error ("Makefile not found - $target") unless ( -f "$dir/$target.mk" );
665
 
666
        #
275 dpurdie 667
        #   Export data into the user environment
668
        #   Allows underlying tools to locate data files with little effort
669
        #
670
        $ENV{'GBE_MAKE_TYPE'} = $text;                  # P or D or C
671
        $ENV{'GBE_MAKE_TARGET'} = $target;              # Target platform
672
        $ENV{'GBE_MAKE_CFG'} = $Tags->{$dir}{config};   # Ref to config data
673
        $ENV{'GBE_MAKE_CMD'} = $cmd;                    # Make phase
674
 
675
        #
227 dpurdie 676
        #   Build up the make command line
677
        #   Examine command specfic flags
678
        #
679
        my @args = @defs;
680
        push @args, "IFLAG=$commands{$cmd}{IFLAG}" if ( exists $commands{$cmd}{IFLAG} );
261 dpurdie 681
        push @args, "NOSCMDEPEND=1";
227 dpurdie 682
 
683
        my $cdir = CleanDirName ($dir);
684
        my @make_command;
685
        push @make_command, "$ENV{GBE_BIN}/xmake";
686
        push @make_command, "-s" if $opt_silent;
687
        push @make_command, "--no-print-directory";
688
        push @make_command, "-C", $cdir unless ( $cdir eq $::Cwd );
689
        push @make_command, "-f", "$target.mk";
690
        push @make_command, @args;
691
        push @make_command, 'make_dir' unless exists $commands{$cmd}{nomakecheck} ;
692
        push @make_command, $cmd;
693
 
694
        Message ( sprintf ("[$text] %-${tlen}s, $cmd, $cdir", $target ));
695
        System (@make_command, "DEBUG=$do_debug" );
696
    }
697
}
698
 
699
#-------------------------------------------------------------------------------
700
# Function        : TestMakeFiles
701
#
702
# Description     : Test all the makefile dependent files to see if any of the
703
#                   makefiles need to be rebuilt.
704
#
705
#                   Walk the directory tree looking for makefiles to be
706
#                   rebuilt.
707
#
708
# Inputs          : $cmd            - Current command
709
#                   $pref           - Ref to an array of platforms
710
#
711
# Returns         : 
712
#
713
sub TestMakeFiles
714
{
715
    my ( $cmd, $pref ) = @_;
716
    Verbose ("Test makefile dependencies");
717
 
718
    #
719
    #   Read in the Tag file for the current directory
720
    #   This will provide the current list of subdirectories
721
    #
722
    #   Process Test the current makefiles, then test any subdirs
723
    #
724
    TestSubMake( $cmd, $Cwd, $pref );
725
 
726
    #
727
    #   Report build errors
728
    #   Done after all makefiles have been processed
729
    #
730
    if ( $build_error )
731
    {
732
        Error ("Error creating makefiles. Errors previously reported");
733
    }
734
 
735
    #
736
    #   Post makefile build processing
737
    #   Only required if a files have been re-built
738
    #
739
    if ( $update )
740
    {
741
        #
742
        #   Sanity test the makefile structure
743
        #   Ensure that makefiles have only one parent.
744
        #
745
        TestParents();
746
 
747
        #
748
        #   Sanity test the installed and packaged files
749
        #   Generate warnings and errors if a file if packaged from two
750
        #   locations
751
        #
752
        TestPackages();
753
 
754
        #
755
        #   Generate DPACKAGE file if required
756
        #
757
        JatsDPackage::DPackageGenerate( $::ScmRoot, $::ScmInterface  );
758
    }
759
 
760
    #
761
    #
762
    #   Check that the build.pl file is not newer that the tags file
763
    #   This will not be an error, but it will be a nagging warning
764
    #
765
    my @build_warn;
766
    my $bstamp = -M "$::ScmRoot/$ScmBuildSrc";
767
    my $tstamp = -M "$::ScmRoot/Makefile.gbe";
768
 
769
    push @build_warn, "Missing: Makefile.gbe" unless ( defined $tstamp );
770
    push @build_warn, "Modified build file ($ScmBuildSrc)" if ( $tstamp && $bstamp < $tstamp );
771
    if ( @build_warn )
772
    {
773
        Warning ("The build file is newer than the generated files",
774
                 "The project needs to be built for these changes to be included",
775
                 @build_warn );
776
    }
777
}
778
 
779
#-------------------------------------------------------------------------------
780
# Function        : TestSubMake
781
#
782
# Description     : Test the makefiles in the current directory
783
#                   Recurse into subdirectories
784
#
785
# Inputs          : $cmd            - Current command
786
#                   $dir            - Directory to test
787
#                   $pref           - Ref to an array of platforms
788
#
789
# Returns         : 
790
#
791
sub TestSubMake
792
{
793
    my ($cmd, $dir, $pref ) = @_;
794
 
795
    $Tags = ReadMaketags( $dir, 1 );
796
    unless ( $Tags )
797
    {
798
        Verbose2 ("TestSubMake :Directory not in tag database", $dir );
799
        MakeBuild( $dir);
800
    }
801
    else
802
    {
803
        TestMake( $cmd, $dir, $pref );
804
    }
805
 
806
    #
807
    #   Recurse into any subdirectories that may be a part of the build
808
    #
809
    unless ( exists $defs{NORECURSE} && $defs{NORECURSE}  )
810
    {
811
        foreach my $subdir (@{$Tags->{$dir}{subdirs}} )
812
        {
813
            TestSubMake( $cmd, CleanDirName( "$dir/$subdir"), $pref );
814
        }
815
    }
816
}
817
 
818
#-------------------------------------------------------------------------------
819
# Function        : TestMake
820
#
821
# Description     : Test the makefiles component files
822
#                   and determine if the makefile(s) need to be rebuilt
823
#
824
# Inputs          : $cmd            - Current command
825
#                   $dir            - Directory to test
826
#                   $pref           - Ref to an array of platforms
827
#
828
# Returns         : 
829
#
830
sub TestMake
831
{
832
    my ( $cmd, $dir, $pref ) = @_;
833
    my @must_rebuild;
834
 
835
    if ( $cmd eq 'rebuild' )
836
    {
837
        MakeBuild( $dir);
838
        return;
839
    }
840
 
841
    #
842
    #   Check that the local makefile.pl is not newer than
843
    #   the Tags file. Not all makefile.pl's create .mk files
844
    #
845
    my $mstamp = -M "$dir/makefile.pl";
846
    my $tstamp = -M "$dir/Makefile.gbe";
847
 
848
    unless ( defined $tstamp )
849
    {
850
        UniquePush (\@must_rebuild, "Missing: $dir/Makefile.gbe");
851
    }
852
 
853
    if ( $mstamp && $mstamp < $tstamp  )
854
    {
855
        UniquePush (\@must_rebuild, "Updated: $dir/makefile.pl");
856
    }
857
    else
858
    {
859
        if ( $Tags->{$dir}{root} )
860
        {
861
            Verbose2 "TestMake: Root directory has no makefiles: $dir";
862
            return;
863
        }
864
 
865
        if ( $Tags->{$dir}{noplatforms} )
866
        {
867
            Verbose2 "TestMake: No make targets in $dir";
868
            return;
869
        }
870
 
871
        #
872
        #   Process only the required build targets
873
        #
874
        foreach my $tgt ( keys %{$Tags->{$dir}{platforms}}   )
875
        {
876
            next if ( %gbe_platform && not exists $gbe_platform{$tgt} );
877
            #
878
            #   Locate all the makefile dependent files
879
            #
880
            my $data = $Tags->{$dir}{full}{$tgt}{'@ScmDepends'};
881
            if ( $data )
882
            {
883
                Verbose2 ("Processing: $dir : $tgt");
884
                my $base_stamp = -M "$dir/$tgt.mk";
885
                unless ( defined $base_stamp )
886
                {
887
                    UniquePush (\@must_rebuild, "Missing: $dir/$tgt.mk");
888
                }
889
                else
890
                {
891
                    foreach my $file ( "$dir/makefile.pl" ,@$data )
892
                    {
893
                        $file = "$dir/$file" if ( $file =~ m~^\.~ );
894
                        my $stamp = -M $file;
895
                        if ( defined $stamp )
896
                        {
897
                            Verbose3 ("Timestamp: $stamp, $file");
898
                            if ( $stamp < $base_stamp  )
899
                            {
900
                                UniquePush (\@must_rebuild, $file);
901
                            }
902
                        }
903
                        else
904
                        {
905
                            UniquePush (\@must_rebuild, "Missing: $file");
906
                        }
907
                    }
908
                }
909
            }
910
            else
911
            {
912
                Warning ("No dependency information for: $tgt in $dir");
913
            }
914
        }
915
    }
916
 
917
    if ( @must_rebuild )
918
    {
919
        my @display;
920
        push (@display, CleanDirName($_) ) foreach ( @must_rebuild );
921
        Message ("One or more JATS source or internal files have changed, Makefiles will be rebuilt",
922
                  "Target is: $dir",
923
                  @display );
924
        MakeBuild ($dir);
925
    }
926
    return;
927
}
928
 
929
#-------------------------------------------------------------------------------
930
# Function        : MakeBuild
931
#
932
# Description     : Rebuild the makefiles in the specified directory
933
#                   This does not involve recursion - thats already been
934
#                   done.
935
#
936
#                   Once the makefiles have been re-built the tags database
937
#                   must be read in again as it may have changed.
938
#
939
# Inputs          : 
940
#
941
# Returns         : 
942
#
943
sub MakeBuild
944
{
945
    my ($dir) = @_;
946
 
947
    #
948
    #   No makefiles to build in the root directory
949
    #   Can't rebuild the top-level Makefile.gbe file
950
    #
951
    return if ( $Tags->{$dir}{root} );
952
 
953
    #
954
    #   Try to rebuild the makefile
955
    #
956
    chdir $dir || Error ("Cannot change directory to $dir");
261 dpurdie 957
    my $result = System ('--NoExit', $ENV{GBE_PERL}, 'makefile.pl',
958
                            $::ScmRoot, $makelib, "--interface=$::ScmInterface" );
227 dpurdie 959
    chdir $::Cwd || Error ("Cannot change directory to $::Cwd");
960
 
961
    #
962
    #   Re-read the tags database
963
    #
964
    $Tags = ReadMaketags( $dir, 2 );
965
 
966
    #
967
    #   Flag that makefiles have been modified
968
    #
969
    $update = 1;
261 dpurdie 970
    $build_error = 1 if ( $result );
227 dpurdie 971
}
972
 
973
#-------------------------------------------------------------------------------
974
# Function        : UnMakeFiles
975
#
976
# Description     : Delete generated makefiles and control files
977
#
978
# Inputs          : $cmd            - Current command
979
#                   $pref           - Ref to an array of platforms
980
#
981
# Returns         : 
982
#
983
sub UnMakeFiles
984
{
985
    #
986
    #   Recurse down the tree
987
    #   Recurse, then performs operations in the current directory
988
    #
989
    sub UnSubMakeFiles
990
    {
991
        my ($dir) = @_;
992
        $Tags = ReadMaketags( $dir, 1 );
993
        foreach my $subdir (@{$Tags->{$dir}{subdirs}} )
994
        {
995
            UnSubMakeFiles( CleanDirName( "$dir/$subdir") );
996
        }
997
        UnMake( $dir );
998
    }
999
 
1000
    #
1001
    #   Delete makefiles in the current directory
1002
    #
1003
    sub UnMake
1004
    {
1005
        my ($dir) = @_;
1006
        Verbose("Unmake in $dir");
1007
        foreach my $tgt ( keys %{$Tags->{$dir}{platforms}}   )
1008
        {
1009
            Verbose2("Unmake. Delete ${tgt}.mk");
1010
            unlink ("$dir/${tgt}.mk");
1011
        }
1012
        unlink ("$dir/Makefile.gbe");
1013
        Verbose2("Unmake. Delete Makefile.gbe");
1014
    }
1015
 
1016
    #
1017
    #   Depth first recursion through the tree
1018
    #
1019
    UnSubMakeFiles ( $Cwd );
1020
}
1021
 
1022
#-------------------------------------------------------------------------------
1023
# Function        : TestParents
1024
#
1025
# Description     : Ensure that each makefile node has exactly one parent
1026
#                   Prevent the user from creating recursive loops
1027
#
1028
# Inputs          : 
1029
#
1030
# Returns         : 
1031
#
1032
my %parents;
1033
sub TestParents
1034
{
1035
    Verbose ("Test makefile parents");
1036
    #
1037
    #   Init the hash. Command may be invoked multiple times
1038
    #
1039
    %parents = ();
1040
 
1041
    #
1042
    #   Recurse down the tree
1043
    #   Recurse, then performs operations in the current directory
1044
    #
1045
    sub RecurseDown
1046
    {
1047
        my ($dir) = @_;
1048
        $Tags = ReadMaketags( $dir, 1 );
1049
        Verbose2("TestParents in $dir");
1050
        foreach my $subdir (@{$Tags->{$dir}{subdirs}} )
1051
        {
1052
            my $subdir = CleanDirName( "$dir/$subdir");
1053
            push @{$parents{$subdir}}, $dir;
1054
            RecurseDown( $subdir );
1055
        }
1056
    }
1057
 
1058
    #
1059
    #   Depth first recursion through the tree
1060
    #
1061
    RecurseDown ( $Cwd );
1062
 
1063
    #
1064
    #   Test for only one parent
1065
    #   The root makefile won't have any
1066
    #
1067
    foreach my $dir ( sort keys %{$Tags} )
1068
    {
1069
        my $count = $#{$parents{$dir}};
1070
        if ( $count > 0 )
1071
        {
1072
            if ( defined($GBE_ABT) )
1073
            {
1074
                Warning ("Error supressed by ABT");
1075
                Warning ("makefile.pl with multiple parents",
1076
                         "makefile.pl in: $dir",
1077
                         "Parented by:", @{$parents{$dir}} );
1078
            }
1079
            else
1080
            {
1081
                unlink $Tags->{$dir}{config};
1082
                Error ("makefile.pl with multiple parents",
1083
                       "makefile.pl in: $dir",
1084
                       "Parented by:", @{$parents{$dir}} );
1085
            }
1086
        }
1087
    }
1088
}
1089
 
1090
#-------------------------------------------------------------------------------
1091
# Function        : TestPackages
1092
#
1093
# Description     : Ensure that files that are packaged and installed are
1094
#                   only done from one makefile. Warn if the same file
1095
#                   is being packaged from multiple makefiles.
1096
#
1097
# Inputs          : 
1098
#
1099
# Returns         : 
1100
#
1101
my %test_packages;
1102
sub TestPackages
1103
{
1104
    Verbose ("Test packaged files");
1105
    #
1106
    #   Init the hash. Command may be invoked multiple times
1107
    #
1108
    %test_packages = ();
1109
 
1110
    #
1111
    #   Recurse down the tree
1112
    #   Recurse, then performs operations in the current directory
1113
    #
1114
    sub TRecurseDown
1115
    {
1116
        my ($dir) = @_;
1117
        Verbose2("TestPackages in $dir");
1118
        $Tags = ReadMaketags( $dir, 1 );
1119
        #
1120
        #   Process makefile
1121
        #   Examine all the %PACKAGE_xxx and %INSTALL_xxx fields thare listed
1122
        #   in the @PACKAGE_VARS and @INSTALL_VARS array
1123
        #
1124
        foreach my $target ( keys %{$Tags->{$dir}{platforms}}   )
1125
        {
1126
            next if ( %gbe_platform && not exists $gbe_platform{$target} );
1127
            foreach my $field ( @{$Tags->{$dir}{full}{$target}{'@PACKAGE_VARS'}},
1128
                                @{$Tags->{$dir}{full}{$target}{'@INSTALL_VARS'}} )
1129
            {
1130
                foreach my $entry ( keys %{$Tags->{$dir}{full}{$target}{$field}} )
1131
                {
1132
                    Verbose3("TestPackages: $target, File: $entry");
1133
                    push @{$test_packages{$target}{$entry}}, $dir;
1134
                }
1135
            }
1136
        }
1137
 
1138
        #
1139
        #   Process subdirectories too
1140
        #
1141
        foreach my $subdir (@{$Tags->{$dir}{subdirs}} )
1142
        {
1143
            TRecurseDown( CleanDirName( "$dir/$subdir") );
1144
        }
1145
    }
1146
 
1147
 
1148
 
1149
    #
1150
    #   Depth first recursion through the tree
1151
    #
1152
    TRecurseDown ( $Cwd );
1153
 
1154
    #
1155
    #   Test and report files that are packaged in different makefiles
1156
    #   There are two issues:
1157
    #       1) Not good practice
1158
    #       2) May be different files
1159
    #   The warning message is a bit ugly - but it shouldn't pop up often.
1160
    #
1161
#    DebugDumpData ("test_packages", \%test_packages);
1162
 
1163
    foreach my $target ( sort keys %test_packages )
1164
    {
1165
        foreach my $file ( sort keys %{$test_packages{$target}} )
1166
        {
1167
            #
1168
            #   The descpkg file is known to be packaged from multiple dirs
1169
            #
1170
            next if ( $file =~ m~/descpkg~ );
1171
            if ( $#{$test_packages{$target}{$file}} > 0 )
1172
            {
1173
                Warning ("File is packaged or installed from multiple makefiles",
1174
                         "Target: $target, Packaged file: $file",
1175
                         "Packaged from the following directories:", @{$test_packages{$target}{$file}} );
1176
            }
1177
        }
1178
    }
1179
}
1180
 
1181
 
1182
#-------------------------------------------------------------------------------
1183
# Function        : DoHelp
1184
#
1185
# Description     : Display basic help information
1186
#
1187
# Inputs          : None
1188
#
1189
# Returns         :
1190
#
1191
sub DoHelp
1192
{
1193
 
1194
#
1195
#   Display basic usage information
1196
#
1197
    pod2usage(-verbose => 0,
1198
              -message => "Version: $VERSION",
1199
              -exitval => 'NOEXIT');
1200
 
1201
    print "Platform targets\n";
1202
    foreach ( sort keys %BUILDINFO )
1203
    {
1204
        print "    $_\n";
1205
    }
1206
 
1207
    my @alias = sort keys %ScmBuildAliases;
1208
    if ( $#alias >=0 )
1209
    {
1210
        print "Alias targets\n";
1211
        foreach ( @alias )
1212
        {
1213
            print "    $_   - $ScmBuildAliases{$_}\n";
1214
        }
1215
    }
1216
}
1217
 
1218
#-------------------------------------------------------------------------------
1219
# Function        : ReadMaketags
1220
#
1221
# Description     : Read in the global make tags data base
1222
#                   This contains information on all the components within
1223
#                   the build. The tags allow recursive makes to be pruned.
1224
#
1225
#                   The file may change while the build is running
1226
#                   It can be read multiple times
1227
#
1228
# Inputs          : $dir            - Directory entry to read
1229
#                   $test           - 1: Read if available
1230
#                                     2: Force read
1231
#
1232
# Returns         : Reference to the tag data for the requested directory
1233
#                   Will error if no available
1234
#
1235
our %cf_minfo;
1236
our %cf_minfo2;
1237
my %tag_data;
1238
sub ReadMaketags
1239
{
1240
    my ($dir, $test) = @_;
1241
 
1242
    #
1243
    #   Force data re-aquisition
1244
    #
1245
    delete $tag_data{$dir}
1246
        if ( $test && $test == 2 );
1247
 
1248
    #
1249
    #   Do we already have the entry
1250
    #
1251
    return \%tag_data
1252
        if ( exists ($tag_data{$dir} ));
1253
 
1254
    #
1255
    #   If the entry is not known, then re-read the index file
1256
    #
1257
    unless ( $::cf_filelist{$dir} )
1258
    {
1259
        my $index_file = "$::ScmRoot/$::ScmInterface/Makefile.cfg";
1260
        Error ("Makefile index missing. Rebuild required") unless ( -f $index_file );
1261
 
1262
        #
1263
        #   Kill the entry in %INC to force the file to be read in
1264
        #
1265
        $::cf_filelist = ();
1266
        delete $INC{ $index_file };
1267
        require $index_file;
1268
    }
1269
 
1270
    my $cfg_filen = $::cf_filelist{$dir};
1271
    unless ( $cfg_filen )
1272
    {
1273
        return undef
1274
            if ( $test );
1275
        Error ("Makefile index entry missing: $dir. Rebuild required");
1276
    }
1277
 
1278
 
1279
    #
1280
    #   Read in all the Makefile_x.cfg files
1281
    #
1282
    %cf_minfo = ();
1283
    %cf_minfo2 = ();
1284
    my $cfg_file = "$::ScmRoot/$::ScmInterface/$cfg_filen";
1285
 
1286
    unless ( -f $cfg_file )
1287
    {
1288
        return undef
1289
            if ( $test );
1290
        Error ("Make data file missing: $cfg_file. Rebuild required");
1291
    }
1292
 
1293
    delete $INC{ $cfg_file };
1294
    require $cfg_file;
1295
 
1296
    Error ("Makefile info2 not present")
1297
        unless ( keys %::cf_info2 );
1298
 
1299
    Error ("Makefile info2 incorrect version. Rebuild required")
1300
        unless ( exists $::cf_info2{version} && $::cf_info2{version} eq 1 );
1301
 
1302
    %{$tag_data{$dir}} = %::cf_info2;
1303
    $tag_data{$dir}{config} = $cfg_file;
1304
    %{$tag_data{$dir}{full}} = %::cf_info;
1305
 
1306
#DebugDumpData ("ReadMaketags", $tag_data{$dir});
1307
    return \%tag_data;
1308
 
1309
}
1310
 
1311
#-------------------------------------------------------------------------------
1312
# Function        : ExpandComposite
1313
#
1314
# Description     : Expand a command via composite command expansion
1315
#                   A composite command may contain other composite commands
261 dpurdie 1316
#                   Detect, as an error, recursive expansions
227 dpurdie 1317
#
1318
# Inputs          : $cmd    - command to expand
1319
#
1320
# Returns         : An array of commands
1321
#
1322
sub ExpandComposite
1323
{
1324
    my ($cmd) = @_;
1325
    my @cmds;
1326
    my @scmds = $cmd;
261 dpurdie 1327
    my %seen;
227 dpurdie 1328
    while ( @scmds )
1329
    {
1330
        my $cmd = shift @scmds;
1331
        if ( exists $composite_commands{$cmd} )
1332
        {
261 dpurdie 1333
 
1334
            Error ("Internal. Recursion in composite command definitions: $cmd")
1335
                if ($seen{$cmd});
1336
 
227 dpurdie 1337
            @scmds = (@{$composite_commands{$cmd}}, @scmds);
261 dpurdie 1338
            $seen{$cmd} = 1;
227 dpurdie 1339
        }
1340
        else
1341
        {
1342
            push @cmds, $cmd;
1343
        }
1344
    }
1345
 
1346
    return @cmds;
1347
}
1348
 
1349
 
1350
#-------------------------------------------------------------------------------
1351
#   Documentation
1352
#
1353
 
1354
=pod
1355
 
1356
=head1 NAME
1357
 
1358
jmake - JATS make support tool
1359
 
1360
=head1 SYNOPSIS
1361
 
1362
 Usage: jats make [options][targets][flags]
1363
 
1364
 Where options:
1365
    -h, -h -h, -man     - Help messages with increasing verbosity
1366
    -verbose            - Verbose operation
1367
    -debug              - Debug operation
1368
    -default=target     - Default 'target' if none is supplied
1369
 
1370
 Where flags are of the form Name=Value
1371
    SHOWENV=1           - Show make environment
1372
    LEAVETMP=1          - Leave temp working files
1373
    NODEPEND=1          - Ignore dependency checking
261 dpurdie 1374
    EXPERT=1            - Ignore dependency on makefiles
227 dpurdie 1375
    OPTIONS=[opt]       - Maketime options [args,allargs,filter...]
1376
 
1377
 Valid targets include:
1378
    all                 - build and install everything(p*)
1379
    build               - build everything (pu)
1380
    debug               - build all things for debug (pu)
1381
    prod                - build all things for production (pu)
1382
    install             - install public components (pu*)
1383
    lint                - lints the source (assumes debug)(p)
1384
    package             - build all packages (pu*)
1385
    package-{set}       - build specific package (see below) (pu*)
1386
    run_tests           - Run the tests specified in the makefile
1387
    run_unit_tests      - Run the automatic unit tests specified in the makefile
1388
    deploy              - Run the deployment scripts (p*)
1389
    rebuild             - recursively rebuild makefiles
1390
    depend              - construct the dependencies (u*)
1391
    rmlitter            - remove build litter (core, tmp and err) (*)
1392
    clean               - delete generate, obj, libraries and programs (p*)
1393
    clobber             - delete everything which can be remade (p*)
1394
    help                - A list of alias and platforms
1395
 
1396
      (u) undo target available (ie uninstall)
1397
      (p) optional [platform_] prefix targets (ie XXX_build)
1398
      (*) optional [_debug|_prod] postfix targets (ie clean_debug)
1399
 
1400
 
1401
=head1 OPTIONS
1402
 
1403
=over 8
1404
 
1405
=item B<-help>
1406
 
1407
Print a brief help message and exits.
1408
 
1409
=item B<-help -help>
1410
 
1411
Print a detailed help message with an explanation for each option.
1412
 
1413
=item B<-man>
1414
 
1415
Prints the manual page and exits.
1416
 
1417
=item B<-verbose>
1418
 
1419
Increase the level of verbosity of the program execution
1420
 
1421
=item B<-debug>
1422
 
1423
Increase the debug output during program execution
1424
 
1425
 
1426
=item B<-default=target>
1427
 
1428
This options specifies the default target if none is provided on the command
1429
line. Used by the jats wrapper to simplify processing.
1430
 
1431
=back
1432
 
261 dpurdie 1433
=head1 TARGETS
227 dpurdie 1434
 
261 dpurdie 1435
Targets are described above.
1436
 
1437
Most targets support three modifiers. These can be used in conjunction with each
1438
other.
1439
 
227 dpurdie 1440
=over 8
1441
 
261 dpurdie 1442
=item undo
1443
 
1444
Many target operation can be undone by prefixing the tarhet with 'un' ie:
1445
uninstall.
1446
 
1447
=item platform prefix
1448
 
1449
Many target operations can be limited to one platform by prefixing the target
1450
with a valid platform name and an underscore. ie WIN32_all
1451
 
1452
=item build postfix. prod or debug
1453
 
1454
Many targets operations can be limited toi either production of debug by
1455
adding '_prod' or '_debug' to the target. ie 'install_debug'
1456
 
1457
=back
1458
 
1459
=head1 FLAGS
1460
 
227 dpurdie 1461
Flags are in the form TAG=value. This is a format that it used as they will be
1462
passed directly to the underlying makefiles. The recognised flags are:
1463
 
261 dpurdie 1464
=over 8
1465
 
227 dpurdie 1466
=item B<SHOWENV=1>
1467
 
1468
This flag will force the 'Environment' to be displayed before commands are executed
1469
 
1470
=item B<LEAVETMP=1>
1471
 
1472
This flag will cause temp files, created by the build process, to notr be deleted.
1473
 
1474
=item B<NODEPEND=1>
1475
 
1476
This flag will supress dependency checking. Makefiles will not be created when
1477
the makefile.pl is changed. Source files will not be scanned for header files.
1478
 
261 dpurdie 1479
=item B<EXPERT=1>
1480
 
1481
This flag will supress dependency checking between object files and the
1482
generated makefile. This option can be used while test building a large build
1483
when the makefile has been rebuilt but the user does not wish all the object
1484
files to be rebuilt.
1485
 
227 dpurdie 1486
=item B<OPTIONS=list,list>
1487
 
1488
This flags passes a list of comma seperated options into the makefile. The exact
1489
set of available options is target specific. Refer to the JATS manual.
1490
 
1491
 
1492
=back