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