attpackagemake.mk revision 902
1923N/A#
1923N/A# CDDL HEADER START
1923N/A#
1923N/A# The contents of this file are subject to the terms of the
1923N/A# Common Development and Distribution License (the "License").
1923N/A# You may not use this file except in compliance with the License.
1923N/A#
1923N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1923N/A# or http://www.opensolaris.org/os/licensing.
1923N/A# See the License for the specific language governing permissions
1923N/A# and limitations under the License.
1923N/A#
1923N/A# When distributing Covered Code, include this CDDL HEADER in each
1923N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1923N/A# If applicable, add the following below this CDDL HEADER, with the
1923N/A# fields enclosed by brackets "[]" replaced with your own identifying
1923N/A# information: Portions Copyright [yyyy] [name of copyright owner]
1923N/A#
1923N/A# CDDL HEADER END
1923N/A#
1923N/A# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
1923N/A#
3661N/A#
1923N/A# Rules and Macros for building opens source software that uses AT&T's package
1923N/A# tool.
1923N/A#
1923N/A# To use these rules, include ../make-rules/attpackagemake.mk in your Makefile
1923N/A# and define "build", "install" targets appropriate to building your component.
1923N/A# Ex:
1923N/A#
1923N/A# build: $(BUILD_32) \
1923N/A# $(BUILD_64)
1923N/A#
1923N/A# install: $(INSTALL_32) \
1923N/A# $(INSTALL_64)
1923N/A#
1923N/A# Any additional pre/post configure, build, or install actions can be specified
3661N/A# in your Makefile by setting them in on of the following macros:
3661N/A# COMPONENT_PRE_BUILD_ACTION, COMPONENT_POST_BUILD_ACTION
1923N/A# COMPONENT_PRE_INSTALL_ACTION, COMPONENT_POST_INSTALL_ACTION
1923N/A#
1923N/A# If component specific make targets need to be used for build or install, they
1923N/A# can be specified in
1923N/A# COMPONENT_BUILD_TARGETS, COMPONENT_INSTALL_TARGETS
1923N/A#
1923N/A
1923N/A# Environment variables and arguments passed into the build and install
1923N/A# environment(s). These are the initial settings.
1923N/ACOMPONENT_BUILD_ENV += \
1923N/A CC_EXPLICIT="$(CC)" \
1923N/A PATH=$(shell dirname $(CC)):$(PATH) \
1923N/A CC=$(shell basename $(CC))
1923N/A NPROC="$(NPROC)"
1923N/A
1923N/A# This explicitly exports the build type for 32/64 bit distinction
1923N/ACOMPONENT_BUILD_ARGS = \
1923N/A HOSTTYPE="$(HOSTTYPE$(BITS))" \
1923N/A CCFLAGS="$(CFLAGS)" \
1923N/A LDFLAGS="$(CXXFLAGS)"
1923N/A
1923N/A# The install and test process needs the same environment as the build
1923N/ACOMPONENT_INSTALL_ENV = $(COMPONENT_BUILD_ENV)
1923N/ACOMPONENT_TEST_ENV = $(COMPONENT_BUILD_ENV)
1923N/ACOMPONENT_INSTALL_ARGS = HOSTTYPE="$(HOSTTYPE$(BITS))"
1923N/ACOMPONENT_TEST_ARGS = HOSTTYPE="$(HOSTTYPE$(BITS))"
1923N/A
1923N/A# build the configured source
1923N/A$(BUILD_DIR)/%/.built: $(SOURCE_DIR)/.prep
1923N/A $(RM) -r $(@D) ; $(MKDIR) $(@D)
1923N/A $(CLONEY) $(SOURCE_DIR) $(@D)
1923N/A $(COMPONENT_PRE_BUILD_ACTION)
1923N/A cd $(@D); $(ENV) $(COMPONENT_BUILD_ENV) \
1923N/A bin/package make $(COMPONENT_BUILD_TARGETS) $(COMPONENT_BUILD_ARGS)
1923N/A $(COMPONENT_POST_BUILD_ACTION)
1923N/A $(TOUCH) $@
1923N/A
1923N/A# install the built source into a prototype area
1923N/A$(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built
1923N/A $(COMPONENT_PRE_INSTALL_ACTION)
1923N/A $(RM) -r $(PROTO_DIR)/$(MACH$(BITS)); $(MKDIR) $(PROTO_DIR)/$(MACH$(BITS));
1923N/A cd $(@D); $(ENV) $(COMPONENT_INSTALL_ENV) \
1923N/A bin/package flat $(COMPONENT_INSTALL_TARGETS) \
1923N/A $(COMPONENT_INSTALL_ARGS) \
1923N/A $(PROTO_DIR)/$(MACH$(BITS)) $(COMPONENT_INSTALL_PACKAGES)
$(COMPONENT_POST_INSTALL_ACTION)
$(TOUCH) $@
# test the built source
$(BUILD_DIR)/%/.tested: $(BUILD_DIR)/%/.built
$(COMPONENT_PRE_TEST_ACTION)
cd $(@D); $(ENV) $(COMPONENT_TEST_ENV) \
bin/package test $(COMPONENT_TEST_TARGETS) \
$(COMPONENT_TEST_ARGS)
$(COMPONENT_POST_TEST_ACTION)
$(TOUCH) $@
clean::
$(RM) -r $(BUILD_DIR) $(PROTO_DIR)