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
= 2.11
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
/sh
109 PUNAME
= /usr
/bin
/puname
111 PKG_REPO
= file
:$(WS_REPO
)
113 COMPONENT_SRC_NAME
= $(COMPONENT_NAME
)
115 COMPONENT_LICENSE_FILE ?
= $(COMPONENT_NAME
).license
117 COMPONENT_DIR
:= $(shell pwd
)
118 SOURCE_DIR
= $(COMPONENT_DIR
)/$(COMPONENT_SRC
)
119 BUILD_DIR
= $(COMPONENT_DIR
)/build
120 PROTO_DIR
= $(BUILD_DIR
)/prototype
/$(MACH
)
123 ARCHLIBSUBDIR64
= $(MACH64
)
124 ARCHLIBSUBDIR
= $(ARCHLIBSUBDIR
$(BITS
))
132 KERNELDRVDIR
= /kernel
/drv
133 KERNELDRVDIR32
=/kernel
/drv
134 KERNELDRVDIR64
=/kernel
/drv
/$(MACH64
)
135 USRBINDIR
= $(USRDIR
)/bin
136 USRBINDIR32
= $(USRDIR
)/bin
/$(MACH32
)
137 USRBINDIR64
= $(USRDIR
)/bin
/$(MACH64
)
138 USRSBINDIR
= $(USRDIR
)/sbin
139 USRSBINDIR32
= $(USRDIR
)/sbin
/$(MACH32
)
140 USRSBINDIR64
= $(USRDIR
)/sbin
/$(MACH64
)
141 USRLIBDIR
= $(USRDIR
)/lib
142 USRLIBDIR32
= $(USRDIR
)/lib
143 USRLIBDIR64
= $(USRDIR
)/lib
/$(MACH64
)
144 USRSHAREDIR
= $(USRDIR
)/share
145 USRINCDIR
= $(USRDIR
)/include
146 USRSHARELOCALEDIR
= $(USRSHAREDIR
)/locale
147 USRSHAREMANDIR
= $(USRSHAREDIR
)/man
148 USRSHAREDOCDIR
= $(USRSHAREDIR
)/doc
149 USRSHARELIBDIR
= $(USRSHAREDIR
)/lib
150 USRSHAREMAN1DIR
= $(USRSHAREMANDIR
)/man1
151 USRSHAREMAN1MDIR
= $(USRSHAREMANDIR
)/man1m
152 USRSHAREMAN3DIR
= $(USRSHAREMANDIR
)/man3
153 USRSHAREMAN4DIR
= $(USRSHAREMANDIR
)/man4
154 USRSHAREMAN5DIR
= $(USRSHAREMANDIR
)/man5
155 USRSHAREMAN8DIR
= $(USRSHAREMANDIR
)/man8
156 USRKERNELDRVDIR
= $(USRDIR
)/kernel
/drv
157 USRKERNELDRVDIR32
= $(USRDIR
)/kernel
/drv
158 USRKERNELDRVDIR64
= $(USRDIR
)/kernel
/drv
/$(MACH64
)
160 # The *.$(BITS) variables are different from those above (better suited for
161 # isaexec wrapper), and allow for default 32-bit vs. nondefault 64-bit setups
162 USRBINDIR
.32 = $(USRBINDIR
)
163 USRBINDIR
.64 = $(USRBINDIR64
)
164 USRSBINDIR
.32 = $(USRSBINDIR
)
165 USRSBINDIR
.64 = $(USRSBINDIR64
)
166 USRLIBDIR
.32 = $(USRLIBDIR
)
167 USRLIBDIR
.64 = $(USRLIBDIR64
)
169 PROTOETCDIR
= $(PROTO_DIR
)/$(ETCDIR
)
170 PROTOETCSECDIR
= $(PROTO_DIR
)/$(ETCDIR
)/security
171 PROTOUSRDIR
= $(PROTO_DIR
)/$(USRDIR
)
172 PROTOBINDIR
= $(PROTO_DIR
)/$(BINDIR
)
173 PROTOSBINDIR
= $(PROTO_DIR
)/$(SBINDIR
)
174 PROTOLIBDIR
= $(PROTO_DIR
)/$(LIBDIR
)
175 PROTOVARDIR
= $(PROTO_DIR
)/$(VARDIR
)
176 PROTOKERNELDRVDIR
= $(PROTO_DIR
)/$(KERNELDRVDIR
)
177 PROTOKERNELDRVDIR32
= $(PROTO_DIR
)/$(KERNELDRVDIR32
)
178 PROTOKERNELDRVDIR64
= $(PROTO_DIR
)/$(KERNELDRVDIR64
)
179 PROTOUSRBINDIR
= $(PROTO_DIR
)/$(USRBINDIR
)
180 PROTOUSRBINDIR32
= $(PROTO_DIR
)/$(USRBINDIR32
)
181 PROTOUSRBINDIR64
= $(PROTO_DIR
)/$(USRBINDIR64
)
182 PROTOUSRSBINDIR
= $(PROTO_DIR
)/$(USRSBINDIR
)
183 PROTOUSRSBINDIR32
= $(PROTO_DIR
)/$(USRSBINDIR32
)
184 PROTOUSRSBINDIR64
= $(PROTO_DIR
)/$(USRSBINDIR64
)
185 PROTOUSRLIBDIR
= $(PROTO_DIR
)/$(USRLIBDIR
)
186 PROTOUSRLIBDIR32
= $(PROTO_DIR
)/$(USRLIBDIR32
)
187 PROTOUSRLIBDIR64
= $(PROTO_DIR
)/$(USRLIBDIR64
)
188 PROTOUSRINCDIR
= $(PROTO_DIR
)/$(USRINCDIR
)
189 PROTOUSRSHAREDIR
= $(PROTO_DIR
)/$(USRSHAREDIR
)
190 PROTOUSRSHARELIBDIR
= $(PROTO_DIR
)/$(USRSHARELIBDIR
)
191 PROTOUSRSHAREMANDIR
= $(PROTO_DIR
)/$(USRSHAREMANDIR
)
192 PROTOUSRSHAREDOCDIR
= $(PROTO_DIR
)/$(USRSHAREDOCDIR
)
193 PROTOUSRSHAREMAN1DIR
= $(PROTO_DIR
)/$(USRSHAREMAN1DIR
)
194 PROTOUSRSHAREMAN1MDIR
= $(PROTO_DIR
)/$(USRSHAREMAN1MDIR
)
195 PROTOUSRSHAREMAN3DIR
= $(PROTO_DIR
)/$(USRSHAREMAN3DIR
)
196 PROTOUSRSHAREMAN4DIR
= $(PROTO_DIR
)/$(USRSHAREMAN4DIR
)
197 PROTOUSRSHAREMAN5DIR
= $(PROTO_DIR
)/$(USRSHAREMAN5DIR
)
198 PROTOUSRSHAREMAN8DIR
= $(PROTO_DIR
)/$(USRSHAREMAN8DIR
)
199 PROTOUSRSHARELOCALEDIR
= $(PROTO_DIR
)/$(USRSHARELOCALEDIR
)
200 PROTOUSRKERNELDRVDIR
= $(PROTO_DIR
)/$(USRKERNELDRVDIR
)
201 PROTOUSRKERNELDRVDIR32
= $(PROTO_DIR
)/$(USRKERNELDRVDIR32
)
202 PROTOUSRKERNELDRVDIR64
= $(PROTO_DIR
)/$(USRKERNELDRVDIR64
)
204 PROTOUSRBINDIR
.32 = $(PROTOUSRBINDIR
)
205 PROTOUSRBINDIR
.64 = $(PROTOUSRBINDIR64
)
206 PROTOUSRSBINDIR
.32 = $(PROTOUSRSBINDIR
)
207 PROTOUSRSBINDIR
.64 = $(PROTOUSRSBINDIR64
)
208 PROTOUSRLIBDIR
.32 = $(PROTOUSRLIBDIR
)
209 PROTOUSRLIBDIR
.64 = $(PROTOUSRLIBDIR64
)
211 # NOTE: We do not build SFW contents
212 # /usr/sfw/bin is just a historic artefact, containing symlinks
213 SFWBIN
= /usr
/sfw
/bin
215 SFWBIN64
= $(SFWBIN
)/$(MACH64
)
216 SFWSBIN
= /usr
/sfw
/sbin
217 SFWSBIN32
= $(SFWSBIN
)
218 SFWSBIN64
= $(SFWSBIN
)/$(MACH64
)
219 SFWINCLUDE
= /usr
/sfw
/include
220 SFWLIB
= /usr
/sfw
/lib
222 SFWLIB64
= $(SFWLIB
)/$(MACH64
)
223 SFWSHARE
= /usr
/sfw
/share
224 SFWSHAREMAN
= $(SFWSHARE
)/man
225 SFWSHAREMAN1
= $(SFWSHAREMAN
)/man1
226 PROTOSFWBIN
= $(PROTO_DIR
)/$(SFWBIN
)
227 PROTOSFWBIN32
= $(PROTO_DIR
)/$(SFWBIN32
)
228 PROTOSFWBIN64
= $(PROTO_DIR
)/$(SFWBIN64
)
229 PROTOSFWSBIN
= $(PROTO_DIR
)/$(SFWSBIN
)
230 PROTOSFWSBIN32
= $(PROTO_DIR
)/$(SFWSBIN32
)
231 PROTOSFWSBIN64
= $(PROTO_DIR
)/$(SFWSBIN64
)
232 PROTOSFWLIB
= $(PROTO_DIR
)/$(SFWLIB
)
233 PROTOSFWLIB32
= $(PROTO_DIR
)/$(SFWLIB32
)
234 PROTOSFWLIB64
= $(PROTO_DIR
)/$(SFWLIB64
)
235 PROTOSFWSHARE
= $(PROTO_DIR
)/$(SFWSHARE
)
236 PROTOSFWSHAREMAN
= $(PROTO_DIR
)/$(SFWSHAREMAN
)
237 PROTOSFWSHAREMAN1
= $(PROTO_DIR
)/$(SFWSHAREMAN1
)
238 PROTOSFWINCLUDE
= $(PROTO_DIR
)/$(SFWINCLUDE
)
240 # The *.$(BITS) variables are different from those above (better suited for
241 # isaexec wrapper), and allow for default 32-bit vs. nondefault 64-bit setups
242 SFWBIN
.32 = $(SFWBIN
)
243 SFWBIN
.64 = $(SFWBIN64
)
244 SFWSBIN
.32 = $(SFWSBIN
)
245 SFWSBIN
.64 = $(SFWSBIN64
)
246 SFWLIB
.32 = $(SFWLIB
)
247 SFWLIB
.64 = $(SFWLIB64
)
248 PROTOSFWBIN
.32 = $(PROTOSFWBIN
)
249 PROTOSFWBIN
.64 = $(PROTOSFWBIN64
)
250 PROTOSFWSBIN
.32 = $(PROTOSFWSBIN
)
251 PROTOSFWSBIN
.64 = $(PROTOSFWSBIN64
)
252 PROTOSFWLIB
.32 = $(PROTOSFWLIB
)
253 PROTOSFWLIB
.64 = $(PROTOSFWLIB64
)
255 CLDIR
= /usr
/share
/common-lisp
256 PROTOCLDIR
= $(PROTO_DIR
)/$(CLDIR
)
258 GNUBIN
= /usr
/gnu
/bin
259 GNUBIN32
= $(GNUBIN
)/$(MACH32
)
260 GNUBIN64
= $(GNUBIN
)/$(MACH64
)
261 GNUSBIN
= /usr
/gnu
/sbin
262 GNUSBIN32
= $(GNUSBIN
)/$(MACH32
)
263 GNUSBIN64
= $(GNUSBIN
)/$(MACH64
)
264 GNULIB
= /usr
/gnu
/lib
266 GNULIB64
= $(GNULIB
)/$(MACH64
)
267 GNUSHARE
= /usr
/gnu
/share
268 GNUSHAREMAN
= $(GNUSHARE
)/man
269 GNUSHAREMAN1
= $(GNUSHAREMAN
)/man1
270 PROTOGNUBIN
= $(PROTO_DIR
)/$(GNUBIN
)
271 PROTOGNUBIN32
= $(PROTO_DIR
)/$(GNUBIN32
)
272 PROTOGNUBIN64
= $(PROTO_DIR
)/$(GNUBIN64
)
273 PROTOGNUSBIN
= $(PROTO_DIR
)/$(GNUSBIN
)
274 PROTOGNUSBIN32
= $(PROTO_DIR
)/$(GNUSBIN32
)
275 PROTOGNUSBIN64
= $(PROTO_DIR
)/$(GNUSBIN64
)
276 PROTOGNULIB
= $(PROTO_DIR
)/$(GNULIB
)
277 PROTOGNULIB32
= $(PROTO_DIR
)/$(GNULIB32
)
278 PROTOGNULIB64
= $(PROTO_DIR
)/$(GNULIB64
)
279 PROTOGNUSHARE
= $(PROTO_DIR
)/$(GNUSHARE
)
280 PROTOGNUSHAREMAN
= $(PROTO_DIR
)/$(GNUSHAREMAN
)
281 PROTOGNUSHAREMAN1
= $(PROTO_DIR
)/$(GNUSHAREMAN1
)
283 # The *.$(BITS) variables are different from those above (better suited for
284 # isaexec wrapper), and allow for default 32-bit vs. nondefault 64-bit setups
285 GNUBIN
.32 = $(GNUBIN
)
286 GNUBIN
.64 = $(GNUBIN64
)
287 GNUSBIN
.32 = $(GNUSBIN
)
288 GNUSBIN
.64 = $(GNUSBIN64
)
289 GNULIB
.32 = $(GNULIB
)
290 GNULIB
.64 = $(GNULIB64
)
291 PROTOGNUBIN
.32 = $(PROTOGNUBIN
)
292 PROTOGNUBIN
.64 = $(PROTOGNUBIN64
)
293 PROTOGNUSBIN
.32 = $(PROTOGNUSBIN
)
294 PROTOGNUSBIN
.64 = $(PROTOGNUSBIN64
)
295 PROTOGNULIB
.32 = $(PROTOGNULIB
)
296 PROTOGNULIB
.64 = $(PROTOGNULIB64
)
298 # work around _TIME, _DATE, embedded date chatter in component builds
299 # to use, set TIME_CONSTANT in the component Makefile and add $(CONSTANT_TIME)
300 # to the appropriate {CONFIGURE|BUILD|INSTALL}_ENV
301 CONSTANT_TIME
= LD_PRELOAD_32
=$(WS_TOOLS
)/time-
$(MACH32
).so
302 CONSTANT_TIME
+= LD_PRELOAD_64
=$(WS_TOOLS
)/time-
$(MACH64
).so
303 CONSTANT_TIME
+= TIME_CONSTANT
=$(TIME_CONSTANT
)
305 # set MACH from uname -p to either sparc or i386
306 MACH
:= $(shell uname
-p
)
308 # set MACH32 from MACH to either sparcv7 or i86
309 MACH32_1
= $(MACH
:sparc
=sparcv7
)
310 MACH32
= $(MACH32_1
:i386
=i86
)
312 # set MACH64 from MACH to either sparcv9 or amd64
313 MACH64_1
= $(MACH
:sparc
=sparcv9
)
314 MACH64
= $(MACH64_1
:i386
=amd64
)
316 CONFIGURE_32
= $(BUILD_DIR_32
)/.configured
317 CONFIGURE_64
= $(BUILD_DIR_64
)/.configured
319 BUILD_DIR_32
= $(BUILD_DIR
)/$(MACH32
)
320 BUILD_DIR_64
= $(BUILD_DIR
)/$(MACH64
)
322 BUILD_32
= $(BUILD_DIR_32
)/.built
323 BUILD_64
= $(BUILD_DIR_64
)/.built
324 BUILD_32_and_64
= $(BUILD_32
) $(BUILD_64
)
325 $(BUILD_DIR_32
)/.built
: BITS
=32
326 $(BUILD_DIR_64
)/.built
: BITS
=64
328 INSTALL_32
= $(BUILD_DIR_32
)/.installed
329 INSTALL_64
= $(BUILD_DIR_64
)/.installed
330 INSTALL_32_and_64
= $(INSTALL_32
) $(INSTALL_64
)
331 $(BUILD_DIR_32
)/.installed
: BITS
=32
332 $(BUILD_DIR_64
)/.installed
: BITS
=64
334 # set the default target for installation of the component
335 COMPONENT_INSTALL_TARGETS
= install
337 # set the default build test results directory
338 COMPONENT_TEST_BUILD_DIR
= $(BUILD_DIR
)/test/$(MACH
$(BITS
))
340 # set the default master test results directory
341 COMPONENT_TEST_RESULTS_DIR
= $(COMPONENT_DIR
)/test
343 # set the default master test results file
344 COMPONENT_TEST_MASTER
= $(COMPONENT_TEST_RESULTS_DIR
)/results-
$(BITS
).master
346 # set the default test results output file
347 COMPONENT_TEST_OUTPUT
= $(COMPONENT_TEST_BUILD_DIR
)/test-
$(BITS
)-results
349 # set the default test results comparison diffs file
350 COMPONENT_TEST_DIFFS
= $(COMPONENT_TEST_BUILD_DIR
)/test-
$(BITS
)-diffs
352 # set the default test snapshot file
353 COMPONENT_TEST_SNAPSHOT
= $(COMPONENT_TEST_BUILD_DIR
)/results-
$(BITS
).snapshot
355 # Normally $(GSED) is simplest, but some results files need more power.
356 COMPONENT_TEST_TRANSFORMER
= $(GSED
)
358 # The set of default transforms to be applied to the test results to try
360 COMPONENT_TEST_TRANSFORMS
= \
361 '-e "s|$(@D)|\\$$(@D)|g" ' \
362 '-e "s|$(PERL)|\\$$(PERL)|g" ' \
363 '-e "s|$(SOURCE_DIR)|\\$$(SOURCE_DIR)|g" '
365 # set the default commands used to generate the file containing the set
366 # of transforms to be applied to the test results to try to normalize them.
367 COMPONENT_TEST_CREATE_TRANSFORMS
= \
368 if
[ -e
$(COMPONENT_TEST_MASTER
) ]; \
370 print "\#!/bin/sh" > $(COMPONENT_TEST_TRANSFORM_CMD
); \
371 print '$(COMPONENT_TEST_TRANSFORMER) ' \
372 $(COMPONENT_TEST_TRANSFORMS
) \
373 ' \\' >> $(COMPONENT_TEST_TRANSFORM_CMD
); \
374 print '$(COMPONENT_TEST_OUTPUT) \\' \
375 >> $(COMPONENT_TEST_TRANSFORM_CMD
); \
376 print '> $(COMPONENT_TEST_SNAPSHOT)' \
377 >> $(COMPONENT_TEST_TRANSFORM_CMD
); \
380 # set the default command for performing any test result munging
381 COMPONENT_TEST_TRANSFORM_CMD
= $(COMPONENT_TEST_BUILD_DIR
)/transform-
$(BITS
)-results
383 # set the default operation to run to perform test result normalization
384 COMPONENT_TEST_PERFORM_TRANSFORM
= \
385 if
[ -e
$(COMPONENT_TEST_MASTER
) ]; \
387 $(SHELL
) $(COMPONENT_TEST_TRANSFORM_CMD
); \
390 # set the default command used to compare the master results with the snapshot
391 COMPONENT_TEST_COMPARE_CMD
= $(GDIFF
) -uN
393 # set the default way that master and snapshot test results are compared
394 COMPONENT_TEST_COMPARE
= \
395 if
[ -e
$(COMPONENT_TEST_MASTER
) ]; \
397 $(COMPONENT_TEST_COMPARE_CMD
) \
398 $(COMPONENT_TEST_MASTER
) $(COMPONENT_TEST_SNAPSHOT
) \
399 > $(COMPONENT_TEST_DIFFS
); \
400 print "Test results in $(COMPONENT_TEST_OUTPUT)"; \
401 if
[ -s
$(COMPONENT_TEST_DIFFS
) ]; \
403 print "Differences found."; \
404 $(CAT
) $(COMPONENT_TEST_DIFFS
); \
407 print "No differences found."; \
411 # set the default env command to use for test of the component
412 COMPONENT_TEST_ENV_CMD
= $(ENV
)
414 # set the default command to use for test of the component
415 COMPONENT_TEST_CMD
= $(GMAKE
)
417 # set the default target for test of the component
418 COMPONENT_TEST_TARGETS
= check
420 # set the default directory for test of the component
421 COMPONENT_TEST_DIR
= $(@D
)
423 # determine the type of tests we want to run.
424 ifeq ($(strip $(wildcard $(COMPONENT_TEST_RESULTS_DIR
)/results-
*.master
)),)
425 TEST_32
= $(BUILD_DIR_32
)/.tested
426 TEST_64
= $(BUILD_DIR_64
)/.tested
428 TEST_32
= $(BUILD_DIR_32
)/.tested-and-compared
429 TEST_64
= $(BUILD_DIR_64
)/.tested-and-compared
431 TEST_32_and_64
= $(TEST_32
) $(TEST_64
)
432 $(BUILD_DIR_32
)/.tested
: BITS
=32
433 $(BUILD_DIR_64
)/.tested
: BITS
=64
434 $(BUILD_DIR_32
)/.tested-and-compared
: BITS
=32
435 $(BUILD_DIR_64
)/.tested-and-compared
: BITS
=64
437 # BUILD_TOOLS is the root of all tools not normally installed on the system.
441 SPRO_ROOT
= $(BUILD_TOOLS
)/sunstudio
$(SPRO_VERSION
)
442 SPRO_VROOT
= $(SPRO_ROOT
)
444 PARFAIT_ROOT
= $(BUILD_TOOLS
)/parfait
/parfait-tools-1.0
.1/
445 PARFAIT
= $(PARFAIT_ROOT
)/bin
/parfait
446 export PARFAIT_NATIVESUNCC
=$(SPRO_VROOT
)/bin
/cc
447 export PARFAIT_NATIVESUNCXX
=$(SPRO_VROOT
)/bin
/CC
448 export PARFAIT_NATIVEGCC
=$(GCC_ROOT
)/bin
/gcc
449 export PARFAIT_NATIVEGXX
=$(GCC_ROOT
)/bin
/g
++
452 # The CCACHE makefile variable should evaluate to empty string or a pathname
453 # like /usr/bin/ccache depending on your PATH value and "which" implementation.
454 # The assignment via ":=" is important, to only do this once in a Makefile,
455 # and not on every reference to the value as "=" assignment would result in.
456 # Review `man ccache` for optional configuration tuning, like cache size etc.
458 # For production builds or suspected errors you can disable this feature by
459 # setting ENABLE_CCACHE=false (as makefile or environment variable, which
460 # is currently the default) to not even define the usage of wrapper in the
461 # userland-building makefile system.
462 # If you want to speed up your re-builds, you must set ENABLE_CCACHE=true.
463 # For legacy reasons, the CCACHE_DISABLE and CCACHE_NODISABLE variables (from
464 # configuration of the "ccache" program itself) are also supported, but direct
465 # use is discouraged, since their syntax and usage are counter-intuitive.
467 # Still, absence of ccache in PATH is not considered a fatal error since the
468 # build would just proceed well with original compiler.
469 # Note: In code below we fast-track if the makefile CCACHE variable is defined
470 # but fall back to shell executability tests if just envvar CCACHE is passed.
472 export CCACHE
:= $(shell \
473 if
test -n
"$(CCACHE)" ; then \
476 if
test x
"$${CCACHE_DISABLE-}" != x
-o x
"$(CCACHE_DISABLE)" != x \
477 -o x
"$${ENABLE_CCACHE-}" = xfalse
-o x
"$(ENABLE_CCACHE)" = xfalse \
479 echo
"NOT USING CCACHE FOR OI-USERLAND because explicitly disabled" >&2 ; \
481 if
test x
"$${CCACHE_NODISABLE-}" != x
-o x
"$(CCACHE_NODISABLE)" != x \
482 -o x
"$${ENABLE_CCACHE-}" = xtrue
-o x
"$(ENABLE_CCACHE)" = xtrue \
486 `which ccache 2>/dev/null | egrep '^/'` \
488 ; do if
test -n
"$$F" && test -x
"$$F" ; then \
490 echo
"USING CCACHE FOR OI-USERLAND: $$F" >&2 ; \
491 if
test x
"$${CCACHE_DISABLE-}" != x
; then \
492 echo
"WARNING: envvar CCACHE_DISABLE is set, so effectively ccache will not act!" >&2 ; \
497 echo
"NOT USING CCACHE FOR OI-USERLAND because not found" >&2 ; \
503 GCC_ROOT
= /usr
/gcc
/$(GCC_VERSION
)
505 CC.studio
.32 = $(SPRO_VROOT
)/bin
/cc
506 CXX.studio
.32 = $(SPRO_VROOT
)/bin
/CC
507 F77.studio
.32 = $(SPRO_VROOT
)/bin
/f77
508 FC.studio
.32 = $(SPRO_VROOT
)/bin
/f90
510 CC.studio
.64 = $(SPRO_VROOT
)/bin
/cc
511 CXX.studio
.64 = $(SPRO_VROOT
)/bin
/CC
512 F77.studio
.64 = $(SPRO_VROOT
)/bin
/f77
513 FC.studio
.64 = $(SPRO_VROOT
)/bin
/f90
515 CC.gcc
.32 = $(GCC_ROOT
)/bin
/gcc
516 CXX.gcc
.32 = $(GCC_ROOT
)/bin
/g
++
517 F77.gcc
.32 = $(GCC_ROOT
)/bin
/gfortran
518 FC.gcc
.32 = $(GCC_ROOT
)/bin
/gfortran
520 CC.gcc
.64 = $(GCC_ROOT
)/bin
/gcc
521 CXX.gcc
.64 = $(GCC_ROOT
)/bin
/g
++
522 F77.gcc
.64 = $(GCC_ROOT
)/bin
/gfortran
523 FC.gcc
.64 = $(GCC_ROOT
)/bin
/gfortran
525 ifneq ($(strip $(CCACHE
)),)
527 CCACHE_WRAP_ROOT
= $(WS_TOOLS
)/ccache-wrap
528 export CC_gcc_32
:= $(CC.gcc
.32)
529 export CC_gcc_64
:= $(CC.gcc
.64)
530 export CXX_gcc_32
:= $(CXX.gcc
.32)
531 export CXX_gcc_64
:= $(CXX.gcc
.64)
532 CC.gcc
.32 := $(CCACHE_WRAP_ROOT
)/CC.gcc
.32
533 CC.gcc
.64 := $(CCACHE_WRAP_ROOT
)/CC.gcc
.64
534 CXX.gcc
.32 := $(CCACHE_WRAP_ROOT
)/CXX.gcc
.32
535 CXX.gcc
.64 := $(CCACHE_WRAP_ROOT
)/CXX.gcc
.64
537 ifneq ($(strip $(CCACHE_DIR
)),)
538 export CCACHE_DIR
:= $(CCACHE_DIR
)
541 ifneq ($(strip $(CCACHE_LOGFILE
)),)
542 export CCACHE_LOGFILE
:= $(CCACHE_LOGFILE
)
547 lint
.32 = $(SPRO_VROOT
)/bin
/lint
-m32
548 lint
.64 = $(SPRO_VROOT
)/bin
/lint
-m64
550 LINT
= $(lint.
$(BITS
))
554 PYTHON
.2.7.VENDOR_PACKAGES
.32 = /usr
/lib
/python2.7
/vendor-packages
555 PYTHON
.2.7.VENDOR_PACKAGES
.64 = /usr
/lib
/python2.7
/vendor-packages
/64
556 PYTHON
.2.7.VENDOR_PACKAGES
= $(PYTHON
.2.7.VENDOR_PACKAGES.
$(BITS
))
558 PYTHON
.3.4.VENDOR_PACKAGES
.32 = /usr
/lib
/python3.4
/vendor-packages
559 PYTHON
.3.4.VENDOR_PACKAGES
.64 = /usr
/lib
/python3.4
/vendor-packages
/64
560 PYTHON
.3.4.VENDOR_PACKAGES
= $(PYTHON
.3.4.VENDOR_PACKAGES.
$(BITS
))
562 ifeq ($(strip $(PARFAIT_BUILD
)),yes
)
563 CC.studio
.32 = $(WS_TOOLS
)/parfait
/cc
564 CXX.studio
.32 = $(WS_TOOLS
)/parfait
/CC
565 CC.studio
.64 = $(WS_TOOLS
)/parfait
/cc
566 CXX.studio
.64 = $(WS_TOOLS
)/parfait
/CC
567 CC.gcc
.32 = $(WS_TOOLS
)/parfait
/gcc
568 CXX.gcc
.32 = $(WS_TOOLS
)/parfait
/g
++
569 CC.gcc
.64 = $(WS_TOOLS
)/parfait
/gcc
570 CXX.gcc
.64 = $(WS_TOOLS
)/parfait
/g
++
571 LD
= $(WS_TOOLS
)/parfait
/ld
574 CC
= $(CC.
$(COMPILER
).
$(BITS
))
575 CXX
= $(CXX.
$(COMPILER
).
$(BITS
))
576 F77
= $(F77.
$(COMPILER
).
$(BITS
))
577 FC
= $(FC.
$(COMPILER
).
$(BITS
))
580 RUBY_LIB_VERSION
.2.2 = 2.2.0
581 RUBY_LIB_VERSION
.2.3 = 2.3.0
582 RUBY
.2.2 = /usr
/ruby
/2.2/bin
/ruby
583 RUBY
.2.3 = /usr
/ruby
/2.3/bin
/ruby
584 RUBY
= $(RUBY.
$(RUBY_VERSION
))
585 RUBY_LIB_VERSION
= $(RUBY_LIB_VERSION.
$(RUBY_VERSION
))
587 # Transform Ruby scripts to call the supported
588 # version-specific ruby; used in multiple *.mk files
589 RUBY_SCRIPT_FIX_FUNC
= \
590 $(GNU_GREP
) -Rl
'^\#! */usr/bin/env ruby' | \
591 /usr
/bin
/xargs
-I\
{\
} $(GSED
) -i
-e \
592 '1s%^\#! */usr/bin/env ruby%\#!/usr/ruby/$(RUBY_VERSION)/bin/ruby%' \
595 # Use the ruby lib versions to represent the RUBY_VERSIONS that
596 # need to get built. This is done because during package transformations
597 # both the ruby version and the ruby library version are needed.
598 RUBY_VERSIONS
= $(RUBY_LIB_VERSION
)
600 PYTHON_VENDOR_PACKAGES
.32 = /usr
/lib
/python
$(PYTHON_VERSION
)/vendor-packages
601 PYTHON_VENDOR_PACKAGES
.64 = /usr
/lib
/python
$(PYTHON_VERSION
)/vendor-packages
/64
602 PYTHON_VENDOR_PACKAGES
= $(PYTHON_VENDOR_PACKAGES.
$(BITS
))
604 PYTHON
.2.7.32 = /usr
/bin
/python2.7
605 PYTHON
.2.7.64 = /usr
/bin
/$(MACH64
)/python2.7
607 PYTHON
.3.4.32 = /usr
/bin
/python3.4
608 PYTHON
.3.4.64 = /usr
/bin
/$(MACH64
)/python3.4
610 PYTHON
.32 = $(PYTHON.
$(PYTHON_VERSION
).32)
611 PYTHON
.64 = $(PYTHON.
$(PYTHON_VERSION
).64)
612 PYTHON
= $(PYTHON.
$(PYTHON_VERSION
).
$(BITS
))
614 # The default is site-packages, but that directory belongs to the end-user.
615 # Modules which are shipped by the OS but not with the core Python distribution
616 # belong in vendor-packages.
617 PYTHON_LIB
= /usr
/lib
/python
$(PYTHON_VERSION
)/vendor-packages
618 PYTHON_DATA
= $(PYTHON_LIB
)
620 JAVA7_HOME
= /usr
/jdk
/instances
/openjdk1.7
.0
621 JAVA8_HOME
= /usr
/jdk
/instances
/openjdk1.8
.0
622 JAVA_HOME
= $(JAVA8_HOME
)
624 # This is the default BUILD version of perl
625 # Not necessarily the system's default version, i.e. /usr/bin/perl
630 PERL
.5.22 = /usr
/perl5
/5.22/bin
/perl
631 PERL
.5.24 = /usr
/perl5
/5.24/bin
/perl
633 POD2MAN
.5.22 = /usr
/perl5
/5.22/bin
/pod2man
634 POD2MAN
.5.24 = /usr
/perl5
/5.24/bin
/pod2man
636 PERL
= $(PERL.
$(PERL_VERSION
))
637 POD2MAN
= $(POD2MAN.
$(PERL_VERSION
))
639 PERL_ARCH
:= $(shell $(PERL
) -e
'use Config; print $$Config{archname}')
640 PERL_ARCH_FUNC
= $(shell $(1) -e
'use Config; print $$Config{archname}')
641 # Optimally we should ask perl which C compiler was used but it doesn't
642 # result in a full path name. Only "c" is being recorded
643 # inside perl builds while we actually need a full path to
644 # the studio compiler.
645 #PERL_CC := $(shell $(PERL) -e 'use Config; print $$Config{cc}')
647 PKG_MACROS
+= PERL_ARCH
=$(PERL_ARCH
)
648 PKG_MACROS
+= PERL_VERSION
=$(PERL_VERSION
)
650 # Config magic for Postgres/EnterpriseDB/...
651 # Default DB version is the oldest one, for hopefully best built complatibility
653 PG_IMPLEM ?
= postgres
654 PG_VERNUM
= $(subst .
,,$(PG_VERSION
))
655 # For dependencies, including REQUIRED_PACKAGES if needed
656 PG_BASEPKG
= database
/$(PG_IMPLEM
)-$(PG_VERNUM
)
658 PG_HOME
= $(USRDIR
)/$(PG_IMPLEM
)/$(PG_VERSION
)
659 PG_BINDIR
.32 = $(PG_HOME
)/bin
660 PG_BINDIR
.64 = $(PG_HOME
)/bin
/$(MACH64
)
661 PG_BINDIR
= $(PG_BINDIR.
$(BITS
))
662 PG_INCDIR
= $(PG_HOME
)/include
663 PG_MANDIR
= $(PG_HOME
)/man
664 PG_SHAREDIR
= $(PG_HOME
)/share
665 PG_DOCDIR
= $(PG_HOME
)/doc
666 PG_LIBDIR
.32 = $(PG_HOME
)/lib
667 PG_LIBDIR
.64 = $(PG_HOME
)/lib
/$(MACH64
)
668 PG_LIBDIR
= $(PG_LIBDIR.
$(BITS
))
669 PG_CONFIG
.32 = $(PG_BINDIR
.32)/pg_config
670 PG_CONFIG
.64 = $(PG_BINDIR
.64)/pg_config
671 PG_CONFIG
= $(PG_CONFIG.
$(BITS
))
673 PKG_MACROS
+= PG_VERSION
=$(PG_VERSION
)
674 PKG_MACROS
+= PG_VERNUM
=$(PG_VERNUM
)
675 PKG_MACROS
+= PG_BASEPKG
=$(PG_BASEPKG
)
677 # Config magic for MySQL/MariaDB/Percona/...
678 # Default DB version is the oldest one, for hopefully best built compatibility
679 # NOTE: At this time the gate does not provide a recipe for actual "mysql"
680 # The "/usr/mysql/*" trees are mediated to preferred MariaDB or Percona variant
682 MYSQL_IMPLEM ?
= mariadb
683 MYSQL_VERNUM
= $(subst .
,,$(MYSQL_VERSION
))
684 # For dependencies, including REQUIRED_PACKAGES if needed
685 MYSQL_BASEPKG
= database
/$(MYSQL_IMPLEM
)-$(MYSQL_VERNUM
)
687 MYSQL_HOME
= $(USRDIR
)/$(MYSQL_IMPLEM
)/$(MYSQL_VERSION
)
688 MYSQL_BINDIR
.32 = $(MYSQL_HOME
)/bin
689 MYSQL_BINDIR
.64 = $(MYSQL_HOME
)/bin
/$(MACH64
)
690 MYSQL_BINDIR
= $(MYSQL_BINDIR.
$(BITS
))
691 MYSQL_INCDIR
= $(MYSQL_HOME
)/include
692 MYSQL_MANDIR
= $(MYSQL_HOME
)/man
693 MYSQL_SHAREDIR
= $(MYSQL_HOME
)/share
694 MYSQL_DOCDIR
= $(MYSQL_HOME
)/doc
695 MYSQL_LIBDIR
.32 = $(MYSQL_HOME
)/lib
696 MYSQL_LIBDIR
.64 = $(MYSQL_HOME
)/lib
/$(MACH64
)
697 MYSQL_LIBDIR
= $(MYSQL_LIBDIR.
$(BITS
))
698 MYSQL_CONFIG
.32 = $(MYSQL_BINDIR
.32)/mysql_config
699 MYSQL_CONFIG
.64 = $(MYSQL_BINDIR
.64)/mysql_config
700 MYSQL_CONFIG
= $(MYSQL_CONFIG.
$(BITS
))
702 PKG_MACROS
+= MYSQL_VERSION
=$(MYSQL_VERSION
)
703 PKG_MACROS
+= MYSQL_VERNUM
=$(MYSQL_VERNUM
)
704 PKG_MACROS
+= MYSQL_BASEPKG
=$(MYSQL_BASEPKG
)
706 # Default libjpeg implementation layout
707 JPEG_IMPLEM ?
= libjpeg8-turbo
708 JPEG_HOME
= $(USRLIBDIR
)/$(JPEG_IMPLEM
)
709 JPEG_BINDIR
.32 = $(JPEG_HOME
)/bin
710 JPEG_BINDIR
.64 = $(JPEG_HOME
)/bin
/$(MACH64
)
711 JPEG_BINDIR
= $(JPEG_BINDIR.
$(BITS
))
712 JPEG_INCDIR
= $(USRINCDIR
)/$(JPEG_IMPLEM
)
713 JPEG_LIBDIR
.32 = $(JPEG_HOME
)/lib
714 JPEG_LIBDIR
.64 = $(JPEG_HOME
)/lib
/$(MACH64
)
715 JPEG_LIBDIR
= $(JPEG_LIBDIR.
$(BITS
))
716 JPEG_CPPFLAGS
= -I
$(JPEG_INCDIR
)
717 JPEG_CFLAGS
.32 = -Wl
,-L
$(JPEG_LIBDIR
.32) -Wl
,-R
$(JPEG_LIBDIR
.32)
718 JPEG_CFLAGS
.64 = -Wl
,-L
$(JPEG_LIBDIR
.64) -Wl
,-R
$(JPEG_LIBDIR
.64)
719 JPEG_CFLAGS
= $(JPEG_CFLAGS.
$(BITS
))
720 JPEG_CXXFLAGS
.32 = -Wl
,-L
$(JPEG_LIBDIR
.32) -Wl
,-R
$(JPEG_LIBDIR
.32)
721 JPEG_CXXFLAGS
.64 = -Wl
,-L
$(JPEG_LIBDIR
.64) -Wl
,-R
$(JPEG_LIBDIR
.64)
722 JPEG_CXXFLAGS
= $(JPEG_CXXFLAGS.
$(BITS
))
723 JPEG_LDFLAGS
.32 = -L
$(JPEG_LIBDIR
.32) -R
$(JPEG_LIBDIR
.32)
724 JPEG_LDFLAGS
.64 = -L
$(JPEG_LIBDIR
.64) -R
$(JPEG_LIBDIR
.64)
725 JPEG_LDFLAGS
= $(JPEG_LDFLAGS.
$(BITS
))
727 # This is the default BUILD version of tcl
728 # Not necessarily the system's default version, i.e. /usr/bin/tclsh
730 TCLSH
.8.5.i386.32
= /usr
/bin
/i86
/tclsh8.5
731 TCLSH
.8.5.i386.64
= /usr
/bin
/amd64
/tclsh8.5
732 TCLSH
.8.5.sparc
.32 = /usr
/bin
/sparcv7
/tclsh8.5
733 TCLSH
.8.5.sparc
.64 = /usr
/bin
/sparcv9
/tclsh8.5
734 TCLSH
= $(TCLSH.
$(TCL_VERSION
).
$(MACH
).
$(BITS
))
736 CCSMAKE
= /usr
/bin
/dmake
737 GMAKE
= /usr
/gnu
/bin
/make
738 GPATCH
= /usr
/gnu
/bin
/patch
740 GPATCH_BACKUP
= --backup
--version-control
=numbered
741 GPATCH_FLAGS
= -p
$(PATCH_LEVEL
) $(GPATCH_BACKUP
)
743 GDIFF
= /usr
/gnu
/bin
/diff
744 GSORT
= /usr
/gnu
/bin
/sort
745 GUNZIP
= /usr
/bin
/gunzip
747 PKGREPO
= /usr
/bin
/pkgrepo
748 PKGSEND
= /usr
/bin
/pkgsend
749 ifeq ($(strip $(PKGLINT_COMPONENT
)),)
750 PKGLINT
= /usr
/bin
/pkglint
752 PKGLINT
= ${WS_TOOLS}/pkglint
755 ACLOCAL
= /usr
/bin
/aclocal-1.10
756 AUTOMAKE
= /usr
/bin
/automake-1.10
757 AUTORECONF
= /usr
/bin
/autoreconf
759 KSH93
= /usr
/bin
/ksh93
760 TOUCH
= /usr
/bin
/touch
761 MKDIR
= /bin
/mkdir
-p
770 INSTALL
= /usr
/bin
/install
771 GNU_GREP
= /usr
/gnu
/bin
/grep
772 CHMOD
= /usr
/bin
/chmod
775 GAS
= /usr
/gnu
/bin
/as
776 GTAR
= /usr
/gnu
/bin
/tar
777 STRIP
= /usr
/bin
/strip
778 IPS2TGZ
= $(WS_TOOLS
)/ips2tgz
780 INS.
dir= $(INSTALL
) -d
$@
781 INS.file
= $(INSTALL
) -m
444 $< $(@D
)
783 PKG_CONFIG_PATH
.32 = /usr
/lib
/pkgconfig
784 PKG_CONFIG_PATH
.64 = /usr
/lib
/$(MACH64
)/pkgconfig
785 PKG_CONFIG_PATH
= $(PKG_CONFIG_PATH.
$(BITS
))
787 # Set default path for environment modules
788 MODULE_VERSION
= 3.2.10
789 MODULE_PATH
= /usr
/share
/Modules
/modulefiles
790 MODULE_VERSIONS_PATH
= /usr
/share
/Modules
/versions
792 # Path to bash completions
793 BASH_COMPLETIONS_PATH
= /usr
/share
/bash-completion
/completions
796 # C preprocessor flag sets to ease feature selection. Add the required
797 # feature to your Makefile with CPPFLAGS += $(FEATURE_MACRO) and add to
798 # the component build with CONFIGURE_OPTIONS += CPPFLAGS="$(CPPFLAGS)" or
802 # Enables visibility of some c99 math functions that aren't visible by default.
803 # What other side-effects are there?
804 CPP_C99_EXTENDED_MATH
= -D_STDC_99
806 # Enables large file support for components that have no other means of doing
807 # so. Use CPP_LARGEFILES and not the .32/.64 variety directly
808 CPP_LARGEFILES
.32 := $(shell getconf LFS_CFLAGS
)
809 CPP_LARGEFILES
.64 := $(shell getconf LFS64_CFLAGS
)
810 CPP_LARGEFILES
= $(CPP_LARGEFILES.
$(BITS
))
812 # Enables some #pragma redefine_extname to POSIX-compliant Standard C Library
813 # functions. Also avoids the component's #define _POSIX_C_SOURCE to some value
814 # we currently do not support.
815 CPP_POSIX
= -D_POSIX_C_SOURCE
=200112L -D_POSIX_PTHREAD_SEMANTICS
817 # XPG6 mode. This option enables XPG6 conformance, plus extensions.
818 # Amongst other things, this option will cause system calls like
819 # popen (3C) and system (3C) to invoke the standards-conforming
820 # shell, /usr/xpg4/bin/sh, instead of /usr/bin/sh. Add studio_XPG6MODE to
821 # CFLAGS instead of using this directly
822 CPP_XPG6MODE
= -D_XOPEN_SOURCE
=600 -D__EXTENSIONS__
=1 -D_XPG6
824 # XPG5 mode. These options are specific for C++, where _XPG6,
825 # _XOPEN_SOURCE=600 and C99 are illegal. -D__EXTENSIONS__=1 is legal in C++.
826 CPP_XPG5MODE
= -D_XOPEN_SOURCE
=500 -D__EXTENSIONS__
=1 -D_XPG5
829 # Studio C compiler flag sets to ease feature selection. Add the required
830 # feature to your Makefile with CFLAGS += $(FEATURE_MACRO) and add to the
831 # component build with CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar.
834 # Generate 32/64 bit objects
837 # Code generation instruction set and optimization 'hints'. Use studio_XBITS
838 # and not the .arch.bits variety directly.
839 studio_XBITS.sparc
.32 = -xtarget
=ultra2
-xarch
=sparcvis
-xchip
=ultra2
840 studio_XBITS.sparc
.64 =
841 ifneq ($(strip $(PARFAIT_BUILD
)),yes
)
842 studio_XBITS.sparc
.64 += -xtarget
=ultra2
844 studio_XBITS.sparc
.64 += -xarch
=sparcvis
-xchip
=ultra2
845 studio_XBITS.i386.32
= -xchip
=pentium
846 studio_XBITS.i386.64
= -xchip
=generic
-Ui386
-U__i386
847 studio_XBITS
= $(studio_XBITS.
$(MACH
).
$(BITS
))
849 # Turn on recognition of supported C99 language features and enable the 1999 C
850 # standard library semantics of routines that appear in both the 1990 and
851 # 1999 C standard. To use set studio_C99MODE=$(studio_99_ENABLE) in your
852 # component Makefile.
853 studio_C99_ENABLE
= -xc99
=all
855 # Turn off recognition of C99 language features, and do not enable the 1999 C
856 # standard library semantics of routines that appeared in both the 1990 and
857 # 1999 C standard. To use set studio_C99MODE=$(studio_99_DISABLE) in your
858 # component Makefile.
859 studio_C99_DISABLE
= -xc99
=none
861 # Use the compiler default 'xc99=all,no_lib'
864 # For C++, compatibility with C99 (which is technically illegal) is
865 # enabled in a different way. So, we must use a different macro for it.
866 studio_cplusplus_C99_ENABLE
= -xlang
=c99
869 studio_cplusplus_C99_DISABLE
=
871 # And this is the macro you should actually use
872 studio_cplusplus_C99MODE
=
874 # Turn on C99 for gcc
875 gcc_C99_ENABLE
= -std
=c99
877 # Allow zero-sized struct/union declarations and void functions with return
879 studio_FEATURES_EXTENSIONS
= -features
=extensions
881 # Control the Studio optimization level.
882 studio_OPT.sparc
.32 = -xO4
883 studio_OPT.sparc
.64 = -xO4
884 studio_OPT.i386.32
= -xO4
885 studio_OPT.i386.64
= -xO4
886 studio_OPT
= $(studio_OPT.
$(MACH
).
$(BITS
))
888 # Studio PIC code generation. Use CC_PIC instead to select PIC code generation.
889 studio_PIC
= -KPIC
-DPIC
891 # The Sun Studio 11 compiler has changed the behaviour of integer
892 # wrap arounds and so a flag is needed to use the legacy behaviour
893 # (without this flag panics/hangs could be exposed within the source).
894 # This is used through studio_IROPTS, not the 'sparc' variety.
895 studio_IROPTS.sparc
= -W2
,-xwrap_int
896 studio_IROPTS
= $(studio_IROPTS.
$(MACH
))
898 # Control register usage for generated code. SPARC ABI requires system
899 # libraries not to use application registers. x86 requires 'no%frameptr' at
902 # We should just use -xregs but we need to workaround 7030022. Note
903 # that we can't use the (documented) -Wc,-xregs workaround because
904 # libtool really hates -Wc and thinks it should be -Wl. Instead
905 # we use an (undocumented) option which actually happens to be what
907 studio_XREGS.sparc
= -Qoption cg
-xregs
=no
%appl
908 studio_XREGS.i386
= -xregs
=no
%frameptr
909 studio_XREGS
= $(studio_XREGS.
$(MACH
))
911 gcc_XREGS.sparc
= -mno-app-regs
913 gcc_XREGS
= $(gcc_XREGS.
$(MACH
))
915 # Set data alignment on sparc to reasonable values, 8 byte alignment for 32 bit
916 # objects and 16 byte alignment for 64 bit objects. This is added to CFLAGS by
918 studio_ALIGN.sparc
.32 = -xmemalign
=8s
919 studio_ALIGN.sparc
.64 = -xmemalign
=16s
920 studio_ALIGN
= $(studio_ALIGN.
$(MACH
).
$(BITS
))
922 # Studio shorthand for building multi-threaded code, enables -D_REENTRANT and
923 # linking with threadin support. This is added to CFLAGS by default, override
924 # studio_MT to turn this off.
927 # See CPP_XPG6MODE comment above.
928 studio_XPG6MODE
= $(studio_C99MODE
) $(CPP_XPG6MODE
)
929 XPG6MODE
= $(studio_XPG6MODE
)
931 # See CPP_XPG5MODE comment above. You can only use this in C++, not in C99.
932 studio_XPG5MODE
= $(studio_cplusplus_C99MODE
) $(CPP_XPG5MODE
)
933 XPG5MODE
= $(studio_XPG5MODE
)
935 # Default Studio C compiler flags. Add the required feature to your Makefile
936 # with CFLAGS += $(FEATURE_MACRO) and add to the component build with
937 # CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar. In most cases, it
938 # should not be necessary to add CFLAGS to any environment other than the
939 # configure environment.
940 CFLAGS.studio
+= $(studio_OPT
) $(studio_XBITS
) $(studio_XREGS
) \
941 $(studio_IROPTS
) $(studio_C99MODE
) $(studio_ALIGN
) \
945 # GNU C compiler flag sets to ease feature selection. Add the required
946 # feature to your Makefile with CFLAGS += $(FEATURE_MACRO) and add to the
947 # component build with CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar.
950 # GCC Compiler optimization flag
953 # GCC PIC code generation. Use CC_PIC instead to select PIC code generation.
954 gcc_PIC
= -fPIC
-DPIC
956 # Generic macro for PIC code generation. Use this macro instead of the
957 # compiler specific variant.
958 CC_PIC
= $($(COMPILER
)_PIC
)
961 # Default GNU C compiler flags. Add the required feature to your Makefile
962 # with CFLAGS += $(FEATURE_MACRO) and add to the component build with
963 # CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar. In most cases, it
964 # should not be necessary to add CFLAGS to any environment other than the
965 # configure environment.
966 CFLAGS.gcc
+= $(gcc_OPT
)
967 CFLAGS.gcc
+= $(gcc_XREGS
)
970 # Build 32 or 64 bit objects.
973 # Add compiler specific 'default' features
974 CFLAGS
+= $(CFLAGS.
$(COMPILER
))
977 # Studio C++ requires -norunpath to avoid adding its location into the RUNPATH
978 # to C++ applications.
979 studio_NORUNPATH
= -norunpath
981 # To link in standard mode (the default mode) without any C++ libraries
982 # (except libCrun), use studio_LIBRARY_NONE in your component Makefile.
983 studio_LIBRARY_NONE
= -library
=%none
985 # Don't link C++ with any C++ Runtime or Standard C++ library
986 studio_CXXLIB_NONE
= -xnolib
988 # Link C++ with the Studio C++ Runtime and Standard C++ library. This is the
989 # default for "standard" mode.
990 studio_CXXLIB_CSTD
= -library
=Cstd
,Crun
992 # link C++ with the Studio C++ Runtime and Apache Standard C++ library
993 studio_CXXLIB_APACHE
= -library
=stdcxx4
,Crun
995 # Add the C++ ABI compatibility flags for older ABI compatibility. The default
996 # is "standard mode" (-compat=5)
997 studio_COMPAT_VERSION_4
= -compat
=4
999 # Tell the compiler that we don't want the studio runpath added to the
1000 # linker flags. We never want the Studio location added to the RUNPATH.
1001 CXXFLAGS
+= $($(COMPILER
)_NORUNPATH
)
1003 # Build 32 or 64 bit objects in C++ as well.
1004 CXXFLAGS
+= $(CC_BITS
)
1006 # Build 32 or 64 bit objects in FORTRAN as well.
1007 F77FLAGS
+= $(CC_BITS
)
1008 FCFLAGS
+= $(CC_BITS
)
1012 # Solaris linker flag sets to ease feature selection. Add the required
1013 # feature to your Makefile with LDFLAGS += $(FEATURE_MACRO) and add to the
1014 # component build with CONFIGURE_OPTIONS += LDFLAGS="$(LDFLAGS)" or similiar.
1017 # set the bittedness that we want to link
1021 LD_BITS
= $($(LINKER
).
ld.
$(BITS
))
1022 LDFLAGS
= $(LD_BITS
)
1024 # Reduce the symbol table size, effectively conflicting with -g. We should
1025 # get linker guidance here.
1026 LD_Z_REDLOCSYM
= -z redlocsym
1028 # Cause the linker to rescan archive libraries and resolve remaining unresolved
1029 # symbols recursively until all symbols are resolved. Components should be
1030 # linking in the libraries they need, in the required order. This should
1031 # only be required if the component's native build is horribly broken.
1032 LD_Z_RESCAN_NOW
= -z rescan-now
1034 LD_Z_TEXT
= -z direct
1036 # make sure that -lc is always present when building shared objects.
1039 # make sure all symbols are defined.
1042 # eliminate unreferenced dynamic dependencies
1043 LD_Z_IGNORE
= -z ignore
1045 # use direct binding
1046 LD_B_DIRECT
= -Bdirect
1048 # use generic macro names for enabling/disabling ASLR
1049 ASLR_ENABLE
= -z aslr
=enable
1050 ASLR_DISABLE
= -z aslr
=disable
1051 ASLR_MODE
= $(ASLR_DISABLE
)
1053 # by default, turn off Address Space Layout Randomization for ELF executables;
1054 # to explicitly enable ASLR, set ASLR_MODE = $(ASLR_ENABLE)
1055 # in that component's Makefile
1056 LD_Z_ASLR
= $(ASLR_MODE
)
1059 # More Solaris linker flags that we want to be sure that everyone gets. This
1060 # is automatically added to the calling environment during the 'build' and
1061 # 'install' phases of the component build. Each individual feature can be
1062 # turned off by adding FEATURE_MACRO= to the component Makefile.
1065 # Create a non-executable bss segment when linking.
1066 LD_MAP_NOEXBSS
= -M
/usr
/lib
/ld/map.noexbss
1069 LD_MAP_PAGEALIGN
= -M
/usr
/lib
/ld/map.pagealign
1071 # Linker options to add when only building libraries
1072 LD_OPTIONS_SO
+= $(LD_Z_TEXT
) $(LD_Z_DEFS
) $(LD_DEF_LIBS
)
1074 # Default linker options that everyone should get. Do not add additional
1075 # libraries to this macro, as it will apply to everything linked during the
1077 LD_OPTIONS
+= $(LD_MAP_PAGEALIGN
) $(LD_B_DIRECT
) $(LD_Z_IGNORE
)
1079 # only used on executables
1080 LD_EXEC_OPTIONS
= $(LD_Z_ASLR
)
1082 # Environment variables and arguments passed into the build and install
1083 # environment(s). These are the initial settings.
1084 COMPONENT_BUILD_ENV
= \
1085 LD_OPTIONS
="$(LD_OPTIONS)" \
1086 LD_EXEC_OPTIONS
="$(LD_EXEC_OPTIONS)"
1087 COMPONENT_INSTALL_ENV
= \
1088 LD_OPTIONS
="$(LD_OPTIONS)" \
1089 LD_EXEC_OPTIONS
="$(LD_EXEC_OPTIONS)"
1091 # PERL options which depend on C options should be placed here
1092 # Don't trust Perl $Config{optimize}, we can get Studio flags
1093 PERL_OPTIMIZE
=$(gcc_OPT
)
1095 # We need this to overwrite options of perl used to compile illumos-gate
1096 PERL_STUDIO_OVERWRITE
= cc="$(CC)" cccdlflags
="$(CC_PIC)" ld="$(CC)" ccname
="$(shell basename $(CC))" optimize
="$(gcc_OPT)"
1098 # Allow user to override default maximum number of archives
1099 NUM_EXTRA_ARCHIVES
= 1 2 3 4 5 6 7 8 9 10
1101 # Rewrite absolute source-code paths into relative for ccache, so that any
1102 # workspace with a shared CCACHE_DIR can benefit when compiling a component
1103 ifneq ($(strip $(CCACHE
)),)
1104 export CCACHE_BASEDIR
= $(BUILD_DIR_
$(BITS
))
1105 COMPONENT_BUILD_ENV
+= CCACHE
="$(CCACHE)"
1106 COMPONENT_INSTALL_ENV
+= CCACHE
="$(CCACHE)"
1107 COMPONENT_TEST_ENV
+= CCACHE
="$(CCACHE)"
1108 COMPONENT_BUILD_ENV
+= CC_gcc_32
="$(CC_gcc_32)"
1109 COMPONENT_BUILD_ENV
+= CC_gcc_64
="$(CC_gcc_32)"
1110 COMPONENT_BUILD_ENV
+= CXX_gcc_32
="$(CXX_gcc_64)"
1111 COMPONENT_BUILD_ENV
+= CXX_gcc_64
="$(CXX_gcc_64)"
1112 COMPONENT_INSTALL_ENV
+= CC_gcc_32
="$(CC_gcc_32)"
1113 COMPONENT_INSTALL_ENV
+= CC_gcc_64
="$(CC_gcc_32)"
1114 COMPONENT_INSTALL_ENV
+= CXX_gcc_32
="$(CXX_gcc_64)"
1115 COMPONENT_INSTALL_ENV
+= CXX_gcc_64
="$(CXX_gcc_64)"
1116 COMPONENT_TEST_ENV
+= CC_gcc_32
="$(CC_gcc_32)"
1117 COMPONENT_TEST_ENV
+= CC_gcc_64
="$(CC_gcc_32)"
1118 COMPONENT_TEST_ENV
+= CXX_gcc_32
="$(CXX_gcc_64)"
1119 COMPONENT_TEST_ENV
+= CXX_gcc_64
="$(CXX_gcc_64)"
1120 COMPONENT_BUILD_ENV.
$(BITS
) += CCACHE_BASEDIR
="$(BUILD_DIR_$(BITS))"
1121 COMPONENT_INSTALL_ENV.
$(BITS
) += CCACHE_BASEDIR
="$(BUILD_DIR_$(BITS))"
1122 COMPONENT_TEST_ENV.
$(BITS
) += CCACHE_BASEDIR
="$(BUILD_DIR_$(BITS))"
1124 ifneq ($(strip $(CCACHE_DIR
)),)
1125 COMPONENT_BUILD_ENV
+= CCACHE_DIR
="$(CCACHE_DIR)"
1126 COMPONENT_INSTALL_ENV
+= CCACHE_DIR
="$(CCACHE_DIR)"
1127 COMPONENT_TEST_ENV
+= CCACHE_DIR
="$(CCACHE_DIR)"
1130 ifneq ($(strip $(CCACHE_LOGFILE
)),)
1131 COMPONENT_BUILD_ENV
+= CCACHE_LOGFILE
="$(CCACHE_LOGFILE)"
1132 COMPONENT_INSTALL_ENV
+= CCACHE_LOGFILE
="$(CCACHE_LOGFILE)"
1133 COMPONENT_TEST_ENV
+= CCACHE_LOGFILE
="$(CCACHE_LOGFILE)"
1138 # Add any bit-specific settings
1139 COMPONENT_BUILD_ENV
+= $(COMPONENT_BUILD_ENV.
$(BITS
))
1140 COMPONENT_BUILD_ARGS
+= $(COMPONENT_BUILD_ARGS.
$(BITS
))
1141 COMPONENT_INSTALL_ENV
+= $(COMPONENT_INSTALL_ENV.
$(BITS
))
1142 COMPONENT_INSTALL_ARGS
+= $(COMPONENT_INSTALL_ARGS.
$(BITS
))
1144 # declare these phony so that we avoid filesystem conflicts.
1145 .PHONY
: prep build
install publish
test clean clobber parfait
1147 # If there are no tests to execute
1148 NO_TESTS
= test-nothing
1150 @echo
"There are no tests available at this time."
1152 # default behaviour for 'component-hook' target is to echo the component
1153 # name and version information, but more complex behaviour can be implemented
1154 # via command line setting of the COMPONENT_HOOK macro.
1155 COMPONENT_HOOK ?
= echo
$(COMPONENT_NAME
) $(COMPONENT_VERSION
)
1161 # Packages with tools that are required to build Userland components
1163 REQUIRED_PACKAGES
+= metapackages
/build-essential
1165 # Only a default dependency if component being built produces binaries.
1166 ifneq ($(strip $(BUILD_BITS
)),NO_ARCH
)
1167 REQUIRED_PACKAGES
+= system
/library
1170 include $(WS_MAKE_RULES
)/environment.mk
1172 # A simple rule to print the value of any macro. Ex:
1173 # $ gmake print-REQUIRED_PACKAGES
1174 # Note that some macros are set on a per target basis, so what you see
1175 # is not always what you get.
1177 @echo
'$(subst ','\'',$*=$($*)) (origin: $(origin $*), flavor
: $(flavor
$*))'