127N/A# The contents of this file are subject to the terms of the
127N/A# Common Development and Distribution License (the "License").
127N/A# You may not use this file except in compliance with the License.
127N/A# See the License for the specific language governing permissions
127N/A# and limitations under the License.
127N/A# When distributing Covered Code, include this CDDL HEADER in each
127N/A# If applicable, add the following below this CDDL HEADER, with the
127N/A# fields enclosed by brackets "[]" replaced with your own identifying
127N/A# information: Portions Copyright [yyyy] [name of copyright owner]
127N/A# Copyright (c) 2010, 2011, Oracle
and/or its affiliates. All rights reserved.
127N/A# Rules and Macros for building opens source software that uses configure /
127N/A# GNU auto* tools to configure their build for the system they are on. This
127N/A# uses GNU Make to build the components to take advantage of the viewpath
127N/A# support and build multiple version (32/64 bit) from a shared source.
127N/A# and define "build", "install", and "test" targets appropriate to building
127N/A# build: $(SOURCE_DIR)/build/$(MACH32)/.built \
127N/A# $(SOURCE_DIR)/build/$(MACH64)/.built
729N/A# install: $(SOURCE_DIR)/build/$(MACH32)/.installed \
729N/A# $(SOURCE_DIR)/build/$(MACH64)/.installed
729N/A# test: $(SOURCE_DIR)/build/$(MACH32)/.tested \
729N/A# $(SOURCE_DIR)/build/$(MACH64)/.tested
844N/A# Any additional
pre/post configure, build, or install actions can be specified
729N/A# in your make file by setting them in on of the following macros:
729N/A# COMPONENT_PRE_CONFIGURE_ACTION, COMPONENT_POST_CONFIGURE_ACTION
729N/A# COMPONENT_PRE_BUILD_ACTION, COMPONENT_POST_BUILD_ACTION
127N/A# COMPONENT_PRE_INSTALL_ACTION, COMPONENT_POST_INSTALL_ACTION
127N/A# COMPONENT_PRE_TEST_ACTION, COMPONENT_POST_TEST_ACTION
127N/A# If component specific make targets need to be used for build or install, they
127N/A# COMPONENT_BUILD_TARGETS, COMPONENT_INSTALL_TARGETS
127N/A# COMPONENT_TEST_TARGETS
751N/ACONFIGURE_BINDIR.32 = $(CONFIGURE_PREFIX)/bin
751N/ACONFIGURE_BINDIR.64 = $(CONFIGURE_PREFIX)/bin/$(MACH64)
751N/ACONFIGURE_LIBDIR.32 = $(CONFIGURE_PREFIX)/lib
751N/ACONFIGURE_LIBDIR.64 = $(CONFIGURE_PREFIX)/lib/$(MACH64)
751N/ACONFIGURE_SBINDIR.32 = $(CONFIGURE_PREFIX)/sbin
751N/ACONFIGURE_SBINDIR.64 = $(CONFIGURE_PREFIX)/sbin/$(MACH64)
729N/ACONFIGURE_ENV = CONFIG_SHELL="$(CONFIG_SHELL)"
729N/ACONFIGURE_OPTIONS += CC="$(CC)"
729N/ACONFIGURE_OPTIONS += CXX="$(CXX)"
729N/ACONFIGURE_OPTIONS += --prefix=$(CONFIGURE_PREFIX)
729N/ACONFIGURE_OPTIONS += --mandir=$(CONFIGURE_MANDIR)
729N/ACONFIGURE_OPTIONS += --bindir=$(CONFIGURE_BINDIR.$(BITS))
729N/ACONFIGURE_OPTIONS += --libdir=$(CONFIGURE_LIBDIR.$(BITS))
729N/ACONFIGURE_OPTIONS += --sbindir=$(CONFIGURE_SBINDIR.$(BITS))
729N/ACONFIGURE_OPTIONS += $(CONFIGURE_OPTIONS.$(BITS))
729N/ACOMPONENT_INSTALL_ARGS += DESTDIR=$(PROTO_DIR)
729N/A$(BUILD_DIR_32)/.configured: BITS=32
729N/A$(BUILD_DIR_64)/.configured: BITS=64
729N/ACONFIGURE_ENV += $(CONFIGURE_ENV.$(BITS))
729N/A# configure the unpacked source for building 32 and 64 bit version
729N/ACONFIGURE_SCRIPT = $(SOURCE_DIR)/configure
729N/A$(BUILD_DIR)/%/.configured: $(SOURCE_DIR)/.prep
729N/A ($(RM) -rf $(@D) ; $(MKDIR) $(@D))
729N/A $(COMPONENT_PRE_CONFIGURE_ACTION)
729N/A (cd $(@D) ; $(ENV) $(CONFIGURE_ENV) $(CONFIG_SHELL) \
729N/A $(CONFIGURE_SCRIPT) $(CONFIGURE_OPTIONS))
729N/A $(COMPONENT_POST_CONFIGURE_ACTION)
729N/A# build the configured source
729N/A$(BUILD_DIR)/%/.built: $(BUILD_DIR)/%/.configured
729N/A $(COMPONENT_PRE_BUILD_ACTION)
729N/A (cd $(@D) ; $(ENV) $(COMPONENT_BUILD_ENV) \
127N/A $(GMAKE) $(COMPONENT_BUILD_ARGS) $(COMPONENT_BUILD_TARGETS))
127N/A $(COMPONENT_POST_BUILD_ACTION)
127N/A# install the built source into a prototype area
181N/A$(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built
181N/A $(COMPONENT_PRE_INSTALL_ACTION)
127N/A (cd $(@D) ; $(ENV) $(COMPONENT_INSTALL_ENV) $(GMAKE) \
127N/A $(COMPONENT_INSTALL_ARGS) $(COMPONENT_INSTALL_TARGETS))
127N/A $(COMPONENT_POST_INSTALL_ACTION)
$(BUILD_DIR)/%/.tested: $(BUILD_DIR)/%/.built
$(COMPONENT_PRE_TEST_ACTION)
(cd $(@D) ; $(ENV) $(COMPONENT_TEST_ENV) $(GMAKE) \
$(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS))
$(COMPONENT_POST_TEST_ACTION)
$(RM) -r $(BUILD_DIR) $(PROTO_DIR)