Marcel Telka
2024-04-06 d5f77aba7114f0848f8116baa85c485375bc1385
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
 
#
# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
#
 
#
# This file sets up the standard, default options and base requirements for
# userland components.
#
.NOTPARALLEL:
 
# Assume components use a configure script-style build by default.
BUILD_STYLE ?= configure
 
# Some build styles might want to set some defaults before prep.mk is included.
-include $(WS_MAKE_RULES)/$(strip $(BUILD_STYLE))-defaults.mk
 
# The SINGLE_PERL_VERSION variable is used to select building a component for
# single or multiple Perl versions.  By default we build for single Perl
# version only unless the component is a Perl module.  If the default value of
# SINGLE_PERL_VERSION is not what is needed for a component it could be
# overridden in component's Makefile.
SINGLE_PERL_VERSION ?= yes
ifeq ($(strip $(SINGLE_PERL_VERSION)),yes)
PERL_VERSIONS = $(PERL_VERSION)
endif
 
# The SINGLE_PYTHON_VERSION variable is used to select building a component for
# single or multiple Python versions.  By default we build for single Python
# version only unless the component is a Python project.  If the default value
# of SINGLE_PYTHON_VERSION is not what is needed for a component it could be
# overridden in component's Makefile.
SINGLE_PYTHON_VERSION ?= yes
ifeq ($(strip $(SINGLE_PYTHON_VERSION)),yes)
PYTHON_VERSIONS = $(PYTHON_VERSION)
endif
 
include $(WS_MAKE_RULES)/prep.mk
 
# Override this to limit builds and publication to a single architecture.
BUILD_ARCH ?= $(MACH)
ifneq ($(strip $(BUILD_ARCH)),$(MACH))
PUBLISH_STAMP= 
 
target-na:
    @echo "Not available for $(MACH)"
 
BUILD_TARGET ?= target-na
INSTALL_TARGET ?= target-na
TEST_TARGET ?= target-na
SYSTEM_TEST_TARGET ?= target-na
endif
 
# If not an archive build (i.e. extract and copy) or pkg build (publish only),
# include relevant makefile.
ifneq ($(strip $(BUILD_STYLE)),archive)
ifneq ($(strip $(BUILD_STYLE)),pkg)
include $(WS_MAKE_RULES)/$(strip $(BUILD_STYLE)).mk
endif
endif
 
ifeq ($(strip $(BUILD_STYLE)),configure)
# Assume these items should always be set in the configure environment.  strip
# is used to work around potential problems with extra blank characters
# inserted into strings during nested configure invocations within builds for
# components such as gdb.
ifneq ($(strip $(CFLAGS)),)
# Only if provided.
CONFIGURE_ENV += CFLAGS="$(strip $(CFLAGS))"
endif
ifneq ($(strip $(CXXFLAGS)),)
# Only if provided.
CONFIGURE_ENV += CXXFLAGS="$(strip $(CXXFLAGS))"
endif
# Always process LDFLAGS.
CONFIGURE_ENV += LDFLAGS="$(strip $(LDFLAGS))"
endif
 
ifeq ($(strip $(BUILD_STYLE)),justmake)
# Assume these items should always be set in the build environment.
COMPONENT_BUILD_ENV += CC="$(CC)"
COMPONENT_BUILD_ENV += CXX="$(CXX)"
ifneq ($(strip $(CFLAGS)),)
# Only if provided.
COMPONENT_BUILD_ENV += CFLAGS="$(strip $(CFLAGS))"
endif
ifneq ($(strip $(CXXFLAGS)),)
# Only if provided.
COMPONENT_BUILD_ENV += CXXFLAGS="$(strip $(CXXFLAGS))"
endif
# Always process LDFLAGS.
COMPONENT_BUILD_ENV += LDFLAGS="$(strip $(LDFLAGS))"
endif
 
# Assume components built with ant do not need ASLR.
ifeq ($(strip $(BUILD_STYLE)),ant)
ASLR_MODE= $(ASLR_NOT_APPLICABLE)
else
ifeq ($(strip $(DEFAULT_ASLR_ENABLE)),yes)
# Enable ASLR by default unless target build is NO_ARCH.
ifneq ($(strip $(BUILD_BITS)),NO_ARCH)
ASLR_MODE= $(ASLR_ENABLE)
endif # DEFAULT_ASLR_ENABLE yes
endif # BUILD_BITS NO_ARCH
endif # BUILD_STYLE ant
 
# Default targets; to omit a specific target, explicitly set the related target
# variable to empty before including this file or set COMMON_TARGETS=no.
COMMON_TARGETS ?= yes
 
ifneq ($(strip $(COMMON_TARGETS)),no)
# For ant-based build style, assume that install is provided by simply building
# the component and that no tests are available.
ifeq ($(strip $(BUILD_STYLE)),ant)
INSTALL_TARGET ?= build
TEST_TARGET ?= $(NO_TESTS)
SYSTEM_TEST_TARGET ?= $(NO_TESTS)
endif
 
# For archive-based build style, assume that the build, install, and test
# targets will be provided.
ifeq ($(strip $(BUILD_STYLE)),archive)
BUILD_TARGET ?=
INSTALL_TARGET ?=
TEST_TARGET ?=
endif
 
# For pkg-based build style, assume there are no build, install, or test steps;
# just a package to be published.  However, 'gmake sample-manifest' requires
# proto dir.  Since sample-manifest generation depends on install target we
# will abuse it to get the required dir created.
ifeq ($(strip $(BUILD_STYLE)),pkg)
BUILD_TARGET=
INSTALL_TARGET = $(BUILD_DIR)/.installed
TEST_TARGET=
SYSTEM_TEST_TARGET=
build:
test system-test:    $(NO_TESTS)
 
$(BUILD_DIR)/.installed:
    $(RM) -r $(BUILD_DIR)
    $(MKDIR) $(PROTO_DIR)
    $(TOUCH) $@
 
clean::
    $(RM) -r $(BUILD_DIR)
endif
 
# If TEST_TARGET is NO_TESTS, assume no system tests by default.
ifeq ($(strip $(TEST_TARGET)),$(NO_TESTS))
SYSTEM_TEST_TARGET ?= $(NO_TESTS)
endif
 
# If TEST_TARGET is SKIP_TEST, assume system tests are skipped by default.
ifeq ($(strip $(TEST_TARGET)),$(SKIP_TEST))
SYSTEM_TEST_TARGET ?= $(SKIP_TEST)
endif
 
# Otherwise, attempt to define common targets assuming defaults.
BUILD_TARGET ?= $(BUILD_$(MK_BITS))
ifneq ($(strip $(BUILD_TARGET)),)
build:          $(BUILD_TARGET)
endif
 
INSTALL_TARGET ?= $(INSTALL_$(MK_BITS))
ifneq ($(strip $(INSTALL_TARGET)),)
install:        $(INSTALL_TARGET)
endif
 
TEST_TARGET ?= $(TEST_$(MK_BITS))
ifneq ($(strip $(TEST_TARGET)),)
test:           $(TEST_TARGET)
endif
 
# For the system-test target, assume that none have been implemented.
SYSTEM_TEST_TARGET ?= $(SYSTEM_TESTS_NOT_IMPLEMENTED)
ifneq ($(strip $(SYSTEM_TEST_TARGET)),)
system-test:    $(SYSTEM_TEST_TARGET)
endif
endif # COMMON_TARGETS
 
# Always needed; every component builds packages.
include $(WS_MAKE_RULES)/ips.mk
 
# Determine if we should automatically add files directory to PKG_PROTO_DIRS.
ifeq ($(wildcard files),files)
PKG_PROTO_DIRS +=    $(COMPONENT_DIR)/files
endif
 
# Add bit and mach-specific logic to general actions.
COMPONENT_PRE_CONFIGURE_ACTION += $(COMPONENT_PRE_CONFIGURE_ACTION.$(BITS))
COMPONENT_PRE_CONFIGURE_ACTION += $(COMPONENT_PRE_CONFIGURE_ACTION.$(MACH))
COMPONENT_POST_CONFIGURE_ACTION += $(COMPONENT_POST_CONFIGURE_ACTION.$(BITS))
COMPONENT_POST_CONFIGURE_ACTION += $(COMPONENT_POST_CONFIGURE_ACTION.$(MACH))
COMPONENT_PRE_BUILD_ACTION += $(COMPONENT_PRE_BUILD_ACTION.$(BITS))
COMPONENT_PRE_BUILD_ACTION += $(COMPONENT_PRE_BUILD_ACTION.$(MACH))
COMPONENT_POST_BUILD_ACTION += $(COMPONENT_POST_BUILD_ACTION.$(BITS))
COMPONENT_POST_BUILD_ACTION += $(COMPONENT_POST_BUILD_ACTION.$(MACH))
COMPONENT_PRE_INSTALL_ACTION += $(COMPONENT_PRE_INSTALL_ACTION.$(BITS))
COMPONENT_PRE_INSTALL_ACTION += $(COMPONENT_PRE_INSTALL_ACTION.$(MACH))
COMPONENT_POST_INSTALL_ACTION += $(COMPONENT_POST_INSTALL_ACTION.$(BITS))
COMPONENT_POST_INSTALL_ACTION += $(COMPONENT_POST_INSTALL_ACTION.$(MACH))
COMPONENT_PRE_TEST_ACTION += $(COMPONENT_PRE_TEST_ACTION.$(BITS))
COMPONENT_PRE_TEST_ACTION += $(COMPONENT_PRE_TEST_ACTION.$(MACH))
COMPONENT_POST_TEST_ACTION += $(COMPONENT_POST_TEST_ACTION.$(BITS))
COMPONENT_POST_TEST_ACTION += $(COMPONENT_POST_TEST_ACTION.$(MACH))
 
# If component asked for non-default gcc version we need to make sure it is
# installed
ifneq ($(strip $(GCC_VERSION)),$(GCC_DEFAULT))
USERLAND_REQUIRED_PACKAGES += developer/gcc-$(GCC_VERSION)
endif
 
# If component asked for non-default clang version we need to make sure it is
# installed
ifneq ($(strip $(CLANG_VERSION)),$(CLANG_DEFAULT))
USERLAND_REQUIRED_PACKAGES += developer/clang-$(CLANG_VERSION)
endif