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]
21 # Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
24 PATH
=/usr
/bin
:/usr
/gnu
/bin
26 # The location of an internal mirror of community source archives that we build
27 # in this gate. This mirror has been seeded to include "custom" source archives
28 # for a few components where the communities either no longer provide matching
29 # source archives or we have changes that aren't reflected in their archives or
31 #INTERNAL_ARCHIVE_MIRROR = http://userland.us.oracle.com/source-archives
33 # The location of an external mirror of community source archives that we build
34 # in this gate. The external mirror is a replica of the internal mirror.
35 #EXTERNAL_ARCHIVE_MIRROR = \
36 # http://static.opensolaris.org/action/browse/userland/tarball/userland
38 # Default to looking for source archives on the internal mirror and the external
39 # mirror before we hammer on the community source archive repositories.
40 #export DOWNLOAD_SEARCH_PATH += $(INTERNAL_ARCHIVE_MIRROR)
41 #export DOWNLOAD_SEARCH_PATH += $(EXTERNAL_ARCHIVE_MIRROR)
43 # The workspace starts at the mercurial root
44 ifeq ($(origin WS_TOP
), undefined
)
46 $(shell hg root
2>/dev
/null || git rev-parse
--show-toplevel
)
49 USERLAND_ARCHIVES ?
= $(WS_TOP
)/archives
/
50 WS_MACH
= $(WS_TOP
)/$(MACH
)
51 WS_LOGS
= $(WS_MACH
)/logs
52 WS_REPO
= $(WS_MACH
)/repo
53 WS_TOOLS
= $(WS_TOP
)/tools
54 WS_MAKE_RULES
= $(WS_TOP
)/make-rules
55 WS_COMPONENTS
= $(WS_TOP
)/components
56 WS_LICENSES
= $(WS_TOP
)/licenses
57 WS_INCORPORATIONS
= $(WS_TOP
)/incorporations
58 WS_LINT_CACHE
= $(WS_MACH
)/pkglint-cache
60 # we want our pkg piplines to fail if there is an error
61 # (like if pkgdepend fails in the middle of a pipe), but
62 # we don't want the builds or ./configure's failing as well.
63 # so we only set pipefail for the publish target and have
64 # to reset it for the others since they might be invoked
65 # as dependencies of publish.
70 publish
: SHELLOPTS
=pipefail
74 # This can be overridden to avoid rebuilding when you touch a Makefile
75 MAKEFILE_PREREQ
= Makefile
77 CONSOLIDATION
= userland
78 PUBLISHER ?
= $(CONSOLIDATION
)
79 PUBLISHER_LOCALIZABLE ?
= $(CONSOLIDATION
)-localizable
81 # Defines $(space) as a single blank space, so we can use it to convert
82 # space-separated paths to colon-separated paths in variables with
83 # $(subst $(space),:,$(strip $(SPATHS)))
85 space
:= $(empty
) $(empty
)
90 OS_VERSION
:= $(shell uname
-r
)
91 SOLARIS_VERSION
= $(OS_VERSION
:5.
%=2.
%)
93 PKG_SOLARIS_VERSION ?
= 5.11
95 include $(WS_MAKE_RULES
)/ips-buildinfo.mk
101 PYTHON_VERSIONS
= 2.7
103 BASS_O_MATIC
= $(WS_TOOLS
)/bass-o-matic
105 CLONEY
= $(WS_TOOLS
)/cloney
107 CONFIG_SHELL
= /bin
/bash
109 PKG_REPO
= file
:$(WS_REPO
)
111 COMPONENT_SRC_NAME
= $(COMPONENT_NAME
)
113 COMPONENT_LICENSE_FILE ?
= $(COMPONENT_NAME
).license
115 COMPONENT_DIR
:= $(shell pwd
)
116 SOURCE_DIR
= $(COMPONENT_DIR
)/$(COMPONENT_SRC
)
117 BUILD_DIR
= $(COMPONENT_DIR
)/build
118 PROTO_DIR
= $(BUILD_DIR
)/prototype
/$(MACH
)
121 ARCHLIBSUBDIR64
= $(MACH64
)
122 ARCHLIBSUBDIR
= $(ARCHLIBSUBDIR
$(BITS
))
130 KERNELDRVDIR
= /kernel
/drv
131 KERNELDRVDIR32
=/kernel
/drv
132 KERNELDRVDIR64
=/kernel
/drv
/$(MACH64
)
133 USRBINDIR
= $(USRDIR
)/bin
134 USRBINDIR32
= $(USRDIR
)/bin
/$(MACH32
)
135 USRBINDIR64
= $(USRDIR
)/bin
/$(MACH64
)
136 USRSBINDIR
= $(USRDIR
)/sbin
137 USRSBINDIR32
= $(USRDIR
)/sbin
/$(MACH32
)
138 USRSBINDIR64
= $(USRDIR
)/sbin
/$(MACH64
)
139 USRLIBDIR
= $(USRDIR
)/lib
140 USRLIBDIR32
= $(USRDIR
)/lib
141 USRLIBDIR64
= $(USRDIR
)/lib
/$(MACH64
)
142 USRSHAREDIR
= $(USRDIR
)/share
143 USRINCDIR
= $(USRDIR
)/include
144 USRSHARELOCALEDIR
= $(USRSHAREDIR
)/locale
145 USRSHAREMANDIR
= $(USRSHAREDIR
)/man
146 USRSHAREDOCDIR
= $(USRSHAREDIR
)/doc
147 USRSHARELIBDIR
= $(USRSHAREDIR
)/lib
148 USRSHAREMAN1DIR
= $(USRSHAREMANDIR
)/man1
149 USRSHAREMAN1MDIR
= $(USRSHAREMANDIR
)/man1m
150 USRSHAREMAN3DIR
= $(USRSHAREMANDIR
)/man3
151 USRSHAREMAN4DIR
= $(USRSHAREMANDIR
)/man4
152 USRSHAREMAN5DIR
= $(USRSHAREMANDIR
)/man5
153 USRSHAREMAN8DIR
= $(USRSHAREMANDIR
)/man8
154 USRKERNELDRVDIR
= $(USRDIR
)/kernel
/drv
155 USRKERNELDRVDIR32
= $(USRDIR
)/kernel
/drv
156 USRKERNELDRVDIR64
= $(USRDIR
)/kernel
/drv
/$(MACH64
)
158 # The *.$(BITS) variables are different from those above (better suited for
159 # isaexec wrapper), and allow for default 32-bit vs. nondefault 64-bit setups
160 USRBINDIR
.32 = $(USRBINDIR
)
161 USRBINDIR
.64 = $(USRBINDIR64
)
162 USRSBINDIR
.32 = $(USRSBINDIR
)
163 USRSBINDIR
.64 = $(USRSBINDIR64
)
164 USRLIBDIR
.32 = $(USRLIBDIR
)
165 USRLIBDIR
.64 = $(USRLIBDIR64
)
167 PROTOETCDIR
= $(PROTO_DIR
)/$(ETCDIR
)
168 PROTOETCSECDIR
= $(PROTO_DIR
)/$(ETCDIR
)/security
169 PROTOUSRDIR
= $(PROTO_DIR
)/$(USRDIR
)
170 PROTOBINDIR
= $(PROTO_DIR
)/$(BINDIR
)
171 PROTOSBINDIR
= $(PROTO_DIR
)/$(SBINDIR
)
172 PROTOLIBDIR
= $(PROTO_DIR
)/$(LIBDIR
)
173 PROTOVARDIR
= $(PROTO_DIR
)/$(VARDIR
)
174 PROTOKERNELDRVDIR
= $(PROTO_DIR
)/$(KERNELDRVDIR
)
175 PROTOKERNELDRVDIR32
= $(PROTO_DIR
)/$(KERNELDRVDIR32
)
176 PROTOKERNELDRVDIR64
= $(PROTO_DIR
)/$(KERNELDRVDIR64
)
177 PROTOUSRBINDIR
= $(PROTO_DIR
)/$(USRBINDIR
)
178 PROTOUSRBINDIR32
= $(PROTO_DIR
)/$(USRBINDIR32
)
179 PROTOUSRBINDIR64
= $(PROTO_DIR
)/$(USRBINDIR64
)
180 PROTOUSRSBINDIR
= $(PROTO_DIR
)/$(USRSBINDIR
)
181 PROTOUSRSBINDIR32
= $(PROTO_DIR
)/$(USRSBINDIR32
)
182 PROTOUSRSBINDIR64
= $(PROTO_DIR
)/$(USRSBINDIR64
)
183 PROTOUSRLIBDIR
= $(PROTO_DIR
)/$(USRLIBDIR
)
184 PROTOUSRLIBDIR32
= $(PROTO_DIR
)/$(USRLIBDIR32
)
185 PROTOUSRLIBDIR64
= $(PROTO_DIR
)/$(USRLIBDIR64
)
186 PROTOUSRINCDIR
= $(PROTO_DIR
)/$(USRINCDIR
)
187 PROTOUSRSHAREDIR
= $(PROTO_DIR
)/$(USRSHAREDIR
)
188 PROTOUSRSHARELIBDIR
= $(PROTO_DIR
)/$(USRSHARELIBDIR
)
189 PROTOUSRSHAREMANDIR
= $(PROTO_DIR
)/$(USRSHAREMANDIR
)
190 PROTOUSRSHAREDOCDIR
= $(PROTO_DIR
)/$(USRSHAREDOCDIR
)
191 PROTOUSRSHAREMAN1DIR
= $(PROTO_DIR
)/$(USRSHAREMAN1DIR
)
192 PROTOUSRSHAREMAN1MDIR
= $(PROTO_DIR
)/$(USRSHAREMAN1MDIR
)
193 PROTOUSRSHAREMAN3DIR
= $(PROTO_DIR
)/$(USRSHAREMAN3DIR
)
194 PROTOUSRSHAREMAN4DIR
= $(PROTO_DIR
)/$(USRSHAREMAN4DIR
)
195 PROTOUSRSHAREMAN5DIR
= $(PROTO_DIR
)/$(USRSHAREMAN5DIR
)
196 PROTOUSRSHAREMAN8DIR
= $(PROTO_DIR
)/$(USRSHAREMAN8DIR
)
197 PROTOUSRSHARELOCALEDIR
= $(PROTO_DIR
)/$(USRSHARELOCALEDIR
)
198 PROTOUSRKERNELDRVDIR
= $(PROTO_DIR
)/$(USRKERNELDRVDIR
)
199 PROTOUSRKERNELDRVDIR32
= $(PROTO_DIR
)/$(USRKERNELDRVDIR32
)
200 PROTOUSRKERNELDRVDIR64
= $(PROTO_DIR
)/$(USRKERNELDRVDIR64
)
202 PROTOUSRBINDIR
.32 = $(PROTOUSRBINDIR
)
203 PROTOUSRBINDIR
.64 = $(PROTOUSRBINDIR64
)
204 PROTOUSRSBINDIR
.32 = $(PROTOUSRSBINDIR
)
205 PROTOUSRSBINDIR
.64 = $(PROTOUSRSBINDIR64
)
206 PROTOUSRLIBDIR
.32 = $(PROTOUSRLIBDIR
)
207 PROTOUSRLIBDIR
.64 = $(PROTOUSRLIBDIR64
)
209 # NOTE: We do not build SFW contents
210 # /usr/sfw/bin is just a historic artefact, containing symlinks
211 SFWBIN
= /usr
/sfw
/bin
213 SFWBIN64
= $(SFWBIN
)/$(MACH64
)
214 SFWSBIN
= /usr
/sfw
/sbin
215 SFWSBIN32
= $(SFWSBIN
)
216 SFWSBIN64
= $(SFWSBIN
)/$(MACH64
)
217 SFWINCLUDE
= /usr
/sfw
/include
218 SFWLIB
= /usr
/sfw
/lib
220 SFWLIB64
= $(SFWLIB
)/$(MACH64
)
221 SFWSHARE
= /usr
/sfw
/share
222 SFWSHAREMAN
= $(SFWSHARE
)/man
223 SFWSHAREMAN1
= $(SFWSHAREMAN
)/man1
224 PROTOSFWBIN
= $(PROTO_DIR
)/$(SFWBIN
)
225 PROTOSFWBIN32
= $(PROTO_DIR
)/$(SFWBIN32
)
226 PROTOSFWBIN64
= $(PROTO_DIR
)/$(SFWBIN64
)
227 PROTOSFWSBIN
= $(PROTO_DIR
)/$(SFWSBIN
)
228 PROTOSFWSBIN32
= $(PROTO_DIR
)/$(SFWSBIN32
)
229 PROTOSFWSBIN64
= $(PROTO_DIR
)/$(SFWSBIN64
)
230 PROTOSFWLIB
= $(PROTO_DIR
)/$(SFWLIB
)
231 PROTOSFWLIB32
= $(PROTO_DIR
)/$(SFWLIB32
)
232 PROTOSFWLIB64
= $(PROTO_DIR
)/$(SFWLIB64
)
233 PROTOSFWSHARE
= $(PROTO_DIR
)/$(SFWSHARE
)
234 PROTOSFWSHAREMAN
= $(PROTO_DIR
)/$(SFWSHAREMAN
)
235 PROTOSFWSHAREMAN1
= $(PROTO_DIR
)/$(SFWSHAREMAN1
)
236 PROTOSFWINCLUDE
= $(PROTO_DIR
)/$(SFWINCLUDE
)
238 # The *.$(BITS) variables are different from those above (better suited for
239 # isaexec wrapper), and allow for default 32-bit vs. nondefault 64-bit setups
240 SFWBIN
.32 = $(SFWBIN
)
241 SFWBIN
.64 = $(SFWBIN64
)
242 SFWSBIN
.32 = $(SFWSBIN
)
243 SFWSBIN
.64 = $(SFWSBIN64
)
244 SFWLIB
.32 = $(SFWLIB
)
245 SFWLIB
.64 = $(SFWLIB64
)
246 PROTOSFWBIN
.32 = $(PROTOSFWBIN
)
247 PROTOSFWBIN
.64 = $(PROTOSFWBIN64
)
248 PROTOSFWSBIN
.32 = $(PROTOSFWSBIN
)
249 PROTOSFWSBIN
.64 = $(PROTOSFWSBIN64
)
250 PROTOSFWLIB
.32 = $(PROTOSFWLIB
)
251 PROTOSFWLIB
.64 = $(PROTOSFWLIB64
)
253 CLDIR
= /usr
/share
/common-lisp
254 PROTOCLDIR
= $(PROTO_DIR
)/$(CLDIR
)
256 GNUBIN
= /usr
/gnu
/bin
257 GNUBIN32
= $(GNUBIN
)/$(MACH32
)
258 GNUBIN64
= $(GNUBIN
)/$(MACH64
)
259 GNUSBIN
= /usr
/gnu
/sbin
260 GNUSBIN32
= $(GNUSBIN
)/$(MACH32
)
261 GNUSBIN64
= $(GNUSBIN
)/$(MACH64
)
262 GNULIB
= /usr
/gnu
/lib
264 GNULIB64
= $(GNULIB
)/$(MACH64
)
265 GNUSHARE
= /usr
/gnu
/share
266 GNUSHAREMAN
= $(GNUSHARE
)/man
267 GNUSHAREMAN1
= $(GNUSHAREMAN
)/man1
268 PROTOGNUBIN
= $(PROTO_DIR
)/$(GNUBIN
)
269 PROTOGNUBIN32
= $(PROTO_DIR
)/$(GNUBIN32
)
270 PROTOGNUBIN64
= $(PROTO_DIR
)/$(GNUBIN64
)
271 PROTOGNUSBIN
= $(PROTO_DIR
)/$(GNUSBIN
)
272 PROTOGNUSBIN32
= $(PROTO_DIR
)/$(GNUSBIN32
)
273 PROTOGNUSBIN64
= $(PROTO_DIR
)/$(GNUSBIN64
)
274 PROTOGNULIB
= $(PROTO_DIR
)/$(GNULIB
)
275 PROTOGNULIB32
= $(PROTO_DIR
)/$(GNULIB32
)
276 PROTOGNULIB64
= $(PROTO_DIR
)/$(GNULIB64
)
277 PROTOGNUSHARE
= $(PROTO_DIR
)/$(GNUSHARE
)
278 PROTOGNUSHAREMAN
= $(PROTO_DIR
)/$(GNUSHAREMAN
)
279 PROTOGNUSHAREMAN1
= $(PROTO_DIR
)/$(GNUSHAREMAN1
)
281 # The *.$(BITS) variables are different from those above (better suited for
282 # isaexec wrapper), and allow for default 32-bit vs. nondefault 64-bit setups
283 GNUBIN
.32 = $(GNUBIN
)
284 GNUBIN
.64 = $(GNUBIN64
)
285 GNUSBIN
.32 = $(GNUSBIN
)
286 GNUSBIN
.64 = $(GNUSBIN64
)
287 GNULIB
.32 = $(GNULIB
)
288 GNULIB
.64 = $(GNULIB64
)
289 PROTOGNUBIN
.32 = $(PROTOGNUBIN
)
290 PROTOGNUBIN
.64 = $(PROTOGNUBIN64
)
291 PROTOGNUSBIN
.32 = $(PROTOGNUSBIN
)
292 PROTOGNUSBIN
.64 = $(PROTOGNUSBIN64
)
293 PROTOGNULIB
.32 = $(PROTOGNULIB
)
294 PROTOGNULIB
.64 = $(PROTOGNULIB64
)
296 # work around _TIME, _DATE, embedded date chatter in component builds
297 # to use, set TIME_CONSTANT in the component Makefile and add $(CONSTANT_TIME)
298 # to the appropriate {CONFIGURE|BUILD|INSTALL}_ENV
299 CONSTANT_TIME
= LD_PRELOAD_32
=$(WS_TOOLS
)/time-
$(MACH32
).so
300 CONSTANT_TIME
+= LD_PRELOAD_64
=$(WS_TOOLS
)/time-
$(MACH64
).so
301 CONSTANT_TIME
+= TIME_CONSTANT
=$(TIME_CONSTANT
)
303 # set MACH from uname -p to either sparc or i386
304 MACH
:= $(shell uname
-p
)
306 # set MACH32 from MACH to either sparcv7 or i86
307 MACH32_1
= $(MACH
:sparc
=sparcv7
)
308 MACH32
= $(MACH32_1
:i386
=i86
)
310 # set MACH64 from MACH to either sparcv9 or amd64
311 MACH64_1
= $(MACH
:sparc
=sparcv9
)
312 MACH64
= $(MACH64_1
:i386
=amd64
)
314 CONFIGURE_32
= $(BUILD_DIR_32
)/.configured
315 CONFIGURE_64
= $(BUILD_DIR_64
)/.configured
317 BUILD_DIR_32
= $(BUILD_DIR
)/$(MACH32
)
318 BUILD_DIR_64
= $(BUILD_DIR
)/$(MACH64
)
320 BUILD_32
= $(BUILD_DIR_32
)/.built
321 BUILD_64
= $(BUILD_DIR_64
)/.built
322 BUILD_32_and_64
= $(BUILD_32
) $(BUILD_64
)
323 $(BUILD_DIR_32
)/.built
: BITS
=32
324 $(BUILD_DIR_64
)/.built
: BITS
=64
326 INSTALL_32
= $(BUILD_DIR_32
)/.installed
327 INSTALL_64
= $(BUILD_DIR_64
)/.installed
328 INSTALL_32_and_64
= $(INSTALL_32
) $(INSTALL_64
)
329 $(BUILD_DIR_32
)/.installed
: BITS
=32
330 $(BUILD_DIR_64
)/.installed
: BITS
=64
332 # set the default target for installation of the component
333 COMPONENT_INSTALL_TARGETS
= install
335 # set the default build test results directory
336 COMPONENT_TEST_BUILD_DIR
= $(BUILD_DIR
)/test/$(MACH
$(BITS
))
338 # set the default master test results directory
339 COMPONENT_TEST_RESULTS_DIR
= $(COMPONENT_DIR
)/test
341 # set the default master test results file
342 COMPONENT_TEST_MASTER
= $(COMPONENT_TEST_RESULTS_DIR
)/results-
$(BITS
).master
344 # set the default test results output file
345 COMPONENT_TEST_OUTPUT
= $(COMPONENT_TEST_BUILD_DIR
)/test-
$(BITS
)-results
347 # set the default test results comparison diffs file
348 COMPONENT_TEST_DIFFS
= $(COMPONENT_TEST_BUILD_DIR
)/test-
$(BITS
)-diffs
350 # set the default test snapshot file
351 COMPONENT_TEST_SNAPSHOT
= $(COMPONENT_TEST_BUILD_DIR
)/results-
$(BITS
).snapshot
353 # Normally $(GSED) is simplest, but some results files need more power.
354 COMPONENT_TEST_TRANSFORMER
= $(GSED
)
356 # The set of default transforms to be applied to the test results to try
358 COMPONENT_TEST_TRANSFORMS
= \
359 '-e "s|$(@D)|\\$$(@D)|g" ' \
360 '-e "s|$(PERL)|\\$$(PERL)|g" ' \
361 '-e "s|$(SOURCE_DIR)|\\$$(SOURCE_DIR)|g" '
363 # set the default commands used to generate the file containing the set
364 # of transforms to be applied to the test results to try to normalize them.
365 COMPONENT_TEST_CREATE_TRANSFORMS
= \
366 if
[ -e
$(COMPONENT_TEST_MASTER
) ]; \
368 print "\#!/bin/sh" > $(COMPONENT_TEST_TRANSFORM_CMD
); \
369 print '$(COMPONENT_TEST_TRANSFORMER) ' \
370 $(COMPONENT_TEST_TRANSFORMS
) \
371 ' \\' >> $(COMPONENT_TEST_TRANSFORM_CMD
); \
372 print '$(COMPONENT_TEST_OUTPUT) \\' \
373 >> $(COMPONENT_TEST_TRANSFORM_CMD
); \
374 print '> $(COMPONENT_TEST_SNAPSHOT)' \
375 >> $(COMPONENT_TEST_TRANSFORM_CMD
); \
378 # set the default command for performing any test result munging
379 COMPONENT_TEST_TRANSFORM_CMD
= $(COMPONENT_TEST_BUILD_DIR
)/transform-
$(BITS
)-results
381 # set the default operation to run to perform test result normalization
382 COMPONENT_TEST_PERFORM_TRANSFORM
= \
383 if
[ -e
$(COMPONENT_TEST_MASTER
) ]; \
385 $(SHELL
) $(COMPONENT_TEST_TRANSFORM_CMD
); \
388 # set the default command used to compare the master results with the snapshot
389 COMPONENT_TEST_COMPARE_CMD
= $(GDIFF
) -uN
391 # set the default way that master and snapshot test results are compared
392 COMPONENT_TEST_COMPARE
= \
393 if
[ -e
$(COMPONENT_TEST_MASTER
) ]; \
395 $(COMPONENT_TEST_COMPARE_CMD
) \
396 $(COMPONENT_TEST_MASTER
) $(COMPONENT_TEST_SNAPSHOT
) \
397 > $(COMPONENT_TEST_DIFFS
); \
398 print "Test results in $(COMPONENT_TEST_OUTPUT)"; \
399 if
[ -s
$(COMPONENT_TEST_DIFFS
) ]; \
401 print "Differences found."; \
402 $(CAT
) $(COMPONENT_TEST_DIFFS
); \
405 print "No differences found."; \
409 # set the default env command to use for test of the component
410 COMPONENT_TEST_ENV_CMD
= $(ENV
)
412 # set the default command to use for test of the component
413 COMPONENT_TEST_CMD
= $(GMAKE
)
415 # set the default target for test of the component
416 COMPONENT_TEST_TARGETS
= check
418 # set the default directory for test of the component
419 COMPONENT_TEST_DIR
= $(@D
)
421 # determine the type of tests we want to run.
422 ifeq ($(strip $(wildcard $(COMPONENT_TEST_RESULTS_DIR
)/results-
*.master
)),)
423 TEST_32
= $(BUILD_DIR_32
)/.tested
424 TEST_64
= $(BUILD_DIR_64
)/.tested
426 TEST_32
= $(BUILD_DIR_32
)/.tested-and-compared
427 TEST_64
= $(BUILD_DIR_64
)/.tested-and-compared
429 TEST_32_and_64
= $(TEST_32
) $(TEST_64
)
430 $(BUILD_DIR_32
)/.tested
: BITS
=32
431 $(BUILD_DIR_64
)/.tested
: BITS
=64
432 $(BUILD_DIR_32
)/.tested-and-compared
: BITS
=32
433 $(BUILD_DIR_64
)/.tested-and-compared
: BITS
=64
435 # BUILD_TOOLS is the root of all tools not normally installed on the system.
438 SPRO_ROOT
= $(BUILD_TOOLS
)/sunstudio12.1
439 SPRO_VROOT
= $(SPRO_ROOT
)
441 PARFAIT_ROOT
= $(BUILD_TOOLS
)/parfait
/parfait-tools-1.0
.1/
442 PARFAIT
= $(PARFAIT_ROOT
)/bin
/parfait
443 export PARFAIT_NATIVESUNCC
=$(SPRO_VROOT
)/bin
/cc
444 export PARFAIT_NATIVESUNCXX
=$(SPRO_VROOT
)/bin
/CC
445 export PARFAIT_NATIVEGCC
=$(GCC_ROOT
)/bin
/gcc
446 export PARFAIT_NATIVEGXX
=$(GCC_ROOT
)/bin
/g
++
449 # The CCACHE makefile variable should evaluate to empty string or a pathname
450 # like /usr/bin/ccache depending on your PATH value and "which" implementation.
451 # The assignment via ":=" is important, to only do this once in a Makefile,
452 # and not on every reference to the value as "=" assignment would result in.
453 # Review `man ccache` for optional configuration tuning, like cache size etc.
455 # For production builds or suspected errors you can disable this feature by
456 # setting ENABLE_CCACHE=false (as makefile or environment variable, which
457 # is currently the default) to not even define the usage of wrapper in the
458 # userland-building makefile system.
459 # If you want to speed up your re-builds, you must set ENABLE_CCACHE=true.
460 # For legacy reasons, the CCACHE_DISABLE and CCACHE_NODISABLE variables (from
461 # configuration of the "ccache" program itself) are also supported, but direct
462 # use is discouraged, since their syntax and usage are counter-intuitive.
464 # Still, absence of ccache in PATH is not considered a fatal error since the
465 # build would just proceed well with original compiler.
466 # Note: In code below we fast-track if the makefile CCACHE variable is defined
467 # but fall back to shell executability tests if just envvar CCACHE is passed.
469 export CCACHE
:= $(shell \
470 if
test -n
"$(CCACHE)" ; then \
473 if
test x
"$${CCACHE_DISABLE-}" != x
-o x
"$(CCACHE_DISABLE)" != x \
474 -o x
"$${ENABLE_CCACHE-}" = xfalse
-o x
"$(ENABLE_CCACHE)" = xfalse \
476 echo
"NOT USING CCACHE FOR OI-USERLAND because explicitly disabled" >&2 ; \
478 if
test x
"$${CCACHE_NODISABLE-}" != x
-o x
"$(CCACHE_NODISABLE)" != x \
479 -o x
"$${ENABLE_CCACHE-}" = xtrue
-o x
"$(ENABLE_CCACHE)" = xtrue \
483 `which ccache 2>/dev/null | egrep '^/'` \
485 ; do if
test -n
"$$F" && test -x
"$$F" ; then \
487 echo
"USING CCACHE FOR OI-USERLAND: $$F" >&2 ; \
488 if
test x
"$${CCACHE_DISABLE-}" != x
; then \
489 echo
"WARNING: envvar CCACHE_DISABLE is set, so effectively ccache will not act!" >&2 ; \
494 echo
"NOT USING CCACHE FOR OI-USERLAND because not found" >&2 ; \
499 GCC_ROOT
= /usr
/gcc
/4.9
501 CC.studio
.32 = $(SPRO_VROOT
)/bin
/cc
502 CXX.studio
.32 = $(SPRO_VROOT
)/bin
/CC
503 F77.studio
.32 = $(SPRO_VROOT
)/bin
/f77
504 FC.studio
.32 = $(SPRO_VROOT
)/bin
/f90
506 CC.studio
.64 = $(SPRO_VROOT
)/bin
/cc
507 CXX.studio
.64 = $(SPRO_VROOT
)/bin
/CC
508 F77.studio
.64 = $(SPRO_VROOT
)/bin
/f77
509 FC.studio
.64 = $(SPRO_VROOT
)/bin
/f90
511 CC.gcc
.32 = $(GCC_ROOT
)/bin
/gcc
512 CXX.gcc
.32 = $(GCC_ROOT
)/bin
/g
++
513 F77.gcc
.32 = $(GCC_ROOT
)/bin
/gfortran
514 FC.gcc
.32 = $(GCC_ROOT
)/bin
/gfortran
516 CC.gcc
.64 = $(GCC_ROOT
)/bin
/gcc
517 CXX.gcc
.64 = $(GCC_ROOT
)/bin
/g
++
518 F77.gcc
.64 = $(GCC_ROOT
)/bin
/gfortran
519 FC.gcc
.64 = $(GCC_ROOT
)/bin
/gfortran
521 ifneq ($(strip $(CCACHE
)),)
523 CCACHE_WRAP_ROOT
= $(WS_TOOLS
)/ccache-wrap
524 export CC_gcc_32
:= $(CC.gcc
.32)
525 export CC_gcc_64
:= $(CC.gcc
.64)
526 export CXX_gcc_32
:= $(CXX.gcc
.32)
527 export CXX_gcc_64
:= $(CXX.gcc
.64)
528 CC.gcc
.32 := $(CCACHE_WRAP_ROOT
)/CC.gcc
.32
529 CC.gcc
.64 := $(CCACHE_WRAP_ROOT
)/CC.gcc
.64
530 CXX.gcc
.32 := $(CCACHE_WRAP_ROOT
)/CXX.gcc
.32
531 CXX.gcc
.64 := $(CCACHE_WRAP_ROOT
)/CXX.gcc
.64
533 ifneq ($(strip $(CCACHE_DIR
)),)
534 export CCACHE_DIR
:= $(CCACHE_DIR
)
537 ifneq ($(strip $(CCACHE_LOGFILE
)),)
538 export CCACHE_LOGFILE
:= $(CCACHE_LOGFILE
)
543 lint
.32 = $(SPRO_VROOT
)/bin
/lint
-m32
544 lint
.64 = $(SPRO_VROOT
)/bin
/lint
-m64
546 LINT
= $(lint.
$(BITS
))
550 PYTHON
.2.7.VENDOR_PACKAGES
.32 = /usr
/lib
/python2.7
/vendor-packages
551 PYTHON
.2.7.VENDOR_PACKAGES
.64 = /usr
/lib
/python2.7
/vendor-packages
/64
552 PYTHON
.2.7.VENDOR_PACKAGES
= $(PYTHON
.2.7.VENDOR_PACKAGES.
$(BITS
))
554 PYTHON
.3.4.VENDOR_PACKAGES
.32 = /usr
/lib
/python3.4
/vendor-packages
555 PYTHON
.3.4.VENDOR_PACKAGES
.64 = /usr
/lib
/python3.4
/vendor-packages
/64
556 PYTHON
.3.4.VENDOR_PACKAGES
= $(PYTHON
.3.4.VENDOR_PACKAGES.
$(BITS
))
558 ifeq ($(strip $(PARFAIT_BUILD
)),yes
)
559 CC.studio
.32 = $(WS_TOOLS
)/parfait
/cc
560 CXX.studio
.32 = $(WS_TOOLS
)/parfait
/CC
561 CC.studio
.64 = $(WS_TOOLS
)/parfait
/cc
562 CXX.studio
.64 = $(WS_TOOLS
)/parfait
/CC
563 CC.gcc
.32 = $(WS_TOOLS
)/parfait
/gcc
564 CXX.gcc
.32 = $(WS_TOOLS
)/parfait
/g
++
565 CC.gcc
.64 = $(WS_TOOLS
)/parfait
/gcc
566 CXX.gcc
.64 = $(WS_TOOLS
)/parfait
/g
++
567 LD
= $(WS_TOOLS
)/parfait
/ld
570 CC
= $(CC.
$(COMPILER
).
$(BITS
))
571 CXX
= $(CXX.
$(COMPILER
).
$(BITS
))
572 F77
= $(F77.
$(COMPILER
).
$(BITS
))
573 FC
= $(FC.
$(COMPILER
).
$(BITS
))
576 RUBY_LIB_VERSION
.2.2 = 2.2.0
577 RUBY_LIB_VERSION
.2.3 = 2.3.0
578 RUBY
.2.2 = /usr
/ruby
/2.2/bin
/ruby
579 RUBY
.2.3 = /usr
/ruby
/2.3/bin
/ruby
580 RUBY
= $(RUBY.
$(RUBY_VERSION
))
581 RUBY_LIB_VERSION
= $(RUBY_LIB_VERSION.
$(RUBY_VERSION
))
583 # Transform Ruby scripts to call the supported
584 # version-specific ruby; used in multiple *.mk files
585 RUBY_SCRIPT_FIX_FUNC
= \
586 $(GNU_GREP
) -Rl
'^\#! */usr/bin/env ruby' | \
587 /usr
/bin
/xargs
-I\
{\
} $(GSED
) -i
-e \
588 '1s%^\#! */usr/bin/env ruby%\#!/usr/ruby/$(RUBY_VERSION)/bin/ruby%' \
591 # Use the ruby lib versions to represent the RUBY_VERSIONS that
592 # need to get built. This is done because during package transformations
593 # both the ruby version and the ruby library version are needed.
594 RUBY_VERSIONS
= $(RUBY_LIB_VERSION
)
596 PYTHON_VENDOR_PACKAGES
.32 = /usr
/lib
/python
$(PYTHON_VERSION
)/vendor-packages
597 PYTHON_VENDOR_PACKAGES
.64 = /usr
/lib
/python
$(PYTHON_VERSION
)/vendor-packages
/64
598 PYTHON_VENDOR_PACKAGES
= $(PYTHON_VENDOR_PACKAGES.
$(BITS
))
600 PYTHON
.2.7.32 = /usr
/bin
/python2.7
601 PYTHON
.2.7.64 = /usr
/bin
/$(MACH64
)/python2.7
603 PYTHON
.3.4.32 = /usr
/bin
/python3.4
604 PYTHON
.3.4.64 = /usr
/bin
/$(MACH64
)/python3.4
606 PYTHON
.32 = $(PYTHON.
$(PYTHON_VERSION
).32)
607 PYTHON
.64 = $(PYTHON.
$(PYTHON_VERSION
).64)
608 PYTHON
= $(PYTHON.
$(PYTHON_VERSION
).
$(BITS
))
610 # The default is site-packages, but that directory belongs to the end-user.
611 # Modules which are shipped by the OS but not with the core Python distribution
612 # belong in vendor-packages.
613 PYTHON_LIB
= /usr
/lib
/python
$(PYTHON_VERSION
)/vendor-packages
614 PYTHON_DATA
= $(PYTHON_LIB
)
616 JAVA7_HOME
= /usr
/jdk
/instances
/openjdk1.7
.0
617 JAVA8_HOME
= /usr
/jdk
/instances
/openjdk1.8
.0
618 JAVA_HOME
= $(JAVA8_HOME
)
620 # This is the default BUILD version of perl
621 # Not necessarily the system's default version, i.e. /usr/bin/perl
624 PERL_VERSIONS
= 5.22 5.24
626 PERL
.5.22 = /usr
/perl5
/5.22/bin
/perl
627 PERL
.5.24 = /usr
/perl5
/5.24/bin
/perl
629 POD2MAN
.5.22 = /usr
/perl5
/5.22/bin
/pod2man
630 POD2MAN
.5.24 = /usr
/perl5
/5.24/bin
/pod2man
632 PERL
= $(PERL.
$(PERL_VERSION
))
633 POD2MAN
= $(POD2MAN.
$(PERL_VERSION
))
635 PERL_ARCH
:= $(shell $(PERL
) -e
'use Config; print $$Config{archname}')
636 PERL_ARCH_FUNC
= $(shell $(1) -e
'use Config; print $$Config{archname}')
637 # Optimally we should ask perl which C compiler was used but it doesn't
638 # result in a full path name. Only "c" is being recorded
639 # inside perl builds while we actually need a full path to
640 # the studio compiler.
641 #PERL_CC := $(shell $(PERL) -e 'use Config; print $$Config{cc}')
643 PKG_MACROS
+= PERL_ARCH
=$(PERL_ARCH
)
644 PKG_MACROS
+= PERL_VERSION
=$(PERL_VERSION
)
646 # Config magic for Postgres/EnterpriseDB/...
647 # Default DB version is the oldest one, for hopefully best built complatibility
649 PG_IMPLEM ?
= postgres
650 PG_VERNUM
= $(subst .
,,$(PG_VERSION
))
651 # For dependencies, including REQUIRED_PACKAGES if needed
652 PG_BASEPKG
= database
/$(PG_IMPLEM
)-$(PG_VERNUM
)
654 PG_HOME
= $(USRDIR
)/$(PG_IMPLEM
)/$(PG_VERSION
)
655 PG_BINDIR
.32 = $(PG_HOME
)/bin
656 PG_BINDIR
.64 = $(PG_HOME
)/bin
/$(MACH64
)
657 PG_BINDIR
= $(PG_BINDIR.
$(BITS
))
658 PG_INCDIR
= $(PG_HOME
)/include
659 PG_MANDIR
= $(PG_HOME
)/man
660 PG_SHAREDIR
= $(PG_HOME
)/share
661 PG_DOCDIR
= $(PG_HOME
)/doc
662 PG_LIBDIR
.32 = $(PG_HOME
)/lib
663 PG_LIBDIR
.64 = $(PG_HOME
)/lib
/$(MACH64
)
664 PG_LIBDIR
= $(PG_LIBDIR.
$(BITS
))
665 PG_CONFIG
.32 = $(PG_BINDIR
.32)/pg_config
666 PG_CONFIG
.64 = $(PG_BINDIR
.64)/pg_config
667 PG_CONFIG
= $(PG_CONFIG.
$(BITS
))
669 PKG_MACROS
+= PG_VERSION
=$(PG_VERSION
)
670 PKG_MACROS
+= PG_VERNUM
=$(PG_VERNUM
)
671 PKG_MACROS
+= PG_BASEPKG
=$(PG_BASEPKG
)
673 # Config magic for MySQL/MariaDB/Percona/...
674 # Default DB version is the oldest one, for hopefully best built compatibility
675 # NOTE: At this time the gate does not provide a recipe for actual "mysql"
676 # The "/usr/mysql/*" trees are mediated to preferred MariaDB or Percona variant
678 MYSQL_IMPLEM ?
= mariadb
679 MYSQL_VERNUM
= $(subst .
,,$(MYSQL_VERSION
))
680 # For dependencies, including REQUIRED_PACKAGES if needed
681 MYSQL_BASEPKG
= database
/$(MYSQL_IMPLEM
)-$(MYSQL_VERNUM
)
683 MYSQL_HOME
= $(USRDIR
)/$(MYSQL_IMPLEM
)/$(MYSQL_VERSION
)
684 MYSQL_BINDIR
.32 = $(MYSQL_HOME
)/bin
685 MYSQL_BINDIR
.64 = $(MYSQL_HOME
)/bin
/$(MACH64
)
686 MYSQL_BINDIR
= $(MYSQL_BINDIR.
$(BITS
))
687 MYSQL_INCDIR
= $(MYSQL_HOME
)/include
688 MYSQL_MANDIR
= $(MYSQL_HOME
)/man
689 MYSQL_SHAREDIR
= $(MYSQL_HOME
)/share
690 MYSQL_DOCDIR
= $(MYSQL_HOME
)/doc
691 MYSQL_LIBDIR
.32 = $(MYSQL_HOME
)/lib
692 MYSQL_LIBDIR
.64 = $(MYSQL_HOME
)/lib
/$(MACH64
)
693 MYSQL_LIBDIR
= $(MYSQL_LIBDIR.
$(BITS
))
694 MYSQL_CONFIG
.32 = $(MYSQL_BINDIR
.32)/mysql_config
695 MYSQL_CONFIG
.64 = $(MYSQL_BINDIR
.64)/mysql_config
696 MYSQL_CONFIG
= $(MYSQL_CONFIG.
$(BITS
))
698 PKG_MACROS
+= MYSQL_VERSION
=$(MYSQL_VERSION
)
699 PKG_MACROS
+= MYSQL_VERNUM
=$(MYSQL_VERNUM
)
700 PKG_MACROS
+= MYSQL_BASEPKG
=$(MYSQL_BASEPKG
)
702 # Default libjpeg implementation layout
703 JPEG_IMPLEM ?
= libjpeg8-turbo
704 JPEG_HOME
= $(USRLIBDIR
)/$(JPEG_IMPLEM
)
705 JPEG_BINDIR
.32 = $(JPEG_HOME
)/bin
706 JPEG_BINDIR
.64 = $(JPEG_HOME
)/bin
/$(MACH64
)
707 JPEG_BINDIR
= $(JPEG_BINDIR.
$(BITS
))
708 JPEG_INCDIR
= $(USRINCDIR
)/$(JPEG_IMPLEM
)
709 JPEG_LIBDIR
.32 = $(JPEG_HOME
)/lib
710 JPEG_LIBDIR
.64 = $(JPEG_HOME
)/lib
/$(MACH64
)
711 JPEG_LIBDIR
= $(JPEG_LIBDIR.
$(BITS
))
712 JPEG_CPPFLAGS
= -I
$(JPEG_INCDIR
)
713 JPEG_CFLAGS
.32 = -Wl
,-L
$(JPEG_LIBDIR
.32) -Wl
,-R
$(JPEG_LIBDIR
.32)
714 JPEG_CFLAGS
.64 = -Wl
,-L
$(JPEG_LIBDIR
.64) -Wl
,-R
$(JPEG_LIBDIR
.64)
715 JPEG_CFLAGS
= $(JPEG_CFLAGS.
$(BITS
))
716 JPEG_CXXFLAGS
.32 = -Wl
,-L
$(JPEG_LIBDIR
.32) -Wl
,-R
$(JPEG_LIBDIR
.32)
717 JPEG_CXXFLAGS
.64 = -Wl
,-L
$(JPEG_LIBDIR
.64) -Wl
,-R
$(JPEG_LIBDIR
.64)
718 JPEG_CXXFLAGS
= $(JPEG_CXXFLAGS.
$(BITS
))
719 JPEG_LDFLAGS
.32 = -L
$(JPEG_LIBDIR
.32) -R
$(JPEG_LIBDIR
.32)
720 JPEG_LDFLAGS
.64 = -L
$(JPEG_LIBDIR
.64) -R
$(JPEG_LIBDIR
.64)
721 JPEG_LDFLAGS
= $(JPEG_LDFLAGS.
$(BITS
))
723 # This is the default BUILD version of tcl
724 # Not necessarily the system's default version, i.e. /usr/bin/tclsh
726 TCLSH
.8.5.i386.32
= /usr
/bin
/i86
/tclsh8.5
727 TCLSH
.8.5.i386.64
= /usr
/bin
/amd64
/tclsh8.5
728 TCLSH
.8.5.sparc
.32 = /usr
/bin
/sparcv7
/tclsh8.5
729 TCLSH
.8.5.sparc
.64 = /usr
/bin
/sparcv9
/tclsh8.5
730 TCLSH
= $(TCLSH.
$(TCL_VERSION
).
$(MACH
).
$(BITS
))
732 CCSMAKE
= /usr
/ccs
/bin
/make
733 GMAKE
= /usr
/gnu
/bin
/make
734 GPATCH
= /usr
/gnu
/bin
/patch
736 GPATCH_BACKUP
= --backup
--version-control
=numbered
737 GPATCH_FLAGS
= -p
$(PATCH_LEVEL
) $(GPATCH_BACKUP
)
738 GSED
= /usr
/gnu
/bin
/sed
739 GDIFF
= /usr
/gnu
/bin
/diff
740 GSORT
= /usr
/gnu
/bin
/sort
741 GUNZIP
= /usr
/bin
/gunzip
743 PKGREPO
= /usr
/bin
/pkgrepo
744 PKGSEND
= /usr
/bin
/pkgsend
745 ifeq ($(strip $(PKGLINT_COMPONENT
)),)
746 PKGLINT
= /usr
/bin
/pkglint
748 PKGLINT
= ${WS_TOOLS}/pkglint
751 ACLOCAL
= /usr
/bin
/aclocal-1.10
752 AUTOMAKE
= /usr
/bin
/automake-1.10
753 AUTORECONF
= /usr
/bin
/autoreconf
755 KSH93
= /usr
/bin
/ksh93
756 TOUCH
= /usr
/bin
/touch
757 MKDIR
= /bin
/mkdir
-p
766 INSTALL
= /usr
/bin
/ginstall
767 GNU_GREP
= /usr
/gnu
/bin
/grep
768 CHMOD
= /usr
/bin
/chmod
771 GAS
= /usr
/gnu
/bin
/as
772 GTAR
= /usr
/gnu
/bin
/tar
773 STRIP
= /usr
/bin
/strip
774 IPS2TGZ
= $(WS_TOOLS
)/ips2tgz
776 INS.
dir= $(INSTALL
) -d
$@
777 INS.file
= $(INSTALL
) -m
444 $< $(@D
)
779 PKG_CONFIG_PATH
.32 = /usr
/lib
/pkgconfig
780 PKG_CONFIG_PATH
.64 = /usr
/lib
/$(MACH64
)/pkgconfig
781 PKG_CONFIG_PATH
= $(PKG_CONFIG_PATH.
$(BITS
))
783 # Set default path for environment modules
784 MODULE_VERSION
= 3.2.10
785 MODULE_PATH
= /usr
/share
/Modules
/modulefiles
786 MODULE_VERSIONS_PATH
= /usr
/share
/Modules
/versions
788 # Path to bash completions
789 BASH_COMPLETIONS_PATH
= /usr
/share
/bash-completion
/completions
792 # C preprocessor flag sets to ease feature selection. Add the required
793 # feature to your Makefile with CPPFLAGS += $(FEATURE_MACRO) and add to
794 # the component build with CONFIGURE_OPTIONS += CPPFLAGS="$(CPPFLAGS)" or
798 # Enables visibility of some c99 math functions that aren't visible by default.
799 # What other side-effects are there?
800 CPP_C99_EXTENDED_MATH
= -D_STDC_99
802 # Enables large file support for components that have no other means of doing
803 # so. Use CPP_LARGEFILES and not the .32/.64 variety directly
804 CPP_LARGEFILES
.32 := $(shell getconf LFS_CFLAGS
)
805 CPP_LARGEFILES
.64 := $(shell getconf LFS64_CFLAGS
)
806 CPP_LARGEFILES
= $(CPP_LARGEFILES.
$(BITS
))
808 # Enables some #pragma redefine_extname to POSIX-compliant Standard C Library
809 # functions. Also avoids the component's #define _POSIX_C_SOURCE to some value
810 # we currently do not support.
811 CPP_POSIX
= -D_POSIX_C_SOURCE
=200112L -D_POSIX_PTHREAD_SEMANTICS
813 # XPG6 mode. This option enables XPG6 conformance, plus extensions.
814 # Amongst other things, this option will cause system calls like
815 # popen (3C) and system (3C) to invoke the standards-conforming
816 # shell, /usr/xpg4/bin/sh, instead of /usr/bin/sh. Add studio_XPG6MODE to
817 # CFLAGS instead of using this directly
818 CPP_XPG6MODE
= -D_XOPEN_SOURCE
=600 -D__EXTENSIONS__
=1 -D_XPG6
820 # XPG5 mode. These options are specific for C++, where _XPG6,
821 # _XOPEN_SOURCE=600 and C99 are illegal. -D__EXTENSIONS__=1 is legal in C++.
822 CPP_XPG5MODE
= -D_XOPEN_SOURCE
=500 -D__EXTENSIONS__
=1 -D_XPG5
825 # Studio C compiler flag sets to ease feature selection. Add the required
826 # feature to your Makefile with CFLAGS += $(FEATURE_MACRO) and add to the
827 # component build with CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar.
830 # Generate 32/64 bit objects
833 # Code generation instruction set and optimization 'hints'. Use studio_XBITS
834 # and not the .arch.bits variety directly.
835 studio_XBITS.sparc
.32 = -xtarget
=ultra2
-xarch
=sparcvis
-xchip
=ultra2
836 studio_XBITS.sparc
.64 =
837 ifneq ($(strip $(PARFAIT_BUILD
)),yes
)
838 studio_XBITS.sparc
.64 += -xtarget
=ultra2
840 studio_XBITS.sparc
.64 += -xarch
=sparcvis
-xchip
=ultra2
841 studio_XBITS.i386.32
= -xchip
=pentium
842 studio_XBITS.i386.64
= -xchip
=generic
-Ui386
-U__i386
843 studio_XBITS
= $(studio_XBITS.
$(MACH
).
$(BITS
))
845 # Turn on recognition of supported C99 language features and enable the 1999 C
846 # standard library semantics of routines that appear in both the 1990 and
847 # 1999 C standard. To use set studio_C99MODE=$(studio_99_ENABLE) in your
848 # component Makefile.
849 studio_C99_ENABLE
= -xc99
=all
851 # Turn off recognition of C99 language features, and do not enable the 1999 C
852 # standard library semantics of routines that appeared in both the 1990 and
853 # 1999 C standard. To use set studio_C99MODE=$(studio_99_DISABLE) in your
854 # component Makefile.
855 studio_C99_DISABLE
= -xc99
=none
857 # Use the compiler default 'xc99=all,no_lib'
860 # For C++, compatibility with C99 (which is technically illegal) is
861 # enabled in a different way. So, we must use a different macro for it.
862 studio_cplusplus_C99_ENABLE
= -xlang
=c99
865 studio_cplusplus_C99_DISABLE
=
867 # And this is the macro you should actually use
868 studio_cplusplus_C99MODE
=
870 # Turn on C99 for gcc
871 gcc_C99_ENABLE
= -std
=c99
873 # Allow zero-sized struct/union declarations and void functions with return
875 studio_FEATURES_EXTENSIONS
= -features
=extensions
877 # Control the Studio optimization level.
878 studio_OPT.sparc
.32 = -xO4
879 studio_OPT.sparc
.64 = -xO4
880 studio_OPT.i386.32
= -xO4
881 studio_OPT.i386.64
= -xO4
882 studio_OPT
= $(studio_OPT.
$(MACH
).
$(BITS
))
884 # Studio PIC code generation. Use CC_PIC instead to select PIC code generation.
885 studio_PIC
= -KPIC
-DPIC
887 # The Sun Studio 11 compiler has changed the behaviour of integer
888 # wrap arounds and so a flag is needed to use the legacy behaviour
889 # (without this flag panics/hangs could be exposed within the source).
890 # This is used through studio_IROPTS, not the 'sparc' variety.
891 studio_IROPTS.sparc
= -W2
,-xwrap_int
892 studio_IROPTS
= $(studio_IROPTS.
$(MACH
))
894 # Control register usage for generated code. SPARC ABI requires system
895 # libraries not to use application registers. x86 requires 'no%frameptr' at
898 # We should just use -xregs but we need to workaround 7030022. Note
899 # that we can't use the (documented) -Wc,-xregs workaround because
900 # libtool really hates -Wc and thinks it should be -Wl. Instead
901 # we use an (undocumented) option which actually happens to be what
903 studio_XREGS.sparc
= -Qoption cg
-xregs
=no
%appl
904 studio_XREGS.i386
= -xregs
=no
%frameptr
905 studio_XREGS
= $(studio_XREGS.
$(MACH
))
907 gcc_XREGS.sparc
= -mno-app-regs
909 gcc_XREGS
= $(gcc_XREGS.
$(MACH
))
911 # Set data alignment on sparc to reasonable values, 8 byte alignment for 32 bit
912 # objects and 16 byte alignment for 64 bit objects. This is added to CFLAGS by
914 studio_ALIGN.sparc
.32 = -xmemalign
=8s
915 studio_ALIGN.sparc
.64 = -xmemalign
=16s
916 studio_ALIGN
= $(studio_ALIGN.
$(MACH
).
$(BITS
))
918 # Studio shorthand for building multi-threaded code, enables -D_REENTRANT and
919 # linking with threadin support. This is added to CFLAGS by default, override
920 # studio_MT to turn this off.
923 # See CPP_XPG6MODE comment above.
924 studio_XPG6MODE
= $(studio_C99MODE
) $(CPP_XPG6MODE
)
925 XPG6MODE
= $(studio_XPG6MODE
)
927 # See CPP_XPG5MODE comment above. You can only use this in C++, not in C99.
928 studio_XPG5MODE
= $(studio_cplusplus_C99MODE
) $(CPP_XPG5MODE
)
929 XPG5MODE
= $(studio_XPG5MODE
)
931 # Default Studio C compiler flags. Add the required feature to your Makefile
932 # with CFLAGS += $(FEATURE_MACRO) and add to the component build with
933 # CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar. In most cases, it
934 # should not be necessary to add CFLAGS to any environment other than the
935 # configure environment.
936 CFLAGS.studio
+= $(studio_OPT
) $(studio_XBITS
) $(studio_XREGS
) \
937 $(studio_IROPTS
) $(studio_C99MODE
) $(studio_ALIGN
) \
941 # GNU C compiler flag sets to ease feature selection. Add the required
942 # feature to your Makefile with CFLAGS += $(FEATURE_MACRO) and add to the
943 # component build with CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar.
946 # GCC Compiler optimization flag
949 # GCC PIC code generation. Use CC_PIC instead to select PIC code generation.
950 gcc_PIC
= -fPIC
-DPIC
952 # Generic macro for PIC code generation. Use this macro instead of the
953 # compiler specific variant.
954 CC_PIC
= $($(COMPILER
)_PIC
)
957 # Default GNU C compiler flags. Add the required feature to your Makefile
958 # with CFLAGS += $(FEATURE_MACRO) and add to the component build with
959 # CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar. In most cases, it
960 # should not be necessary to add CFLAGS to any environment other than the
961 # configure environment.
962 CFLAGS.gcc
+= $(gcc_OPT
)
963 CFLAGS.gcc
+= $(gcc_XREGS
)
966 # Build 32 or 64 bit objects.
969 # Add compiler specific 'default' features
970 CFLAGS
+= $(CFLAGS.
$(COMPILER
))
973 # Studio C++ requires -norunpath to avoid adding its location into the RUNPATH
974 # to C++ applications.
975 studio_NORUNPATH
= -norunpath
977 # To link in standard mode (the default mode) without any C++ libraries
978 # (except libCrun), use studio_LIBRARY_NONE in your component Makefile.
979 studio_LIBRARY_NONE
= -library
=%none
981 # Don't link C++ with any C++ Runtime or Standard C++ library
982 studio_CXXLIB_NONE
= -xnolib
984 # Link C++ with the Studio C++ Runtime and Standard C++ library. This is the
985 # default for "standard" mode.
986 studio_CXXLIB_CSTD
= -library
=Cstd
,Crun
988 # link C++ with the Studio C++ Runtime and Apache Standard C++ library
989 studio_CXXLIB_APACHE
= -library
=stdcxx4
,Crun
991 # Add the C++ ABI compatibility flags for older ABI compatibility. The default
992 # is "standard mode" (-compat=5)
993 studio_COMPAT_VERSION_4
= -compat
=4
995 # Tell the compiler that we don't want the studio runpath added to the
996 # linker flags. We never want the Studio location added to the RUNPATH.
997 CXXFLAGS
+= $($(COMPILER
)_NORUNPATH
)
999 # Build 32 or 64 bit objects in C++ as well.
1000 CXXFLAGS
+= $(CC_BITS
)
1002 # Build 32 or 64 bit objects in FORTRAN as well.
1003 F77FLAGS
+= $(CC_BITS
)
1004 FCFLAGS
+= $(CC_BITS
)
1008 # Solaris linker flag sets to ease feature selection. Add the required
1009 # feature to your Makefile with LDFLAGS += $(FEATURE_MACRO) and add to the
1010 # component build with CONFIGURE_OPTIONS += LDFLAGS="$(LDFLAGS)" or similiar.
1013 # set the bittedness that we want to link
1017 LD_BITS
= $($(LINKER
).
ld.
$(BITS
))
1018 LDFLAGS
= $(LD_BITS
)
1020 # Reduce the symbol table size, effectively conflicting with -g. We should
1021 # get linker guidance here.
1022 LD_Z_REDLOCSYM
= -z redlocsym
1024 # Cause the linker to rescan archive libraries and resolve remaining unresolved
1025 # symbols recursively until all symbols are resolved. Components should be
1026 # linking in the libraries they need, in the required order. This should
1027 # only be required if the component's native build is horribly broken.
1028 LD_Z_RESCAN_NOW
= -z rescan-now
1030 LD_Z_TEXT
= -z direct
1032 # make sure that -lc is always present when building shared objects.
1035 # make sure all symbols are defined.
1038 # eliminate unreferenced dynamic dependencies
1039 LD_Z_IGNORE
= -z ignore
1041 # use direct binding
1042 LD_B_DIRECT
= -Bdirect
1044 # use generic macro names for enabling/disabling ASLR
1045 ASLR_ENABLE
= -z aslr
=enable
1046 ASLR_DISABLE
= -z aslr
=disable
1047 ASLR_MODE
= $(ASLR_DISABLE
)
1049 # by default, turn off Address Space Layout Randomization for ELF executables;
1050 # to explicitly enable ASLR, set ASLR_MODE = $(ASLR_ENABLE)
1051 # in that component's Makefile
1052 LD_Z_ASLR
= $(ASLR_MODE
)
1055 # More Solaris linker flags that we want to be sure that everyone gets. This
1056 # is automatically added to the calling environment during the 'build' and
1057 # 'install' phases of the component build. Each individual feature can be
1058 # turned off by adding FEATURE_MACRO= to the component Makefile.
1061 # Create a non-executable stack when linking.
1062 LD_MAP_NOEXSTK.i386
= -M
/usr
/lib
/ld/map.noexstk
1063 LD_MAP_NOEXSTK.sparc
= -M
/usr
/lib
/ld/map.noexstk
1065 # Create a non-executable bss segment when linking.
1066 LD_MAP_NOEXBSS
= -M
/usr
/lib
/ld/map.noexbss
1068 # Create a non-executable data segment when linking. Due to PLT needs, the
1069 # data segment must be executable on sparc, but the bss does not.
1070 # see mapfile comments for more information
1071 LD_MAP_NOEXDATA.i386
= -M
/usr
/lib
/ld/map.noexdata
1072 LD_MAP_NOEXDATA.sparc
= $(LD_MAP_NOEXBSS
)
1075 LD_MAP_PAGEALIGN
= -M
/usr
/lib
/ld/map.pagealign
1077 # Linker options to add when only building libraries
1078 LD_OPTIONS_SO
+= $(LD_Z_TEXT
) $(LD_Z_DEFS
) $(LD_DEF_LIBS
)
1080 # Default linker options that everyone should get. Do not add additional
1081 # libraries to this macro, as it will apply to everything linked during the
1083 LD_OPTIONS
+= $(LD_MAP_NOEXSTK.
$(MACH
)) $(LD_MAP_NOEXDATA.
$(MACH
)) \
1084 $(LD_MAP_PAGEALIGN
) $(LD_B_DIRECT
) $(LD_Z_IGNORE
)
1086 # only used on executables
1087 LD_EXEC_OPTIONS
= $(LD_Z_ASLR
)
1089 # Environment variables and arguments passed into the build and install
1090 # environment(s). These are the initial settings.
1091 COMPONENT_BUILD_ENV
= \
1092 LD_OPTIONS
="$(LD_OPTIONS)" \
1093 LD_EXEC_OPTIONS
="$(LD_EXEC_OPTIONS)"
1094 COMPONENT_INSTALL_ENV
= \
1095 LD_OPTIONS
="$(LD_OPTIONS)" \
1096 LD_EXEC_OPTIONS
="$(LD_EXEC_OPTIONS)"
1098 # PERL options which depend on C options should be placed here
1099 # Don't trust Perl $Config{optimize}, we can get Studio flags
1100 PERL_OPTIMIZE
=$(gcc_OPT
)
1102 # We need this to overwrite options of perl used to compile illumos-gate
1103 PERL_STUDIO_OVERWRITE
= cc="$(CC)" cccdlflags
="$(CC_PIC)" ld="$(CC)" ccname
="$(shell basename $(CC))" optimize
="$(gcc_OPT)"
1105 # Allow user to override default maximum number of archives
1106 NUM_EXTRA_ARCHIVES
= 1 2 3 4 5 6 7 8 9 10
1108 # Rewrite absolute source-code paths into relative for ccache, so that any
1109 # workspace with a shared CCACHE_DIR can benefit when compiling a component
1110 ifneq ($(strip $(CCACHE
)),)
1111 export CCACHE_BASEDIR
= $(BUILD_DIR_
$(BITS
))
1112 COMPONENT_BUILD_ENV
+= CCACHE
="$(CCACHE)"
1113 COMPONENT_INSTALL_ENV
+= CCACHE
="$(CCACHE)"
1114 COMPONENT_TEST_ENV
+= CCACHE
="$(CCACHE)"
1115 COMPONENT_BUILD_ENV
+= CC_gcc_32
="$(CC_gcc_32)"
1116 COMPONENT_BUILD_ENV
+= CC_gcc_64
="$(CC_gcc_32)"
1117 COMPONENT_BUILD_ENV
+= CXX_gcc_32
="$(CXX_gcc_64)"
1118 COMPONENT_BUILD_ENV
+= CXX_gcc_64
="$(CXX_gcc_64)"
1119 COMPONENT_INSTALL_ENV
+= CC_gcc_32
="$(CC_gcc_32)"
1120 COMPONENT_INSTALL_ENV
+= CC_gcc_64
="$(CC_gcc_32)"
1121 COMPONENT_INSTALL_ENV
+= CXX_gcc_32
="$(CXX_gcc_64)"
1122 COMPONENT_INSTALL_ENV
+= CXX_gcc_64
="$(CXX_gcc_64)"
1123 COMPONENT_TEST_ENV
+= CC_gcc_32
="$(CC_gcc_32)"
1124 COMPONENT_TEST_ENV
+= CC_gcc_64
="$(CC_gcc_32)"
1125 COMPONENT_TEST_ENV
+= CXX_gcc_32
="$(CXX_gcc_64)"
1126 COMPONENT_TEST_ENV
+= CXX_gcc_64
="$(CXX_gcc_64)"
1127 COMPONENT_BUILD_ENV.
$(BITS
) += CCACHE_BASEDIR
="$(BUILD_DIR_$(BITS))"
1128 COMPONENT_INSTALL_ENV.
$(BITS
) += CCACHE_BASEDIR
="$(BUILD_DIR_$(BITS))"
1129 COMPONENT_TEST_ENV.
$(BITS
) += CCACHE_BASEDIR
="$(BUILD_DIR_$(BITS))"
1131 ifneq ($(strip $(CCACHE_DIR
)),)
1132 COMPONENT_BUILD_ENV
+= CCACHE_DIR
="$(CCACHE_DIR)"
1133 COMPONENT_INSTALL_ENV
+= CCACHE_DIR
="$(CCACHE_DIR)"
1134 COMPONENT_TEST_ENV
+= CCACHE_DIR
="$(CCACHE_DIR)"
1137 ifneq ($(strip $(CCACHE_LOGFILE
)),)
1138 COMPONENT_BUILD_ENV
+= CCACHE_LOGFILE
="$(CCACHE_LOGFILE)"
1139 COMPONENT_INSTALL_ENV
+= CCACHE_LOGFILE
="$(CCACHE_LOGFILE)"
1140 COMPONENT_TEST_ENV
+= CCACHE_LOGFILE
="$(CCACHE_LOGFILE)"
1145 # Add any bit-specific settings
1146 COMPONENT_BUILD_ENV
+= $(COMPONENT_BUILD_ENV.
$(BITS
))
1147 COMPONENT_BUILD_ARGS
+= $(COMPONENT_BUILD_ARGS.
$(BITS
))
1148 COMPONENT_INSTALL_ENV
+= $(COMPONENT_INSTALL_ENV.
$(BITS
))
1149 COMPONENT_INSTALL_ARGS
+= $(COMPONENT_INSTALL_ARGS.
$(BITS
))
1151 # declare these phony so that we avoid filesystem conflicts.
1152 .PHONY
: prep build
install publish
test clean clobber parfait
1154 # If there are no tests to execute
1155 NO_TESTS
= test-nothing
1157 @echo
"There are no tests available at this time."
1159 # default behaviour for 'component-hook' target is to echo the component
1160 # name and version information, but more complex behaviour can be implemented
1161 # via command line setting of the COMPONENT_HOOK macro.
1162 COMPONENT_HOOK ?
= echo
$(COMPONENT_NAME
) $(COMPONENT_VERSION
)
1168 # Packages with tools that are required to build Userland components
1170 REQUIRED_PACKAGES
+= metapackages
/build-essential
1172 # Only a default dependency if component being built produces binaries.
1173 ifneq ($(strip $(BUILD_BITS
)),NO_ARCH
)
1174 REQUIRED_PACKAGES
+= system
/library
1177 include $(WS_MAKE_RULES
)/environment.mk
1179 # A simple rule to print the value of any macro. Ex:
1180 # $ gmake print-REQUIRED_PACKAGES
1181 # Note that some macros are set on a per target basis, so what you see
1182 # is not always what you get.
1184 @echo
'$(subst ','\'',$*=$($*)) (origin: $(origin $*), flavor
: $(flavor
$*))'