python/manuel: update to 1.13.0
[oi-userland.git] / make-rules / attpackagemake.mk
blob36d3a463c100bab03494cd6eb11c76d3ce91f54c
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
21 # Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
24 # Rules and Macros for building opens source software that uses AT&T's package
25 # tool.
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:
31 # build: $(BUILD_32) \
32 # $(BUILD_64)
34 # install: $(INSTALL_32) \
35 # $(INSTALL_64)
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
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
47 # Environment variables and arguments passed into the build and install
48 # environment(s). These are the initial settings.
49 COMPONENT_BUILD_ENV += \
50 CC_EXPLICIT="$(CC)" \
51 PATH=$(shell dirname $(CC)):$(PATH) \
52 CC=$(shell basename $(CC))
53 NPROC="$(NPROC)"
55 # This explicitly exports the build type for 32/64 bit distinction
56 COMPONENT_BUILD_ARGS = \
57 HOSTTYPE="$(HOSTTYPE$(BITS))" \
58 CCFLAGS="$(CFLAGS)" \
59 LDFLAGS="$(CXXFLAGS)"
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))"
67 # build the configured source
68 $(BUILD_DIR)/%/.built: $(SOURCE_DIR)/.prep
69 $(RM) -r $(@D) ; $(MKDIR) $(@D)
70 $(ENV) $(CLONEY_ARGS) $(CLONEY) $(SOURCE_DIR) $(@D)
71 $(COMPONENT_PRE_BUILD_ACTION)
72 cd $(@D); $(ENV) $(COMPONENT_BUILD_ENV) \
73 bin/package make $(COMPONENT_BUILD_TARGETS) $(COMPONENT_BUILD_ARGS)
74 $(COMPONENT_POST_BUILD_ACTION)
75 $(TOUCH) $@
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));
81 cd $(@D); $(ENV) $(COMPONENT_INSTALL_ENV) \
82 bin/package flat $(COMPONENT_INSTALL_TARGETS) \
83 $(COMPONENT_INSTALL_ARGS) \
84 $(PROTO_DIR)/$(MACH$(BITS)) $(COMPONENT_INSTALL_PACKAGES)
85 $(COMPONENT_POST_INSTALL_ACTION)
86 $(TOUCH) $@
88 # test the built source
89 $(BUILD_DIR)/%/.tested-and-compared: $(COMPONENT_TEST_DEP)
90 $(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
91 $(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
92 $(COMPONENT_PRE_TEST_ACTION)
93 -(cd $(COMPONENT_TEST_DIR) ; \
94 $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
95 bin/package test $(COMPONENT_TEST_TARGETS) \
96 $(COMPONENT_TEST_ARGS)) \
97 &> $(COMPONENT_TEST_OUTPUT)
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) $@
105 $(BUILD_DIR)/%/.tested: SHELLOPTS=pipefail
106 $(BUILD_DIR)/%/.tested: $(COMPONENT_TEST_DEP)
107 $(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
108 $(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
109 $(COMPONENT_PRE_TEST_ACTION)
110 (cd $(COMPONENT_TEST_DIR) ; \
111 $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
112 bin/package test $(COMPONENT_TEST_TARGETS) \
113 $(COMPONENT_TEST_ARGS)) \
114 |& $(TEE) $(COMPONENT_TEST_OUTPUT)
115 $(COMPONENT_POST_TEST_ACTION)
116 $(COMPONENT_TEST_CREATE_TRANSFORMS)
117 $(COMPONENT_TEST_PERFORM_TRANSFORM)
118 $(COMPONENT_TEST_CLEANUP)
119 $(TOUCH) $@
121 clean::
122 $(RM) -r $(BUILD_DIR) $(PROTO_DIR)