Till Wegmüller
2024-04-05 3f9136b3de67269afdd692eece3dc40814e6cbda
commit | author | age
d99f73 1 #
AL 2 # CDDL HEADER START
3 #
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.
7 #
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.
12 #
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]
18 #
19 # CDDL HEADER END
20 #
21
22 #
23 # Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
24 #
25
26 #
27 # This file sets up the standard, default options and base requirements for
28 # userland components.
29 #
dab0d0 30 .NOTPARALLEL:
d99f73 31
fdb421 32 # Assume components use a configure script-style build by default.
MT 33 BUILD_STYLE ?= configure
34
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
37
e537d3 38 # The SINGLE_PERL_VERSION variable is used to select building a component for
MT 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)
46 endif
47
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)
56 endif
57
fdb421 58 include $(WS_MAKE_RULES)/prep.mk
MT 59
d99f73 60 # Override this to limit builds and publication to a single architecture.
AL 61 BUILD_ARCH ?= $(MACH)
62 ifneq ($(strip $(BUILD_ARCH)),$(MACH))
63 PUBLISH_STAMP= 
64
65 target-na:
66     @echo "Not available for $(MACH)"
67
68 BUILD_TARGET ?= target-na
69 INSTALL_TARGET ?= target-na
70 TEST_TARGET ?= target-na
71 SYSTEM_TEST_TARGET ?= target-na
72 endif
73
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
79 endif
80 endif
de49ed 81
d99f73 82 ifeq ($(strip $(BUILD_STYLE)),configure)
AL 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)),)
88 # Only if provided.
89 CONFIGURE_ENV += CFLAGS="$(strip $(CFLAGS))"
90 endif
91 ifneq ($(strip $(CXXFLAGS)),)
92 # Only if provided.
93 CONFIGURE_ENV += CXXFLAGS="$(strip $(CXXFLAGS))"
94 endif
95 # Always process LDFLAGS.
96 CONFIGURE_ENV += LDFLAGS="$(strip $(LDFLAGS))"
97 endif
98
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)),)
104 # Only if provided.
105 COMPONENT_BUILD_ENV += CFLAGS="$(strip $(CFLAGS))"
106 endif
107 ifneq ($(strip $(CXXFLAGS)),)
108 # Only if provided.
109 COMPONENT_BUILD_ENV += CXXFLAGS="$(strip $(CXXFLAGS))"
110 endif
111 # Always process LDFLAGS.
112 COMPONENT_BUILD_ENV += LDFLAGS="$(strip $(LDFLAGS))"
113 endif
114
115 # Assume components built with ant do not need ASLR.
116 ifeq ($(strip $(BUILD_STYLE)),ant)
117 ASLR_MODE= $(ASLR_NOT_APPLICABLE)
118 else
567b74 119 ifeq ($(strip $(DEFAULT_ASLR_ENABLE)),yes)
d99f73 120 # Enable ASLR by default unless target build is NO_ARCH.
AL 121 ifneq ($(strip $(BUILD_BITS)),NO_ARCH)
122 ASLR_MODE= $(ASLR_ENABLE)
567b74 123 endif # DEFAULT_ASLR_ENABLE yes
d99f73 124 endif # BUILD_BITS NO_ARCH
AL 125 endif # BUILD_STYLE ant
126
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
130
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)
138 endif
139
140 # For archive-based build style, assume that the build, install, and test
141 # targets will be provided.
142 ifeq ($(strip $(BUILD_STYLE)),archive)
143 BUILD_TARGET ?=
144 INSTALL_TARGET ?=
145 TEST_TARGET ?=
146 endif
147
148 # For pkg-based build style, assume there are no build, install, or test steps;
522d32 149 # just a package to be published.  However, 'gmake sample-manifest' requires
daf581 150 # proto dir.  Since sample-manifest generation depends on install target we
522d32 151 # will abuse it to get the required dir created.
d99f73 152 ifeq ($(strip $(BUILD_STYLE)),pkg)
AL 153 BUILD_TARGET=
522d32 154 INSTALL_TARGET = $(BUILD_DIR)/.installed
d99f73 155 TEST_TARGET=
AL 156 SYSTEM_TEST_TARGET=
522d32 157 build:
d99f73 158 test system-test:    $(NO_TESTS)
522d32 159
MT 160 $(BUILD_DIR)/.installed:
161     $(RM) -r $(BUILD_DIR)
daf581 162     $(MKDIR) $(PROTO_DIR)
522d32 163     $(TOUCH) $@
cd51a1 164
MT 165 clean::
166     $(RM) -r $(BUILD_DIR)
d99f73 167 endif
AL 168
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)
172 endif
173
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)
177 endif
178
179 # Otherwise, attempt to define common targets assuming defaults.
180 BUILD_TARGET ?= $(BUILD_$(MK_BITS))
181 ifneq ($(strip $(BUILD_TARGET)),)
182 build:          $(BUILD_TARGET)
183 endif
184
185 INSTALL_TARGET ?= $(INSTALL_$(MK_BITS))
186 ifneq ($(strip $(INSTALL_TARGET)),)
187 install:        $(INSTALL_TARGET)
188 endif
189
190 TEST_TARGET ?= $(TEST_$(MK_BITS))
191 ifneq ($(strip $(TEST_TARGET)),)
192 test:           $(TEST_TARGET)
193 endif
194
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)
199 endif
200 endif # COMMON_TARGETS
201
202 # Always needed; every component builds packages.
203 include $(WS_MAKE_RULES)/ips.mk
204
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
208 endif
209
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))
926f5b 227
MT 228 # If component asked for non-default gcc version we need to make sure it is
229 # installed
230 ifneq ($(strip $(GCC_VERSION)),$(GCC_DEFAULT))
231 USERLAND_REQUIRED_PACKAGES += developer/gcc-$(GCC_VERSION)
232 endif
61f685 233
MT 234 # If component asked for non-default clang version we need to make sure it is
235 # installed
236 ifneq ($(strip $(CLANG_VERSION)),$(CLANG_DEFAULT))
237 USERLAND_REQUIRED_PACKAGES += developer/clang-$(CLANG_VERSION)
238 endif