python/jedi: update to 0.19.2
[oi-userland.git] / make-rules / ninja.mk
blobcd35c09287b8fa7fc9f7a4eccda5d35562b0dee8
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
23 # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
26 # Rules and Macros for building open source software that builds with
27 # ninja (whether using a provided ninja file or one generated by a tool
28 # such as meson).
30 # To use these rules on their own, set BUILD_STYLE=ninja before including
31 # $(WS_MAKE_RULES)/common.mk. They will also be used for the build rules
32 # if you set BUILD_STYLE=meson.
34 # Any additional pre/post configure, build, or install actions can be specified
35 # in your Makefile by setting them in on of the following macros:
36 # COMPONENT_PRE_BUILD_ACTION, COMPONENT_BUILD_ACTION,
37 # COMPONENT_POST_BUILD_ACTION, COMPONENT_PRE_INSTALL_ACTION,
38 # COMPONENT_INSTALL_ACTION, COMPONENT_POST_INSTALL_ACTION
40 # If component specific ninja targets need to be used for build or install, they
41 # can be specified in
42 # COMPONENT_BUILD_TARGETS, COMPONENT_INSTALL_TARGETS
45 NINJA = /usr/bin/ninja
47 COMPONENT_INSTALL_ENV += DESTDIR=$(PROTO_DIR)
48 COMPONENT_INSTALL_ARGS += $(COMPONENT_INSTALL_ARGS.$(BITS))
50 COMPONENT_BUILD_ACTION ?= \
51 $(ENV) $(COMPONENT_BUILD_ENV) \
52 $(NINJA) -C $(@D) $(COMPONENT_BUILD_ARGS) $(COMPONENT_BUILD_TARGETS)
54 # build the configured source
55 $(BUILD_DIR)/%/.built: $(BUILD_DIR)/%/.configured
56 $(COMPONENT_PRE_BUILD_ACTION)
57 ($(COMPONENT_BUILD_ACTION))
58 $(COMPONENT_POST_BUILD_ACTION)
59 $(TOUCH) $@
61 COMPONENT_INSTALL_ACTION ?= \
62 $(ENV) $(COMPONENT_INSTALL_ENV) \
63 $(NINJA) -C $(@D) $(COMPONENT_INSTALL_ARGS) $(COMPONENT_INSTALL_TARGETS)
65 # install the built source into a prototype area
66 $(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built
67 $(COMPONENT_PRE_INSTALL_ACTION)
68 ($(COMPONENT_INSTALL_ACTION))
69 $(COMPONENT_POST_INSTALL_ACTION)
70 $(TOUCH) $@
72 # set the default command to use for test of the component
73 COMPONENT_TEST_CMD = $(NINJA)
74 COMPONENT_SYSTEM_TEST_CMD = $(NINJA)
76 # set the default target for test of the component
77 COMPONENT_TEST_TARGETS = test
78 COMPONENT_SYSTEM_TEST_TARGETS = test
80 # test the built source
81 $(BUILD_DIR)/%/.tested-and-compared: $(COMPONENT_TEST_DEP)
82 $(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
83 $(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
84 $(COMPONENT_PRE_TEST_ACTION)
85 -(cd $(COMPONENT_TEST_DIR) ; \
86 $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
87 $(COMPONENT_TEST_CMD) \
88 $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) \
89 &> $(COMPONENT_TEST_OUTPUT)
90 $(COMPONENT_POST_TEST_ACTION)
91 $(COMPONENT_TEST_CREATE_TRANSFORMS)
92 $(COMPONENT_TEST_PERFORM_TRANSFORM)
93 $(COMPONENT_TEST_COMPARE)
94 $(COMPONENT_TEST_CLEANUP)
95 $(TOUCH) $@
97 $(BUILD_DIR)/%/.tested: SHELLOPTS=pipefail
98 $(BUILD_DIR)/%/.tested: $(COMPONENT_TEST_DEP)
99 $(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
100 $(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
101 $(COMPONENT_PRE_TEST_ACTION)
102 (cd $(COMPONENT_TEST_DIR) ; \
103 $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
104 $(COMPONENT_TEST_CMD) \
105 $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) \
106 |& $(TEE) $(COMPONENT_TEST_OUTPUT)
107 $(COMPONENT_POST_TEST_ACTION)
108 $(COMPONENT_TEST_CREATE_TRANSFORMS)
109 $(COMPONENT_TEST_PERFORM_TRANSFORM)
110 $(COMPONENT_TEST_CLEANUP)
111 $(TOUCH) $@
113 clean::
114 $(RM) -r $(BUILD_DIR) $(PROTO_DIR)
116 USERLAND_REQUIRED_PACKAGES += developer/build/ninja