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]
23 # Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
27 # This file sets up the standard, default options and base requirements for
28 # userland components.
32 # Assume components use a configure script-style build by default.
33 BUILD_STYLE ?
= configure
35 # Some build styles might want to set some defaults before prep.mk is included.
36 -include $(WS_MAKE_RULES
)/$(strip $(BUILD_STYLE
))-defaults.mk
38 # The SINGLE_PERL_VERSION variable is used to select building a component for
39 # single or multiple Perl versions. By default we build for single Perl
40 # version only unless the component is a Perl module. If the default value of
41 # SINGLE_PERL_VERSION is not what is needed for a component it could be
42 # overridden in component's Makefile.
43 SINGLE_PERL_VERSION ?
= yes
44 ifeq ($(strip $(SINGLE_PERL_VERSION
)),yes
)
45 PERL_VERSIONS
= $(PERL_VERSION
)
48 # The SINGLE_PYTHON_VERSION variable is used to select building a component for
49 # single or multiple Python versions. By default we build for single Python
50 # version only unless the component is a Python project. If the default value
51 # of SINGLE_PYTHON_VERSION is not what is needed for a component it could be
52 # overridden in component's Makefile.
53 SINGLE_PYTHON_VERSION ?
= yes
54 ifeq ($(strip $(SINGLE_PYTHON_VERSION
)),yes
)
55 PYTHON_VERSIONS
= $(PYTHON_VERSION
)
58 include $(WS_MAKE_RULES
)/prep.mk
60 # Override this to limit builds and publication to a single architecture.
62 ifneq ($(strip $(BUILD_ARCH
)),$(MACH
))
66 @echo
"Not available for $(MACH)"
68 BUILD_TARGET ?
= target-na
69 INSTALL_TARGET ?
= target-na
70 TEST_TARGET ?
= target-na
71 SYSTEM_TEST_TARGET ?
= target-na
74 # If not an archive build (i.e. extract and copy) or pkg build (publish only),
75 # include relevant makefile.
76 ifneq ($(strip $(BUILD_STYLE
)),archive
)
77 ifneq ($(strip $(BUILD_STYLE
)),pkg
)
78 include $(WS_MAKE_RULES
)/$(strip $(BUILD_STYLE
)).mk
82 ifeq ($(strip $(BUILD_STYLE
)),configure
)
83 # Assume these items should always be set in the configure environment. strip
84 # is used to work around potential problems with extra blank characters
85 # inserted into strings during nested configure invocations within builds for
86 # components such as gdb.
87 ifneq ($(strip $(CFLAGS
)),)
89 CONFIGURE_ENV
+= CFLAGS
="$(strip $(CFLAGS))"
91 ifneq ($(strip $(CXXFLAGS
)),)
93 CONFIGURE_ENV
+= CXXFLAGS
="$(strip $(CXXFLAGS))"
95 # Always process LDFLAGS.
96 CONFIGURE_ENV
+= LDFLAGS
="$(strip $(LDFLAGS))"
99 ifeq ($(strip $(BUILD_STYLE
)),justmake
)
100 # Assume these items should always be set in the build environment.
101 COMPONENT_BUILD_ENV
+= CC
="$(CC)"
102 COMPONENT_BUILD_ENV
+= CXX
="$(CXX)"
103 ifneq ($(strip $(CFLAGS
)),)
105 COMPONENT_BUILD_ENV
+= CFLAGS
="$(strip $(CFLAGS))"
107 ifneq ($(strip $(CXXFLAGS
)),)
109 COMPONENT_BUILD_ENV
+= CXXFLAGS
="$(strip $(CXXFLAGS))"
111 # Always process LDFLAGS.
112 COMPONENT_BUILD_ENV
+= LDFLAGS
="$(strip $(LDFLAGS))"
115 # Assume components built with ant do not need ASLR.
116 ifeq ($(strip $(BUILD_STYLE
)),ant
)
117 ASLR_MODE
= $(ASLR_NOT_APPLICABLE
)
119 ifeq ($(strip $(DEFAULT_ASLR_ENABLE
)),yes
)
120 # Enable ASLR by default unless target build is NO_ARCH.
121 ifneq ($(strip $(BUILD_BITS
)),NO_ARCH
)
122 ASLR_MODE
= $(ASLR_ENABLE
)
123 endif # DEFAULT_ASLR_ENABLE yes
124 endif # BUILD_BITS NO_ARCH
125 endif # BUILD_STYLE ant
127 # Default targets; to omit a specific target, explicitly set the related target
128 # variable to empty before including this file or set COMMON_TARGETS=no.
129 COMMON_TARGETS ?
= yes
131 ifneq ($(strip $(COMMON_TARGETS
)),no
)
132 # For ant-based build style, assume that install is provided by simply building
133 # the component and that no tests are available.
134 ifeq ($(strip $(BUILD_STYLE
)),ant
)
135 INSTALL_TARGET ?
= build
136 TEST_TARGET ?
= $(NO_TESTS
)
137 SYSTEM_TEST_TARGET ?
= $(NO_TESTS
)
140 # For archive-based build style, assume that the build, install, and test
141 # targets will be provided.
142 ifeq ($(strip $(BUILD_STYLE
)),archive
)
148 # For pkg-based build style, assume there are no build, install, or test steps;
149 # just a package to be published. However, 'gmake sample-manifest' requires
150 # proto dir. Since sample-manifest generation depends on install target we
151 # will abuse it to get the required dir created.
152 ifeq ($(strip $(BUILD_STYLE
)),pkg
)
154 INSTALL_TARGET
= $(BUILD_DIR
)/.installed
158 test system-test
: $(NO_TESTS
)
160 $(BUILD_DIR
)/.installed
:
161 $(RM
) -r
$(BUILD_DIR
)
162 $(MKDIR
) $(PROTO_DIR
)
166 $(RM
) -r
$(BUILD_DIR
)
169 # If TEST_TARGET is NO_TESTS, assume no system tests by default.
170 ifeq ($(strip $(TEST_TARGET
)),$(NO_TESTS
))
171 SYSTEM_TEST_TARGET ?
= $(NO_TESTS
)
174 # If TEST_TARGET is SKIP_TEST, assume system tests are skipped by default.
175 ifeq ($(strip $(TEST_TARGET
)),$(SKIP_TEST
))
176 SYSTEM_TEST_TARGET ?
= $(SKIP_TEST
)
179 # Otherwise, attempt to define common targets assuming defaults.
180 BUILD_TARGET ?
= $(BUILD_
$(MK_BITS
))
181 ifneq ($(strip $(BUILD_TARGET
)),)
182 build
: $(BUILD_TARGET
)
185 INSTALL_TARGET ?
= $(INSTALL_
$(MK_BITS
))
186 ifneq ($(strip $(INSTALL_TARGET
)),)
187 install: $(INSTALL_TARGET
)
190 TEST_TARGET ?
= $(TEST_
$(MK_BITS
))
191 ifneq ($(strip $(TEST_TARGET
)),)
195 # For the system-test target, assume that none have been implemented.
196 SYSTEM_TEST_TARGET ?
= $(SYSTEM_TESTS_NOT_IMPLEMENTED
)
197 ifneq ($(strip $(SYSTEM_TEST_TARGET
)),)
198 system-test
: $(SYSTEM_TEST_TARGET
)
200 endif # COMMON_TARGETS
202 # Always needed; every component builds packages.
203 include $(WS_MAKE_RULES
)/ips.mk
205 # Determine if we should automatically add files directory to PKG_PROTO_DIRS.
206 ifeq ($(wildcard files
),files
)
207 PKG_PROTO_DIRS
+= $(COMPONENT_DIR
)/files
210 # Add bit and mach-specific logic to general actions.
211 COMPONENT_PRE_CONFIGURE_ACTION
+= $(COMPONENT_PRE_CONFIGURE_ACTION.
$(BITS
))
212 COMPONENT_PRE_CONFIGURE_ACTION
+= $(COMPONENT_PRE_CONFIGURE_ACTION.
$(MACH
))
213 COMPONENT_POST_CONFIGURE_ACTION
+= $(COMPONENT_POST_CONFIGURE_ACTION.
$(BITS
))
214 COMPONENT_POST_CONFIGURE_ACTION
+= $(COMPONENT_POST_CONFIGURE_ACTION.
$(MACH
))
215 COMPONENT_PRE_BUILD_ACTION
+= $(COMPONENT_PRE_BUILD_ACTION.
$(BITS
))
216 COMPONENT_PRE_BUILD_ACTION
+= $(COMPONENT_PRE_BUILD_ACTION.
$(MACH
))
217 COMPONENT_POST_BUILD_ACTION
+= $(COMPONENT_POST_BUILD_ACTION.
$(BITS
))
218 COMPONENT_POST_BUILD_ACTION
+= $(COMPONENT_POST_BUILD_ACTION.
$(MACH
))
219 COMPONENT_PRE_INSTALL_ACTION
+= $(COMPONENT_PRE_INSTALL_ACTION.
$(BITS
))
220 COMPONENT_PRE_INSTALL_ACTION
+= $(COMPONENT_PRE_INSTALL_ACTION.
$(MACH
))
221 COMPONENT_POST_INSTALL_ACTION
+= $(COMPONENT_POST_INSTALL_ACTION.
$(BITS
))
222 COMPONENT_POST_INSTALL_ACTION
+= $(COMPONENT_POST_INSTALL_ACTION.
$(MACH
))
223 COMPONENT_PRE_TEST_ACTION
+= $(COMPONENT_PRE_TEST_ACTION.
$(BITS
))
224 COMPONENT_PRE_TEST_ACTION
+= $(COMPONENT_PRE_TEST_ACTION.
$(MACH
))
225 COMPONENT_POST_TEST_ACTION
+= $(COMPONENT_POST_TEST_ACTION.
$(BITS
))
226 COMPONENT_POST_TEST_ACTION
+= $(COMPONENT_POST_TEST_ACTION.
$(MACH
))
228 # In an ideal world all components should support parallel build but it is
229 # often not the case. So by default we do not run parallel build and allow
230 # components to opt-in for parallel build by setting USE_PARALLEL_BUILD = yes.
231 PARALLEL_JOBS ?
= $(shell /usr
/sbin
/psrinfo
-t
-c
)
232 ifeq ($(strip $(USE_PARALLEL_BUILD
)),yes
)
233 COMPONENT_BUILD_CMAKE_ARGS
+= -j
$(PARALLEL_JOBS
)
234 COMPONENT_BUILD_GMAKE_ARGS
+= -j
$(PARALLEL_JOBS
)
235 COMPONENT_BUILD_SETUP_PY_ARGS
+= -j
$(PARALLEL_JOBS
)