unixodbc: Fix dependency to library/readline-8 library/readline-8/32
[oi-userland.git] / make-rules / common-rules.mk
blob741bf1708c27993869b47fc7f67f88dbc07915b9
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) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
25 # Common rules used for building, installing, and testing of components.
28 # build the configured source
29 $(BUILD_DIR)/%/.built: $(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_BUILD_ACTION)
35 (cd $(@D)$(COMPONENT_SUBDIR:%=/%) ; $(ENV) $(COMPONENT_BUILD_ENV) \
36 $(COMPONENT_BUILD_CMD) $(COMPONENT_BUILD_ARGS))
37 $(COMPONENT_POST_BUILD_ACTION)
38 $(TOUCH) $@
40 # install the built source into a prototype area
41 $(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built
42 $(COMPONENT_PRE_INSTALL_ACTION)
43 (cd $(@D)$(COMPONENT_SUBDIR:%=/%) ; $(ENV) $(COMPONENT_INSTALL_ENV) \
44 $(COMPONENT_INSTALL_CMD) $(COMPONENT_INSTALL_ARGS))
45 $(COMPONENT_POST_INSTALL_ACTION)
46 $(TOUCH) $@
48 # test the built source
49 COMPONENT_TEST_DEP += $(BUILD_DIR)/%/.built
51 $(BUILD_DIR)/%/.tested-and-compared: $(COMPONENT_TEST_DEP)
52 $(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
53 $(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
54 $(COMPONENT_PRE_TEST_ACTION)
55 -(cd $(COMPONENT_TEST_DIR) ; \
56 $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
57 $(COMPONENT_TEST_CMD) \
58 $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) \
59 &> $(COMPONENT_TEST_OUTPUT)
60 $(COMPONENT_POST_TEST_ACTION)
61 $(COMPONENT_TEST_CREATE_TRANSFORMS)
62 $(COMPONENT_TEST_PERFORM_TRANSFORM)
63 $(COMPONENT_TEST_COMPARE)
64 $(COMPONENT_TEST_CLEANUP)
65 $(TOUCH) $@
67 $(BUILD_DIR)/%/.tested: SHELLOPTS=pipefail
68 $(BUILD_DIR)/%/.tested: $(COMPONENT_TEST_DEP)
69 $(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
70 $(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
71 $(COMPONENT_PRE_TEST_ACTION)
72 (cd $(COMPONENT_TEST_DIR) ; \
73 $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
74 $(COMPONENT_TEST_CMD) \
75 $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) \
76 |& $(TEE) $(COMPONENT_TEST_OUTPUT)
77 $(COMPONENT_POST_TEST_ACTION)
78 $(COMPONENT_TEST_CREATE_TRANSFORMS)
79 $(COMPONENT_TEST_PERFORM_TRANSFORM)
80 $(COMPONENT_TEST_CLEANUP)
81 $(TOUCH) $@