Subversion Repositories DevTools

Rev

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

Rev 289 Rev 335
Line 59... Line 59...
59
            CMDTERM     => $cmdterm
59
            CMDTERM     => $cmdterm
60
        };
60
        };
61
    return bless $self, __PACKAGE__;
61
    return bless $self, __PACKAGE__;
62
}
62
}
63
 
63
 
-
 
64
sub Reset
-
 
65
{
-
 
66
    my ($self) = shift;
-
 
67
    delete $self->{DEPEND_target};
-
 
68
    delete $self->{DEPEND_list};
-
 
69
    delete $self->{DEPEND_dir};
-
 
70
    delete $self->{DEPEND_file};
-
 
71
}
64
 
72
 
65
sub Prt
73
sub Prt
66
{
74
{
67
    my ($self) = shift;
75
    my ($self) = shift;
68
    ::MakePrint ("@_");
76
    ::MakePrint ("@_");
Line 291... Line 299...
291
        }
299
        }
292
    }
300
    }
293
    $self->CondClose();                         # close session
301
    $self->CondClose();                         # close session
294
}
302
}
295
 
303
 
-
 
304
#-------------------------------------------------------------------------------
-
 
305
# Function        : SetShldTarget
-
 
306
#
-
 
307
# Description     : Set up the Shared Library target information
-
 
308
#                   Main function is to calculate the name of the
-
 
309
#                   dependency file so that it can be used
-
 
310
#
-
 
311
#                   Must be called before SHLDDEPEND or DepRules
-
 
312
#
-
 
313
# Inputs          : $self
-
 
314
#                   $target         - Name of the target library
-
 
315
#                                     May or may not have $(GBE_TYPE)
-
 
316
#                   $dir            - Optional alternate directory
-
 
317
#                                     Default: LIBDIR
-
 
318
#
-
 
319
# Returns         : Full name of the dependency file
-
 
320
#
-
 
321
 
-
 
322
sub SetShldTarget
-
 
323
{
-
 
324
    my ($self, $target, $dir ) = @_;
-
 
325
    ::Warning("Internal: SetShldTarget already specified") if ( defined $self->{DEPEND_target} );
-
 
326
 
-
 
327
    #   Create a 'tag' to be used within the makefile
-
 
328
    #
-
 
329
    $self->{DEPEND_target} = $target;
-
 
330
    $self->{DEPEND_list} = $target . '_shdp';
-
 
331
 
-
 
332
    #
-
 
333
    #   Set up the name of the dependency file
-
 
334
    #
-
 
335
    $dir = 'LIBDIR' unless ( defined $dir );
-
 
336
    $self->{DEPEND_dir} = $dir;
-
 
337
 
-
 
338
    my $depfile = "\$($dir)/${target}";
-
 
339
    $depfile .= '$(GBE_TYPE)' unless ( $depfile =~ m~\$\(GBE_TYPE\)~ );
-
 
340
    $depfile .= '.dep';
-
 
341
    $self->{DEPEND_file} = $depfile;
296
 
342
 
-
 
343
    ::Verbose3("SetShldTarget",
-
 
344
                "DepDir:  $self->{DEPEND_dir}",
-
 
345
                "DepFile: $self->{DEPEND_file}",
-
 
346
                "DepList: $self->{DEPEND_list}" );
-
 
347
 
-
 
348
    return $depfile;
-
 
349
}
297
 
350
 
-
 
351
#-------------------------------------------------------------------------------
-
 
352
# Function        : SHLDDEPEND
-
 
353
#
-
 
354
# Description     : Create a set of rules and recipes to handle the creation
-
 
355
#                   of dependency files used in the creation of shared
-
 
356
#                   libraries
-
 
357
#
-
 
358
#
-
 
359
# Inputs          : $self
-
 
360
#                   $base       - SHBASE: Defines the shared library name (eg: lib)
-
 
361
#                   $name       - SHNAME: Defines the base library name (eg: lib.so.1.1)
-
 
362
#
298
sub SHLDDEPEND
363
sub SHLDDEPEND
299
{
364
{
300
    my ($self) = shift;
365
    my ($self) = shift;
301
    my ($target, $base, $name, $dir) = @_;
366
    my ($base, $name) = @_;
302
 
-
 
303
    $self->Label( "Include Shared Library Dependency Rules", $target );
-
 
304
    $dir = "LIBDIR" unless ( defined $dir );
-
 
305
 
367
 
-
 
368
    #
-
 
369
    #   Sanity test: The name of the list must have been setup
-
 
370
    #
-
 
371
    my $depfile = $self->{DEPEND_file} || ::Error ("Internal error: SetShldTarget not called before SHLDDEPEND");
-
 
372
 
-
 
373
    $self->Newline();
-
 
374
    $self->Label( "Include Shared Library Dependency Rules", $self->{DEPEND_target} );
-
 
375
 
306
    $self->Prt( "
376
    $self->Prt(
307
\$($dir)/${target}.dep:\tSHBASE=${base}
377
"${depfile}:\tSHBASE=${base}
308
\$($dir)/${target}.dep:\tSHNAME=${name}
378
${depfile}:\tSHNAME=${name}
309
\$($dir)/${target}.dep:\t\$(GBE_$dir)
379
${depfile}:\tDPLIST=$self->{DEPEND_list}
310
\$($dir)/${target}.dep:\t\$(SCM_MAKEFILE)
380
${depfile}:\t\$(GBE_$self->{DEPEND_dir}) \$(SCM_MAKEFILE)
311
	\$(SHLDDEPEND)
381
	\$(SHLDDEPEND)
312
 
382
 
313
ifneq \"\$(findstring \$(IFLAG),23)\" \"\"
383
ifneq \"\$(findstring \$(IFLAG),23)\" \"\"
314
-include\t\$($dir)/${target}.dep
384
-include\t${depfile}
315
endif
385
endif
316
 
386
 
317
" );
387
" );
-
 
388
 
-
 
389
    #   Mark file as generated by the toolset
-
 
390
    #
-
 
391
    ::ToolsetGenerate( $depfile );
318
}
392
}
319
 
393
 
-
 
394
#-------------------------------------------------------------------------------
-
 
395
# Function        : SetLdTarget
-
 
396
#
-
 
397
# Description     : Set up the Program target information
-
 
398
#                   Main function is to calculate the name of the
-
 
399
#                   dependency file so that it can be used
-
 
400
#
-
 
401
#                   Must be called before LDDEPEND or DepRules
-
 
402
#
-
 
403
# Inputs          : $self
-
 
404
#                   $target         - Name of the target program
-
 
405
#                   $dir            - Optional alternate directory
-
 
406
#                                     Default: BINDIR
-
 
407
#
-
 
408
# Returns         : Full name of the dependency file
-
 
409
#
-
 
410
sub SetLdTarget
-
 
411
{
-
 
412
    my ($self, $target, $dir ) = @_;
-
 
413
    ::Warning("Internal: SetLdTarget already specified") if ( defined $self->{DEPEND_target} );
-
 
414
 
-
 
415
    #   Create a 'tag' to be used within the makefile
-
 
416
    #
-
 
417
    $self->{DEPEND_target} = $target;
-
 
418
    $self->{DEPEND_list} = $target . '_dp';
-
 
419
 
-
 
420
    #
-
 
421
    #   Set up the name of the dependency file
-
 
422
    #
-
 
423
    $dir = 'BINDIR' unless ( defined $dir );
-
 
424
    $self->{DEPEND_dir} = $dir;
-
 
425
    
-
 
426
    my $depfile = "\$($dir)/${target}.dep";
-
 
427
    $self->{DEPEND_file} = $depfile;
-
 
428
 
-
 
429
    ::Verbose3("SetLdTarget",
-
 
430
                "DepDir:  $self->{DEPEND_dir}",
-
 
431
                "DepFile: $self->{DEPEND_file}",
-
 
432
                "DepList: $self->{DEPEND_list}" );
-
 
433
    
-
 
434
    return $depfile;
-
 
435
}
320
 
436
 
-
 
437
#-------------------------------------------------------------------------------
-
 
438
# Function        : LDDEPEND
-
 
439
#
-
 
440
# Description     : Create a set of rules and recipes to handle the creation
-
 
441
#                   of dependency files used in the creation of a program
-
 
442
#
-
 
443
#
-
 
444
# Inputs          : $self
-
 
445
#
321
sub LDDEPEND
446
sub LDDEPEND
322
{
447
{
323
    my ($self) = shift;
448
    my ($self) = shift;
324
    my ($target, $dir) = @_;
-
 
325
 
449
 
-
 
450
    #
326
    $self->Label( "Include Library Dependency Rules", $target );
451
    #   Sanity test: The name of the list must have been setup
-
 
452
    #
-
 
453
    my $depfile = $self->{DEPEND_file} || ::Error ("Internal error: SetLdTarget not called before LDDEPEND");
-
 
454
    
327
    $dir = "BINDIR" unless ( defined $dir );
455
    $self->Newline();
-
 
456
    $self->Label( "Include Library Dependency Rules", $self->{DEPEND_target} );
328
 
457
 
329
    $self->Prt( "
458
    $self->Prt(
330
\$($dir)/${target}.dep:\t\$(GBE_$dir)
459
"${depfile}:\tDPLIST=$self->{DEPEND_list}
331
\$($dir)/${target}.dep:\t\$(SCM_MAKEFILE)
460
${depfile}:\t\$(GBE_$self->{DEPEND_dir}) \$(SCM_MAKEFILE)
332
	\$(LDDEPEND)
461
	\$(LDDEPEND)
333
 
462
 
334
ifeq \"\$(IFLAG)\" \"3\"
463
ifeq \"\$(IFLAG)\" \"3\"
335
-include\t\$($dir)/${target}.dep
464
-include\t${depfile}
336
endif
465
endif
337
 
466
 
338
" );
467
" );
339
}
-
 
340
 
468
 
-
 
469
    #   Mark file as generated by the toolset
-
 
470
    #
-
 
471
    ::ToolsetGenerate( $depfile );
-
 
472
}
341
 
473
 
-
 
474
#-------------------------------------------------------------------------------
-
 
475
# Function        : DepRules
-
 
476
#
-
 
477
# Description     : Create the list of dependency rules used
-
 
478
#                   within the dependency include file
-
 
479
#
-
 
480
# Inputs          : $libs       - Ref to a list of libraries
-
 
481
#                   $librecipe  - Ref to code to create the library recipe
-
 
482
#                   @uargs      - User arguments, passed to the librecipe function
-
 
483
#
-
 
484
# Returns         : Nothing
-
 
485
#
342
sub DepRules
486
sub DepRules
343
{
487
{
344
    my ($self) = shift;
488
    my ($self) = shift;
345
    my ($target, $libs, $librecipe, @uargs) = @_;
489
    my ( $libs, $librecipe, @uargs) = @_;
346
 
490
 
-
 
491
    #
-
 
492
    #   Sanity test: The name of the list must have been setup
-
 
493
    #
-
 
494
    my $target = $self->{DEPEND_target} || ::Error ("Internal error: SetShldTarget/SetLdTarget not called before DepRules");
-
 
495
    
-
 
496
    $self->SetTag( $self->{DEPEND_list});                   # command tag
-
 
497
    $self->SetTerm();
347
    unless ( $self->{DepRulesHeaderDone}{$target} )
498
    unless ( $self->{DepRulesHeaderDone}{$target} )
348
    {
499
    {
349
        $self->{DepRulesHeaderDone}{$target} = 1;
500
        $self->{DepRulesHeaderDone}{$target} = 1;
350
 
501
 
351
        $self->Label( "Dependencies", $target );    # label
502
        $self->Label( "Linker Dependencies", $target );    # label
352
                                                    # library depends
503
                                                           # library depends
353
        $self->Tag( "\\# DO NOT REMOVE - dependencies\\\\n" );
504
        $self->Tag( "\\# DO NOT REMOVE - dependencies\\\\n" );
354
        $self->Tag( "\\#\\\\n" );
505
        $self->Tag( "\\#\\\\n" );
355
    }
506
    }
356
 
507
 
357
    $self->LibList( $target, $libs, $librecipe, @uargs );
508
    $self->LibList( $target, $libs, $librecipe, @uargs );