8867 add MAC_CAPAB_TRANSCEIVER support for cxgbe
[unleashed.git] / usr / src / tools / Makefile.python
blob147ef2b05c406ecb9936e547be9cbd7aaf271bd9
2 # CDDL HEADER START
4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
19 # CDDL HEADER END
23 # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
27 # This Makefile provides a framework for building the onbld python
28 # modules with multiple versions of python.
30 # It expects as input:
32 # PYSRCS - List of python source files, these are also delivered as
33 # build product.
35 # PYOBJS - List of compiled python (.pyc) files, with no directory prefix
37 # PYTOPDIR - Absolute (including $(ROOT)) path to which files will
38 # be installed, up until the version specific component.
40 # PYMODDIR - Relative path to which files will be installed, below
41 # the version specific component.
43 # For example, to install to /opt/onbld/lib/onbld/python*/bar/
45 # PYTOPDIR = $(ROOTONBLDLIB)
46 # PYMODDIR = bar
49 # It provides as output:
51 # ROOTPYFILES - The list of $(ROOT)-relative paths to which python
52 # source and binary files will be installed. Your
53 # Makefile's 'install' target should depend upon
54 # this.
56 # PYVERSOBJS - The list of paths to compiled python build products,
57 # including their subdirectory.
59 # pyclobber - A target on which 'clobber' should depend, which
60 # removes the per-version python directories and the
61 # output within them.
64 PYFILES = $(PYSRCS) $(PYOBJS)
66 ROOTPYDIR = $(PYTOPDIR)/python$(PYTHON_VERSION)/$(PYMODDIR)
67 ROOTPYFILES = $(PYFILES:%=$(ROOTPYDIR)/%)
69 $(ROOTPYFILES) := FILEMODE = 0444
71 PYVERSDIRS = python$(PYTHON_VERSION)
73 PYVERSOBJS = $(PYOBJS:%=python$(PYTHON_VERSION)/%)
75 CLOBBERFILES += $(PYVERSOBJS)
76 CLOBBERDIRS += $(PYVERSDIRS)
78 .KEEP_STATE:
80 python$(PYTHON_VERSION)/%.pyc: %.py
81 @[ -d $(@D) ] || mkdir $(@D)
82 $(RM) $@
83 $(PYTHON) -mpy_compile $<
84 $(MV) $(*).pyc $@
86 $(ROOTPYDIR)/%.pyc: python$(PYTHON_VERSION)/%.pyc
87 $(INS.pyfile)
89 $(ROOTPYDIR)/%.py: %.py
90 $(INS.pyfile)
92 pyclobber:
93 $(RM) $(CLOBBERFILES)
94 $(RM) -rf $(CLOBBERDIRS)