commit | author | age
|
ff6ec3
|
1 |
# |
EB |
2 |
# CDDL HEADER START |
|
3 |
# |
|
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. |
|
7 |
# |
|
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. |
|
12 |
# |
|
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] |
|
18 |
# |
|
19 |
# CDDL HEADER END |
|
20 |
# |
702558
|
21 |
# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. |
ff6ec3
|
22 |
# |
EB |
23 |
# |
|
24 |
# Rules and Macros for building opens source software that uses AT&T's package |
|
25 |
# tool. |
|
26 |
# |
|
27 |
# To use these rules, include ../make-rules/attpackagemake.mk in your Makefile |
|
28 |
# and define "build", "install" targets appropriate to building your component. |
|
29 |
# Ex: |
|
30 |
# |
|
31 |
# build: $(BUILD_32) \ |
|
32 |
# $(BUILD_64) |
|
33 |
# |
|
34 |
# install: $(INSTALL_32) \ |
|
35 |
# $(INSTALL_64) |
|
36 |
# |
|
37 |
# Any additional pre/post configure, build, or install actions can be specified |
|
38 |
# in your Makefile by setting them in on of the following macros: |
|
39 |
# COMPONENT_PRE_BUILD_ACTION, COMPONENT_POST_BUILD_ACTION |
|
40 |
# COMPONENT_PRE_INSTALL_ACTION, COMPONENT_POST_INSTALL_ACTION |
|
41 |
# |
|
42 |
# If component specific make targets need to be used for build or install, they |
|
43 |
# can be specified in |
|
44 |
# COMPONENT_BUILD_TARGETS, COMPONENT_INSTALL_TARGETS |
|
45 |
# |
|
46 |
|
|
47 |
# Environment variables and arguments passed into the build and install |
|
48 |
# environment(s). These are the initial settings. |
|
49 |
COMPONENT_BUILD_ENV += \ |
e4867a
|
50 |
CC_EXPLICIT="$(CC)" \ |
EB |
51 |
PATH=$(shell dirname $(CC)):$(PATH) \ |
|
52 |
CC=$(shell basename $(CC)) |
|
53 |
NPROC="$(NPROC)" |
ff6ec3
|
54 |
|
e4867a
|
55 |
# This explicitly exports the build type for 32/64 bit distinction |
EB |
56 |
COMPONENT_BUILD_ARGS = \ |
|
57 |
HOSTTYPE="$(HOSTTYPE$(BITS))" \ |
|
58 |
CCFLAGS="$(CFLAGS)" \ |
|
59 |
LDFLAGS="$(CXXFLAGS)" |
|
60 |
|
|
61 |
# The install and test process needs the same environment as the build |
|
62 |
COMPONENT_INSTALL_ENV = $(COMPONENT_BUILD_ENV) |
|
63 |
COMPONENT_TEST_ENV = $(COMPONENT_BUILD_ENV) |
|
64 |
COMPONENT_INSTALL_ARGS = HOSTTYPE="$(HOSTTYPE$(BITS))" |
|
65 |
COMPONENT_TEST_ARGS = HOSTTYPE="$(HOSTTYPE$(BITS))" |
ff6ec3
|
66 |
|
EB |
67 |
# build the configured source |
|
68 |
$(BUILD_DIR)/%/.built: $(SOURCE_DIR)/.prep |
|
69 |
$(RM) -r $(@D) ; $(MKDIR) $(@D) |
c529ec
|
70 |
$(ENV) $(CLONEY_ARGS) $(CLONEY) $(SOURCE_DIR) $(@D) |
ff6ec3
|
71 |
$(COMPONENT_PRE_BUILD_ACTION) |
EB |
72 |
cd $(@D); $(ENV) $(COMPONENT_BUILD_ENV) \ |
|
73 |
bin/package make $(COMPONENT_BUILD_TARGETS) $(COMPONENT_BUILD_ARGS) |
|
74 |
$(COMPONENT_POST_BUILD_ACTION) |
|
75 |
$(TOUCH) $@ |
|
76 |
|
|
77 |
# install the built source into a prototype area |
|
78 |
$(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built |
|
79 |
$(COMPONENT_PRE_INSTALL_ACTION) |
|
80 |
$(RM) -r $(PROTO_DIR)/$(MACH$(BITS)); $(MKDIR) $(PROTO_DIR)/$(MACH$(BITS)); |
e4867a
|
81 |
cd $(@D); $(ENV) $(COMPONENT_INSTALL_ENV) \ |
ff6ec3
|
82 |
bin/package flat $(COMPONENT_INSTALL_TARGETS) \ |
e4867a
|
83 |
$(COMPONENT_INSTALL_ARGS) \ |
ff6ec3
|
84 |
$(PROTO_DIR)/$(MACH$(BITS)) $(COMPONENT_INSTALL_PACKAGES) |
EB |
85 |
$(COMPONENT_POST_INSTALL_ACTION) |
|
86 |
$(TOUCH) $@ |
|
87 |
|
|
88 |
# test the built source |
8d70f8
|
89 |
$(BUILD_DIR)/%/.tested-and-compared: $(BUILD_DIR)/%/.built |
237543
|
90 |
$(RM) -rf $(COMPONENT_TEST_BUILD_DIR) |
AP |
91 |
$(MKDIR) $(COMPONENT_TEST_BUILD_DIR) |
ff6ec3
|
92 |
$(COMPONENT_PRE_TEST_ACTION) |
8d70f8
|
93 |
-(cd $(COMPONENT_TEST_DIR) ; \ |
RB |
94 |
$(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \ |
|
95 |
bin/package test $(COMPONENT_TEST_TARGETS) \ |
89aae0
|
96 |
$(COMPONENT_TEST_ARGS)) \ |
8d70f8
|
97 |
&> $(COMPONENT_TEST_OUTPUT) |
RB |
98 |
$(COMPONENT_POST_TEST_ACTION) |
|
99 |
$(COMPONENT_TEST_CREATE_TRANSFORMS) |
|
100 |
$(COMPONENT_TEST_PERFORM_TRANSFORM) |
|
101 |
$(COMPONENT_TEST_COMPARE) |
|
102 |
$(COMPONENT_TEST_CLEANUP) |
|
103 |
$(TOUCH) $@ |
|
104 |
|
89aae0
|
105 |
$(BUILD_DIR)/%/.tested: SHELLOPTS=pipefail |
8d70f8
|
106 |
$(BUILD_DIR)/%/.tested: $(BUILD_DIR)/%/.built |
89aae0
|
107 |
$(RM) -rf $(COMPONENT_TEST_BUILD_DIR) |
MT |
108 |
$(MKDIR) $(COMPONENT_TEST_BUILD_DIR) |
8d70f8
|
109 |
$(COMPONENT_PRE_TEST_ACTION) |
RB |
110 |
(cd $(COMPONENT_TEST_DIR) ; \ |
|
111 |
$(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \ |
e4867a
|
112 |
bin/package test $(COMPONENT_TEST_TARGETS) \ |
89aae0
|
113 |
$(COMPONENT_TEST_ARGS)) \ |
MT |
114 |
|& $(TEE) $(COMPONENT_TEST_OUTPUT) |
ff6ec3
|
115 |
$(COMPONENT_POST_TEST_ACTION) |
89aae0
|
116 |
$(COMPONENT_TEST_CREATE_TRANSFORMS) |
MT |
117 |
$(COMPONENT_TEST_PERFORM_TRANSFORM) |
8d70f8
|
118 |
$(COMPONENT_TEST_CLEANUP) |
ff6ec3
|
119 |
$(TOUCH) $@ |
8d70f8
|
120 |
|
ff6ec3
|
121 |
clean:: |
EB |
122 |
$(RM) -r $(BUILD_DIR) $(PROTO_DIR) |