Subversion Repositories DevTools

Rev

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

# -*- mode: mak; -*-
###############################################################################
# File:         TOOLSET/pclint.rul
# Contents:     PCLINT common rules
#
# Version   Who      Date        Description#
#           APY      07/10/04    Created
#
# $Source: /cvsroot/etm/devl/CFG/TOOLSET/PCLINT.RUL,v $
# $Revision: 1.4 $ $Date: 2004/10/14 07:06:45 $ $State: Exp $
# $Author: ayoung $ $Locker:  $
#............................................................................#

###############################################################################
#..     Parse user options
#       Global options already parsed
#       These options extend the global options
#
ifdef OPTIONS

ifneq "$(findstring lint2,$(OPTIONS))" ""
LINTPASSES      =2
endif

endif

#..     Lint initialisation
#
#       Ensure that PCLINT is defined
#
.PHONY: lint_init
lint_init:
ifndef PCLINT
        $(warning The LINT operation requires that the environment variable PCLINT be set)
        $(error PCLINT has not been set)
endif
        @if [ ! -f $(lint_cmd) ] ; then \
        echo "ERROR: PCLINT program not found at: $(lint_cmd)";\
        exit 2;\
    fi

#..     Lint configuration files
#       There are three
#       1) System:Toolset specific - Named by the toolset
#       2) User: Common            - build.lnt
#       3) User: Toolset specfic   - Toolset named "lint.???"
#                                    Use same extensions as "warnings.???"
#
ifndef LINT_COFILE
    $(error TOOLSET does not support PCLINT)
endif

lint_cfg_file = $(GBE_CONFIG)/TOOLSET/$(LINT_COFILE)
lint_cfg_file += $(wildcard $(GBE_ROOT)/build.lnt)

ifdef LINT_PRJ_FILE
lint_prj_file := $(wildcard $(GBE_ROOT)/$(LINT_PRJ_FILE))
ifdef lint_prj_file
lint_cfg_file += +lnt\($(suffix $(LINT_PRJ_FILE))\) $(lint_prj_file)
endif
endif

#..     Global flags
#
#       -b            Disable banner.
#       -zero(400)    Generate successful if no messages <400.
#       -dlint        #define 'lint', compat with older source.
#       -I            Add PCLINT to include path.
#
#       -passes(2)    Walk passes, run thru at least two passes so that
#                     cross-functional checks can be made.
#       -e306         Previously encountered module.
#
lint_cmd        = $(subst \,/,$(PCLINT))/lint-nt.exe

lint_flags      += \
        -b \
        '-zero(400)' \
        -dlint \
        -I$(PCLINT)\
    -e306

ifdef LINTPASSES
lint_flags      += \
        '-passes($(LINTPASSES),-e306)'
endif

#..     Enable LINT lob packaging
#
ifndef LINTPACKAGE
LINTPACKAGE     =
else
LINTPACKAGE     =YES
endif

#..     Search path
#
lint_libpath    +=

#..     Archive Lint
#
#       -u        Unit checkout, disables the following messages, 526, 552,
#                 628, 714, 729, 755-759, 765, 768, 769, 1526, 1527, 1711,
#                 1714, 1715, and 1755.
#
#           526   Symbol (Location) not defined.
#           552   Symbol (Location) not accessed.
#           628   No argument information provided for function Symbol.
#           714   Symbol (Location) not referenced.
#           729   Symbol (Location) not explicitly initialized.
#           755,759,765-769
#                 Global (type) Symbol (Location) not referenced.
#           1526  Member function Symbol (Location) not defined.
#           1527  Static member Symbol (Location) not defined.
#           1711  class Symbol (Location) has a virtual function but
#                 is not inherited.
#           1714  Member function Symbol (Location) not referenced.
#           1715  Static member Symbol (Location) not referenced.
#           1755  Global template Symbol (Location) not referenced.
#
#       -oo       Generate lint object
#
lint_arflags    +=

define ARLINT
        $(XX_PRE)echo [$(LIBNAME)] AR linting..
        $(XX_PRE)$(lint_cmd) $(lint_cfg_file) -u '-oo($(LIBNAME))' \
                $(lint_flags) $(lint_arflags) $(LIBCSRC) $(LIBCXXSRC)
endef


#..     Shared library lint
#
#       -u        Unit checkout
#       -oo       Generate lint object
#       --u       Ignore modules contained within 'lnt' specification.
#       -e728     The name-intra module (static) variable is not initialised.
#
lint_shflags    += \
        -u \
        --u \
        -e728

define shlint_pre
        echo [$(SHLIBNAME)] SH linting..; \
        export LINTLIBPATH; LINTLIBPATH="$(lint_libpath)"; \
        $(cmdfile) -NwkWeo$(SHLIBNAME).lnt \
                $(lint_shflags) "$($(SHLIBBASE)_shlnt)"
endef

ifndef LEAVETMP
define shlint_post
        $(rm) -f $(SHLIBNAME).lnt
endef
else
define shlint_post
endef
endif

define SHLIBLINT
        $(XX_PRE)$(shlint_pre)
        $(XX_PRE)$(show_environment)
        $(XX_PRE)$(lint_cmd) $(lint_cfg_file) $(lint_flags) '-oo($(SHLIBNAME))' $(SHLIBNAME).lnt \
                $(SHLIBCSRC) $(SHLIBCXXSRC)
        $(XX_PRE)$(shlint_post)
endef


#..     Program lint
#
#       --u       Ignore modules contained within 'lnt' specification.
#       -e728     The name-intra module (static) variable is not initialised.
#
lint_ldflags    += \
        --u \
        -e728

define ldlint_pre
        echo [$(PROGNAME)] PROG linting..; \
        export LINTLIBPATH; LINTLIBPATH="$(lint_libpath)"; \
        $(cmdfile) -NwkWeo$(PROGNAME).lnt \
                $(lint_ldflags) "$($(PROGBASE)_ldlnt)"
endef

ifndef LEAVETMP
define ldlint_post
        $(rm) -f $(PROGNAME).lnt
endef
else
define ldlint_post
endef
endif

define LDLINT
        $(XX_PRE)$(ldlint_pre)
        $(XX_PRE)$(show_environment)
        $(XX_PRE)$(lint_cmd) $(lint_cfg_file) $(lint_flags) $(PROGNAME).lnt \
                $(PROGCSRC) $(PROGCXXSRC)
        $(XX_PRE)$(ldlint_post)
endef

#