python36: add libressl patch
[unleashed-userland.git] / make-rules / shared-macros.mk
blobf170299d0ca2cf2c8c86e023065580d25eb3f6e2
2 # CDDL HEADER START
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]
19 # CDDL HEADER END
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
30 # anywhere else.
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)
45 export WS_TOP := \
46 $(shell hg root 2>/dev/null || git rev-parse --show-toplevel)
47 endif
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.
66 export SHELLOPTS
67 build: SHELLOPTS=
68 test: SHELLOPTS=
69 install: SHELLOPTS=
70 publish: SHELLOPTS=pipefail
72 SHELL= /bin/bash
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)))
84 empty :=
85 space := $(empty) $(empty)
87 ROOT = /
89 # Native OS version
90 OS_VERSION := $(shell uname -r)
91 SOLARIS_VERSION = 2.11
92 # Target OS version
93 PKG_SOLARIS_VERSION ?= 5.11
95 include $(WS_MAKE_RULES)/ips-buildinfo.mk
97 COMPILER = gcc
98 LINKER = gcc
99 BITS = 32
100 PYTHON_VERSION = 2.7
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 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)
122 ARCHLIBSUBDIR32 =
123 ARCHLIBSUBDIR64 = $(MACH64)
124 ARCHLIBSUBDIR = $(ARCHLIBSUBDIR$(BITS))
126 ETCDIR = /etc
127 USRDIR = /usr
128 BINDIR = /bin
129 SBINDIR = /sbin
130 LIBDIR = /lib
131 VARDIR = /var
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
214 SFWBIN32 = $(SFWBIN)
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
221 SFWLIB32 = $(SFWLIB)
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
265 GNULIB32 = $(GNULIB)
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
359 # to normalize them.
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) ]; \
369 then \
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) ]; \
386 then \
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) ]; \
396 then \
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) ]; \
402 then \
403 print "Differences found."; \
404 $(CAT) $(COMPONENT_TEST_DIFFS); \
405 exit 2; \
406 else \
407 print "No differences found."; \
408 fi \
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
427 else
428 TEST_32 = $(BUILD_DIR_32)/.tested-and-compared
429 TEST_64 = $(BUILD_DIR_64)/.tested-and-compared
430 endif
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.
438 BUILD_TOOLS ?= /opt
440 SPRO_ROOT = $(BUILD_TOOLS)/sunstudio12.1
441 SPRO_VROOT = $(SPRO_ROOT)
443 PARFAIT_ROOT = $(BUILD_TOOLS)/parfait/parfait-tools-1.0.1/
444 PARFAIT= $(PARFAIT_ROOT)/bin/parfait
445 export PARFAIT_NATIVESUNCC=$(SPRO_VROOT)/bin/cc
446 export PARFAIT_NATIVESUNCXX=$(SPRO_VROOT)/bin/CC
447 export PARFAIT_NATIVEGCC=$(GCC_ROOT)/bin/gcc
448 export PARFAIT_NATIVEGXX=$(GCC_ROOT)/bin/g++
451 # The CCACHE makefile variable should evaluate to empty string or a pathname
452 # like /usr/bin/ccache depending on your PATH value and "which" implementation.
453 # The assignment via ":=" is important, to only do this once in a Makefile,
454 # and not on every reference to the value as "=" assignment would result in.
455 # Review `man ccache` for optional configuration tuning, like cache size etc.
457 # For production builds or suspected errors you can disable this feature by
458 # setting ENABLE_CCACHE=false (as makefile or environment variable, which
459 # is currently the default) to not even define the usage of wrapper in the
460 # userland-building makefile system.
461 # If you want to speed up your re-builds, you must set ENABLE_CCACHE=true.
462 # For legacy reasons, the CCACHE_DISABLE and CCACHE_NODISABLE variables (from
463 # configuration of the "ccache" program itself) are also supported, but direct
464 # use is discouraged, since their syntax and usage are counter-intuitive.
466 # Still, absence of ccache in PATH is not considered a fatal error since the
467 # build would just proceed well with original compiler.
468 # Note: In code below we fast-track if the makefile CCACHE variable is defined
469 # but fall back to shell executability tests if just envvar CCACHE is passed.
471 export CCACHE := $(shell \
472 if test -n "$(CCACHE)" ; then \
473 echo "$(CCACHE)"; \
474 else \
475 if test x"$${CCACHE_DISABLE-}" != x -o x"$(CCACHE_DISABLE)" != x \
476 -o x"$${ENABLE_CCACHE-}" = xfalse -o x"$(ENABLE_CCACHE)" = xfalse \
477 ; then \
478 echo "NOT USING CCACHE FOR OI-USERLAND because explicitly disabled" >&2 ; \
479 else \
480 if test x"$${CCACHE_NODISABLE-}" != x -o x"$(CCACHE_NODISABLE)" != x \
481 -o x"$${ENABLE_CCACHE-}" = xtrue -o x"$(ENABLE_CCACHE)" = xtrue \
482 ; then \
483 for F in \
484 "$$CCACHE" \
485 `which ccache 2>/dev/null | egrep '^/'` \
486 /usr/bin/ccache \
487 ; do if test -n "$$F" && test -x "$$F" ; then \
488 echo "$$F" ; \
489 echo "USING CCACHE FOR OI-USERLAND: $$F" >&2 ; \
490 if test x"$${CCACHE_DISABLE-}" != x ; then \
491 echo "WARNING: envvar CCACHE_DISABLE is set, so effectively ccache will not act!" >&2 ; \
492 fi; \
493 exit 0; \
494 fi; \
495 done; \
496 echo "NOT USING CCACHE FOR OI-USERLAND because not found" >&2 ; \
497 fi; \
498 fi; \
501 GCC_ROOT = /usr/gcc/4.9
503 CC.studio.32 = $(SPRO_VROOT)/bin/cc
504 CXX.studio.32 = $(SPRO_VROOT)/bin/CC
505 F77.studio.32 = $(SPRO_VROOT)/bin/f77
506 FC.studio.32 = $(SPRO_VROOT)/bin/f90
508 CC.studio.64 = $(SPRO_VROOT)/bin/cc
509 CXX.studio.64 = $(SPRO_VROOT)/bin/CC
510 F77.studio.64 = $(SPRO_VROOT)/bin/f77
511 FC.studio.64 = $(SPRO_VROOT)/bin/f90
513 CC.gcc.32 = $(GCC_ROOT)/bin/gcc
514 CXX.gcc.32 = $(GCC_ROOT)/bin/g++
515 F77.gcc.32 = $(GCC_ROOT)/bin/gfortran
516 FC.gcc.32 = $(GCC_ROOT)/bin/gfortran
518 CC.gcc.64 = $(GCC_ROOT)/bin/gcc
519 CXX.gcc.64 = $(GCC_ROOT)/bin/g++
520 F77.gcc.64 = $(GCC_ROOT)/bin/gfortran
521 FC.gcc.64 = $(GCC_ROOT)/bin/gfortran
523 ifneq ($(strip $(CCACHE)),)
525 CCACHE_WRAP_ROOT = $(WS_TOOLS)/ccache-wrap
526 export CC_gcc_32 := $(CC.gcc.32)
527 export CC_gcc_64 := $(CC.gcc.64)
528 export CXX_gcc_32 := $(CXX.gcc.32)
529 export CXX_gcc_64 := $(CXX.gcc.64)
530 CC.gcc.32 := $(CCACHE_WRAP_ROOT)/CC.gcc.32
531 CC.gcc.64 := $(CCACHE_WRAP_ROOT)/CC.gcc.64
532 CXX.gcc.32 := $(CCACHE_WRAP_ROOT)/CXX.gcc.32
533 CXX.gcc.64 := $(CCACHE_WRAP_ROOT)/CXX.gcc.64
535 ifneq ($(strip $(CCACHE_DIR)),)
536 export CCACHE_DIR := $(CCACHE_DIR)
537 endif
539 ifneq ($(strip $(CCACHE_LOGFILE)),)
540 export CCACHE_LOGFILE := $(CCACHE_LOGFILE)
541 endif
543 endif
545 lint.32 = $(SPRO_VROOT)/bin/lint -m32
546 lint.64 = $(SPRO_VROOT)/bin/lint -m64
548 LINT = $(lint.$(BITS))
550 LD = /usr/bin/ld
552 PYTHON.2.7.VENDOR_PACKAGES.32 = /usr/lib/python2.7/vendor-packages
553 PYTHON.2.7.VENDOR_PACKAGES.64 = /usr/lib/python2.7/vendor-packages/64
554 PYTHON.2.7.VENDOR_PACKAGES = $(PYTHON.2.7.VENDOR_PACKAGES.$(BITS))
556 PYTHON.3.4.VENDOR_PACKAGES.32 = /usr/lib/python3.4/vendor-packages
557 PYTHON.3.4.VENDOR_PACKAGES.64 = /usr/lib/python3.4/vendor-packages/64
558 PYTHON.3.4.VENDOR_PACKAGES = $(PYTHON.3.4.VENDOR_PACKAGES.$(BITS))
560 ifeq ($(strip $(PARFAIT_BUILD)),yes)
561 CC.studio.32 = $(WS_TOOLS)/parfait/cc
562 CXX.studio.32 = $(WS_TOOLS)/parfait/CC
563 CC.studio.64 = $(WS_TOOLS)/parfait/cc
564 CXX.studio.64 = $(WS_TOOLS)/parfait/CC
565 CC.gcc.32 = $(WS_TOOLS)/parfait/gcc
566 CXX.gcc.32 = $(WS_TOOLS)/parfait/g++
567 CC.gcc.64 = $(WS_TOOLS)/parfait/gcc
568 CXX.gcc.64 = $(WS_TOOLS)/parfait/g++
569 LD = $(WS_TOOLS)/parfait/ld
570 endif
572 CC = $(CC.$(COMPILER).$(BITS))
573 CXX = $(CXX.$(COMPILER).$(BITS))
574 F77 = $(F77.$(COMPILER).$(BITS))
575 FC = $(FC.$(COMPILER).$(BITS))
577 RUBY_VERSION = 2.3
578 RUBY_LIB_VERSION.2.2 = 2.2.0
579 RUBY_LIB_VERSION.2.3 = 2.3.0
580 RUBY.2.2 = /usr/ruby/2.2/bin/ruby
581 RUBY.2.3 = /usr/ruby/2.3/bin/ruby
582 RUBY = $(RUBY.$(RUBY_VERSION))
583 RUBY_LIB_VERSION = $(RUBY_LIB_VERSION.$(RUBY_VERSION))
585 # Transform Ruby scripts to call the supported
586 # version-specific ruby; used in multiple *.mk files
587 RUBY_SCRIPT_FIX_FUNC = \
588 $(GNU_GREP) -Rl '^\#! */usr/bin/env ruby' | \
589 /usr/bin/xargs -I\{\} $(GSED) -i -e \
590 '1s%^\#! */usr/bin/env ruby%\#!/usr/ruby/$(RUBY_VERSION)/bin/ruby%' \
591 \{\}
593 # Use the ruby lib versions to represent the RUBY_VERSIONS that
594 # need to get built. This is done because during package transformations
595 # both the ruby version and the ruby library version are needed.
596 RUBY_VERSIONS = $(RUBY_LIB_VERSION)
598 PYTHON_VENDOR_PACKAGES.32 = /usr/lib/python$(PYTHON_VERSION)/vendor-packages
599 PYTHON_VENDOR_PACKAGES.64 = /usr/lib/python$(PYTHON_VERSION)/vendor-packages/64
600 PYTHON_VENDOR_PACKAGES = $(PYTHON_VENDOR_PACKAGES.$(BITS))
602 PYTHON.2.7.32 = /usr/bin/python2.7
603 PYTHON.2.7.64 = /usr/bin/$(MACH64)/python2.7
605 PYTHON.3.4.32 = /usr/bin/python3.4
606 PYTHON.3.4.64 = /usr/bin/$(MACH64)/python3.4
608 PYTHON.32 = $(PYTHON.$(PYTHON_VERSION).32)
609 PYTHON.64 = $(PYTHON.$(PYTHON_VERSION).64)
610 PYTHON = $(PYTHON.$(PYTHON_VERSION).$(BITS))
612 # The default is site-packages, but that directory belongs to the end-user.
613 # Modules which are shipped by the OS but not with the core Python distribution
614 # belong in vendor-packages.
615 PYTHON_LIB= /usr/lib/python$(PYTHON_VERSION)/vendor-packages
616 PYTHON_DATA= $(PYTHON_LIB)
618 JAVA7_HOME = /usr/jdk/instances/openjdk1.7.0
619 JAVA8_HOME = /usr/jdk/instances/openjdk1.8.0
620 JAVA_HOME = $(JAVA8_HOME)
622 # This is the default BUILD version of perl
623 # Not necessarily the system's default version, i.e. /usr/bin/perl
624 PERL_VERSION = 5.22
626 PERL_VERSIONS = 5.22
628 PERL.5.22 = /usr/perl5/5.22/bin/perl
629 PERL.5.24 = /usr/perl5/5.24/bin/perl
631 POD2MAN.5.22 = /usr/perl5/5.22/bin/pod2man
632 POD2MAN.5.24 = /usr/perl5/5.24/bin/pod2man
634 PERL = $(PERL.$(PERL_VERSION))
635 POD2MAN = $(POD2MAN.$(PERL_VERSION))
637 PERL_ARCH := $(shell $(PERL) -e 'use Config; print $$Config{archname}')
638 PERL_ARCH_FUNC= $(shell $(1) -e 'use Config; print $$Config{archname}')
639 # Optimally we should ask perl which C compiler was used but it doesn't
640 # result in a full path name. Only "c" is being recorded
641 # inside perl builds while we actually need a full path to
642 # the studio compiler.
643 #PERL_CC := $(shell $(PERL) -e 'use Config; print $$Config{cc}')
645 PKG_MACROS += PERL_ARCH=$(PERL_ARCH)
646 PKG_MACROS += PERL_VERSION=$(PERL_VERSION)
648 # Config magic for Postgres/EnterpriseDB/...
649 # Default DB version is the oldest one, for hopefully best built complatibility
650 PG_VERSION ?= 9.3
651 PG_IMPLEM ?= postgres
652 PG_VERNUM = $(subst .,,$(PG_VERSION))
653 # For dependencies, including REQUIRED_PACKAGES if needed
654 PG_BASEPKG = database/$(PG_IMPLEM)-$(PG_VERNUM)
656 PG_HOME = $(USRDIR)/$(PG_IMPLEM)/$(PG_VERSION)
657 PG_BINDIR.32 = $(PG_HOME)/bin
658 PG_BINDIR.64 = $(PG_HOME)/bin/$(MACH64)
659 PG_BINDIR = $(PG_BINDIR.$(BITS))
660 PG_INCDIR = $(PG_HOME)/include
661 PG_MANDIR = $(PG_HOME)/man
662 PG_SHAREDIR = $(PG_HOME)/share
663 PG_DOCDIR = $(PG_HOME)/doc
664 PG_LIBDIR.32 = $(PG_HOME)/lib
665 PG_LIBDIR.64 = $(PG_HOME)/lib/$(MACH64)
666 PG_LIBDIR = $(PG_LIBDIR.$(BITS))
667 PG_CONFIG.32 = $(PG_BINDIR.32)/pg_config
668 PG_CONFIG.64 = $(PG_BINDIR.64)/pg_config
669 PG_CONFIG = $(PG_CONFIG.$(BITS))
671 PKG_MACROS += PG_VERSION=$(PG_VERSION)
672 PKG_MACROS += PG_VERNUM=$(PG_VERNUM)
673 PKG_MACROS += PG_BASEPKG=$(PG_BASEPKG)
675 # Config magic for MySQL/MariaDB/Percona/...
676 # Default DB version is the oldest one, for hopefully best built compatibility
677 # NOTE: At this time the gate does not provide a recipe for actual "mysql"
678 # The "/usr/mysql/*" trees are mediated to preferred MariaDB or Percona variant
679 MYSQL_VERSION ?= 5.5
680 MYSQL_IMPLEM ?= mariadb
681 MYSQL_VERNUM = $(subst .,,$(MYSQL_VERSION))
682 # For dependencies, including REQUIRED_PACKAGES if needed
683 MYSQL_BASEPKG = database/$(MYSQL_IMPLEM)-$(MYSQL_VERNUM)
685 MYSQL_HOME = $(USRDIR)/$(MYSQL_IMPLEM)/$(MYSQL_VERSION)
686 MYSQL_BINDIR.32 = $(MYSQL_HOME)/bin
687 MYSQL_BINDIR.64 = $(MYSQL_HOME)/bin/$(MACH64)
688 MYSQL_BINDIR = $(MYSQL_BINDIR.$(BITS))
689 MYSQL_INCDIR = $(MYSQL_HOME)/include
690 MYSQL_MANDIR = $(MYSQL_HOME)/man
691 MYSQL_SHAREDIR = $(MYSQL_HOME)/share
692 MYSQL_DOCDIR = $(MYSQL_HOME)/doc
693 MYSQL_LIBDIR.32 = $(MYSQL_HOME)/lib
694 MYSQL_LIBDIR.64 = $(MYSQL_HOME)/lib/$(MACH64)
695 MYSQL_LIBDIR = $(MYSQL_LIBDIR.$(BITS))
696 MYSQL_CONFIG.32 = $(MYSQL_BINDIR.32)/mysql_config
697 MYSQL_CONFIG.64 = $(MYSQL_BINDIR.64)/mysql_config
698 MYSQL_CONFIG = $(MYSQL_CONFIG.$(BITS))
700 PKG_MACROS += MYSQL_VERSION=$(MYSQL_VERSION)
701 PKG_MACROS += MYSQL_VERNUM=$(MYSQL_VERNUM)
702 PKG_MACROS += MYSQL_BASEPKG=$(MYSQL_BASEPKG)
704 # Default libjpeg implementation layout
705 JPEG_IMPLEM ?= libjpeg8-turbo
706 JPEG_HOME = $(USRLIBDIR)/$(JPEG_IMPLEM)
707 JPEG_BINDIR.32 = $(JPEG_HOME)/bin
708 JPEG_BINDIR.64 = $(JPEG_HOME)/bin/$(MACH64)
709 JPEG_BINDIR = $(JPEG_BINDIR.$(BITS))
710 JPEG_INCDIR = $(USRINCDIR)/$(JPEG_IMPLEM)
711 JPEG_LIBDIR.32 = $(JPEG_HOME)/lib
712 JPEG_LIBDIR.64 = $(JPEG_HOME)/lib/$(MACH64)
713 JPEG_LIBDIR = $(JPEG_LIBDIR.$(BITS))
714 JPEG_CPPFLAGS = -I$(JPEG_INCDIR)
715 JPEG_CFLAGS.32 = -Wl,-L$(JPEG_LIBDIR.32) -Wl,-R$(JPEG_LIBDIR.32)
716 JPEG_CFLAGS.64 = -Wl,-L$(JPEG_LIBDIR.64) -Wl,-R$(JPEG_LIBDIR.64)
717 JPEG_CFLAGS = $(JPEG_CFLAGS.$(BITS))
718 JPEG_CXXFLAGS.32 = -Wl,-L$(JPEG_LIBDIR.32) -Wl,-R$(JPEG_LIBDIR.32)
719 JPEG_CXXFLAGS.64 = -Wl,-L$(JPEG_LIBDIR.64) -Wl,-R$(JPEG_LIBDIR.64)
720 JPEG_CXXFLAGS = $(JPEG_CXXFLAGS.$(BITS))
721 JPEG_LDFLAGS.32 = -L$(JPEG_LIBDIR.32) -R$(JPEG_LIBDIR.32)
722 JPEG_LDFLAGS.64 = -L$(JPEG_LIBDIR.64) -R$(JPEG_LIBDIR.64)
723 JPEG_LDFLAGS = $(JPEG_LDFLAGS.$(BITS))
725 # This is the default BUILD version of tcl
726 # Not necessarily the system's default version, i.e. /usr/bin/tclsh
727 TCL_VERSION = 8.5
728 TCLSH.8.5.i386.32 = /usr/bin/i86/tclsh8.5
729 TCLSH.8.5.i386.64 = /usr/bin/amd64/tclsh8.5
730 TCLSH.8.5.sparc.32 = /usr/bin/sparcv7/tclsh8.5
731 TCLSH.8.5.sparc.64 = /usr/bin/sparcv9/tclsh8.5
732 TCLSH = $(TCLSH.$(TCL_VERSION).$(MACH).$(BITS))
734 CCSMAKE = /usr/bin/dmake
735 GMAKE = /usr/gnu/bin/make
736 GPATCH = /usr/gnu/bin/patch
737 PATCH_LEVEL = 1
738 GPATCH_BACKUP = --backup --version-control=numbered
739 GPATCH_FLAGS = -p$(PATCH_LEVEL) $(GPATCH_BACKUP)
740 GSED = /usr/bin/sed
741 GDIFF = /usr/gnu/bin/diff
742 GSORT = /usr/gnu/bin/sort
743 GUNZIP = /usr/bin/gunzip
745 PKGREPO = /usr/bin/pkgrepo
746 PKGSEND = /usr/bin/pkgsend
747 ifeq ($(strip $(PKGLINT_COMPONENT)),)
748 PKGLINT = /usr/bin/pkglint
749 else
750 PKGLINT = ${WS_TOOLS}/pkglint
751 endif
753 ACLOCAL = /usr/bin/aclocal-1.10
754 AUTOMAKE = /usr/bin/automake-1.10
755 AUTORECONF = /usr/bin/autoreconf
757 KSH93 = /usr/bin/ksh93
758 TOUCH = /usr/bin/touch
759 MKDIR = /bin/mkdir -p
760 RM = /bin/rm -f
761 CP = /bin/cp -f
762 MV = /bin/mv -f
763 LN = /bin/ln
764 CAT = /bin/cat
765 SYMLINK = /bin/ln -s
766 ENV = /usr/bin/env
767 FIND = /usr/bin/find
768 INSTALL = /usr/bin/install
769 GNU_GREP = /usr/gnu/bin/grep
770 CHMOD = /usr/bin/chmod
771 NAWK = /usr/bin/nawk
772 TEE = /usr/bin/tee
773 GAS = /usr/gnu/bin/as
774 GTAR = /usr/gnu/bin/tar
775 STRIP = /usr/bin/strip
776 IPS2TGZ = $(WS_TOOLS)/ips2tgz
778 INS.dir= $(INSTALL) -d $@
779 INS.file= $(INSTALL) -m 444 $< $(@D)
781 PKG_CONFIG_PATH.32 = /usr/lib/pkgconfig
782 PKG_CONFIG_PATH.64 = /usr/lib/$(MACH64)/pkgconfig
783 PKG_CONFIG_PATH = $(PKG_CONFIG_PATH.$(BITS))
785 # Set default path for environment modules
786 MODULE_VERSION = 3.2.10
787 MODULE_PATH = /usr/share/Modules/modulefiles
788 MODULE_VERSIONS_PATH = /usr/share/Modules/versions
790 # Path to bash completions
791 BASH_COMPLETIONS_PATH = /usr/share/bash-completion/completions
794 # C preprocessor flag sets to ease feature selection. Add the required
795 # feature to your Makefile with CPPFLAGS += $(FEATURE_MACRO) and add to
796 # the component build with CONFIGURE_OPTIONS += CPPFLAGS="$(CPPFLAGS)" or
797 # similiar.
800 # Enables visibility of some c99 math functions that aren't visible by default.
801 # What other side-effects are there?
802 CPP_C99_EXTENDED_MATH = -D_STDC_99
804 # Enables large file support for components that have no other means of doing
805 # so. Use CPP_LARGEFILES and not the .32/.64 variety directly
806 CPP_LARGEFILES.32 := $(shell getconf LFS_CFLAGS)
807 CPP_LARGEFILES.64 := $(shell getconf LFS64_CFLAGS)
808 CPP_LARGEFILES = $(CPP_LARGEFILES.$(BITS))
810 # Enables some #pragma redefine_extname to POSIX-compliant Standard C Library
811 # functions. Also avoids the component's #define _POSIX_C_SOURCE to some value
812 # we currently do not support.
813 CPP_POSIX = -D_POSIX_C_SOURCE=200112L -D_POSIX_PTHREAD_SEMANTICS
815 # XPG6 mode. This option enables XPG6 conformance, plus extensions.
816 # Amongst other things, this option will cause system calls like
817 # popen (3C) and system (3C) to invoke the standards-conforming
818 # shell, /usr/xpg4/bin/sh, instead of /usr/bin/sh. Add studio_XPG6MODE to
819 # CFLAGS instead of using this directly
820 CPP_XPG6MODE= -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1 -D_XPG6
822 # XPG5 mode. These options are specific for C++, where _XPG6,
823 # _XOPEN_SOURCE=600 and C99 are illegal. -D__EXTENSIONS__=1 is legal in C++.
824 CPP_XPG5MODE= -D_XOPEN_SOURCE=500 -D__EXTENSIONS__=1 -D_XPG5
827 # Studio C compiler flag sets to ease feature selection. Add the required
828 # feature to your Makefile with CFLAGS += $(FEATURE_MACRO) and add to the
829 # component build with CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar.
832 # Generate 32/64 bit objects
833 CC_BITS = -m$(BITS)
835 # Code generation instruction set and optimization 'hints'. Use studio_XBITS
836 # and not the .arch.bits variety directly.
837 studio_XBITS.sparc.32 = -xtarget=ultra2 -xarch=sparcvis -xchip=ultra2
838 studio_XBITS.sparc.64 =
839 ifneq ($(strip $(PARFAIT_BUILD)),yes)
840 studio_XBITS.sparc.64 += -xtarget=ultra2
841 endif
842 studio_XBITS.sparc.64 += -xarch=sparcvis -xchip=ultra2
843 studio_XBITS.i386.32 = -xchip=pentium
844 studio_XBITS.i386.64 = -xchip=generic -Ui386 -U__i386
845 studio_XBITS = $(studio_XBITS.$(MACH).$(BITS))
847 # Turn on recognition of supported C99 language features and enable the 1999 C
848 # standard library semantics of routines that appear in both the 1990 and
849 # 1999 C standard. To use set studio_C99MODE=$(studio_99_ENABLE) in your
850 # component Makefile.
851 studio_C99_ENABLE = -xc99=all
853 # Turn off recognition of C99 language features, and do not enable the 1999 C
854 # standard library semantics of routines that appeared in both the 1990 and
855 # 1999 C standard. To use set studio_C99MODE=$(studio_99_DISABLE) in your
856 # component Makefile.
857 studio_C99_DISABLE = -xc99=none
859 # Use the compiler default 'xc99=all,no_lib'
860 studio_C99MODE =
862 # For C++, compatibility with C99 (which is technically illegal) is
863 # enabled in a different way. So, we must use a different macro for it.
864 studio_cplusplus_C99_ENABLE = -xlang=c99
866 # Turn it off.
867 studio_cplusplus_C99_DISABLE =
869 # And this is the macro you should actually use
870 studio_cplusplus_C99MODE =
872 # Turn on C99 for gcc
873 gcc_C99_ENABLE = -std=c99
875 # Allow zero-sized struct/union declarations and void functions with return
876 # statements.
877 studio_FEATURES_EXTENSIONS = -features=extensions
879 # Control the Studio optimization level.
880 studio_OPT.sparc.32 = -xO4
881 studio_OPT.sparc.64 = -xO4
882 studio_OPT.i386.32 = -xO4
883 studio_OPT.i386.64 = -xO4
884 studio_OPT = $(studio_OPT.$(MACH).$(BITS))
886 # Studio PIC code generation. Use CC_PIC instead to select PIC code generation.
887 studio_PIC = -KPIC -DPIC
889 # The Sun Studio 11 compiler has changed the behaviour of integer
890 # wrap arounds and so a flag is needed to use the legacy behaviour
891 # (without this flag panics/hangs could be exposed within the source).
892 # This is used through studio_IROPTS, not the 'sparc' variety.
893 studio_IROPTS.sparc = -W2,-xwrap_int
894 studio_IROPTS = $(studio_IROPTS.$(MACH))
896 # Control register usage for generated code. SPARC ABI requires system
897 # libraries not to use application registers. x86 requires 'no%frameptr' at
898 # x04 or higher.
900 # We should just use -xregs but we need to workaround 7030022. Note
901 # that we can't use the (documented) -Wc,-xregs workaround because
902 # libtool really hates -Wc and thinks it should be -Wl. Instead
903 # we use an (undocumented) option which actually happens to be what
904 # CC would use.
905 studio_XREGS.sparc = -Qoption cg -xregs=no%appl
906 studio_XREGS.i386 = -xregs=no%frameptr
907 studio_XREGS = $(studio_XREGS.$(MACH))
909 gcc_XREGS.sparc = -mno-app-regs
910 gcc_XREGS.i386 =
911 gcc_XREGS = $(gcc_XREGS.$(MACH))
913 # Set data alignment on sparc to reasonable values, 8 byte alignment for 32 bit
914 # objects and 16 byte alignment for 64 bit objects. This is added to CFLAGS by
915 # default.
916 studio_ALIGN.sparc.32 = -xmemalign=8s
917 studio_ALIGN.sparc.64 = -xmemalign=16s
918 studio_ALIGN = $(studio_ALIGN.$(MACH).$(BITS))
920 # Studio shorthand for building multi-threaded code, enables -D_REENTRANT and
921 # linking with threadin support. This is added to CFLAGS by default, override
922 # studio_MT to turn this off.
923 studio_MT = -mt
925 # See CPP_XPG6MODE comment above.
926 studio_XPG6MODE = $(studio_C99MODE) $(CPP_XPG6MODE)
927 XPG6MODE = $(studio_XPG6MODE)
929 # See CPP_XPG5MODE comment above. You can only use this in C++, not in C99.
930 studio_XPG5MODE = $(studio_cplusplus_C99MODE) $(CPP_XPG5MODE)
931 XPG5MODE = $(studio_XPG5MODE)
933 # Default Studio C compiler flags. Add the required feature to your Makefile
934 # with CFLAGS += $(FEATURE_MACRO) and add to the component build with
935 # CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar. In most cases, it
936 # should not be necessary to add CFLAGS to any environment other than the
937 # configure environment.
938 CFLAGS.studio += $(studio_OPT) $(studio_XBITS) $(studio_XREGS) \
939 $(studio_IROPTS) $(studio_C99MODE) $(studio_ALIGN) \
940 $(studio_MT)
943 # GNU C compiler flag sets to ease feature selection. Add the required
944 # feature to your Makefile with CFLAGS += $(FEATURE_MACRO) and add to the
945 # component build with CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar.
948 # GCC Compiler optimization flag
949 gcc_OPT = -O3
951 # GCC PIC code generation. Use CC_PIC instead to select PIC code generation.
952 gcc_PIC = -fPIC -DPIC
954 # Generic macro for PIC code generation. Use this macro instead of the
955 # compiler specific variant.
956 CC_PIC = $($(COMPILER)_PIC)
959 # Default GNU C compiler flags. Add the required feature to your Makefile
960 # with CFLAGS += $(FEATURE_MACRO) and add to the component build with
961 # CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar. In most cases, it
962 # should not be necessary to add CFLAGS to any environment other than the
963 # configure environment.
964 CFLAGS.gcc += $(gcc_OPT)
965 CFLAGS.gcc += $(gcc_XREGS)
968 # Build 32 or 64 bit objects.
969 CFLAGS += $(CC_BITS)
971 # Add compiler specific 'default' features
972 CFLAGS += $(CFLAGS.$(COMPILER))
975 # Studio C++ requires -norunpath to avoid adding its location into the RUNPATH
976 # to C++ applications.
977 studio_NORUNPATH = -norunpath
979 # To link in standard mode (the default mode) without any C++ libraries
980 # (except libCrun), use studio_LIBRARY_NONE in your component Makefile.
981 studio_LIBRARY_NONE = -library=%none
983 # Don't link C++ with any C++ Runtime or Standard C++ library
984 studio_CXXLIB_NONE = -xnolib
986 # Link C++ with the Studio C++ Runtime and Standard C++ library. This is the
987 # default for "standard" mode.
988 studio_CXXLIB_CSTD = -library=Cstd,Crun
990 # link C++ with the Studio C++ Runtime and Apache Standard C++ library
991 studio_CXXLIB_APACHE = -library=stdcxx4,Crun
993 # Add the C++ ABI compatibility flags for older ABI compatibility. The default
994 # is "standard mode" (-compat=5)
995 studio_COMPAT_VERSION_4 = -compat=4
997 # Tell the compiler that we don't want the studio runpath added to the
998 # linker flags. We never want the Studio location added to the RUNPATH.
999 CXXFLAGS += $($(COMPILER)_NORUNPATH)
1001 # Build 32 or 64 bit objects in C++ as well.
1002 CXXFLAGS += $(CC_BITS)
1004 # Build 32 or 64 bit objects in FORTRAN as well.
1005 F77FLAGS += $(CC_BITS)
1006 FCFLAGS += $(CC_BITS)
1010 # Solaris linker flag sets to ease feature selection. Add the required
1011 # feature to your Makefile with LDFLAGS += $(FEATURE_MACRO) and add to the
1012 # component build with CONFIGURE_OPTIONS += LDFLAGS="$(LDFLAGS)" or similiar.
1015 # set the bittedness that we want to link
1016 ccs.ld.64 = -64
1017 gcc.ld.32 = -m32
1018 gcc.ld.64 = -m64
1019 LD_BITS = $($(LINKER).ld.$(BITS))
1020 LDFLAGS = $(LD_BITS)
1022 # Reduce the symbol table size, effectively conflicting with -g. We should
1023 # get linker guidance here.
1024 LD_Z_REDLOCSYM = -z redlocsym
1026 # Cause the linker to rescan archive libraries and resolve remaining unresolved
1027 # symbols recursively until all symbols are resolved. Components should be
1028 # linking in the libraries they need, in the required order. This should
1029 # only be required if the component's native build is horribly broken.
1030 LD_Z_RESCAN_NOW = -z rescan-now
1032 LD_Z_TEXT = -z direct
1034 # make sure that -lc is always present when building shared objects.
1035 LD_DEF_LIBS += -lc
1037 # make sure all symbols are defined.
1038 LD_Z_DEFS = -z defs
1040 # eliminate unreferenced dynamic dependencies
1041 LD_Z_IGNORE = -z ignore
1043 # use direct binding
1044 LD_B_DIRECT = -Bdirect
1046 # use generic macro names for enabling/disabling ASLR
1047 ASLR_ENABLE = -z aslr=enable
1048 ASLR_DISABLE = -z aslr=disable
1049 ASLR_MODE = $(ASLR_DISABLE)
1051 # by default, turn off Address Space Layout Randomization for ELF executables;
1052 # to explicitly enable ASLR, set ASLR_MODE = $(ASLR_ENABLE)
1053 # in that component's Makefile
1054 LD_Z_ASLR = $(ASLR_MODE)
1057 # More Solaris linker flags that we want to be sure that everyone gets. This
1058 # is automatically added to the calling environment during the 'build' and
1059 # 'install' phases of the component build. Each individual feature can be
1060 # turned off by adding FEATURE_MACRO= to the component Makefile.
1063 # Create a non-executable bss segment when linking.
1064 LD_MAP_NOEXBSS = -M /usr/lib/ld/map.noexbss
1066 # Page alignment
1067 LD_MAP_PAGEALIGN = -M /usr/lib/ld/map.pagealign
1069 # Linker options to add when only building libraries
1070 LD_OPTIONS_SO += $(LD_Z_TEXT) $(LD_Z_DEFS) $(LD_DEF_LIBS)
1072 # Default linker options that everyone should get. Do not add additional
1073 # libraries to this macro, as it will apply to everything linked during the
1074 # component build.
1075 LD_OPTIONS += $(LD_MAP_PAGEALIGN) $(LD_B_DIRECT) $(LD_Z_IGNORE)
1077 # only used on executables
1078 LD_EXEC_OPTIONS = $(LD_Z_ASLR)
1080 # Environment variables and arguments passed into the build and install
1081 # environment(s). These are the initial settings.
1082 COMPONENT_BUILD_ENV= \
1083 LD_OPTIONS="$(LD_OPTIONS)" \
1084 LD_EXEC_OPTIONS="$(LD_EXEC_OPTIONS)"
1085 COMPONENT_INSTALL_ENV= \
1086 LD_OPTIONS="$(LD_OPTIONS)" \
1087 LD_EXEC_OPTIONS="$(LD_EXEC_OPTIONS)"
1089 # PERL options which depend on C options should be placed here
1090 # Don't trust Perl $Config{optimize}, we can get Studio flags
1091 PERL_OPTIMIZE =$(gcc_OPT)
1093 # We need this to overwrite options of perl used to compile illumos-gate
1094 PERL_STUDIO_OVERWRITE = cc="$(CC)" cccdlflags="$(CC_PIC)" ld="$(CC)" ccname="$(shell basename $(CC))" optimize="$(gcc_OPT)"
1096 # Allow user to override default maximum number of archives
1097 NUM_EXTRA_ARCHIVES= 1 2 3 4 5 6 7 8 9 10
1099 # Rewrite absolute source-code paths into relative for ccache, so that any
1100 # workspace with a shared CCACHE_DIR can benefit when compiling a component
1101 ifneq ($(strip $(CCACHE)),)
1102 export CCACHE_BASEDIR = $(BUILD_DIR_$(BITS))
1103 COMPONENT_BUILD_ENV += CCACHE="$(CCACHE)"
1104 COMPONENT_INSTALL_ENV += CCACHE="$(CCACHE)"
1105 COMPONENT_TEST_ENV += CCACHE="$(CCACHE)"
1106 COMPONENT_BUILD_ENV += CC_gcc_32="$(CC_gcc_32)"
1107 COMPONENT_BUILD_ENV += CC_gcc_64="$(CC_gcc_32)"
1108 COMPONENT_BUILD_ENV += CXX_gcc_32="$(CXX_gcc_64)"
1109 COMPONENT_BUILD_ENV += CXX_gcc_64="$(CXX_gcc_64)"
1110 COMPONENT_INSTALL_ENV += CC_gcc_32="$(CC_gcc_32)"
1111 COMPONENT_INSTALL_ENV += CC_gcc_64="$(CC_gcc_32)"
1112 COMPONENT_INSTALL_ENV += CXX_gcc_32="$(CXX_gcc_64)"
1113 COMPONENT_INSTALL_ENV += CXX_gcc_64="$(CXX_gcc_64)"
1114 COMPONENT_TEST_ENV += CC_gcc_32="$(CC_gcc_32)"
1115 COMPONENT_TEST_ENV += CC_gcc_64="$(CC_gcc_32)"
1116 COMPONENT_TEST_ENV += CXX_gcc_32="$(CXX_gcc_64)"
1117 COMPONENT_TEST_ENV += CXX_gcc_64="$(CXX_gcc_64)"
1118 COMPONENT_BUILD_ENV.$(BITS) += CCACHE_BASEDIR="$(BUILD_DIR_$(BITS))"
1119 COMPONENT_INSTALL_ENV.$(BITS) += CCACHE_BASEDIR="$(BUILD_DIR_$(BITS))"
1120 COMPONENT_TEST_ENV.$(BITS) += CCACHE_BASEDIR="$(BUILD_DIR_$(BITS))"
1122 ifneq ($(strip $(CCACHE_DIR)),)
1123 COMPONENT_BUILD_ENV += CCACHE_DIR="$(CCACHE_DIR)"
1124 COMPONENT_INSTALL_ENV += CCACHE_DIR="$(CCACHE_DIR)"
1125 COMPONENT_TEST_ENV += CCACHE_DIR="$(CCACHE_DIR)"
1126 endif
1128 ifneq ($(strip $(CCACHE_LOGFILE)),)
1129 COMPONENT_BUILD_ENV += CCACHE_LOGFILE="$(CCACHE_LOGFILE)"
1130 COMPONENT_INSTALL_ENV += CCACHE_LOGFILE="$(CCACHE_LOGFILE)"
1131 COMPONENT_TEST_ENV += CCACHE_LOGFILE="$(CCACHE_LOGFILE)"
1132 endif
1134 endif
1136 # Add any bit-specific settings
1137 COMPONENT_BUILD_ENV += $(COMPONENT_BUILD_ENV.$(BITS))
1138 COMPONENT_BUILD_ARGS += $(COMPONENT_BUILD_ARGS.$(BITS))
1139 COMPONENT_INSTALL_ENV += $(COMPONENT_INSTALL_ENV.$(BITS))
1140 COMPONENT_INSTALL_ARGS += $(COMPONENT_INSTALL_ARGS.$(BITS))
1142 # declare these phony so that we avoid filesystem conflicts.
1143 .PHONY: prep build install publish test clean clobber parfait
1145 # If there are no tests to execute
1146 NO_TESTS = test-nothing
1147 test-nothing:
1148 @echo "There are no tests available at this time."
1150 # default behaviour for 'component-hook' target is to echo the component
1151 # name and version information, but more complex behaviour can be implemented
1152 # via command line setting of the COMPONENT_HOOK macro.
1153 COMPONENT_HOOK ?= echo $(COMPONENT_NAME) $(COMPONENT_VERSION)
1155 component-hook:
1156 @$(COMPONENT_HOOK)
1159 # Packages with tools that are required to build Userland components
1161 REQUIRED_PACKAGES += metapackages/build-essential
1163 # Only a default dependency if component being built produces binaries.
1164 ifneq ($(strip $(BUILD_BITS)),NO_ARCH)
1165 REQUIRED_PACKAGES += system/library
1166 endif
1168 include $(WS_MAKE_RULES)/environment.mk
1170 # A simple rule to print the value of any macro. Ex:
1171 # $ gmake print-REQUIRED_PACKAGES
1172 # Note that some macros are set on a per target basis, so what you see
1173 # is not always what you get.
1174 print-%:
1175 @echo '$(subst ','\'',$*=$($*)) (origin: $(origin $*), flavor: $(flavor $*))'