Subversion Repositories DevTools

Rev

Rev 227 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
227 dpurdie 1
# -*- mode: perl; tabs: 8; indent-width: 4; show-tabs: yes; -*-
2
#
3
# Module name   : PCLINT
4
# Module type   : Makefile system
5
# Compiler(s)   : ANSI C
6
# Environment(s): Gimple C/C++ PCLint
7
#
8
# Description:
9
#   PCLINT toolset support.
10
#
11
# Contents:     
12
#   Generate rules to use Gmiple/PCLINT.
13
#
14
# Version   Who     Date        Description
15
#           APY     21/09/04    Created
16
#
17
# $Source: /cvsroot/etm/devl/CFG/TOOLSET/PCLINT,v $
18
# $Revision: 1.5 $ $Date: 2004/10/20 05:55:54 $ $State: Exp $
19
# $Author: ayoung $ $Locker:  $
20
#............................................................................#
21
 
22
use strict;
23
use warnings;
24
 
25
###############################################################################
26
#   PCLintInit()
27
#       Runtime initialisation
28
#
29
#   Arguments:
30
#       none                    No arguments currently defined
31
#
32
###############################################################################
33
 
34
PCLintInit();
35
 
36
sub PCLintInit
37
{
38
    ToolsetRules( "pclint.rul" );
39
}
40
 
41
 
42
###############################################################################
43
#   ToolsetARLINT( $name, \@args, \@objs )
44
#       This subroutine takes the user options and builds the rules
45
#       required to build the library 'name'.
46
#
47
#   Arguments:
48
#       none                    No arguments currently defined
49
#
50
#   Output:
51
#       [ $(LIBDIR)/name$_lint:   .... ]
52
#           $(ARLINT)
53
#
54
###############################################################################
55
 
56
sub PCLintAR
57
{
58
    my ($name, $pArgs, $pObjs, $target, $CSRC, $CXXSRC) = @_;
59
    my ($io) = ToolsetPrinter::New();
60
 
61
    #.. Lint command
62
    #
63
    $io->Prt( "\n\t\$(ARLINT)\n" );             # work horse
64
 
65
    #.. Remove generate files
66
    #
67
   ToolsetGenerate( "\$(LIBDIR)/${name}\$(GBE_TYPE).lob" );
68
 
69
    #
70
    #   Install and package the lint objects
71
    #
72
    PCLintInstall( $io, $name, $::LIB_INS{$name} );
73
    PCLintPackage( $io, $name, $::LIB_PKG{$name} );
74
 
75
    #
76
    #   UnPackaging command
77
    #   Since we are manually packaging we need to unpackage too
78
    #
79
    PackageLibAddFiles( $name, "\$(OBJDIR)/${name}\$(GBE_TYPE).lob", "RemoveOnly=1");
80
 
81
    $io->Newline();
82
}
83
 
84
 
85
###############################################################################
86
#   PCLintLD( $name, \@args, \@objs, \@libraries, \@csrc, \@cxxsrc )
87
#
88
#       This subroutine takes the user options and builds the rules
89
#       required to lint the program 'name'.
90
#
91
#   Arguments:
92
#       (none)
93
#
94
#   Output:
95
#       [ $(LIBDIR)/$name_lint:   .... ]
96
#           $(SHLIBLINT)
97
#
98
#       $name_shlnt +=
99
#       $name_shlnt += ...
100
#           :
101
#
102
###############################################################################
103
 
104
sub PCLintSHLIB
105
{
106
    my ($name, $pArgs, $pObjs, $pLibs, $target, $CSRC, $CXXSRC) = @_;
107
    my ($shlint) = "$name\_shlnt";
108
    my ($io) = ToolsetPrinter::New();
109
 
110
    #.. Lint command
111
    #
112
    $io->Prt( "\n\t\$(SHLIBLINT)\n" );          # work horse
113
 
114
    #.. Remove generate files
115
    #
116
    ToolsetGenerate( "\$(LIBDIR)/${name}\$(GBE_TYPE).lob" );
117
 
118
    #
119
    #   Install and package the lint objects
120
    #
121
    PCLintInstall( $io, $name, $::SHLIB_INS{$name} );
122
    PCLintPackage( $io, $name, $::SHLIB_PKG{$name} );
123
    PackageShlibAddFiles( $name, "\$(LIBDIR)/${name}\$(GBE_TYPE).lob", "RemoveOnly=1", "Class=lint");
124
    $io->Newline();
125
 
126
    #.. Lint object list,
127
    #
128
    #   Now piece together a variable $(name_shlint) which ends up
129
    #   in the command file building the lint object list.
130
    #
131
    $io->SetTag( "$shlint" );
132
    $io->Tag( "" );                             # remove undef warning
133
    $io->LibList( $name, $pLibs, \&PCLintLibRecipe );
134
    $io->Newline();
135
}
136
 
137
 
138
###############################################################################
139
#   PCLintLD( $name, \@args, \@objs, \@libraries, \@csrc, \@cxxsrc )
140
#
141
#       This subroutine takes the user options and builds the rules
142
#       required to lint the program 'name'.
143
#
144
#   Arguments:
145
#       (none)
146
#
147
#   Output:
148
#       [ $(BINDIR)/$name_lint:   .... ]
149
#           $(LDLINT)
150
#
151
#       $name_ldlnt +=
152
#       $name_ldlnt += ...
153
#           :
154
#
155
###############################################################################
156
 
157
sub PCLintLD
158
{
159
    my ($name, $pArgs, $pObjs, $pLibs, $target, $CSRC, $CXXSRC) = @_;
160
    my ($ldlint) = "$name\_ldlnt";
161
    my ($io) = ToolsetPrinter::New();
162
 
163
    #.. Lint command
164
    #
165
    $io->Prt( "\n\t\$(LDLINT)\n\n" );           # work horse
166
 
167
    #.. Lint object list,
168
    #
169
    #   Now piece together a variable $(name_ldlint) which ends up 
170
    #   in the command file building the lint object list.
171
    #
172
    $io->SetTag( "$ldlint" );
173
    $io->Tag( "" );                             # remove undef warning
174
    $io->LibList( $name, $pLibs, \&PCLintLibRecipe );
175
    $io->Newline();
176
}
177
 
178
 
179
sub PCLintLibRecipe
180
{
181
    my ($io, $target, $lib) = @_;
182
 
183
    $io->Cmd( "@(vlint3,$lib,LINTLIBPATH)" );   # lint resource
184
}
185
 
186
 
187
sub PCLintInstall
188
{
189
    my ($io, $name, $iptr) = @_;
190
    return unless ($iptr );
191
 
192
    my ($dest) = @{$iptr}[0];
193
    my ($dir) = StripFileExt( $dest );
194
 
195
    #
196
    #   Installation command
197
    #
198
    $io->Prt("\t\$(call InstallFile,$dir/$name\$(GBE_TYPE).lob,\$(LIBDIR)/$name\$(GBE_TYPE).lob,$dir,-w)\n" );
199
}
200
 
201
 
202
sub PCLintPackage
203
{
204
    my ($io, $name, $iptr) = @_;
205
    return unless ($iptr );
206
 
207
    my ($dest) = @{$iptr}[0];
208
    my ($dir) = StripFileExt( $dest );
209
 
210
    #
211
    #   Packaging command
212
    #
2429 dpurdie 213
    $io->Prt("\t\$(if \$(LINTPACKAGE),\$(call PackageFile,$dir/$name\$(GBE_TYPE).lob,\$(LIBDIR)/$name\$(GBE_TYPE).lob,-w))\n" );
227 dpurdie 214
 
215
}
216