Marcel Telka
2022-08-08 fdb4214370321159cf0ec37b2a69fe2236967e29
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 #
30
fdb421 31 # Assume components use a configure script-style build by default.
MT 32 BUILD_STYLE ?= configure
33
34 # Some build styles might want to set some defaults before prep.mk is included.
35 -include $(WS_MAKE_RULES)/$(strip $(BUILD_STYLE))-defaults.mk
36
37 include $(WS_MAKE_RULES)/prep.mk
38
d99f73 39 # Override this to limit builds and publication to a single architecture.
AL 40 BUILD_ARCH ?= $(MACH)
41 ifneq ($(strip $(BUILD_ARCH)),$(MACH))
42 PUBLISH_STAMP= 
43
44 target-na:
45     @echo "Not available for $(MACH)"
46
47 BUILD_TARGET ?= target-na
48 INSTALL_TARGET ?= target-na
49 TEST_TARGET ?= target-na
50 SYSTEM_TEST_TARGET ?= target-na
51 endif
52
53 # If not an archive build (i.e. extract and copy) or pkg build (publish only),
54 # include relevant makefile.
55 ifneq ($(strip $(BUILD_STYLE)),archive)
56 ifneq ($(strip $(BUILD_STYLE)),pkg)
57 include $(WS_MAKE_RULES)/$(strip $(BUILD_STYLE)).mk
58 endif
59 endif
de49ed 60
d99f73 61 ifeq ($(strip $(BUILD_STYLE)),configure)
AL 62 # Assume these items should always be set in the configure environment.  strip
63 # is used to work around potential problems with extra blank characters
64 # inserted into strings during nested configure invocations within builds for
65 # components such as gdb.
66 ifneq ($(strip $(CFLAGS)),)
67 # Only if provided.
68 CONFIGURE_ENV += CFLAGS="$(strip $(CFLAGS))"
69 endif
70 ifneq ($(strip $(CXXFLAGS)),)
71 # Only if provided.
72 CONFIGURE_ENV += CXXFLAGS="$(strip $(CXXFLAGS))"
73 endif
74 # Always process LDFLAGS.
75 CONFIGURE_ENV += LDFLAGS="$(strip $(LDFLAGS))"
76 endif
77
78 ifeq ($(strip $(BUILD_STYLE)),justmake)
79 # Assume these items should always be set in the build environment.
80 COMPONENT_BUILD_ENV += CC="$(CC)"
81 COMPONENT_BUILD_ENV += CXX="$(CXX)"
82 ifneq ($(strip $(CFLAGS)),)
83 # Only if provided.
84 COMPONENT_BUILD_ENV += CFLAGS="$(strip $(CFLAGS))"
85 endif
86 ifneq ($(strip $(CXXFLAGS)),)
87 # Only if provided.
88 COMPONENT_BUILD_ENV += CXXFLAGS="$(strip $(CXXFLAGS))"
89 endif
90 # Always process LDFLAGS.
91 COMPONENT_BUILD_ENV += LDFLAGS="$(strip $(LDFLAGS))"
92 endif
93
94 # Assume components built with ant do not need ASLR.
95 ifeq ($(strip $(BUILD_STYLE)),ant)
96 ASLR_MODE= $(ASLR_NOT_APPLICABLE)
97 else
567b74 98 ifeq ($(strip $(DEFAULT_ASLR_ENABLE)),yes)
d99f73 99 # Enable ASLR by default unless target build is NO_ARCH.
AL 100 ifneq ($(strip $(BUILD_BITS)),NO_ARCH)
101 ASLR_MODE= $(ASLR_ENABLE)
567b74 102 endif # DEFAULT_ASLR_ENABLE yes
d99f73 103 endif # BUILD_BITS NO_ARCH
AL 104 endif # BUILD_STYLE ant
105
106 # Default targets; to omit a specific target, explicitly set the related target
107 # variable to empty before including this file or set COMMON_TARGETS=no.
108 COMMON_TARGETS ?= yes
109
110 ifneq ($(strip $(COMMON_TARGETS)),no)
111 # For ant-based build style, assume that install is provided by simply building
112 # the component and that no tests are available.
113 ifeq ($(strip $(BUILD_STYLE)),ant)
114 INSTALL_TARGET ?= build
115 TEST_TARGET ?= $(NO_TESTS)
116 SYSTEM_TEST_TARGET ?= $(NO_TESTS)
117 endif
118
119 # For archive-based build style, assume that the build, install, and test
120 # targets will be provided.
121 ifeq ($(strip $(BUILD_STYLE)),archive)
122 BUILD_TARGET ?=
123 INSTALL_TARGET ?=
124 TEST_TARGET ?=
125 endif
126
127 # For pkg-based build style, assume there are no build, install, or test steps;
522d32 128 # just a package to be published.  However, 'gmake sample-manifest' requires
MT 129 # build dir.  Since sample-manifest generation depends on install target we
130 # will abuse it to get the required dir created.
d99f73 131 ifeq ($(strip $(BUILD_STYLE)),pkg)
AL 132 BUILD_TARGET=
522d32 133 INSTALL_TARGET = $(BUILD_DIR)/.installed
d99f73 134 TEST_TARGET=
AL 135 SYSTEM_TEST_TARGET=
522d32 136 build:
d99f73 137 test system-test:    $(NO_TESTS)
522d32 138
MT 139 $(BUILD_DIR)/.installed:
140     $(RM) -r $(BUILD_DIR)
141     $(MKDIR) $(BUILD_DIR)
142     $(TOUCH) $@
d99f73 143 endif
AL 144
145 # If TEST_TARGET is NO_TESTS, assume no system tests by default.
146 ifeq ($(strip $(TEST_TARGET)),$(NO_TESTS))
147 SYSTEM_TEST_TARGET ?= $(NO_TESTS)
148 endif
149
150 # If TEST_TARGET is SKIP_TEST, assume system tests are skipped by default.
151 ifeq ($(strip $(TEST_TARGET)),$(SKIP_TEST))
152 SYSTEM_TEST_TARGET ?= $(SKIP_TEST)
153 endif
154
155 # Otherwise, attempt to define common targets assuming defaults.
156 BUILD_TARGET ?= $(BUILD_$(MK_BITS))
157 ifneq ($(strip $(BUILD_TARGET)),)
158 build:          $(BUILD_TARGET)
159 endif
160
161 INSTALL_TARGET ?= $(INSTALL_$(MK_BITS))
162 ifneq ($(strip $(INSTALL_TARGET)),)
163 install:        $(INSTALL_TARGET)
164 endif
165
166 TEST_TARGET ?= $(TEST_$(MK_BITS))
167 ifneq ($(strip $(TEST_TARGET)),)
168 test:           $(TEST_TARGET)
169 endif
170
171 # For the system-test target, assume that none have been implemented.
172 SYSTEM_TEST_TARGET ?= $(SYSTEM_TESTS_NOT_IMPLEMENTED)
173 ifneq ($(strip $(SYSTEM_TEST_TARGET)),)
174 system-test:    $(SYSTEM_TEST_TARGET)
175 endif
176 endif # COMMON_TARGETS
177
178 # Always needed; every component builds packages.
179 include $(WS_MAKE_RULES)/ips.mk
180
181 # Determine if we should automatically add files directory to PKG_PROTO_DIRS.
182 ifeq ($(wildcard files),files)
183 PKG_PROTO_DIRS +=    $(COMPONENT_DIR)/files
184 endif
185
186 # Add bit and mach-specific logic to general actions.
187 COMPONENT_PRE_CONFIGURE_ACTION += $(COMPONENT_PRE_CONFIGURE_ACTION.$(BITS))
188 COMPONENT_PRE_CONFIGURE_ACTION += $(COMPONENT_PRE_CONFIGURE_ACTION.$(MACH))
189 COMPONENT_POST_CONFIGURE_ACTION += $(COMPONENT_POST_CONFIGURE_ACTION.$(BITS))
190 COMPONENT_POST_CONFIGURE_ACTION += $(COMPONENT_POST_CONFIGURE_ACTION.$(MACH))
191 COMPONENT_PRE_BUILD_ACTION += $(COMPONENT_PRE_BUILD_ACTION.$(BITS))
192 COMPONENT_PRE_BUILD_ACTION += $(COMPONENT_PRE_BUILD_ACTION.$(MACH))
193 COMPONENT_POST_BUILD_ACTION += $(COMPONENT_POST_BUILD_ACTION.$(BITS))
194 COMPONENT_POST_BUILD_ACTION += $(COMPONENT_POST_BUILD_ACTION.$(MACH))
195 COMPONENT_PRE_INSTALL_ACTION += $(COMPONENT_PRE_INSTALL_ACTION.$(BITS))
196 COMPONENT_PRE_INSTALL_ACTION += $(COMPONENT_PRE_INSTALL_ACTION.$(MACH))
197 COMPONENT_POST_INSTALL_ACTION += $(COMPONENT_POST_INSTALL_ACTION.$(BITS))
198 COMPONENT_POST_INSTALL_ACTION += $(COMPONENT_POST_INSTALL_ACTION.$(MACH))
199 COMPONENT_PRE_TEST_ACTION += $(COMPONENT_PRE_TEST_ACTION.$(BITS))
200 COMPONENT_PRE_TEST_ACTION += $(COMPONENT_PRE_TEST_ACTION.$(MACH))
201 COMPONENT_POST_TEST_ACTION += $(COMPONENT_POST_TEST_ACTION.$(BITS))
202 COMPONENT_POST_TEST_ACTION += $(COMPONENT_POST_TEST_ACTION.$(MACH))