Makefile revision 3693
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# CDDL HEADER START
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# The contents of this file are subject to the terms of the
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# Common Development and Distribution License (the "License").
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# You may not use this file except in compliance with the License.
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# See the License for the specific language governing permissions
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# and limitations under the License.
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# When distributing Covered Code, include this CDDL HEADER in each
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# If applicable, add the following below this CDDL HEADER, with the
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# fields enclosed by brackets "[]" replaced with your own identifying
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# information: Portions Copyright [yyyy] [name of copyright owner]
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# CDDL HEADER END
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki TuomiCOMPONENT_SRC= $(COMPONENT_NAME)-$(COMPONENT_VERSION)
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi sha256:90d27e14ea7e03570026850e2e50ba71ad20b7eb31035aada1cf3def8f8d4916
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki TuomiCOMPONENT_ARCHIVE_URL= $(COMPONENT_PROJECT_URL)ftp/python/$(COMPONENT_VERSION)/$(COMPONENT_ARCHIVE)
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# Need to preserve timestamp for Grammar files. If the pickle files are older,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# Python will try to rebuild them.
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# We patch auto* files, so regenerate headers and configure
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# we don't want to leak $(CC_BITS) into BASECFLAGS as it causes problems with
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# python-config
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# to find the ncurses headers
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# enable large files how they did in JDS
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# libffi for _ctypes
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki TuomiCPPFLAGS += $(shell pkg-config --cflags-only-I libffi)
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# because python links with $(CC) ... $(LDFLAGS) ...
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# The python build is profile-guided for studio; to see the benefits of that,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# Python must be compiled with -xO5 and a different build target must be used.
bf7dc750b95039981c0e9d728f313d50cf38a156Martti Rannanjärvi# Use of xprofile requires that the same options be used during compilation and
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# linking. The targets chosen are based on Solaris 11 minimum supported system
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# requirements.
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki TuomiPYFLAGS.i386 = -xtarget=opteron -xarch=sse2 -xcache=generic
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki TuomiLDFLAGS.64 = -R/usr/gnu/lib/$(MACH64) -L/usr/gnu/lib/$(MACH64)
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# Python puts its header files in a special place.
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# PYTHONPATH in the environment can be harmful, but setting it to empty via
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# _INSTALL_ENV causes problems too, so just ignore the entire environment.
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# Because of this, we need to specify PATH in multiple places below.
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki TuomiCONFIGURE_OPTIONS += --infodir=$(CONFIGURE_INFODIR)
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki TuomiCONFIGURE_OPTIONS += XPROFILE_DIR="$(XPROFILE_DIR)"
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki TuomiCOMPONENT_BUILD_ENV += XPROFILE_DIR="$(XPROFILE_DIR)"
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# 64 bit shared objects need to go in a 64-bit directory
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki TuomiCOMPONENT_INSTALL_ARGS.64 += DESTSHARED=$(CONFIGURE_PREFIX)/lib/python2.7/lib-dynload
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# Simplify the definitions of CC, CXX, CFLAGS and LDFLAGS so they hard-code
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# neither paths from our build systems nor Studio-specific options.
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi -e 's/^CFLAGS=.*/CFLAGS=\t\t\$$\(BASECFLAGS) \$$\(OPT) \$$\(EXTRA_CFLAGS)/' \
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# Because we stripped the Makefile above, we need to pass several things in the
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# environment, and use -e to tell gmake to pay attention to the environment.
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# 1. Setup pyconfig.h file to support 32 & 64 bit.
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# 2. If the /usr/lib/python2.7/lib2to3/*.pickle files are older than the
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# related *.txt files in the same directory, it will rebuild them any time
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# you try to build a Python module. So here we also touch the pickle files
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# to avoid this.
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# 3. Strip build machine paths from _sysconfigdata.py & config/Makefile.
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# Note that although the 64-bit version is not used (and thus commented
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# out in the manifest), we still need to specify the 32-/64-bit paths,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# otherwise the 64-bit build will fail to find the 32-bit path.
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki TuomiCONFIG_MAKEFILE.64= lib/$(MACH64)/python2.7/config/Makefile
532bb6cdc2fc62ae39ed51a694528852c2da9e07Aki Tuomi $(MV) include/python2.7/pyconfig.h include/python2.7/pyconfig-$(BITS).h ; \
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi $(GSED) -i -e 's|$(SOURCE_DIR)|.|g' -e 's|$(COMPONENT_DIR)|..|g' \
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi -e 's|$(SPRO_VROOT)/bin/||g' lib/python2.7/_sysconfigdata.py \
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# common targets
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# Using "-uall,-network" ensures all tests are run except the network tests.
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# The network tests contain many expected failures when run behind a firewall.
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# The "-v" ensures verbose mode. You can set TESTOPTS_PYTHON_TEST to a
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# particular test if you want to run just one test. For example, run gmake with
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# "-k" so it continues and does both 32-bit and 64-bit tests, even if there is a
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# failure, like this:
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# $ TESTOPTS_PYTHON_TEST=test_sys gmake -k test
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# Note that when a test succeeds, the builds/*/.tested file gets created. You
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# may need to remove these files, or run "gmake clobber" or "gmake clean"
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi# between tests.
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki TuomiCOMPONENT_TEST_ENV = EXTRATESTOPTS="-v -uall,-network $(TESTOPTS_PYTHON_TEST)"