Subversion Repositories DevTools

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

# -*- mode: perl; tabs: 8; indent-width: 4; show-tabs: yes; -*-
#
# Module name   : PCLINT
# Module type   : Makefile system
# Compiler(s)   : ANSI C
# Environment(s): Gimple C/C++ PCLint
#
# Description:
#   PCLINT toolset support.
#
# Contents:     
#   Generate rules to use Gmiple/PCLINT.
#
# Version   Who     Date        Description
#           APY     21/09/04    Created
#
# $Source: /cvsroot/etm/devl/CFG/TOOLSET/PCLINT,v $
# $Revision: 1.5 $ $Date: 2004/10/20 05:55:54 $ $State: Exp $
# $Author: ayoung $ $Locker:  $
#............................................................................#

use strict;
use warnings;

###############################################################################
#   PCLintInit()
#       Runtime initialisation
#
#   Arguments:
#       none                    No arguments currently defined
#
###############################################################################

PCLintInit();

sub PCLintInit
{
    ToolsetRules( "pclint.rul" );
}


###############################################################################
#   ToolsetARLINT( $name, \@args, \@objs )
#       This subroutine takes the user options and builds the rules
#       required to build the library 'name'.
#
#   Arguments:
#       none                    No arguments currently defined
#
#   Output:
#       [ $(LIBDIR)/name$_lint:   .... ]
#           $(ARLINT)
#
###############################################################################

sub PCLintAR
{
    my ($name, $pArgs, $pObjs, $target, $CSRC, $CXXSRC) = @_;
    my ($io) = ToolsetPrinter::New();

    #.. Lint command
    #
    $io->Prt( "\n\t\$(ARLINT)\n" );             # work horse

    #.. Remove generate files
    #
   ToolsetGenerate( "\$(LIBDIR)/${name}\$(GBE_TYPE).lob" );

    #
    #   Install and package the lint objects
    #
    PCLintInstall( $io, $name, $::LIB_INS{$name} );
    PCLintPackage( $io, $name, $::LIB_PKG{$name} );

    #
    #   UnPackaging command
    #   Since we are manually packaging we need to unpackage too
    #
    PackageLibAddFiles( $name, "\$(OBJDIR)/${name}\$(GBE_TYPE).lob", "RemoveOnly=1");

    $io->Newline();
}


###############################################################################
#   PCLintLD( $name, \@args, \@objs, \@libraries, \@csrc, \@cxxsrc )
#
#       This subroutine takes the user options and builds the rules
#       required to lint the program 'name'.
#
#   Arguments:
#       (none)
#
#   Output:
#       [ $(LIBDIR)/$name_lint:   .... ]
#           $(SHLIBLINT)
#
#       $name_shlnt +=
#       $name_shlnt += ...
#           :
#
###############################################################################

sub PCLintSHLIB
{
    my ($name, $pArgs, $pObjs, $pLibs, $target, $CSRC, $CXXSRC) = @_;
    my ($shlint) = "$name\_shlnt";
    my ($io) = ToolsetPrinter::New();

    #.. Lint command
    #
    $io->Prt( "\n\t\$(SHLIBLINT)\n" );          # work horse

    #.. Remove generate files
    #
    ToolsetGenerate( "\$(LIBDIR)/${name}\$(GBE_TYPE).lob" );
    
    #
    #   Install and package the lint objects
    #
    PCLintInstall( $io, $name, $::SHLIB_INS{$name} );
    PCLintPackage( $io, $name, $::SHLIB_PKG{$name} );
    PackageShlibAddFiles( $name, "\$(LIBDIR)/${name}\$(GBE_TYPE).lob", "RemoveOnly=1", "Class=lint");
    $io->Newline();

    #.. Lint object list,
    #
    #   Now piece together a variable $(name_shlint) which ends up
    #   in the command file building the lint object list.
    #
    $io->SetTag( "$shlint" );
    $io->Tag( "" );                             # remove undef warning
    $io->LibList( $name, $pLibs, \&PCLintLibRecipe );
    $io->Newline();
}


###############################################################################
#   PCLintLD( $name, \@args, \@objs, \@libraries, \@csrc, \@cxxsrc )
#
#       This subroutine takes the user options and builds the rules
#       required to lint the program 'name'.
#
#   Arguments:
#       (none)
#
#   Output:
#       [ $(BINDIR)/$name_lint:   .... ]
#           $(LDLINT)
#
#       $name_ldlnt +=
#       $name_ldlnt += ...
#           :
#
###############################################################################

sub PCLintLD
{
    my ($name, $pArgs, $pObjs, $pLibs, $target, $CSRC, $CXXSRC) = @_;
    my ($ldlint) = "$name\_ldlnt";
    my ($io) = ToolsetPrinter::New();

    #.. Lint command
    #
    $io->Prt( "\n\t\$(LDLINT)\n\n" );           # work horse

    #.. Lint object list,
    #
    #   Now piece together a variable $(name_ldlint) which ends up 
    #   in the command file building the lint object list.
    #
    $io->SetTag( "$ldlint" );
    $io->Tag( "" );                             # remove undef warning
    $io->LibList( $name, $pLibs, \&PCLintLibRecipe );
    $io->Newline();
}


sub PCLintLibRecipe
{
    my ($io, $target, $lib) = @_;

    $io->Cmd( "@(vlint3,$lib,LINTLIBPATH)" );   # lint resource
}


sub PCLintInstall
{
    my ($io, $name, $iptr) = @_;
    return unless ($iptr );

    my ($dest) = @{$iptr}[0];
    my ($dir) = StripFileExt( $dest );

    #
    #   Installation command
    #
    $io->Prt("\t\$(call InstallFile,$dir/$name\$(GBE_TYPE).lob,\$(LIBDIR)/$name\$(GBE_TYPE).lob,$dir,-w)\n" );
}


sub PCLintPackage
{
    my ($io, $name, $iptr) = @_;
    return unless ($iptr );

    my ($dest) = @{$iptr}[0];
    my ($dir) = StripFileExt( $dest );

    #
    #   Packaging command
    #
    $io->Prt("\t\$(if \$(LINTPACKAGE),\$(call PackageFile,$dir/$name\$(GBE_TYPE).lob,\$(LIBDIR)/$name\$(GBE_TYPE).lob,$dir,-w))\n" );

}