Makefile revision 3786
2454dfa32c93c20a8522c6ed42fe057baaac9f9aStephan Bosch#
f9c7106cc05eedb57d1beee3ca3c47f49fafb172Timo Sirainen# CDDL HEADER START
f9c7106cc05eedb57d1beee3ca3c47f49fafb172Timo Sirainen#
f9c7106cc05eedb57d1beee3ca3c47f49fafb172Timo Sirainen# The contents of this file are subject to the terms of the
ef50336eefcb9ba99f73c6af37420eaf8857a39bTimo Sirainen# Common Development and Distribution License (the "License").
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo Sirainen# You may not use this file except in compliance with the License.
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo Sirainen#
e7ca5f820d6a1a8fe549a2966ac707a60e055ef4Timo Sirainen# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
f9c7106cc05eedb57d1beee3ca3c47f49fafb172Timo Sirainen# or http://www.opensolaris.org/os/licensing.
f9c7106cc05eedb57d1beee3ca3c47f49fafb172Timo Sirainen# See the License for the specific language governing permissions
81e6e1ef0feef60644a4c4b745d82a4c98223affTimo Sirainen# and limitations under the License.
81e6e1ef0feef60644a4c4b745d82a4c98223affTimo Sirainen#
f9c7106cc05eedb57d1beee3ca3c47f49fafb172Timo Sirainen# When distributing Covered Code, include this CDDL HEADER in each
f9c7106cc05eedb57d1beee3ca3c47f49fafb172Timo Sirainen# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo Sirainen# If applicable, add the following below this CDDL HEADER, with the
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo Sirainen# fields enclosed by brackets "[]" replaced with your own identifying
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo Sirainen# information: Portions Copyright [yyyy] [name of copyright owner]
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo Sirainen#
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo Sirainen# CDDL HEADER END
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo Sirainen#
a81e49899669137f9d7d1ba4c3130c9389cee530Timo Sirainen
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo Sirainen#
ef893433824a4e9a8e423cfc493b8423ae32ef0fTimo Sirainen# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
ef893433824a4e9a8e423cfc493b8423ae32ef0fTimo Sirainen#
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen
0dffa25d211be541ee3c953b23566a1a990789dfTimo Siraineninclude ../../../make-rules/shared-macros.mk
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo Sirainen
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo SirainenCOMPONENT_NAME= Python
2615df45a8027948a474abe5e817b34b0499c171Timo SirainenCOMPONENT_VERSION= 3.4.2
2615df45a8027948a474abe5e817b34b0499c171Timo SirainenCOMPONENT_PROJECT_URL= http://python.org/
2615df45a8027948a474abe5e817b34b0499c171Timo SirainenCOMPONENT_SRC= $(COMPONENT_NAME)-$(COMPONENT_VERSION)
2615df45a8027948a474abe5e817b34b0499c171Timo SirainenCOMPONENT_ARCHIVE= $(COMPONENT_SRC).tar.xz
2615df45a8027948a474abe5e817b34b0499c171Timo SirainenCOMPONENT_ARCHIVE_HASH= \
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen sha256:1c6d9682d145c056537e477bbfa060ce727f9edd38df1827e0f970dcf04b2def
2615df45a8027948a474abe5e817b34b0499c171Timo SirainenCOMPONENT_ARCHIVE_URL= $(COMPONENT_PROJECT_URL)ftp/python/$(COMPONENT_VERSION)/$(COMPONENT_ARCHIVE)
2615df45a8027948a474abe5e817b34b0499c171Timo SirainenCOMPONENT_BUGDB= utility/python
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen
2615df45a8027948a474abe5e817b34b0499c171Timo SirainenTPNO= 19421
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen
2615df45a8027948a474abe5e817b34b0499c171Timo Siraineninclude $(WS_TOP)/make-rules/prep.mk
2615df45a8027948a474abe5e817b34b0499c171Timo Siraineninclude $(WS_TOP)/make-rules/configure.mk
2615df45a8027948a474abe5e817b34b0499c171Timo Siraineninclude $(WS_TOP)/make-rules/ips.mk
2615df45a8027948a474abe5e817b34b0499c171Timo Siraineninclude $(WS_TOP)/make-rules/lint-libraries.mk
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen
f9c7106cc05eedb57d1beee3ca3c47f49fafb172Timo Sirainen# Need to preserve timestamp for Grammar files. If the pickle files are older,
e7ca5f820d6a1a8fe549a2966ac707a60e055ef4Timo Sirainen# Python will try to rebuild them.
e7ca5f820d6a1a8fe549a2966ac707a60e055ef4Timo SirainenPKGSEND_PUBLISH_OPTIONS += -T \*Grammar\*.txt
e7ca5f820d6a1a8fe549a2966ac707a60e055ef4Timo SirainenPKGSEND_PUBLISH_OPTIONS += -T \*Grammar\*.pickle
e7ca5f820d6a1a8fe549a2966ac707a60e055ef4Timo Sirainen
e7ca5f820d6a1a8fe549a2966ac707a60e055ef4Timo Sirainen# We patch auto* files, so regenerate headers and configure
e7ca5f820d6a1a8fe549a2966ac707a60e055ef4Timo SirainenCOMPONENT_PREP_ACTION = \
e7ca5f820d6a1a8fe549a2966ac707a60e055ef4Timo Sirainen (cd $(@D) ; autoheader ; autoconf)
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen# The DTrace patch needs this file to be mode 0755.
2615df45a8027948a474abe5e817b34b0499c171Timo SirainenCOMPONENT_PRE_BUILD_ACTION=($(CHMOD) +x \
e7ca5f820d6a1a8fe549a2966ac707a60e055ef4Timo Sirainen $(SOURCE_DIR)/Include/pydtrace_offsets.sh)
da9f6acdcb303d0fe5160b669668aedf39c8f45aTimo Sirainen
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen# we don't want to leak $(CC_BITS) into BASECFLAGS as it causes problems with
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen# python-config
2615df45a8027948a474abe5e817b34b0499c171Timo SirainenCC += $(CFLAGS)
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen
2615df45a8027948a474abe5e817b34b0499c171Timo SirainenC99MODE=
2615df45a8027948a474abe5e817b34b0499c171Timo SirainenCPPFLAGS += -IPython
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen# to find the ncurses headers
2615df45a8027948a474abe5e817b34b0499c171Timo SirainenCPPFLAGS += -I/usr/include/ncurses
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen# enable large files how they did in JDS
2615df45a8027948a474abe5e817b34b0499c171Timo SirainenCPPFLAGS += -D_LARGEFILE64_SOURCE
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen# libffi for _ctypes
2615df45a8027948a474abe5e817b34b0499c171Timo SirainenCPPFLAGS += $(shell pkg-config --cflags-only-I libffi)
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen# because python links with $(CC) ... $(LDFLAGS) ...
2615df45a8027948a474abe5e817b34b0499c171Timo SirainenLDFLAGS = $(CC_BITS) $(CC_PIC)
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen
da9f6acdcb303d0fe5160b669668aedf39c8f45aTimo Sirainen# build pic
da9f6acdcb303d0fe5160b669668aedf39c8f45aTimo SirainenCFLAGS += $(CC_PIC)
da9f6acdcb303d0fe5160b669668aedf39c8f45aTimo Sirainen
da9f6acdcb303d0fe5160b669668aedf39c8f45aTimo Sirainen# The python build is profile-guided for studio; to see the benefits of that,
e7ca5f820d6a1a8fe549a2966ac707a60e055ef4Timo Sirainen# Python must be compiled with -xO5 and a different build target must be used.
f9c7106cc05eedb57d1beee3ca3c47f49fafb172Timo Sirainen# Use of xprofile requires that the same options be used during compilation and
5707c94de29af4645a93e0d36ffa57af5537172cTimo Sirainen# linking. The targets chosen are based on Solaris 11 minimum supported system
2e295aaaf04febd3bb7be66cddd4d8ffa96fa5dcAki Tuomi# requirements.
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo SirainenCOMPONENT_BUILD_TARGETS = profile-opt
2e295aaaf04febd3bb7be66cddd4d8ffa96fa5dcAki TuomiXPROFILE_DIR = $(BUILD_DIR_$(BITS))/.profile
2e295aaaf04febd3bb7be66cddd4d8ffa96fa5dcAki TuomiPYFLAGS.i386 = -xtarget=opteron -xarch=sse2 -xcache=generic
2e295aaaf04febd3bb7be66cddd4d8ffa96fa5dcAki TuomiPYFLAGS.sparc =
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo SirainenCFLAGS += -xO5 $(PYFLAGS.$(MACH))
a81e49899669137f9d7d1ba4c3130c9389cee530Timo SirainenLDFLAGS += -xO5 $(PYFLAGS.$(MACH))
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo Sirainen
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo Sirainen# add /usr/gnu/lib to the library search/run path
2e295aaaf04febd3bb7be66cddd4d8ffa96fa5dcAki TuomiLDFLAGS.64 = -R/usr/gnu/lib/$(MACH64) -L/usr/gnu/lib/$(MACH64)
5707c94de29af4645a93e0d36ffa57af5537172cTimo SirainenLDFLAGS += $(LDFLAGS.$(BITS))
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo Sirainen
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo Sirainen# Python puts its header files in a special place.
2e295aaaf04febd3bb7be66cddd4d8ffa96fa5dcAki TuomiLINT_FLAGS += -I$(SOURCE_DIR)/Include
5707c94de29af4645a93e0d36ffa57af5537172cTimo Sirainen
5707c94de29af4645a93e0d36ffa57af5537172cTimo SirainenCONFIGURE_OPTIONS += --infodir=$(CONFIGURE_INFODIR)
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo SirainenCONFIGURE_OPTIONS += --enable-shared
3e0bae44b65f5c46989fcef3d1e07203f496327eTimo SirainenCONFIGURE_OPTIONS += --with-dtrace
36aa287d32a78048d66cff024a8f7e848c45a8bfTimo SirainenCONFIGURE_OPTIONS += --with-system-expat
36aa287d32a78048d66cff024a8f7e848c45a8bfTimo SirainenCONFIGURE_OPTIONS += --with-system-ffi
36aa287d32a78048d66cff024a8f7e848c45a8bfTimo SirainenCONFIGURE_OPTIONS += --without-gcc
36aa287d32a78048d66cff024a8f7e848c45a8bfTimo SirainenCONFIGURE_OPTIONS += --without-ensurepip
36aa287d32a78048d66cff024a8f7e848c45a8bfTimo SirainenCONFIGURE_OPTIONS += --enable-ipv6
a81e49899669137f9d7d1ba4c3130c9389cee530Timo SirainenCONFIGURE_OPTIONS += --bindir=/usr/bin
a81e49899669137f9d7d1ba4c3130c9389cee530Timo SirainenCONFIGURE_OPTIONS += CPPFLAGS="$(CPPFLAGS)"
a81e49899669137f9d7d1ba4c3130c9389cee530Timo SirainenCONFIGURE_OPTIONS += LDFLAGS="$(LDFLAGS)"
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo SirainenCONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)"
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo SirainenCONFIGURE_OPTIONS += DFLAGS="-$(BITS)"
5707c94de29af4645a93e0d36ffa57af5537172cTimo SirainenCONFIGURE_OPTIONS += XPROFILE_DIR="$(XPROFILE_DIR)"
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo Sirainen
a81e49899669137f9d7d1ba4c3130c9389cee530Timo SirainenCOMPONENT_BUILD_ENV += DFLAGS="-$(BITS)"
efe78d3ba24fc866af1c79b9223dc0809ba26cadStephan BoschCOMPONENT_BUILD_ENV += XPROFILE_DIR="$(XPROFILE_DIR)"
2e295aaaf04febd3bb7be66cddd4d8ffa96fa5dcAki Tuomi
44fda09101a94883f45b8a6214628e541550cebcTimo Sirainen# Some tests have non-ASCII characters encoded for international domain names;
44fda09101a94883f45b8a6214628e541550cebcTimo Sirainen# the publish step will fail in 'pkgdepend generate' without this:
eb64c3586d854cddd693f0b811d897399076a441Timo SirainenCOMPONENT_PUBLISH_ENV += LC_ALL=en_US.UTF-8
44fda09101a94883f45b8a6214628e541550cebcTimo Sirainen
5707c94de29af4645a93e0d36ffa57af5537172cTimo Sirainen# 64 bit shared objects need to go in a 64-bit directory
ef893433824a4e9a8e423cfc493b8423ae32ef0fTimo SirainenCOMPONENT_INSTALL_ARGS.64 += DESTSHARED=$(CONFIGURE_PREFIX)/lib/python3.4/lib-dynload
a81e49899669137f9d7d1ba4c3130c9389cee530Timo Sirainen
a81e49899669137f9d7d1ba4c3130c9389cee530Timo SirainenASLR_MODE = $(ASLR_ENABLE)
c7f6992db44e9cd33b3b0d754833a1503ee9a53fAki Tuomi
c7f6992db44e9cd33b3b0d754833a1503ee9a53fAki Tuomi# common targets
c0a87e5f3316a57e6f915882fa1951d0fbb74a61Timo Sirainenbuild: $(BUILD_64)
c0a87e5f3316a57e6f915882fa1951d0fbb74a61Timo Siraineninstall: $(INSTALL_64)
c0a87e5f3316a57e6f915882fa1951d0fbb74a61Timo Sirainen
c0a87e5f3316a57e6f915882fa1951d0fbb74a61Timo Sirainen# Using "-uall,-network" ensures all tests are run except the network tests.
c0a87e5f3316a57e6f915882fa1951d0fbb74a61Timo Sirainen# The network tests contain many expected failures when run behind a firewall.
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo Sirainen# The "-v" ensures verbose mode. You can set TESTOPTS_PYTHON_TEST to a
a81e49899669137f9d7d1ba4c3130c9389cee530Timo Sirainen# particular test if you want to run just one test. For example,
bbc7e2c2e726cf84da49f4062d05b0c35a9377bdAki Tuomi# $ TESTOPTS_PYTHON_TEST=test_sys gmake -k test
a81e49899669137f9d7d1ba4c3130c9389cee530Timo Sirainen# Note that when a test succeeds, the builds/*/.tested file gets created. You
a81e49899669137f9d7d1ba4c3130c9389cee530Timo Sirainen# may need to remove these files, or run "gmake clobber" or "gmake clean"
a81e49899669137f9d7d1ba4c3130c9389cee530Timo Sirainen# between tests.
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo Sirainen#
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo SirainenCOMPONENT_TEST_ENV = EXTRATESTOPTS="-v -uall,-network $(TESTOPTS_PYTHON_TEST)"
cb5a43d2dd99db0037b3450701ed83df78bc90f5Timo Sirainen# Prevent the tests from getting stuck waiting for input.
cb5a43d2dd99db0037b3450701ed83df78bc90f5Timo SirainenCOMPONENT_TEST_TARGETS = test < /dev/null
cb5a43d2dd99db0037b3450701ed83df78bc90f5Timo Sirainen
cb5a43d2dd99db0037b3450701ed83df78bc90f5Timo Sirainentest: $(TEST_64)
cb5a43d2dd99db0037b3450701ed83df78bc90f5Timo Sirainen
cb5a43d2dd99db0037b3450701ed83df78bc90f5Timo SirainenBUILD_PKG_DEPENDENCIES = $(BUILD_TOOLS)
cb5a43d2dd99db0037b3450701ed83df78bc90f5Timo Sirainen
cb5a43d2dd99db0037b3450701ed83df78bc90f5Timo Siraineninclude $(WS_TOP)/make-rules/depend.mk
cb5a43d2dd99db0037b3450701ed83df78bc90f5Timo Sirainen