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]
21 # Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
25 # Common rules for components
28 # configure the unpacked source for building
29 $(BUILD_DIR
)/%/.configured
: $(SOURCE_DIR
)/.prep
30 $(RM
) -r
$(@D
) ; $(MKDIR
) $(@D
)
31 $(if
$(filter none
,$(CLONEY_MODE
)),,$(ENV
) \
32 $(CLONEY_ARGS
) $(CLONEY_MODE
:%=CLONEY_MODE
="%") \
33 $(CLONEY
) $(SOURCE_DIR
) $(@D
))
34 $(COMPONENT_PRE_CONFIGURE_ACTION
)
35 (cd
$(@D
)$(COMPONENT_SUBDIR
:%=/%) ; $(ENV
) $(CONFIGURE_ENV
) \
37 $(CONFIGURE_SCRIPT
) $(CONFIGURE_OPTIONS
))
38 $(COMPONENT_POST_CONFIGURE_ACTION
)
41 # build the configured source
42 $(BUILD_DIR
)/%/.built
: $(BUILD_DIR
)/%/.configured
43 $(COMPONENT_PRE_BUILD_ACTION
)
44 (cd
$(@D
)$(COMPONENT_SUBDIR
:%=/%) ; $(ENV
) $(COMPONENT_BUILD_ENV
) \
45 $(COMPONENT_BUILD_CMD
) $(COMPONENT_BUILD_ARGS
) \
46 $(COMPONENT_BUILD_TARGETS
))
47 $(COMPONENT_POST_BUILD_ACTION
)
50 # install the built source into a prototype area
51 $(BUILD_DIR
)/%/.installed
: $(BUILD_DIR
)/%/.built
52 $(COMPONENT_PRE_INSTALL_ACTION
)
53 (cd
$(@D
)$(COMPONENT_SUBDIR
:%=/%) ; $(ENV
) $(COMPONENT_INSTALL_ENV
) \
54 $(COMPONENT_INSTALL_CMD
) $(COMPONENT_INSTALL_ARGS
) \
55 $(COMPONENT_INSTALL_TARGETS
))
56 $(COMPONENT_POST_INSTALL_ACTION
)
59 # test the built source
60 COMPONENT_TEST_DEP
+= $(BUILD_DIR
)/%/.built
62 $(BUILD_DIR
)/%/.tested-and-compared
: $(COMPONENT_TEST_DEP
)
63 $(RM
) -rf
$(COMPONENT_TEST_BUILD_DIR
)
64 $(MKDIR
) $(COMPONENT_TEST_BUILD_DIR
)
65 $(COMPONENT_PRE_TEST_ACTION
)
66 -(cd
$(COMPONENT_TEST_DIR
) ; \
67 $(COMPONENT_TEST_ENV_CMD
) $(COMPONENT_TEST_ENV
) \
68 $(COMPONENT_TEST_CMD
) \
69 $(COMPONENT_TEST_ARGS
) $(COMPONENT_TEST_TARGETS
)) \
70 &> $(COMPONENT_TEST_OUTPUT
)
71 $(COMPONENT_POST_TEST_ACTION
)
72 $(COMPONENT_TEST_CREATE_TRANSFORMS
)
73 $(COMPONENT_TEST_PERFORM_TRANSFORM
)
74 $(COMPONENT_TEST_COMPARE
)
75 $(COMPONENT_TEST_CLEANUP
)
78 $(BUILD_DIR
)/%/.tested
: SHELLOPTS
=pipefail
79 $(BUILD_DIR
)/%/.tested
: $(COMPONENT_TEST_DEP
)
80 $(RM
) -rf
$(COMPONENT_TEST_BUILD_DIR
)
81 $(MKDIR
) $(COMPONENT_TEST_BUILD_DIR
)
82 $(COMPONENT_PRE_TEST_ACTION
)
83 (cd
$(COMPONENT_TEST_DIR
) ; \
84 $(COMPONENT_TEST_ENV_CMD
) $(COMPONENT_TEST_ENV
) \
85 $(COMPONENT_TEST_CMD
) \
86 $(COMPONENT_TEST_ARGS
) $(COMPONENT_TEST_TARGETS
)) \
87 |
& $(TEE
) $(COMPONENT_TEST_OUTPUT
)
88 $(COMPONENT_POST_TEST_ACTION
)
89 $(COMPONENT_TEST_CREATE_TRANSFORMS
)
90 $(COMPONENT_TEST_PERFORM_TRANSFORM
)
91 $(COMPONENT_TEST_CLEANUP
)