5088N/A# The contents of this file are subject to the terms of the
5088N/A# Common Development and Distribution License (the "License").
5088N/A# You may not use this file except in compliance with the License.
5088N/A# See the License for the specific language governing permissions
5088N/A# and limitations under the License.
5088N/A# When distributing Covered Code, include this CDDL HEADER in each
5088N/A# If applicable, add the following below this CDDL HEADER, with the
5088N/A# fields enclosed by brackets "[]" replaced with your own identifying
5088N/A# information: Portions Copyright [yyyy] [name of copyright owner]
5503N/A# Copyright (c) 2010, 2015, Oracle
and/or its affiliates. All rights reserved.
5088N/A# $ (foreach suffix,$(VERSIONS),$(eval include $(WS_MAKE_RULES)/python-$(suffix).mk))
5088N/A$(BUILD_DIR)/%-2.6/.built: PYTHON_VERSION=2.6
5088N/A$(BUILD_DIR)/%-2.7/.built: PYTHON_VERSION=2.7
5088N/A$(BUILD_DIR)/%-3.4/.built: PYTHON_VERSION=3.4
5088N/A$(BUILD_DIR)/$(MACH32)-%/.built: BITS=32
5088N/A$(BUILD_DIR)/$(MACH64)-%/.built: BITS=64
5088N/A$(BUILD_DIR)/%-2.6/.installed: PYTHON_VERSION=2.6
5088N/A$(BUILD_DIR)/%-2.7/.installed: PYTHON_VERSION=2.7
5088N/A$(BUILD_DIR)/%-3.4/.installed: PYTHON_VERSION=3.4
5088N/A$(BUILD_DIR)/$(MACH32)-%/.installed: BITS=32
5088N/A$(BUILD_DIR)/$(MACH64)-%/.installed: BITS=64
5088N/A$(BUILD_DIR)/%-2.6/.tested: PYTHON_VERSION=2.6
5088N/A$(BUILD_DIR)/%-2.7/.tested: PYTHON_VERSION=2.7
5088N/A$(BUILD_DIR)/%-3.4/.tested: PYTHON_VERSION=3.4
5088N/A$(BUILD_DIR)/$(MACH32)-%/.tested: BITS=32
5088N/A$(BUILD_DIR)/$(MACH64)-%/.tested: BITS=64
5088N/A$(BUILD_DIR)/%-2.6/.tested-and-compared: PYTHON_VERSION=2.6
5088N/A$(BUILD_DIR)/%-2.7/.tested-and-compared: PYTHON_VERSION=2.7
5088N/A$(BUILD_DIR)/%-3.4/.tested-and-compared: PYTHON_VERSION=3.4
5088N/A$(BUILD_DIR)/$(MACH32)-%/.tested-and-compared: BITS=32
5088N/A$(BUILD_DIR)/$(MACH64)-%/.tested-and-compared: BITS=64
5088N/ABUILD_32 = $(PYTHON2_VERSIONS:%=$(BUILD_DIR)/$(MACH32)-%/.built)
5088N/ABUILD_64 = $(PYTHON_VERSIONS:%=$(BUILD_DIR)/$(MACH64)-%/.built)
5088N/ABUILD_NO_ARCH = $(PYTHON_VERSIONS:%=$(BUILD_DIR)/$(MACH)-%/.built)
5088N/Aifeq ($(PYTHON_VERSION),3.4)
5088N/ABUILD_32_and_64 = $(BUILD_64)
5088N/AINSTALL_32 = $(PYTHON2_VERSIONS:%=$(BUILD_DIR)/$(MACH32)-%/.installed)
5088N/AINSTALL_64 = $(PYTHON_VERSIONS:%=$(BUILD_DIR)/$(MACH64)-%/.installed)
5088N/AINSTALL_NO_ARCH = $(PYTHON_VERSIONS:%=$(BUILD_DIR)/$(MACH)-%/.installed)
5088N/Aifeq ($(PYTHON_VERSION),3.4)
5088N/AINSTALL_32_and_64 = $(INSTALL_64)
5088N/APYTHON_ENV += CFLAGS="$(CFLAGS)"
5088N/APYTHON_ENV += PATH="$(PATH):$(SPRO_VROOT)/bin"
5088N/ACOMPONENT_BUILD_ENV += $(PYTHON_ENV)
5088N/ACOMPONENT_INSTALL_ENV += $(PYTHON_ENV)
5088N/ACOMPONENT_TEST_ENV += $(PYTHON_ENV)
5088N/A# If we are building Python 2.7 or 3.4 support, build them and install them
5088N/A# before Python 2.6, so 2.6 is installed last and is the canonical version.
5088N/A# When we change the default, the new default should go last.
5088N/Aifneq ($(findstring 2.7,$(PYTHON_VERSIONS)),)
5088N/A$(BUILD_DIR)/%-2.6/.built: $(BUILD_DIR)/%-2.7/.built
5088N/A$(BUILD_DIR)/%-2.6/.installed: $(BUILD_DIR)/%-2.7/.installed
5088N/Aifneq ($(findstring 3.4,$(PYTHON_VERSIONS)),)
5088N/A$(BUILD_DIR)/%-2.6/.built: $(BUILD_DIR)/%-3.4/.built
5088N/A$(BUILD_DIR)/%-2.6/.installed: $(BUILD_DIR)/%-3.4/.installed
5088N/A# Create a distutils config file specific to the combination of build
5088N/A# characteristics (bittedness x Python version), and put it in its own
5088N/A# directory. We can set $HOME to point distutils at it later, allowing
5088N/A# the install phase to find the temporary build directories.
5088N/A$(BUILD_DIR)/config-%/$(CFG):
5088N/A echo "[build]\nbuild_base = $(BUILD_DIR)/$*" > $@
5088N/A# build the configured source
5088N/A$(BUILD_DIR)/%/.built: $(SOURCE_DIR)/.prep $(BUILD_DIR)/config-%/$(CFG)
5088N/A $(RM) -r $(@D) ; $(MKDIR) $(@D)
5088N/A $(COMPONENT_PRE_BUILD_ACTION)
5088N/A (cd $(SOURCE_DIR) ; $(ENV) HOME=$(BUILD_DIR)/config-$* $(COMPONENT_BUILD_ENV) \
5088N/A $(COMPONENT_POST_BUILD_ACTION)
5088N/Aifeq ($(strip $(PARFAIT_BUILD)),yes)
5088N/ACOMPONENT_INSTALL_ARGS += --root $(PROTO_DIR)
5088N/ACOMPONENT_INSTALL_ARGS += --install-lib=$(PYTHON_LIB)
5088N/ACOMPONENT_INSTALL_ARGS += --install-purelib=$(PYTHON_LIB)
5088N/ACOMPONENT_INSTALL_ARGS += --install-platlib=$(PYTHON_LIB)
5088N/ACOMPONENT_INSTALL_ARGS += --install-data=$(PYTHON_DATA)
5088N/ACOMPONENT_INSTALL_ARGS += --force
5088N/A# install the built source into a prototype area
5088N/A$(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built $(BUILD_DIR)/config-%/$(CFG)
5088N/A $(COMPONENT_PRE_INSTALL_ACTION)
5088N/A (cd $(SOURCE_DIR) ; $(ENV) HOME=$(BUILD_DIR)/config-$* $(COMPONENT_INSTALL_ENV) \
5088N/A $(COMPONENT_POST_INSTALL_ACTION)
5088N/A# Define bit specific and Python version specific filenames.
5088N/ACOMPONENT_TEST_MASTER = $(COMPONENT_TEST_RESULTS_DIR)/results-$(PYTHON_VERSION)-$(BITS).master
5088N/ACOMPONENT_TEST_OUTPUT = $(COMPONENT_TEST_BUILD_DIR)/test-$(PYTHON_VERSION)-$(BITS)-results
5088N/ACOMPONENT_TEST_DIFFS = $(COMPONENT_TEST_BUILD_DIR)/test-$(PYTHON_VERSION)-$(BITS)-diffs
5088N/ACOMPONENT_TEST_SNAPSHOT = $(COMPONENT_TEST_BUILD_DIR)/results-$(PYTHON_VERSION)-$(BITS).snapshot
5088N/ACOMPONENT_TEST_TRANSFORM_CMD = $(COMPONENT_TEST_BUILD_DIR)/transform-$(PYTHON_VERSION)-$(BITS)-results
5088N/ACOMPONENT_TEST_DEP = $(BUILD_DIR)/%/.installed
5088N/ACOMPONENT_TEST_DIR = $(COMPONENT_SRC)/test
5088N/ACOMPONENT_TEST_ENV_CMD = $(ENV)
5088N/ACOMPONENT_TEST_ENV += PYTHONPATH=$(PROTO_DIR)$(PYTHON_VENDOR_PACKAGES)
5088N/ACOMPONENT_TEST_CMD = $(PYTHON)
5088N/A# determine the type of tests we want to run.
5088N/Aifeq ($(strip $(wildcard $(COMPONENT_TEST_RESULTS_DIR)/results-*.master)),)
5088N/ATEST_32 = $(PYTHON2_VERSIONS:%=$(BUILD_DIR)/$(MACH32)-%/.tested)
5088N/ATEST_64 = $(PYTHON_VERSIONS:%=$(BUILD_DIR)/$(MACH64)-%/.tested)
5088N/ATEST_NO_ARCH = $(PYTHON_VERSIONS:%=$(BUILD_DIR)/$(MACH)-%/.tested)
5088N/ATEST_32 = $(PYTHON2_VERSIONS:%=$(BUILD_DIR)/$(MACH32)-%/.tested-and-compared)
5088N/ATEST_64 = $(PYTHON_VERSIONS:%=$(BUILD_DIR)/$(MACH64)-%/.tested-and-compared)
5088N/ATEST_NO_ARCH = $(PYTHON_VERSIONS:%=$(BUILD_DIR)/$(MACH)-%/.tested-and-compared)
5088N/Aifeq ($(PYTHON_VERSION),3.4)
5088N/A$(BUILD_DIR)/%/.tested-and-compared: $(COMPONENT_TEST_DEP)
5088N/A $(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
5088N/A $(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
5088N/A $(COMPONENT_PRE_TEST_ACTION)
5088N/A -(cd $(COMPONENT_TEST_DIR) ; \
5088N/A $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
5088N/A $(COMPONENT_TEST_CMD) $(COMPONENT_TEST_ARGS)) \
5088N/A &> $(COMPONENT_TEST_OUTPUT)
5088N/A $(COMPONENT_POST_TEST_ACTION)
5088N/A $(COMPONENT_TEST_CREATE_TRANSFORMS)
5088N/A $(COMPONENT_TEST_PERFORM_TRANSFORM)
5088N/A$(BUILD_DIR)/%/.tested: $(COMPONENT_TEST_DEP)
5088N/A $(COMPONENT_PRE_TEST_ACTION)
5088N/A (cd $(COMPONENT_TEST_DIR) ; \
5088N/A $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
5088N/A $(COMPONENT_TEST_CMD) $(COMPONENT_TEST_ARGS))
5088N/A $(COMPONENT_POST_TEST_ACTION)
5088N/Aifeq ($(strip $(PARFAIT_BUILD)),yes)
5088N/A $(MAKE) PARFAIT_BUILD=yes parfait
5088N/A $(RM) -r $(SOURCE_DIR) $(BUILD_DIR)
5088N/A# Make it easy to construct a URL for a pypi source download. This
5088N/A# construct supports an optional call to a number from
5088N/A# NUM_EXTRA_ARCHIVES for multiple archive downloads.
5088N/Apypi_url_multi = $(shell echo $(COMPONENT_NAME_$(1)) | cut -c1)/$(COMPONENT_NAME_$(1))/$(COMPONENT_ARCHIVE_$(1))
5088N/Apypi_url_single = $(shell echo $(COMPONENT_NAME) | cut -c1)/$(COMPONENT_NAME)/$(COMPONENT_ARCHIVE)
5088N/Apypi_url = $(PYPI_BASE)/$(if $(COMPONENT_NAME_$(1)),$(pypi_url_multi),$(pypi_url_single))
5088N/Aifneq ($(findstring 2.6, $(PYTHON_VERSIONS)),)
5088N/Aifneq ($(findstring 2.7, $(PYTHON_VERSIONS)),)
5088N/Aifneq ($(findstring 3.4, $(PYTHON_VERSIONS)),)