make-rules/lint-libraries.mk
changeset 181 87e11e685b1f
child 254 0f66d3384945
equal deleted inserted replaced
180:4de0581be621 181:87e11e685b1f
       
     1 #
       
     2 # CDDL HEADER START
       
     3 #
       
     4 # The contents of this file are subject to the terms of the
       
     5 # Common Development and Distribution License (the "License").
       
     6 # You may not use this file except in compliance with the License.
       
     7 #
       
     8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
       
     9 # or http://www.opensolaris.org/os/licensing.
       
    10 # See the License for the specific language governing permissions
       
    11 # and limitations under the License.
       
    12 #
       
    13 # When distributing Covered Code, include this CDDL HEADER in each
       
    14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
       
    15 # If applicable, add the following below this CDDL HEADER, with the
       
    16 # fields enclosed by brackets "[]" replaced with your own identifying
       
    17 # information: Portions Copyright [yyyy] [name of copyright owner]
       
    18 #
       
    19 # CDDL HEADER END
       
    20 #
       
    21 # Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
       
    22 #
       
    23 
       
    24 #
       
    25 # Rules and Macros for building lint libraries.  This searches for lint
       
    26 # libraries in the component directory and adds targets to build and install
       
    27 # them for 32/64 bit.
       
    28 #
       
    29 # To use these rules, include $(WS_TOP)/make-rules/lint-libraries.mk in your
       
    30 # Makefile and add your lint library source in your component directory as
       
    31 # llib-l{lib}.
       
    32 #
       
    33 # Makefile
       
    34 #    include $(WS_TOP)/make-rules/lint-libraries.mk
       
    35 #
       
    36 # llib-l{libname}
       
    37 #
       
    38 
       
    39 LINT_LIBRARIES = $(wildcard llib-*)
       
    40 
       
    41 LINT_FLAGS = -nsvx -I$(@D) -I$(SOURCE_DIR)/include -I$(SOURCE_DIR)
       
    42 
       
    43 # template for lint library rules. new rules will be added automatically
       
    44 define lintlib-rule
       
    45 $(BUILD_DIR_32)/$(1).ln:	BITS=32
       
    46 $(BUILD_DIR_64)/$(1).ln:	BITS=64
       
    47 
       
    48 $$(BUILD_DIR)/%/$(1).ln:	$(1) $(BUILD_DIR)/%/.built
       
    49 	(cd $$(@D) ; $$(LINT) $$(LINT_FLAGS) -o $$(@F:llib-l%.ln=%) ../../$$<)
       
    50 
       
    51 $$(PROTOUSRLIBDIR)/$(1):	$(1)
       
    52 	$(INSTALL) -c $$< [email protected]
       
    53 
       
    54 $$(PROTOUSRLIBDIR)/$(1).ln:	$$(BUILD_DIR)/$(MACH32)/$(1).ln
       
    55 	$(INSTALL) -c $$< [email protected]
       
    56 
       
    57 $$(PROTOUSRLIBDIR64)/$(1).ln:	$$(BUILD_DIR)/$(MACH64)/$(1).ln
       
    58 	$(INSTALL) -c $$< [email protected]
       
    59 
       
    60 BUILD_32 += $(BUILD_DIR_32)/$(1).ln
       
    61 BUILD_64 += $(BUILD_DIR_64)/$(1).ln
       
    62 INSTALL_32 += $(PROTOUSRLIBDIR)/$(1)
       
    63 INSTALL_32 += $(PROTOUSRLIBDIR)/$(1).ln
       
    64 INSTALL_64 += $(PROTOUSRLIBDIR64)/$(1).ln
       
    65 endef
       
    66 
       
    67 # Generate the lint library rules from the above template
       
    68 $(foreach lintlib,$(LINT_LIBRARIES),$(eval $(call lintlib-rule,$(lintlib))))