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