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