187ab3622SRichard Lowe# 287ab3622SRichard Lowe# CDDL HEADER START 387ab3622SRichard Lowe# 487ab3622SRichard Lowe# The contents of this file are subject to the terms of the 587ab3622SRichard Lowe# Common Development and Distribution License (the "License"). 687ab3622SRichard Lowe# You may not use this file except in compliance with the License. 787ab3622SRichard Lowe# 887ab3622SRichard Lowe# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 987ab3622SRichard Lowe# or http://www.opensolaris.org/os/licensing. 1087ab3622SRichard Lowe# See the License for the specific language governing permissions 1187ab3622SRichard Lowe# and limitations under the License. 1287ab3622SRichard Lowe# 1387ab3622SRichard Lowe# When distributing Covered Code, include this CDDL HEADER in each 1487ab3622SRichard Lowe# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1587ab3622SRichard Lowe# If applicable, add the following below this CDDL HEADER, with the 1687ab3622SRichard Lowe# fields enclosed by brackets "[]" replaced with your own identifying 1787ab3622SRichard Lowe# information: Portions Copyright [yyyy] [name of copyright owner] 1887ab3622SRichard Lowe# 1987ab3622SRichard Lowe# CDDL HEADER END 2087ab3622SRichard Lowe# 2187ab3622SRichard Lowe 2287ab3622SRichard Lowe# 2387ab3622SRichard Lowe# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 2487ab3622SRichard Lowe# 2587ab3622SRichard Lowe 2687ab3622SRichard Lowe# 2787ab3622SRichard Lowe# This Makefile provides a framework for building the onbld python 2887ab3622SRichard Lowe# modules with multiple versions of python. 2987ab3622SRichard Lowe# 3087ab3622SRichard Lowe# It expects as input: 3187ab3622SRichard Lowe# 3287ab3622SRichard Lowe# PYSRCS - List of python source files, these are also delivered as 3387ab3622SRichard Lowe# build product. 3487ab3622SRichard Lowe# 3587ab3622SRichard Lowe# PYOBJS - List of compiled python (.pyc) files, with no directory prefix 3687ab3622SRichard Lowe# 3787ab3622SRichard Lowe# PYTOPDIR - Absolute (including $(ROOT)) path to which files will 3887ab3622SRichard Lowe# be installed, up until the version specific component. 3987ab3622SRichard Lowe# 4087ab3622SRichard Lowe# PYMODDIR - Relative path to which files will be installed, below 4187ab3622SRichard Lowe# the version specific component. 4287ab3622SRichard Lowe# 4387ab3622SRichard Lowe# For example, to install to /opt/onbld/lib/onbld/python*/bar/ 4487ab3622SRichard Lowe# 4587ab3622SRichard Lowe# PYTOPDIR = $(ROOTONBLDLIB) 4687ab3622SRichard Lowe# PYMODDIR = bar 4787ab3622SRichard Lowe# 4887ab3622SRichard Lowe# 4987ab3622SRichard Lowe# It provides as output: 5087ab3622SRichard Lowe# 5187ab3622SRichard Lowe# ROOTPYFILES - The list of $(ROOT)-relative paths to which python 5287ab3622SRichard Lowe# source and binary files will be installed. Your 5387ab3622SRichard Lowe# Makefile's 'install' target should depend upon 5487ab3622SRichard Lowe# this. 5587ab3622SRichard Lowe# 5687ab3622SRichard Lowe# PYVERSOBJS - The list of paths to compiled python build products, 5787ab3622SRichard Lowe# including their subdirectory. 5887ab3622SRichard Lowe# 5987ab3622SRichard Lowe# pyclobber - A target on which 'clobber' should depend, which 6087ab3622SRichard Lowe# removes the per-version python directories and the 6187ab3622SRichard Lowe# output within them. 6287ab3622SRichard Lowe# 6387ab3622SRichard Lowe 6487ab3622SRichard LowePYFILES = $(PYSRCS) $(PYOBJS) 6587ab3622SRichard Lowe 6687ab3622SRichard LoweROOTPYDIR_26 = $(PYTOPDIR)/python2.6/$(PYMODDIR) 6787ab3622SRichard LoweROOTPYFILES_26 = $(PYFILES:%=$(ROOTPYDIR_26)/%) 6887ab3622SRichard Lowe 69*6066d16eSPiotr JasiukajtisROOTPYFILES = $(ROOTPYFILES_26) 7087ab3622SRichard Lowe$(ROOTPYFILES) := FILEMODE = 0444 7187ab3622SRichard Lowe 72*6066d16eSPiotr JasiukajtisPYVERSDIRS = python2.6 7387ab3622SRichard Lowe 7487ab3622SRichard LowePY26OBJS = $(PYOBJS:%=python2.6/%) 7587ab3622SRichard Lowe$(PY26OBJS) := PYTHON = $(PYTHON_26) 7687ab3622SRichard Lowe 77*6066d16eSPiotr JasiukajtisPYVERSOBJS = $(PY26OBJS) 7887ab3622SRichard Lowe 7987ab3622SRichard LoweCLOBBERFILES += $(PYVERSOBJS) 8087ab3622SRichard LoweCLOBBERDIRS += $(PYVERSDIRS) 8187ab3622SRichard Lowe 8287ab3622SRichard Lowe.KEEP_STATE: 8387ab3622SRichard Lowe 84*6066d16eSPiotr Jasiukajtispython2.6/%.pyc: %.py 8587ab3622SRichard Lowe @[ -d $(@D) ] || mkdir $(@D) 8687ab3622SRichard Lowe $(RM) $@ 8787ab3622SRichard Lowe $(PYTHON) -mpy_compile $< 8887ab3622SRichard Lowe $(MV) $(*).pyc $@ 8987ab3622SRichard Lowe 9087ab3622SRichard Lowe$(ROOTPYDIR_26)/%.pyc: python2.6/%.pyc 9187ab3622SRichard Lowe $(INS.pyfile) 9287ab3622SRichard Lowe 93*6066d16eSPiotr Jasiukajtis$(ROOTPYDIR_26)/%.py: %.py 9487ab3622SRichard Lowe $(INS.pyfile) 9587ab3622SRichard Lowe 9687ab3622SRichard Lowepyclobber: 9787ab3622SRichard Lowe $(RM) $(CLOBBERFILES) 9887ab3622SRichard Lowe $(RM) -rf $(CLOBBERDIRS) 99