Subversion Repositories DevTools

Rev

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

Rev Author Line No. Line
227 dpurdie 1
# -*- mode: mak; -*-
2
###############################################################################
3
# File:         TOOLSET/pclint.rul
4
# Contents:     PCLINT common rules
5
#
6
# Version   Who      Date        Description#
7
#           APY      07/10/04    Created
8
#
9
# $Source: /cvsroot/etm/devl/CFG/TOOLSET/PCLINT.RUL,v $
10
# $Revision: 1.4 $ $Date: 2004/10/14 07:06:45 $ $State: Exp $
11
# $Author: ayoung $ $Locker:  $
12
#............................................................................#
13
 
14
###############################################################################
15
#..     Parse user options
16
#       Global options already parsed
17
#       These options extend the global options
18
#
19
ifdef OPTIONS
20
 
21
ifneq "$(findstring lint2,$(OPTIONS))" ""
22
LINTPASSES	=2
23
endif
24
 
25
endif
26
 
27
#..     Lint initialisation
28
#
29
#       Ensure that PCLINT is defined
30
#
261 dpurdie 31
.PHONY: lint_init
227 dpurdie 32
lint_init:
33
ifndef PCLINT
34
	$(warning The LINT operation requires that the environment variable PCLINT be set)
35
	$(error PCLINT has not been set)
36
endif
37
	@if [ ! -f $(lint_cmd) ] ; then \
38
        echo "ERROR: PCLINT program not found at: $(lint_cmd)";\
39
        exit 2;\
40
    fi
41
 
42
#..     Lint configuration files
43
#       There are three
44
#       1) System:Toolset specific - Named by the toolset
45
#       2) User: Common            - build.lnt
46
#       3) User: Toolset specfic   - Toolset named "lint.???"
47
#                                    Use same extensions as "warnings.???"
48
#
49
ifndef LINT_COFILE
50
    $(error TOOLSET does not support PCLINT)
51
endif
52
 
53
lint_cfg_file = $(GBE_CONFIG)/TOOLSET/$(LINT_COFILE)
54
lint_cfg_file += $(wildcard $(GBE_ROOT)/build.lnt)
55
 
56
ifdef LINT_PRJ_FILE
57
lint_prj_file := $(wildcard $(GBE_ROOT)/$(LINT_PRJ_FILE))
58
ifdef lint_prj_file
59
lint_cfg_file += +lnt\($(suffix $(LINT_PRJ_FILE))\) $(lint_prj_file)
60
endif
61
endif
62
 
63
#..     Global flags
64
#
65
#       -b            Disable banner.
66
#       -zero(400)    Generate successful if no messages <400.
67
#       -dlint        #define 'lint', compat with older source.
68
#       -I            Add PCLINT to include path.
69
#
70
#       -passes(2)    Walk passes, run thru at least two passes so that
71
#                     cross-functional checks can be made.
72
#       -e306         Previously encountered module.
73
#
74
lint_cmd	= $(subst \,/,$(PCLINT))/lint-nt.exe
75
 
76
lint_flags	+= \
77
	-b \
78
	'-zero(400)' \
79
	-dlint \
80
	-I$(PCLINT)\
81
    -e306
82
 
83
ifdef LINTPASSES
84
lint_flags	+= \
85
	'-passes($(LINTPASSES),-e306)'
86
endif
87
 
88
#..     Enable LINT lob packaging
89
#
90
ifndef LINTPACKAGE
91
LINTPACKAGE	=
92
else
93
LINTPACKAGE	=YES
94
endif
95
 
96
#..     Search path
97
#
98
lint_libpath	+=
99
 
100
#..     Archive Lint
101
#
102
#       -u        Unit checkout, disables the following messages, 526, 552,
103
#                 628, 714, 729, 755-759, 765, 768, 769, 1526, 1527, 1711,
104
#                 1714, 1715, and 1755.
105
#
106
#           526   Symbol (Location) not defined.
107
#           552   Symbol (Location) not accessed.
108
#           628   No argument information provided for function Symbol.
109
#           714   Symbol (Location) not referenced.
110
#           729   Symbol (Location) not explicitly initialized.
111
#           755,759,765-769
112
#                 Global (type) Symbol (Location) not referenced.
113
#           1526  Member function Symbol (Location) not defined.
114
#           1527  Static member Symbol (Location) not defined.
115
#           1711  class Symbol (Location) has a virtual function but
116
#                 is not inherited.
117
#           1714  Member function Symbol (Location) not referenced.
118
#           1715  Static member Symbol (Location) not referenced.
119
#           1755  Global template Symbol (Location) not referenced.
120
#
121
#       -oo       Generate lint object
122
#
123
lint_arflags	+=
124
 
125
define ARLINT
6177 dpurdie 126
	$(XX_PRE)echo '[$(LIBNAME)] AR linting..'
227 dpurdie 127
	$(XX_PRE)$(lint_cmd) $(lint_cfg_file) -u '-oo($(LIBNAME))' \
128
		$(lint_flags) $(lint_arflags) $(LIBCSRC) $(LIBCXXSRC)
129
endef
130
 
131
 
132
#..     Shared library lint
133
#
134
#       -u        Unit checkout
135
#       -oo       Generate lint object
136
#       --u       Ignore modules contained within 'lnt' specification.
137
#       -e728     The name-intra module (static) variable is not initialised.
138
#
139
lint_shflags	+= \
140
	-u \
141
	--u \
142
	-e728
143
 
144
define shlint_pre
6177 dpurdie 145
	echo '[$(SHLIBNAME)] SH linting..'; \
227 dpurdie 146
	export LINTLIBPATH; LINTLIBPATH="$(lint_libpath)"; \
147
	$(cmdfile) -NwkWeo$(SHLIBNAME).lnt \
148
		$(lint_shflags) "$($(SHLIBBASE)_shlnt)"
149
endef
150
 
151
ifndef LEAVETMP
152
define shlint_post
153
	$(rm) -f $(SHLIBNAME).lnt
154
endef
155
else
156
define shlint_post
157
endef
158
endif
159
 
160
define SHLIBLINT
161
	$(XX_PRE)$(shlint_pre)
162
	$(XX_PRE)$(show_environment)
163
	$(XX_PRE)$(lint_cmd) $(lint_cfg_file) $(lint_flags) '-oo($(SHLIBNAME))' $(SHLIBNAME).lnt \
164
		$(SHLIBCSRC) $(SHLIBCXXSRC)
165
	$(XX_PRE)$(shlint_post)
166
endef
167
 
168
 
169
#..     Program lint
170
#
171
#       --u       Ignore modules contained within 'lnt' specification.
172
#       -e728     The name-intra module (static) variable is not initialised.
173
#
174
lint_ldflags	+= \
175
	--u \
176
	-e728
177
 
178
define ldlint_pre
6177 dpurdie 179
	echo '[$(PROGNAME)] PROG linting..'; \
227 dpurdie 180
	export LINTLIBPATH; LINTLIBPATH="$(lint_libpath)"; \
181
	$(cmdfile) -NwkWeo$(PROGNAME).lnt \
182
		$(lint_ldflags) "$($(PROGBASE)_ldlnt)"
183
endef
184
 
185
ifndef LEAVETMP
186
define ldlint_post
187
	$(rm) -f $(PROGNAME).lnt
188
endef
189
else
190
define ldlint_post
191
endef
192
endif
193
 
194
define LDLINT
195
	$(XX_PRE)$(ldlint_pre)
196
	$(XX_PRE)$(show_environment)
197
	$(XX_PRE)$(lint_cmd) $(lint_cfg_file) $(lint_flags) $(PROGNAME).lnt \
198
		$(PROGCSRC) $(PROGCXXSRC)
199
	$(XX_PRE)$(ldlint_post)
200
endef
201
 
202
#