Add livereload 2.4.1
[unleashed-userland.git] / make-rules / shared-macros.mk
blob8df28d34935aa881ea8dde8a03f1eaf941aa12e3
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 ROOT = /
83 # Native OS version
84 OS_VERSION := $(shell uname -r)
85 SOLARIS_VERSION = $(OS_VERSION:5.%=2.%)
86 # Target OS version
87 PKG_SOLARIS_VERSION ?= 5.11
89 include $(WS_MAKE_RULES)/ips-buildinfo.mk
91 COMPILER = gcc
92 LINKER = gcc
93 BITS = 32
94 PYTHON_VERSION = 2.7
95 PYTHON_VERSIONS = 2.7
97 BASS_O_MATIC = $(WS_TOOLS)/bass-o-matic
99 CLONEY = $(WS_TOOLS)/cloney
101 CONFIG_SHELL = /bin/bash
103 PKG_REPO = file:$(WS_REPO)
105 COMPONENT_SRC_NAME = $(COMPONENT_NAME)
107 COMPONENT_LICENSE_FILE ?= $(COMPONENT_NAME).license
109 COMPONENT_DIR := $(shell pwd)
110 SOURCE_DIR = $(COMPONENT_DIR)/$(COMPONENT_SRC)
111 BUILD_DIR = $(COMPONENT_DIR)/build
112 PROTO_DIR = $(BUILD_DIR)/prototype/$(MACH)
114 ARCHLIBSUBDIR32 =
115 ARCHLIBSUBDIR64 = $(MACH64)
116 ARCHLIBSUBDIR = $(ARCHLIBSUBDIR$(BITS))
118 ETCDIR = /etc
119 USRDIR = /usr
120 BINDIR = /bin
121 SBINDIR = /sbin
122 LIBDIR = /lib
123 VARDIR = /var
124 KERNELDRVDIR = /kernel/drv
125 KERNELDRVDIR32 =/kernel/drv
126 KERNELDRVDIR64 =/kernel/drv/$(MACH64)
127 USRBINDIR = $(USRDIR)/bin
128 USRBINDIR32 = $(USRDIR)/bin/$(MACH32)
129 USRBINDIR64 = $(USRDIR)/bin/$(MACH64)
130 USRSBINDIR = $(USRDIR)/sbin
131 USRSBINDIR32 = $(USRDIR)/sbin/$(MACH32)
132 USRSBINDIR64 = $(USRDIR)/sbin/$(MACH64)
133 USRLIBDIR = $(USRDIR)/lib
134 USRLIBDIR32 = $(USRDIR)/lib
135 USRLIBDIR64 = $(USRDIR)/lib/$(MACH64)
136 USRSHAREDIR = $(USRDIR)/share
137 USRINCDIR = $(USRDIR)/include
138 USRSHARELOCALEDIR = $(USRSHAREDIR)/locale
139 USRSHAREMANDIR = $(USRSHAREDIR)/man
140 USRSHAREDOCDIR = $(USRSHAREDIR)/doc
141 USRSHARELIBDIR = $(USRSHAREDIR)/lib
142 USRSHAREMAN1DIR = $(USRSHAREMANDIR)/man1
143 USRSHAREMAN1MDIR = $(USRSHAREMANDIR)/man1m
144 USRSHAREMAN3DIR = $(USRSHAREMANDIR)/man3
145 USRSHAREMAN4DIR = $(USRSHAREMANDIR)/man4
146 USRSHAREMAN5DIR = $(USRSHAREMANDIR)/man5
147 USRSHAREMAN8DIR = $(USRSHAREMANDIR)/man8
148 USRKERNELDRVDIR = $(USRDIR)/kernel/drv
149 USRKERNELDRVDIR32 = $(USRDIR)/kernel/drv
150 USRKERNELDRVDIR64 = $(USRDIR)/kernel/drv/$(MACH64)
152 # The *.$(BITS) variables are different from those above (better suited for
153 # isaexec wrapper), and allow for default 32-bit vs. nondefault 64-bit setups
154 USRBINDIR.32 = $(USRBINDIR)
155 USRBINDIR.64 = $(USRBINDIR64)
156 USRSBINDIR.32 = $(USRSBINDIR)
157 USRSBINDIR.64 = $(USRSBINDIR64)
158 USRLIBDIR.32 = $(USRLIBDIR)
159 USRLIBDIR.64 = $(USRLIBDIR64)
161 PROTOETCDIR = $(PROTO_DIR)/$(ETCDIR)
162 PROTOETCSECDIR = $(PROTO_DIR)/$(ETCDIR)/security
163 PROTOUSRDIR = $(PROTO_DIR)/$(USRDIR)
164 PROTOBINDIR = $(PROTO_DIR)/$(BINDIR)
165 PROTOSBINDIR = $(PROTO_DIR)/$(SBINDIR)
166 PROTOLIBDIR = $(PROTO_DIR)/$(LIBDIR)
167 PROTOVARDIR = $(PROTO_DIR)/$(VARDIR)
168 PROTOKERNELDRVDIR = $(PROTO_DIR)/$(KERNELDRVDIR)
169 PROTOKERNELDRVDIR32 = $(PROTO_DIR)/$(KERNELDRVDIR32)
170 PROTOKERNELDRVDIR64 = $(PROTO_DIR)/$(KERNELDRVDIR64)
171 PROTOUSRBINDIR = $(PROTO_DIR)/$(USRBINDIR)
172 PROTOUSRBINDIR32 = $(PROTO_DIR)/$(USRBINDIR32)
173 PROTOUSRBINDIR64 = $(PROTO_DIR)/$(USRBINDIR64)
174 PROTOUSRSBINDIR = $(PROTO_DIR)/$(USRSBINDIR)
175 PROTOUSRSBINDIR32 = $(PROTO_DIR)/$(USRSBINDIR32)
176 PROTOUSRSBINDIR64 = $(PROTO_DIR)/$(USRSBINDIR64)
177 PROTOUSRLIBDIR = $(PROTO_DIR)/$(USRLIBDIR)
178 PROTOUSRLIBDIR32 = $(PROTO_DIR)/$(USRLIBDIR32)
179 PROTOUSRLIBDIR64 = $(PROTO_DIR)/$(USRLIBDIR64)
180 PROTOUSRINCDIR = $(PROTO_DIR)/$(USRINCDIR)
181 PROTOUSRSHAREDIR = $(PROTO_DIR)/$(USRSHAREDIR)
182 PROTOUSRSHARELIBDIR = $(PROTO_DIR)/$(USRSHARELIBDIR)
183 PROTOUSRSHAREMANDIR = $(PROTO_DIR)/$(USRSHAREMANDIR)
184 PROTOUSRSHAREDOCDIR = $(PROTO_DIR)/$(USRSHAREDOCDIR)
185 PROTOUSRSHAREMAN1DIR = $(PROTO_DIR)/$(USRSHAREMAN1DIR)
186 PROTOUSRSHAREMAN1MDIR = $(PROTO_DIR)/$(USRSHAREMAN1MDIR)
187 PROTOUSRSHAREMAN3DIR = $(PROTO_DIR)/$(USRSHAREMAN3DIR)
188 PROTOUSRSHAREMAN4DIR = $(PROTO_DIR)/$(USRSHAREMAN4DIR)
189 PROTOUSRSHAREMAN5DIR = $(PROTO_DIR)/$(USRSHAREMAN5DIR)
190 PROTOUSRSHAREMAN8DIR = $(PROTO_DIR)/$(USRSHAREMAN8DIR)
191 PROTOUSRSHARELOCALEDIR = $(PROTO_DIR)/$(USRSHARELOCALEDIR)
192 PROTOUSRKERNELDRVDIR = $(PROTO_DIR)/$(USRKERNELDRVDIR)
193 PROTOUSRKERNELDRVDIR32 = $(PROTO_DIR)/$(USRKERNELDRVDIR32)
194 PROTOUSRKERNELDRVDIR64 = $(PROTO_DIR)/$(USRKERNELDRVDIR64)
196 PROTOUSRBINDIR.32 = $(PROTOUSRBINDIR)
197 PROTOUSRBINDIR.64 = $(PROTOUSRBINDIR64)
198 PROTOUSRSBINDIR.32 = $(PROTOUSRSBINDIR)
199 PROTOUSRSBINDIR.64 = $(PROTOUSRSBINDIR64)
200 PROTOUSRLIBDIR.32 = $(PROTOUSRLIBDIR)
201 PROTOUSRLIBDIR.64 = $(PROTOUSRLIBDIR64)
203 # NOTE: We do not build SFW contents
204 # /usr/sfw/bin is just a historic artefact, containing symlinks
205 SFWBIN = /usr/sfw/bin
206 SFWBIN32 = $(SFWBIN)
207 SFWBIN64 = $(SFWBIN)/$(MACH64)
208 SFWSBIN = /usr/sfw/sbin
209 SFWSBIN32 = $(SFWSBIN)
210 SFWSBIN64 = $(SFWSBIN)/$(MACH64)
211 SFWINCLUDE = /usr/sfw/include
212 SFWLIB = /usr/sfw/lib
213 SFWLIB32 = $(SFWLIB)
214 SFWLIB64 = $(SFWLIB)/$(MACH64)
215 SFWSHARE = /usr/sfw/share
216 SFWSHAREMAN = $(SFWSHARE)/man
217 SFWSHAREMAN1 = $(SFWSHAREMAN)/man1
218 PROTOSFWBIN = $(PROTO_DIR)/$(SFWBIN)
219 PROTOSFWBIN32 = $(PROTO_DIR)/$(SFWBIN32)
220 PROTOSFWBIN64 = $(PROTO_DIR)/$(SFWBIN64)
221 PROTOSFWSBIN = $(PROTO_DIR)/$(SFWSBIN)
222 PROTOSFWSBIN32 = $(PROTO_DIR)/$(SFWSBIN32)
223 PROTOSFWSBIN64 = $(PROTO_DIR)/$(SFWSBIN64)
224 PROTOSFWLIB = $(PROTO_DIR)/$(SFWLIB)
225 PROTOSFWLIB32 = $(PROTO_DIR)/$(SFWLIB32)
226 PROTOSFWLIB64 = $(PROTO_DIR)/$(SFWLIB64)
227 PROTOSFWSHARE = $(PROTO_DIR)/$(SFWSHARE)
228 PROTOSFWSHAREMAN = $(PROTO_DIR)/$(SFWSHAREMAN)
229 PROTOSFWSHAREMAN1 = $(PROTO_DIR)/$(SFWSHAREMAN1)
230 PROTOSFWINCLUDE = $(PROTO_DIR)/$(SFWINCLUDE)
232 # The *.$(BITS) variables are different from those above (better suited for
233 # isaexec wrapper), and allow for default 32-bit vs. nondefault 64-bit setups
234 SFWBIN.32 = $(SFWBIN)
235 SFWBIN.64 = $(SFWBIN64)
236 SFWSBIN.32 = $(SFWSBIN)
237 SFWSBIN.64 = $(SFWSBIN64)
238 SFWLIB.32 = $(SFWLIB)
239 SFWLIB.64 = $(SFWLIB64)
240 PROTOSFWBIN.32 = $(PROTOSFWBIN)
241 PROTOSFWBIN.64 = $(PROTOSFWBIN64)
242 PROTOSFWSBIN.32 = $(PROTOSFWSBIN)
243 PROTOSFWSBIN.64 = $(PROTOSFWSBIN64)
244 PROTOSFWLIB.32 = $(PROTOSFWLIB)
245 PROTOSFWLIB.64 = $(PROTOSFWLIB64)
247 CLDIR = /usr/share/common-lisp
248 PROTOCLDIR = $(PROTO_DIR)/$(CLDIR)
250 GNUBIN = /usr/gnu/bin
251 GNUBIN32 = $(GNUBIN)/$(MACH32)
252 GNUBIN64 = $(GNUBIN)/$(MACH64)
253 GNUSBIN = /usr/gnu/sbin
254 GNUSBIN32 = $(GNUSBIN)/$(MACH32)
255 GNUSBIN64 = $(GNUSBIN)/$(MACH64)
256 GNULIB = /usr/gnu/lib
257 GNULIB32 = $(GNULIB)
258 GNULIB64 = $(GNULIB)/$(MACH64)
259 GNUSHARE = /usr/gnu/share
260 GNUSHAREMAN = $(GNUSHARE)/man
261 GNUSHAREMAN1 = $(GNUSHAREMAN)/man1
262 PROTOGNUBIN = $(PROTO_DIR)/$(GNUBIN)
263 PROTOGNUBIN32 = $(PROTO_DIR)/$(GNUBIN32)
264 PROTOGNUBIN64 = $(PROTO_DIR)/$(GNUBIN64)
265 PROTOGNUSBIN = $(PROTO_DIR)/$(GNUSBIN)
266 PROTOGNUSBIN32 = $(PROTO_DIR)/$(GNUSBIN32)
267 PROTOGNUSBIN64 = $(PROTO_DIR)/$(GNUSBIN64)
268 PROTOGNULIB = $(PROTO_DIR)/$(GNULIB)
269 PROTOGNULIB32 = $(PROTO_DIR)/$(GNULIB32)
270 PROTOGNULIB64 = $(PROTO_DIR)/$(GNULIB64)
271 PROTOGNUSHARE = $(PROTO_DIR)/$(GNUSHARE)
272 PROTOGNUSHAREMAN = $(PROTO_DIR)/$(GNUSHAREMAN)
273 PROTOGNUSHAREMAN1 = $(PROTO_DIR)/$(GNUSHAREMAN1)
275 # The *.$(BITS) variables are different from those above (better suited for
276 # isaexec wrapper), and allow for default 32-bit vs. nondefault 64-bit setups
277 GNUBIN.32 = $(GNUBIN)
278 GNUBIN.64 = $(GNUBIN64)
279 GNUSBIN.32 = $(GNUSBIN)
280 GNUSBIN.64 = $(GNUSBIN64)
281 GNULIB.32 = $(GNULIB)
282 GNULIB.64 = $(GNULIB64)
283 PROTOGNUBIN.32 = $(PROTOGNUBIN)
284 PROTOGNUBIN.64 = $(PROTOGNUBIN64)
285 PROTOGNUSBIN.32 = $(PROTOGNUSBIN)
286 PROTOGNUSBIN.64 = $(PROTOGNUSBIN64)
287 PROTOGNULIB.32 = $(PROTOGNULIB)
288 PROTOGNULIB.64 = $(PROTOGNULIB64)
290 # work around _TIME, _DATE, embedded date chatter in component builds
291 # to use, set TIME_CONSTANT in the component Makefile and add $(CONSTANT_TIME)
292 # to the appropriate {CONFIGURE|BUILD|INSTALL}_ENV
293 CONSTANT_TIME = LD_PRELOAD_32=$(WS_TOOLS)/time-$(MACH32).so
294 CONSTANT_TIME += LD_PRELOAD_64=$(WS_TOOLS)/time-$(MACH64).so
295 CONSTANT_TIME += TIME_CONSTANT=$(TIME_CONSTANT)
297 # set MACH from uname -p to either sparc or i386
298 MACH := $(shell uname -p)
300 # set MACH32 from MACH to either sparcv7 or i86
301 MACH32_1 = $(MACH:sparc=sparcv7)
302 MACH32 = $(MACH32_1:i386=i86)
304 # set MACH64 from MACH to either sparcv9 or amd64
305 MACH64_1 = $(MACH:sparc=sparcv9)
306 MACH64 = $(MACH64_1:i386=amd64)
308 CONFIGURE_32 = $(BUILD_DIR_32)/.configured
309 CONFIGURE_64 = $(BUILD_DIR_64)/.configured
311 BUILD_DIR_32 = $(BUILD_DIR)/$(MACH32)
312 BUILD_DIR_64 = $(BUILD_DIR)/$(MACH64)
314 BUILD_32 = $(BUILD_DIR_32)/.built
315 BUILD_64 = $(BUILD_DIR_64)/.built
316 BUILD_32_and_64 = $(BUILD_32) $(BUILD_64)
317 $(BUILD_DIR_32)/.built: BITS=32
318 $(BUILD_DIR_64)/.built: BITS=64
320 INSTALL_32 = $(BUILD_DIR_32)/.installed
321 INSTALL_64 = $(BUILD_DIR_64)/.installed
322 INSTALL_32_and_64 = $(INSTALL_32) $(INSTALL_64)
323 $(BUILD_DIR_32)/.installed: BITS=32
324 $(BUILD_DIR_64)/.installed: BITS=64
326 # set the default target for installation of the component
327 COMPONENT_INSTALL_TARGETS = install
329 # set the default build test results directory
330 COMPONENT_TEST_BUILD_DIR = $(BUILD_DIR)/test/$(MACH$(BITS))
332 # set the default master test results directory
333 COMPONENT_TEST_RESULTS_DIR = $(COMPONENT_DIR)/test
335 # set the default master test results file
336 COMPONENT_TEST_MASTER = $(COMPONENT_TEST_RESULTS_DIR)/results-$(BITS).master
338 # set the default test results output file
339 COMPONENT_TEST_OUTPUT = $(COMPONENT_TEST_BUILD_DIR)/test-$(BITS)-results
341 # set the default test results comparison diffs file
342 COMPONENT_TEST_DIFFS = $(COMPONENT_TEST_BUILD_DIR)/test-$(BITS)-diffs
344 # set the default test snapshot file
345 COMPONENT_TEST_SNAPSHOT = $(COMPONENT_TEST_BUILD_DIR)/results-$(BITS).snapshot
347 # Normally $(GSED) is simplest, but some results files need more power.
348 COMPONENT_TEST_TRANSFORMER = $(GSED)
350 # The set of default transforms to be applied to the test results to try
351 # to normalize them.
352 COMPONENT_TEST_TRANSFORMS = \
353 '-e "s|$(@D)|\\$$(@D)|g" ' \
354 '-e "s|$(PERL)|\\$$(PERL)|g" ' \
355 '-e "s|$(SOURCE_DIR)|\\$$(SOURCE_DIR)|g" '
357 # set the default commands used to generate the file containing the set
358 # of transforms to be applied to the test results to try to normalize them.
359 COMPONENT_TEST_CREATE_TRANSFORMS = \
360 if [ -e $(COMPONENT_TEST_MASTER) ]; \
361 then \
362 print "\#!/bin/sh" > $(COMPONENT_TEST_TRANSFORM_CMD); \
363 print '$(COMPONENT_TEST_TRANSFORMER) ' \
364 $(COMPONENT_TEST_TRANSFORMS) \
365 ' \\' >> $(COMPONENT_TEST_TRANSFORM_CMD); \
366 print '$(COMPONENT_TEST_OUTPUT) \\' \
367 >> $(COMPONENT_TEST_TRANSFORM_CMD); \
368 print '> $(COMPONENT_TEST_SNAPSHOT)' \
369 >> $(COMPONENT_TEST_TRANSFORM_CMD); \
372 # set the default command for performing any test result munging
373 COMPONENT_TEST_TRANSFORM_CMD = $(COMPONENT_TEST_BUILD_DIR)/transform-$(BITS)-results
375 # set the default operation to run to perform test result normalization
376 COMPONENT_TEST_PERFORM_TRANSFORM = \
377 if [ -e $(COMPONENT_TEST_MASTER) ]; \
378 then \
379 $(SHELL) $(COMPONENT_TEST_TRANSFORM_CMD); \
382 # set the default command used to compare the master results with the snapshot
383 COMPONENT_TEST_COMPARE_CMD = $(GDIFF) -uN
385 # set the default way that master and snapshot test results are compared
386 COMPONENT_TEST_COMPARE = \
387 if [ -e $(COMPONENT_TEST_MASTER) ]; \
388 then \
389 $(COMPONENT_TEST_COMPARE_CMD) \
390 $(COMPONENT_TEST_MASTER) $(COMPONENT_TEST_SNAPSHOT) \
391 > $(COMPONENT_TEST_DIFFS); \
392 print "Test results in $(COMPONENT_TEST_OUTPUT)"; \
393 if [ -s $(COMPONENT_TEST_DIFFS) ]; \
394 then \
395 print "Differences found."; \
396 $(CAT) $(COMPONENT_TEST_DIFFS); \
397 exit 2; \
398 else \
399 print "No differences found."; \
400 fi \
403 # set the default env command to use for test of the component
404 COMPONENT_TEST_ENV_CMD = $(ENV)
406 # set the default command to use for test of the component
407 COMPONENT_TEST_CMD = $(GMAKE)
409 # set the default target for test of the component
410 COMPONENT_TEST_TARGETS = check
412 # set the default directory for test of the component
413 COMPONENT_TEST_DIR = $(@D)
415 # determine the type of tests we want to run.
416 ifeq ($(strip $(wildcard $(COMPONENT_TEST_RESULTS_DIR)/results-*.master)),)
417 TEST_32 = $(BUILD_DIR_32)/.tested
418 TEST_64 = $(BUILD_DIR_64)/.tested
419 else
420 TEST_32 = $(BUILD_DIR_32)/.tested-and-compared
421 TEST_64 = $(BUILD_DIR_64)/.tested-and-compared
422 endif
423 TEST_32_and_64 = $(TEST_32) $(TEST_64)
424 $(BUILD_DIR_32)/.tested: BITS=32
425 $(BUILD_DIR_64)/.tested: BITS=64
426 $(BUILD_DIR_32)/.tested-and-compared: BITS=32
427 $(BUILD_DIR_64)/.tested-and-compared: BITS=64
429 # BUILD_TOOLS is the root of all tools not normally installed on the system.
430 BUILD_TOOLS ?= /opt
432 SPRO_ROOT = $(BUILD_TOOLS)/sunstudio12.1
433 SPRO_VROOT = $(SPRO_ROOT)
435 PARFAIT_ROOT = $(BUILD_TOOLS)/parfait/parfait-tools-1.0.1/
436 PARFAIT= $(PARFAIT_ROOT)/bin/parfait
437 export PARFAIT_NATIVESUNCC=$(SPRO_VROOT)/bin/cc
438 export PARFAIT_NATIVESUNCXX=$(SPRO_VROOT)/bin/CC
439 export PARFAIT_NATIVEGCC=$(GCC_ROOT)/bin/gcc
440 export PARFAIT_NATIVEGXX=$(GCC_ROOT)/bin/g++
443 # The CCACHE makefile variable should evaluate to empty string or a pathname
444 # like /usr/bin/ccache depending on your PATH value and "which" implementation.
445 # The assignment via ":=" is important, to only do this once in a Makefile,
446 # and not on every reference to the value as "=" assignment would result in.
447 # Review `man ccache` for optional configuration tuning, like cache size etc.
449 # For production builds or suspected errors you can disable this feature by
450 # setting ENABLE_CCACHE=false (as makefile or environment variable, which
451 # is currently the default) to not even define the usage of wrapper in the
452 # userland-building makefile system.
453 # If you want to speed up your re-builds, you must set ENABLE_CCACHE=true.
454 # For legacy reasons, the CCACHE_DISABLE and CCACHE_NODISABLE variables (from
455 # configuration of the "ccache" program itself) are also supported, but direct
456 # use is discouraged, since their syntax and usage are counter-intuitive.
458 # Still, absence of ccache in PATH is not considered a fatal error since the
459 # build would just proceed well with original compiler.
460 # Note: In code below we fast-track if the makefile CCACHE variable is defined
461 # but fall back to shell executability tests if just envvar CCACHE is passed.
463 export CCACHE := $(shell \
464 if test -n "$(CCACHE)" ; then \
465 echo "$(CCACHE)"; \
466 else \
467 if test x"$${CCACHE_DISABLE-}" != x -o x"$(CCACHE_DISABLE)" != x \
468 -o x"$${ENABLE_CCACHE-}" = xfalse -o x"$(ENABLE_CCACHE)" = xfalse \
469 ; then \
470 echo "NOT USING CCACHE FOR OI-USERLAND because explicitly disabled" >&2 ; \
471 else \
472 if test x"$${CCACHE_NODISABLE-}" != x -o x"$(CCACHE_NODISABLE)" != x \
473 -o x"$${ENABLE_CCACHE-}" = xtrue -o x"$(ENABLE_CCACHE)" = xtrue \
474 ; then \
475 for F in \
476 "$$CCACHE" \
477 `which ccache 2>/dev/null | egrep '^/'` \
478 /usr/bin/ccache \
479 ; do if test -n "$$F" && test -x "$$F" ; then \
480 echo "$$F" ; \
481 echo "USING CCACHE FOR OI-USERLAND: $$F" >&2 ; \
482 if test x"$${CCACHE_DISABLE-}" != x ; then \
483 echo "WARNING: envvar CCACHE_DISABLE is set, so effectively ccache will not act!" >&2 ; \
484 fi; \
485 exit 0; \
486 fi; \
487 done; \
488 echo "NOT USING CCACHE FOR OI-USERLAND because not found" >&2 ; \
489 fi; \
490 fi; \
493 GCC_ROOT = /usr/gcc/4.9
495 CC.studio.32 = $(SPRO_VROOT)/bin/cc
496 CXX.studio.32 = $(SPRO_VROOT)/bin/CC
497 F77.studio.32 = $(SPRO_VROOT)/bin/f77
498 FC.studio.32 = $(SPRO_VROOT)/bin/f90
500 CC.studio.64 = $(SPRO_VROOT)/bin/cc
501 CXX.studio.64 = $(SPRO_VROOT)/bin/CC
502 F77.studio.64 = $(SPRO_VROOT)/bin/f77
503 FC.studio.64 = $(SPRO_VROOT)/bin/f90
505 CC.gcc.32 = $(GCC_ROOT)/bin/gcc
506 CXX.gcc.32 = $(GCC_ROOT)/bin/g++
507 F77.gcc.32 = $(GCC_ROOT)/bin/gfortran
508 FC.gcc.32 = $(GCC_ROOT)/bin/gfortran
510 CC.gcc.64 = $(GCC_ROOT)/bin/gcc
511 CXX.gcc.64 = $(GCC_ROOT)/bin/g++
512 F77.gcc.64 = $(GCC_ROOT)/bin/gfortran
513 FC.gcc.64 = $(GCC_ROOT)/bin/gfortran
515 ifneq ($(strip $(CCACHE)),)
517 CCACHE_WRAP_ROOT = $(WS_TOOLS)/ccache-wrap
518 export CC_gcc_32 := $(CC.gcc.32)
519 export CC_gcc_64 := $(CC.gcc.64)
520 export CXX_gcc_32 := $(CXX.gcc.32)
521 export CXX_gcc_64 := $(CXX.gcc.64)
522 CC.gcc.32 := $(CCACHE_WRAP_ROOT)/CC.gcc.32
523 CC.gcc.64 := $(CCACHE_WRAP_ROOT)/CC.gcc.64
524 CXX.gcc.32 := $(CCACHE_WRAP_ROOT)/CXX.gcc.32
525 CXX.gcc.64 := $(CCACHE_WRAP_ROOT)/CXX.gcc.64
527 ifneq ($(strip $(CCACHE_DIR)),)
528 export CCACHE_DIR := $(CCACHE_DIR)
529 endif
531 ifneq ($(strip $(CCACHE_LOGFILE)),)
532 export CCACHE_LOGFILE := $(CCACHE_LOGFILE)
533 endif
535 endif
537 lint.32 = $(SPRO_VROOT)/bin/lint -m32
538 lint.64 = $(SPRO_VROOT)/bin/lint -m64
540 LINT = $(lint.$(BITS))
542 LD = /usr/bin/ld
544 PYTHON.2.7.VENDOR_PACKAGES.32 = /usr/lib/python2.7/vendor-packages
545 PYTHON.2.7.VENDOR_PACKAGES.64 = /usr/lib/python2.7/vendor-packages/64
546 PYTHON.2.7.VENDOR_PACKAGES = $(PYTHON.2.7.VENDOR_PACKAGES.$(BITS))
548 PYTHON.3.4.VENDOR_PACKAGES.32 = /usr/lib/python3.4/vendor-packages
549 PYTHON.3.4.VENDOR_PACKAGES.64 = /usr/lib/python3.4/vendor-packages/64
550 PYTHON.3.4.VENDOR_PACKAGES = $(PYTHON.3.4.VENDOR_PACKAGES.$(BITS))
552 ifeq ($(strip $(PARFAIT_BUILD)),yes)
553 CC.studio.32 = $(WS_TOOLS)/parfait/cc
554 CXX.studio.32 = $(WS_TOOLS)/parfait/CC
555 CC.studio.64 = $(WS_TOOLS)/parfait/cc
556 CXX.studio.64 = $(WS_TOOLS)/parfait/CC
557 CC.gcc.32 = $(WS_TOOLS)/parfait/gcc
558 CXX.gcc.32 = $(WS_TOOLS)/parfait/g++
559 CC.gcc.64 = $(WS_TOOLS)/parfait/gcc
560 CXX.gcc.64 = $(WS_TOOLS)/parfait/g++
561 LD = $(WS_TOOLS)/parfait/ld
562 endif
564 CC = $(CC.$(COMPILER).$(BITS))
565 CXX = $(CXX.$(COMPILER).$(BITS))
566 F77 = $(F77.$(COMPILER).$(BITS))
567 FC = $(FC.$(COMPILER).$(BITS))
569 RUBY_VERSION = 1.9
570 RUBY_LIB_VERSION = 1.9.1
571 RUBY.1.9 = /usr/ruby/1.9/bin/ruby
572 RUBY = $(RUBY.$(RUBY_VERSION))
573 # Use the ruby lib versions to represent the RUBY_VERSIONS that
574 # need to get built. This is done because during package transformations
575 # both the ruby version and the ruby library version are needed.
576 RUBY_VERSIONS = $(RUBY_LIB_VERSION)
578 PYTHON_VENDOR_PACKAGES.32 = /usr/lib/python$(PYTHON_VERSION)/vendor-packages
579 PYTHON_VENDOR_PACKAGES.64 = /usr/lib/python$(PYTHON_VERSION)/vendor-packages/64
580 PYTHON_VENDOR_PACKAGES = $(PYTHON_VENDOR_PACKAGES.$(BITS))
582 PYTHON.2.7.32 = /usr/bin/python2.7
583 PYTHON.2.7.64 = /usr/bin/$(MACH64)/python2.7
585 PYTHON.3.4.32 = /usr/bin/python3.4
586 PYTHON.3.4.64 = /usr/bin/$(MACH64)/python3.4
588 PYTHON.32 = $(PYTHON.$(PYTHON_VERSION).32)
589 PYTHON.64 = $(PYTHON.$(PYTHON_VERSION).64)
590 PYTHON = $(PYTHON.$(PYTHON_VERSION).$(BITS))
592 # The default is site-packages, but that directory belongs to the end-user.
593 # Modules which are shipped by the OS but not with the core Python distribution
594 # belong in vendor-packages.
595 PYTHON_LIB= /usr/lib/python$(PYTHON_VERSION)/vendor-packages
596 PYTHON_DATA= $(PYTHON_LIB)
598 JAVA7_HOME = /usr/jdk/instances/openjdk1.7.0
599 JAVA_HOME = $(JAVA7_HOME)
601 # This is the default BUILD version of perl
602 # Not necessarily the system's default version, i.e. /usr/bin/perl
603 PERL_VERSION = 5.22
605 PERL_VERSIONS = 5.16 5.22
607 PERL.5.16 = /usr/perl5/5.16/bin/perl
608 PERL.5.22 = /usr/perl5/5.22/bin/perl
610 POD2MAN.5.16 = /usr/perl5/5.16/bin/pod2man
611 POD2MAN.5.22 = /usr/perl5/5.22/bin/pod2man
613 PERL = $(PERL.$(PERL_VERSION))
614 POD2MAN = $(POD2MAN.$(PERL_VERSION))
616 PERL_ARCH := $(shell $(PERL) -e 'use Config; print $$Config{archname}')
617 PERL_ARCH_FUNC= $(shell $(1) -e 'use Config; print $$Config{archname}')
618 # Optimally we should ask perl which C compiler was used but it doesn't
619 # result in a full path name. Only "c" is being recorded
620 # inside perl builds while we actually need a full path to
621 # the studio compiler.
622 #PERL_CC := $(shell $(PERL) -e 'use Config; print $$Config{cc}')
624 PKG_MACROS += PERL_ARCH=$(PERL_ARCH)
625 PKG_MACROS += PERL_VERSION=$(PERL_VERSION)
627 # Config magic for Postgres/EnterpriseDB/...
628 # Default DB version is the oldest one, for hopefully best built complatibility
629 PG_VERSION ?= 9.3
630 PG_IMPLEM ?= postgres
631 PG_VERNUM = $(subst .,,$(PG_VERSION))
632 # For dependencies, including REQUIRED_PACKAGES if needed
633 PG_BASEPKG = database/$(PG_IMPLEM)-$(PG_VERNUM)
635 PG_HOME = $(USRDIR)/$(PG_IMPLEM)/$(PG_VERSION)
636 PG_BINDIR.32 = $(PG_HOME)/bin
637 PG_BINDIR.64 = $(PG_HOME)/bin/$(MACH64)
638 PG_BINDIR = $(PG_BINDIR.$(BITS))
639 PG_INCDIR = $(PG_HOME)/include
640 PG_MANDIR = $(PG_HOME)/man
641 PG_SHAREDIR = $(PG_HOME)/share
642 PG_DOCDIR = $(PG_HOME)/doc
643 PG_LIBDIR.32 = $(PG_HOME)/lib
644 PG_LIBDIR.64 = $(PG_HOME)/lib/$(MACH64)
645 PG_LIBDIR = $(PG_LIBDIR.$(BITS))
646 PG_CONFIG.32 = $(PG_BINDIR.32)/pg_config
647 PG_CONFIG.64 = $(PG_BINDIR.64)/pg_config
648 PG_CONFIG = $(PG_CONFIG.$(BITS))
650 PKG_MACROS += PG_VERSION=$(PG_VERSION)
651 PKG_MACROS += PG_VERNUM=$(PG_VERNUM)
652 PKG_MACROS += PG_BASEPKG=$(PG_BASEPKG)
654 # Config magic for MySQL/MariaDB/Percona/...
655 # Default DB version is the oldest one, for hopefully best built compatibility
656 # NOTE: At this time the gate does not provide a recipe for actual "mysql"
657 # The "/usr/mysql/*" trees are mediated to preferred MariaDB or Percona variant
658 MYSQL_VERSION ?= 5.5
659 MYSQL_IMPLEM ?= mariadb
660 MYSQL_VERNUM = $(subst .,,$(MYSQL_VERSION))
661 # For dependencies, including REQUIRED_PACKAGES if needed
662 MYSQL_BASEPKG = database/$(MYSQL_IMPLEM)-$(MYSQL_VERNUM)
664 MYSQL_HOME = $(USRDIR)/$(MYSQL_IMPLEM)/$(MYSQL_VERSION)
665 MYSQL_BINDIR.32 = $(MYSQL_HOME)/bin
666 MYSQL_BINDIR.64 = $(MYSQL_HOME)/bin/$(MACH64)
667 MYSQL_BINDIR = $(MYSQL_BINDIR.$(BITS))
668 MYSQL_INCDIR = $(MYSQL_HOME)/include
669 MYSQL_MANDIR = $(MYSQL_HOME)/man
670 MYSQL_SHAREDIR = $(MYSQL_HOME)/share
671 MYSQL_DOCDIR = $(MYSQL_HOME)/doc
672 MYSQL_LIBDIR.32 = $(MYSQL_HOME)/lib
673 MYSQL_LIBDIR.64 = $(MYSQL_HOME)/lib/$(MACH64)
674 MYSQL_LIBDIR = $(MYSQL_LIBDIR.$(BITS))
675 MYSQL_CONFIG.32 = $(MYSQL_BINDIR.32)/mysql_config
676 MYSQL_CONFIG.64 = $(MYSQL_BINDIR.64)/mysql_config
677 MYSQL_CONFIG = $(MYSQL_CONFIG.$(BITS))
679 PKG_MACROS += MYSQL_VERSION=$(MYSQL_VERSION)
680 PKG_MACROS += MYSQL_VERNUM=$(MYSQL_VERNUM)
681 PKG_MACROS += MYSQL_BASEPKG=$(MYSQL_BASEPKG)
683 # Default libjpeg implementation layout
684 JPEG_IMPLEM ?= libjpeg8-turbo
685 JPEG_HOME = $(USRLIBDIR)/$(JPEG_IMPLEM)
686 JPEG_BINDIR.32 = $(JPEG_HOME)/bin
687 JPEG_BINDIR.64 = $(JPEG_HOME)/bin/$(MACH64)
688 JPEG_BINDIR = $(JPEG_BINDIR.$(BITS))
689 JPEG_INCDIR = $(USRINCDIR)/$(JPEG_IMPLEM)
690 JPEG_LIBDIR.32 = $(JPEG_HOME)/lib
691 JPEG_LIBDIR.64 = $(JPEG_HOME)/lib/$(MACH64)
692 JPEG_LIBDIR = $(JPEG_LIBDIR.$(BITS))
693 JPEG_CPPFLAGS = -I$(JPEG_INCDIR)
694 JPEG_CFLAGS.32 = -Wl,-L$(JPEG_LIBDIR.32) -Wl,-R$(JPEG_LIBDIR.32)
695 JPEG_CFLAGS.64 = -Wl,-L$(JPEG_LIBDIR.64) -Wl,-R$(JPEG_LIBDIR.64)
696 JPEG_CFLAGS = $(JPEG_CFLAGS.$(BITS))
697 JPEG_CXXFLAGS.32 = -Wl,-L$(JPEG_LIBDIR.32) -Wl,-R$(JPEG_LIBDIR.32)
698 JPEG_CXXFLAGS.64 = -Wl,-L$(JPEG_LIBDIR.64) -Wl,-R$(JPEG_LIBDIR.64)
699 JPEG_CXXFLAGS = $(JPEG_CXXFLAGS.$(BITS))
700 JPEG_LDFLAGS.32 = -L$(JPEG_LIBDIR.32) -R$(JPEG_LIBDIR.32)
701 JPEG_LDFLAGS.64 = -L$(JPEG_LIBDIR.64) -R$(JPEG_LIBDIR.64)
702 JPEG_LDFLAGS = $(JPEG_LDFLAGS.$(BITS))
704 # This is the default BUILD version of tcl
705 # Not necessarily the system's default version, i.e. /usr/bin/tclsh
706 TCL_VERSION = 8.5
707 TCLSH.8.5.i386.32 = /usr/bin/i86/tclsh8.5
708 TCLSH.8.5.i386.64 = /usr/bin/amd64/tclsh8.5
709 TCLSH.8.5.sparc.32 = /usr/bin/sparcv7/tclsh8.5
710 TCLSH.8.5.sparc.64 = /usr/bin/sparcv9/tclsh8.5
711 TCLSH = $(TCLSH.$(TCL_VERSION).$(MACH).$(BITS))
713 CCSMAKE = /usr/ccs/bin/make
714 GMAKE = /usr/gnu/bin/make
715 GPATCH = /usr/gnu/bin/patch
716 PATCH_LEVEL = 1
717 GPATCH_BACKUP = --backup --version-control=numbered
718 GPATCH_FLAGS = -p$(PATCH_LEVEL) $(GPATCH_BACKUP)
719 GSED = /usr/gnu/bin/sed
720 GDIFF = /usr/gnu/bin/diff
721 GSORT = /usr/gnu/bin/sort
723 PKGREPO = /usr/bin/pkgrepo
724 PKGSEND = /usr/bin/pkgsend
725 ifeq ($(strip $(PKGLINT_COMPONENT)),)
726 PKGLINT = /usr/bin/pkglint
727 else
728 PKGLINT = ${WS_TOOLS}/pkglint
729 endif
731 ACLOCAL = /usr/bin/aclocal-1.10
732 AUTOMAKE = /usr/bin/automake-1.10
733 AUTORECONF = /usr/bin/autoreconf
735 KSH93 = /usr/bin/ksh93
736 TOUCH = /usr/bin/touch
737 MKDIR = /bin/mkdir -p
738 RM = /bin/rm -f
739 CP = /bin/cp -f
740 MV = /bin/mv -f
741 LN = /bin/ln
742 CAT = /bin/cat
743 SYMLINK = /bin/ln -s
744 ENV = /usr/bin/env
745 FIND = /usr/bin/find
746 INSTALL = /usr/bin/ginstall
747 CHMOD = /usr/bin/chmod
748 NAWK = /usr/bin/nawk
749 TEE = /usr/bin/tee
750 GAS = /usr/gnu/bin/as
751 GTAR = /usr/gnu/bin/tar
752 STRIP = /usr/bin/strip
753 IPS2TGZ = $(WS_TOOLS)/ips2tgz
755 INS.dir= $(INSTALL) -d $@
756 INS.file= $(INSTALL) -m 444 $< $(@D)
758 PKG_CONFIG_PATH.32 = /usr/lib/pkgconfig
759 PKG_CONFIG_PATH.64 = /usr/lib/$(MACH64)/pkgconfig
760 PKG_CONFIG_PATH = $(PKG_CONFIG_PATH.$(BITS))
762 # Set default path for environment modules
763 MODULE_VERSION = 3.2.10
764 MODULE_PATH = /usr/share/Modules/modulefiles
765 MODULE_VERSIONS_PATH = /usr/share/Modules/versions
767 # Path to bash completions
768 BASH_COMPLETIONS_PATH = /usr/share/bash-completion/completions
771 # C preprocessor flag sets to ease feature selection. Add the required
772 # feature to your Makefile with CPPFLAGS += $(FEATURE_MACRO) and add to
773 # the component build with CONFIGURE_OPTIONS += CPPFLAGS="$(CPPFLAGS)" or
774 # similiar.
777 # Enables visibility of some c99 math functions that aren't visible by default.
778 # What other side-effects are there?
779 CPP_C99_EXTENDED_MATH = -D_STDC_99
781 # Enables large file support for components that have no other means of doing
782 # so. Use CPP_LARGEFILES and not the .32/.64 variety directly
783 CPP_LARGEFILES.32 := $(shell getconf LFS_CFLAGS)
784 CPP_LARGEFILES.64 := $(shell getconf LFS64_CFLAGS)
785 CPP_LARGEFILES = $(CPP_LARGEFILES.$(BITS))
787 # Enables some #pragma redefine_extname to POSIX-compliant Standard C Library
788 # functions. Also avoids the component's #define _POSIX_C_SOURCE to some value
789 # we currently do not support.
790 CPP_POSIX = -D_POSIX_C_SOURCE=200112L -D_POSIX_PTHREAD_SEMANTICS
792 # XPG6 mode. This option enables XPG6 conformance, plus extensions.
793 # Amongst other things, this option will cause system calls like
794 # popen (3C) and system (3C) to invoke the standards-conforming
795 # shell, /usr/xpg4/bin/sh, instead of /usr/bin/sh. Add studio_XPG6MODE to
796 # CFLAGS instead of using this directly
797 CPP_XPG6MODE= -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1 -D_XPG6
799 # XPG5 mode. These options are specific for C++, where _XPG6,
800 # _XOPEN_SOURCE=600 and C99 are illegal. -D__EXTENSIONS__=1 is legal in C++.
801 CPP_XPG5MODE= -D_XOPEN_SOURCE=500 -D__EXTENSIONS__=1 -D_XPG5
804 # Studio C compiler flag sets to ease feature selection. Add the required
805 # feature to your Makefile with CFLAGS += $(FEATURE_MACRO) and add to the
806 # component build with CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar.
809 # Generate 32/64 bit objects
810 CC_BITS = -m$(BITS)
812 # Code generation instruction set and optimization 'hints'. Use studio_XBITS
813 # and not the .arch.bits variety directly.
814 studio_XBITS.sparc.32 = -xtarget=ultra2 -xarch=sparcvis -xchip=ultra2
815 studio_XBITS.sparc.64 =
816 ifneq ($(strip $(PARFAIT_BUILD)),yes)
817 studio_XBITS.sparc.64 += -xtarget=ultra2
818 endif
819 studio_XBITS.sparc.64 += -xarch=sparcvis -xchip=ultra2
820 studio_XBITS.i386.32 = -xchip=pentium
821 studio_XBITS.i386.64 = -xchip=generic -Ui386 -U__i386
822 studio_XBITS = $(studio_XBITS.$(MACH).$(BITS))
824 # Turn on recognition of supported C99 language features and enable the 1999 C
825 # standard library semantics of routines that appear in both the 1990 and
826 # 1999 C standard. To use set studio_C99MODE=$(studio_99_ENABLE) in your
827 # component Makefile.
828 studio_C99_ENABLE = -xc99=all
830 # Turn off recognition of C99 language features, and do not enable the 1999 C
831 # standard library semantics of routines that appeared in both the 1990 and
832 # 1999 C standard. To use set studio_C99MODE=$(studio_99_DISABLE) in your
833 # component Makefile.
834 studio_C99_DISABLE = -xc99=none
836 # Use the compiler default 'xc99=all,no_lib'
837 studio_C99MODE =
839 # For C++, compatibility with C99 (which is technically illegal) is
840 # enabled in a different way. So, we must use a different macro for it.
841 studio_cplusplus_C99_ENABLE = -xlang=c99
843 # Turn it off.
844 studio_cplusplus_C99_DISABLE =
846 # And this is the macro you should actually use
847 studio_cplusplus_C99MODE =
849 # Turn on C99 for gcc
850 gcc_C99_ENABLE = -std=c99
852 # Allow zero-sized struct/union declarations and void functions with return
853 # statements.
854 studio_FEATURES_EXTENSIONS = -features=extensions
856 # Control the Studio optimization level.
857 studio_OPT.sparc.32 = -xO4
858 studio_OPT.sparc.64 = -xO4
859 studio_OPT.i386.32 = -xO4
860 studio_OPT.i386.64 = -xO4
861 studio_OPT = $(studio_OPT.$(MACH).$(BITS))
863 # Studio PIC code generation. Use CC_PIC instead to select PIC code generation.
864 studio_PIC = -KPIC -DPIC
866 # The Sun Studio 11 compiler has changed the behaviour of integer
867 # wrap arounds and so a flag is needed to use the legacy behaviour
868 # (without this flag panics/hangs could be exposed within the source).
869 # This is used through studio_IROPTS, not the 'sparc' variety.
870 studio_IROPTS.sparc = -W2,-xwrap_int
871 studio_IROPTS = $(studio_IROPTS.$(MACH))
873 # Control register usage for generated code. SPARC ABI requires system
874 # libraries not to use application registers. x86 requires 'no%frameptr' at
875 # x04 or higher.
877 # We should just use -xregs but we need to workaround 7030022. Note
878 # that we can't use the (documented) -Wc,-xregs workaround because
879 # libtool really hates -Wc and thinks it should be -Wl. Instead
880 # we use an (undocumented) option which actually happens to be what
881 # CC would use.
882 studio_XREGS.sparc = -Qoption cg -xregs=no%appl
883 studio_XREGS.i386 = -xregs=no%frameptr
884 studio_XREGS = $(studio_XREGS.$(MACH))
886 gcc_XREGS.sparc = -mno-app-regs
887 gcc_XREGS.i386 =
888 gcc_XREGS = $(gcc_XREGS.$(MACH))
890 # Set data alignment on sparc to reasonable values, 8 byte alignment for 32 bit
891 # objects and 16 byte alignment for 64 bit objects. This is added to CFLAGS by
892 # default.
893 studio_ALIGN.sparc.32 = -xmemalign=8s
894 studio_ALIGN.sparc.64 = -xmemalign=16s
895 studio_ALIGN = $(studio_ALIGN.$(MACH).$(BITS))
897 # Studio shorthand for building multi-threaded code, enables -D_REENTRANT and
898 # linking with threadin support. This is added to CFLAGS by default, override
899 # studio_MT to turn this off.
900 studio_MT = -mt
902 # See CPP_XPG6MODE comment above.
903 studio_XPG6MODE = $(studio_C99MODE) $(CPP_XPG6MODE)
904 XPG6MODE = $(studio_XPG6MODE)
906 # See CPP_XPG5MODE comment above. You can only use this in C++, not in C99.
907 studio_XPG5MODE = $(studio_cplusplus_C99MODE) $(CPP_XPG5MODE)
908 XPG5MODE = $(studio_XPG5MODE)
910 # Default Studio C compiler flags. Add the required feature to your Makefile
911 # with CFLAGS += $(FEATURE_MACRO) and add to the component build with
912 # CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar. In most cases, it
913 # should not be necessary to add CFLAGS to any environment other than the
914 # configure environment.
915 CFLAGS.studio += $(studio_OPT) $(studio_XBITS) $(studio_XREGS) \
916 $(studio_IROPTS) $(studio_C99MODE) $(studio_ALIGN) \
917 $(studio_MT)
920 # GNU C compiler flag sets to ease feature selection. Add the required
921 # feature to your Makefile with CFLAGS += $(FEATURE_MACRO) and add to the
922 # component build with CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar.
925 # GCC Compiler optimization flag
926 gcc_OPT = -O3
928 # GCC PIC code generation. Use CC_PIC instead to select PIC code generation.
929 gcc_PIC = -fPIC -DPIC
931 # Generic macro for PIC code generation. Use this macro instead of the
932 # compiler specific variant.
933 CC_PIC = $($(COMPILER)_PIC)
936 # Default GNU C compiler flags. Add the required feature to your Makefile
937 # with CFLAGS += $(FEATURE_MACRO) and add to the component build with
938 # CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar. In most cases, it
939 # should not be necessary to add CFLAGS to any environment other than the
940 # configure environment.
941 CFLAGS.gcc += $(gcc_OPT)
942 CFLAGS.gcc += $(gcc_XREGS)
945 # Build 32 or 64 bit objects.
946 CFLAGS += $(CC_BITS)
948 # Add compiler specific 'default' features
949 CFLAGS += $(CFLAGS.$(COMPILER))
952 # Studio C++ requires -norunpath to avoid adding its location into the RUNPATH
953 # to C++ applications.
954 studio_NORUNPATH = -norunpath
956 # To link in standard mode (the default mode) without any C++ libraries
957 # (except libCrun), use studio_LIBRARY_NONE in your component Makefile.
958 studio_LIBRARY_NONE = -library=%none
960 # Don't link C++ with any C++ Runtime or Standard C++ library
961 studio_CXXLIB_NONE = -xnolib
963 # Link C++ with the Studio C++ Runtime and Standard C++ library. This is the
964 # default for "standard" mode.
965 studio_CXXLIB_CSTD = -library=Cstd,Crun
967 # link C++ with the Studio C++ Runtime and Apache Standard C++ library
968 studio_CXXLIB_APACHE = -library=stdcxx4,Crun
970 # Add the C++ ABI compatibility flags for older ABI compatibility. The default
971 # is "standard mode" (-compat=5)
972 studio_COMPAT_VERSION_4 = -compat=4
974 # Tell the compiler that we don't want the studio runpath added to the
975 # linker flags. We never want the Studio location added to the RUNPATH.
976 CXXFLAGS += $($(COMPILER)_NORUNPATH)
978 # Build 32 or 64 bit objects in C++ as well.
979 CXXFLAGS += $(CC_BITS)
981 # Build 32 or 64 bit objects in FORTRAN as well.
982 F77FLAGS += $(CC_BITS)
983 FCFLAGS += $(CC_BITS)
987 # Solaris linker flag sets to ease feature selection. Add the required
988 # feature to your Makefile with LDFLAGS += $(FEATURE_MACRO) and add to the
989 # component build with CONFIGURE_OPTIONS += LDFLAGS="$(LDFLAGS)" or similiar.
992 # set the bittedness that we want to link
993 ccs.ld.64 = -64
994 gcc.ld.32 = -m32
995 gcc.ld.64 = -m64
996 LD_BITS = $($(LINKER).ld.$(BITS))
997 LDFLAGS = $(LD_BITS)
999 # Reduce the symbol table size, effectively conflicting with -g. We should
1000 # get linker guidance here.
1001 LD_Z_REDLOCSYM = -z redlocsym
1003 # Cause the linker to rescan archive libraries and resolve remaining unresolved
1004 # symbols recursively until all symbols are resolved. Components should be
1005 # linking in the libraries they need, in the required order. This should
1006 # only be required if the component's native build is horribly broken.
1007 LD_Z_RESCAN_NOW = -z rescan-now
1009 LD_Z_TEXT = -z direct
1011 # make sure that -lc is always present when building shared objects.
1012 LD_DEF_LIBS += -lc
1014 # make sure all symbols are defined.
1015 LD_Z_DEFS = -z defs
1017 # eliminate unreferenced dynamic dependencies
1018 LD_Z_IGNORE = -z ignore
1020 # use direct binding
1021 LD_B_DIRECT = -Bdirect
1023 # use generic macro names for enabling/disabling ASLR
1024 ASLR_ENABLE = -z aslr=enable
1025 ASLR_DISABLE = -z aslr=disable
1026 ASLR_MODE = $(ASLR_DISABLE)
1028 # by default, turn off Address Space Layout Randomization for ELF executables;
1029 # to explicitly enable ASLR, set ASLR_MODE = $(ASLR_ENABLE)
1030 # in that component's Makefile
1031 LD_Z_ASLR = $(ASLR_MODE)
1034 # More Solaris linker flags that we want to be sure that everyone gets. This
1035 # is automatically added to the calling environment during the 'build' and
1036 # 'install' phases of the component build. Each individual feature can be
1037 # turned off by adding FEATURE_MACRO= to the component Makefile.
1040 # Create a non-executable stack when linking.
1041 LD_MAP_NOEXSTK.i386 = -M /usr/lib/ld/map.noexstk
1042 LD_MAP_NOEXSTK.sparc = -M /usr/lib/ld/map.noexstk
1044 # Create a non-executable bss segment when linking.
1045 LD_MAP_NOEXBSS = -M /usr/lib/ld/map.noexbss
1047 # Create a non-executable data segment when linking. Due to PLT needs, the
1048 # data segment must be executable on sparc, but the bss does not.
1049 # see mapfile comments for more information
1050 LD_MAP_NOEXDATA.i386 = -M /usr/lib/ld/map.noexdata
1051 LD_MAP_NOEXDATA.sparc = $(LD_MAP_NOEXBSS)
1053 # Page alignment
1054 LD_MAP_PAGEALIGN = -M /usr/lib/ld/map.pagealign
1056 # Linker options to add when only building libraries
1057 LD_OPTIONS_SO += $(LD_Z_TEXT) $(LD_Z_DEFS) $(LD_DEF_LIBS)
1059 # Default linker options that everyone should get. Do not add additional
1060 # libraries to this macro, as it will apply to everything linked during the
1061 # component build.
1062 LD_OPTIONS += $(LD_MAP_NOEXSTK.$(MACH)) $(LD_MAP_NOEXDATA.$(MACH)) \
1063 $(LD_MAP_PAGEALIGN) $(LD_B_DIRECT) $(LD_Z_IGNORE)
1065 # only used on executables
1066 LD_EXEC_OPTIONS = $(LD_Z_ASLR)
1068 # Environment variables and arguments passed into the build and install
1069 # environment(s). These are the initial settings.
1070 COMPONENT_BUILD_ENV= \
1071 LD_OPTIONS="$(LD_OPTIONS)" \
1072 LD_EXEC_OPTIONS="$(LD_EXEC_OPTIONS)"
1073 COMPONENT_INSTALL_ENV= \
1074 LD_OPTIONS="$(LD_OPTIONS)" \
1075 LD_EXEC_OPTIONS="$(LD_EXEC_OPTIONS)"
1077 # PERL options which depend on C options should be placed here
1078 # Don't trust Perl $Config{optimize}, we can get Studio flags
1079 PERL_OPTIMIZE =$(gcc_OPT)
1081 # We need this to overwrite options of perl used to compile illumos-gate
1082 PERL_STUDIO_OVERWRITE = cc="$(CC)" cccdlflags="$(CC_PIC)" ld="$(CC)" ccname="$(shell basename $(CC))" optimize="$(gcc_OPT)"
1084 # Allow user to override default maximum number of archives
1085 NUM_EXTRA_ARCHIVES= 1 2 3 4 5 6 7 8 9 10
1087 # Rewrite absolute source-code paths into relative for ccache, so that any
1088 # workspace with a shared CCACHE_DIR can benefit when compiling a component
1089 ifneq ($(strip $(CCACHE)),)
1090 export CCACHE_BASEDIR = $(BUILD_DIR_$(BITS))
1091 COMPONENT_BUILD_ENV += CCACHE="$(CCACHE)"
1092 COMPONENT_INSTALL_ENV += CCACHE="$(CCACHE)"
1093 COMPONENT_TEST_ENV += CCACHE="$(CCACHE)"
1094 COMPONENT_BUILD_ENV += CC_gcc_32="$(CC_gcc_32)"
1095 COMPONENT_BUILD_ENV += CC_gcc_64="$(CC_gcc_32)"
1096 COMPONENT_BUILD_ENV += CXX_gcc_32="$(CXX_gcc_64)"
1097 COMPONENT_BUILD_ENV += CXX_gcc_64="$(CXX_gcc_64)"
1098 COMPONENT_INSTALL_ENV += CC_gcc_32="$(CC_gcc_32)"
1099 COMPONENT_INSTALL_ENV += CC_gcc_64="$(CC_gcc_32)"
1100 COMPONENT_INSTALL_ENV += CXX_gcc_32="$(CXX_gcc_64)"
1101 COMPONENT_INSTALL_ENV += CXX_gcc_64="$(CXX_gcc_64)"
1102 COMPONENT_TEST_ENV += CC_gcc_32="$(CC_gcc_32)"
1103 COMPONENT_TEST_ENV += CC_gcc_64="$(CC_gcc_32)"
1104 COMPONENT_TEST_ENV += CXX_gcc_32="$(CXX_gcc_64)"
1105 COMPONENT_TEST_ENV += CXX_gcc_64="$(CXX_gcc_64)"
1106 COMPONENT_BUILD_ENV.$(BITS) += CCACHE_BASEDIR="$(BUILD_DIR_$(BITS))"
1107 COMPONENT_INSTALL_ENV.$(BITS) += CCACHE_BASEDIR="$(BUILD_DIR_$(BITS))"
1108 COMPONENT_TEST_ENV.$(BITS) += CCACHE_BASEDIR="$(BUILD_DIR_$(BITS))"
1110 ifneq ($(strip $(CCACHE_DIR)),)
1111 COMPONENT_BUILD_ENV += CCACHE_DIR="$(CCACHE_DIR)"
1112 COMPONENT_INSTALL_ENV += CCACHE_DIR="$(CCACHE_DIR)"
1113 COMPONENT_TEST_ENV += CCACHE_DIR="$(CCACHE_DIR)"
1114 endif
1116 ifneq ($(strip $(CCACHE_LOGFILE)),)
1117 COMPONENT_BUILD_ENV += CCACHE_LOGFILE="$(CCACHE_LOGFILE)"
1118 COMPONENT_INSTALL_ENV += CCACHE_LOGFILE="$(CCACHE_LOGFILE)"
1119 COMPONENT_TEST_ENV += CCACHE_LOGFILE="$(CCACHE_LOGFILE)"
1120 endif
1122 endif
1124 # Add any bit-specific settings
1125 COMPONENT_BUILD_ENV += $(COMPONENT_BUILD_ENV.$(BITS))
1126 COMPONENT_BUILD_ARGS += $(COMPONENT_BUILD_ARGS.$(BITS))
1127 COMPONENT_INSTALL_ENV += $(COMPONENT_INSTALL_ENV.$(BITS))
1128 COMPONENT_INSTALL_ARGS += $(COMPONENT_INSTALL_ARGS.$(BITS))
1130 # declare these phony so that we avoid filesystem conflicts.
1131 .PHONY: prep build install publish test clean clobber parfait
1133 # If there are no tests to execute
1134 NO_TESTS = test-nothing
1135 test-nothing:
1136 @echo "There are no tests available at this time."
1138 # default behaviour for 'component-hook' target is to echo the component
1139 # name and version information, but more complex behaviour can be implemented
1140 # via command line setting of the COMPONENT_HOOK macro.
1141 COMPONENT_HOOK ?= echo $(COMPONENT_NAME) $(COMPONENT_VERSION)
1143 component-hook:
1144 @$(COMPONENT_HOOK)
1147 # Packages with tools that are required to build Userland components
1149 REQUIRED_PACKAGES += metapackages/build-essential
1151 # Only a default dependency if component being built produces binaries.
1152 ifneq ($(strip $(BUILD_BITS)),NO_ARCH)
1153 REQUIRED_PACKAGES += system/library
1154 endif
1156 include $(WS_MAKE_RULES)/environment.mk
1158 # A simple rule to print the value of any macro. Ex:
1159 # $ gmake print-REQUIRED_PACKAGES
1160 # Note that some macros are set on a per target basis, so what you see
1161 # is not always what you get.
1162 print-%:
1163 @echo '$(subst ','\'',$*=$($*)) (origin: $(origin $*), flavor: $(flavor $*))'