Merge pull request #2809 from alarcher/nvidia340.102
[unleashed-userland.git] / make-rules / attpackagemake.mk
blob5d0905f88a51acd1df3e4694450ca701537bd210
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 $(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 ifeq ($(strip $(PARFAIT_BUILD)),yes)
76 -$(PARFAIT) $(@D)
77 endif
78 $(TOUCH) $@
80 # install the built source into a prototype area
81 $(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built
82 $(COMPONENT_PRE_INSTALL_ACTION)
83 $(RM) -r $(PROTO_DIR)/$(MACH$(BITS)); $(MKDIR) $(PROTO_DIR)/$(MACH$(BITS));
84 cd $(@D); $(ENV) $(COMPONENT_INSTALL_ENV) \
85 bin/package flat $(COMPONENT_INSTALL_TARGETS) \
86 $(COMPONENT_INSTALL_ARGS) \
87 $(PROTO_DIR)/$(MACH$(BITS)) $(COMPONENT_INSTALL_PACKAGES)
88 $(COMPONENT_POST_INSTALL_ACTION)
89 $(TOUCH) $@
91 # test the built source
92 $(BUILD_DIR)/%/.tested-and-compared: $(BUILD_DIR)/%/.built
93 $(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
94 $(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
95 $(COMPONENT_PRE_TEST_ACTION)
96 -(cd $(COMPONENT_TEST_DIR) ; \
97 $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
98 bin/package test $(COMPONENT_TEST_TARGETS) \
99 $(COMPONENT_TEST_ARGS) \
100 &> $(COMPONENT_TEST_OUTPUT)
101 $(COMPONENT_POST_TEST_ACTION)
102 $(COMPONENT_TEST_CREATE_TRANSFORMS)
103 $(COMPONENT_TEST_PERFORM_TRANSFORM)
104 $(COMPONENT_TEST_COMPARE)
105 $(COMPONENT_TEST_CLEANUP)
106 $(TOUCH) $@
108 $(BUILD_DIR)/%/.tested: $(BUILD_DIR)/%/.built
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 $(COMPONENT_POST_TEST_ACTION)
115 $(COMPONENT_TEST_CLEANUP)
116 $(TOUCH) $@
118 ifeq ($(strip $(PARFAIT_BUILD)),yes)
119 parfait: build
120 else
121 parfait:
122 $(MAKE) PARFAIT_BUILD=yes parfait
123 endif
125 clean::
126 $(RM) -r $(BUILD_DIR) $(PROTO_DIR)