author | Lokanath Das <Lokanath.Das@Sun.COM> |
Thu, 31 May 2012 08:41:19 -0700 | |
changeset 843 | 190d2b5889a8 |
parent 789 | 5f074ca23733 |
child 844 | 55358dcf0cb2 |
permissions | -rw-r--r-- |
789
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
1 |
# |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
2 |
# CDDL HEADER START |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
3 |
# |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
4 |
# The contents of this file are subject to the terms of the |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
5 |
# Common Development and Distribution License (the "License"). |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
6 |
# You may not use this file except in compliance with the License. |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
7 |
# |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
8 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
9 |
# or http://www.opensolaris.org/os/licensing. |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
10 |
# See the License for the specific language governing permissions |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
11 |
# and limitations under the License. |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
12 |
# |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
13 |
# When distributing Covered Code, include this CDDL HEADER in each |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
14 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
15 |
# If applicable, add the following below this CDDL HEADER, with the |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
16 |
# fields enclosed by brackets "[]" replaced with your own identifying |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
17 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
18 |
# |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
19 |
# CDDL HEADER END |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
20 |
# |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
21 |
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
22 |
# |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
23 |
# |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
24 |
# Rules and Macros for building opens source software that uses AT&T's package |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
25 |
# tool. |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
26 |
# |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
27 |
# To use these rules, include ../make-rules/attpackagemake.mk in your Makefile |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
28 |
# and define "build", "install" targets appropriate to building your component. |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
29 |
# Ex: |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
30 |
# |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
31 |
# build: $(BUILD_32) \ |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
32 |
# $(BUILD_64) |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
33 |
# |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
34 |
# install: $(INSTALL_32) \ |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
35 |
# $(INSTALL_64) |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
36 |
# |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
37 |
# Any additional pre/post configure, build, or install actions can be specified |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
38 |
# in your Makefile by setting them in on of the following macros: |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
39 |
# COMPONENT_PRE_BUILD_ACTION, COMPONENT_POST_BUILD_ACTION |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
40 |
# COMPONENT_PRE_INSTALL_ACTION, COMPONENT_POST_INSTALL_ACTION |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
41 |
# |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
42 |
# If component specific make targets need to be used for build or install, they |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
43 |
# can be specified in |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
44 |
# COMPONENT_BUILD_TARGETS, COMPONENT_INSTALL_TARGETS |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
45 |
# |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
46 |
|
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
47 |
# Environment variables and arguments passed into the build and install |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
48 |
# environment(s). These are the initial settings. |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
49 |
COMPONENT_BUILD_ENV += \ |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
50 |
CC="$(CC)" \ |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
51 |
CCFLAGS="$(CFLAGS)" \ |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
52 |
CCFLAGS.FORCE="$(CXXFLAGS)" \ |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
53 |
CC.RUNPATH="$(CC.RUNPATH)" \ |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
54 |
CC.LD.RUNPATH="$(CC.LD.RUNPATH)" \ |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
55 |
CC.LD.ORIGIN="$(CC.LD.ORIGIN)" \ |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
56 |
CC.DLL.ORIGIN="$(CC.DLL.ORIGIN)" \ |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
57 |
CCLDFLAGS="$(CXXFLAGS)" \ |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
58 |
LDOPTIONS="$(CXXFLAGS)" \ |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
59 |
NPROCS="$(NPROCS)" \ |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
60 |
LDFLAGS="$(CXXFLAGS)" |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
61 |
|
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
62 |
# This is a workaround for the AT&T nmake failing to always use |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
63 |
# the environmental CCFLAGS in sub-compiles |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
64 |
COMPONENT_BUILD_ARGS= $(COMPONENT_BUILD_ENV) |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
65 |
|
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
66 |
# build the configured source |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
67 |
$(BUILD_DIR)/%/.built: $(SOURCE_DIR)/.prep |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
68 |
$(RM) -r $(@D) ; $(MKDIR) $(@D) |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
69 |
$(CLONEY) $(SOURCE_DIR) $(@D) |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
70 |
$(COMPONENT_PRE_BUILD_ACTION) |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
71 |
cd $(@D); $(ENV) $(COMPONENT_BUILD_ENV) \ |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
72 |
bin/package make $(COMPONENT_BUILD_TARGETS) $(COMPONENT_BUILD_ARGS) |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
73 |
$(COMPONENT_POST_BUILD_ACTION) |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
74 |
$(TOUCH) $@ |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
75 |
|
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
76 |
# install the built source into a prototype area |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
77 |
$(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
78 |
$(COMPONENT_PRE_INSTALL_ACTION) |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
79 |
$(RM) -r $(PROTO_DIR)/$(MACH$(BITS)); $(MKDIR) $(PROTO_DIR)/$(MACH$(BITS)); |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
80 |
cd $(@D) ; $(ENV) $(COMPONENT_INSTALL_ENV) \ |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
81 |
bin/package flat $(COMPONENT_INSTALL_TARGETS) \ |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
82 |
$(PROTO_DIR)/$(MACH$(BITS)) $(COMPONENT_INSTALL_PACKAGES) |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
83 |
$(COMPONENT_POST_INSTALL_ACTION) |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
84 |
$(TOUCH) $@ |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
85 |
|
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
86 |
# test the built source |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
87 |
$(BUILD_DIR)/%/.tested: $(BUILD_DIR)/%/.built |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
88 |
$(COMPONENT_PRE_TEST_ACTION) |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
89 |
cd $(@D) ; $(ENV) $(COMPONENT_TEST_ENV) bin/package \ |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
90 |
test $(COMPONENT_TEST_TARGETS) |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
91 |
$(COMPONENT_POST_TEST_ACTION) |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
92 |
$(TOUCH) $@ |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
93 |
|
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
94 |
clean:: |
5f074ca23733
7106955 move ksh93 from ON to userland
Edwin Beasant <Edwin.Beasant@oracle.com>
parents:
diff
changeset
|
95 |
$(RM) -r $(BUILD_DIR) $(PROTO_DIR) |