Adam Števko
2018-10-19 4041174dc030925a69b05c5caa8dec17a1b9154d
commit | author | age
9c75c0 1 #
NJ 2 # CDDL HEADER START
3 #
4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
7 #
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
12 #
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
18 #
19 # CDDL HEADER END
20 #
7e1000 21 # Copyright 2017 Gary Mills
0b2b25 22 # Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
9c75c0 23 #
NJ 24
7e1000 25 # These symbols should be used in component Makefiles
GM 26 # whenever PATH is to be defined there:
f627ef 27 #     PATH = $(PATH.illumos)
7e1000 28 #     PATH = $(PATH.gnu)
f627ef 29 PATH.illumos=$(USRBINDIR):$(GNUBIN):$(USRSBINDIR):$(PERL5BINDIR)
GM 30 PATH.gnu=$(GNUBIN):$(USRBINDIR):$(USRSBINDIR):$(PERL5BINDIR)
7e1000 31
GM 32 # Default PATH
f627ef 33 PATH = $(PATH.illumos)
a325d4 34
b643a2 35 # The location of an internal mirror of community source archives that we build
NJ 36 # in this gate.  This mirror has been seeded to include "custom" source archives
37 # for a few components where the communities either no longer provide matching
38 # source archives or we have changes that aren't reflected in their archives or
39 # anywhere else.
58c0dd 40 #INTERNAL_ARCHIVE_MIRROR =    http://userland.us.oracle.com/source-archives
b643a2 41
NJ 42 # The location of an external mirror of community source archives that we build
43 # in this gate.  The external mirror is a replica of the internal mirror.
58c0dd 44 #EXTERNAL_ARCHIVE_MIRROR = \
AS 45 #    http://static.opensolaris.org/action/browse/userland/tarball/userland
b643a2 46
58825e 47 DLC_ARCHIVE_MIRROR = http://dlc.openindiana.org/oi-userland/source-archives
AP 48
b643a2 49 # Default to looking for source archives on the internal mirror and the external
NJ 50 # mirror before we hammer on the community source archive repositories.
0de8ff 51 #export DOWNLOAD_SEARCH_PATH +=    $(INTERNAL_ARCHIVE_MIRROR)
JT 52 #export DOWNLOAD_SEARCH_PATH +=    $(EXTERNAL_ARCHIVE_MIRROR)
9aea33 53
58825e 54 # Look for file at DLC server as last resort
AP 55 export DOWNLOAD_FALLBACK_PATH =  $(DLC_ARCHIVE_MIRROR)
56
9aea33 57 # The workspace starts at the mercurial root
5ada66 58 ifeq ($(origin WS_TOP), undefined)
58c0dd 59 export WS_TOP := \
AS 60     $(shell hg root 2>/dev/null || git rev-parse --show-toplevel)
5ada66 61 endif
9aea33 62
4e1558 63 USERLAND_ARCHIVES ?=    $(WS_TOP)/archives/
10a7de 64 WS_MACH =       $(WS_TOP)/$(MACH)
AP 65 WS_LOGS =       $(WS_MACH)/logs
66 WS_REPO =       $(WS_MACH)/repo
67 WS_TOOLS =      $(WS_TOP)/tools
68 WS_MAKE_RULES = $(WS_TOP)/make-rules
69 WS_COMPONENTS = $(WS_TOP)/components
70 WS_LICENSES =   $(WS_TOP)/licenses
71 WS_INCORPORATIONS =     $(WS_TOP)/incorporations
72 WS_LINT_CACHE = $(WS_MACH)/pkglint-cache
4cfb92 73
5c422f 74 # we want our pkg piplines to fail if there is an error
MS 75 # (like if pkgdepend fails in the middle of a pipe), but
76 # we don't want the builds or ./configure's failing as well.
77 # so we only set pipefail for the publish target and have
78 # to reset it for the others since they might be invoked
79 # as dependencies of publish.
80 export SHELLOPTS
81 build:        SHELLOPTS=
82 test:        SHELLOPTS=
83 install:    SHELLOPTS=
84 publish:    SHELLOPTS=pipefail
85
b602c5 86 SHELL=    /bin/bash
MS 87
1f9ba4 88 # This can be overridden to avoid rebuilding when you touch a Makefile
AP 89 MAKEFILE_PREREQ =    Makefile
90
9c75c0 91 CONSOLIDATION =    userland
d05a6f 92 PUBLISHER ?=    $(CONSOLIDATION)
c4768d 93 PUBLISHER_LOCALIZABLE ?=    $(CONSOLIDATION)-localizable
6514ee 94
1e5ead 95 # Defines $(space) as a single blank space, so we can use it to convert
AP 96 # space-separated paths to colon-separated paths in variables with
97 # $(subst $(space),:,$(strip $(SPATHS)))
98 empty :=
99 space := $(empty) $(empty)
100
3dc823 101 ROOT =            /
NJ 102
097eb5 103 # Native OS version
5ada66 104 OS_VERSION :=        $(shell uname -r)
6514ee 105 SOLARIS_VERSION =    $(OS_VERSION:5.%=2.%)
097eb5 106 # Target OS version
52d240 107 PKG_SOLARIS_VERSION ?= 5.11
9c75c0 108
4cfb92 109 include $(WS_MAKE_RULES)/ips-buildinfo.mk
3dc823 110
2eec07 111 COMPILER =        gcc
72a528 112 LINKER =        gcc
80b1b4 113 BITS =            32
0b2b25 114
AL 115 # The values of BITS changes during the build process for components that
116 # are built 32-bit and 64-bit.  This macro makes it possible to determine
117 # which components are only built 64-bit and allow other make-rules files
118 # to adjust accordingly.  Possible values are: '32', '64', '32_and_64',
119 # '64_and_32', and 'NO_ARCH' (the orderings specify build preference).
120 BUILD_BITS ?=$(BITS)
121 ifeq ($(strip $(BUILD_BITS)),64)
122 BITS ?=            64
123 else
124 BITS ?=            32
125 endif
126
127 # Based on BUILD_BITS, determine which binaries are preferred for a build.
128 # This macro is for the convenience of other make-rules files and should not be
129 # overridden by developers.
130 ifeq ($(strip $(BUILD_BITS)),64)
131 PREFERRED_BITS=64
132 endif
133 # Unlike Solaris we still prefer 32bit
134 ifeq ($(strip $(BUILD_BITS)),64_and_32)
135 PREFERRED_BITS=32
136 endif
137 PREFERRED_BITS ?= 32
138
139 # Map target build to macro/variable naming conventions.  This macro is for the
140 # convenience of other make-rules files and should not be overridden by
141 # developers.
142 ifeq ($(BUILD_BITS),64_and_32)
143 MK_BITS=32_and_64
144 else
145 MK_BITS=$(strip $(BUILD_BITS))
146 endif
147
f2dd52 148 PYTHON_VERSION =    2.7
d64b79 149 PYTHON_VERSIONS =    2.7
9c75c0 150
44f1c2 151 PYTHON_64_ONLY_VERSIONS = 3.5
AP 152
79b849 153 BASS_O_MATIC =    $(WS_TOOLS)/bass-o-matic
NJ 154
81cc19 155 CLONEY =    $(WS_TOOLS)/cloney
MS 156
b73714 157 CONFIG_SHELL =    /bin/bash
CM 158
79b849 159 PKG_REPO =    file:$(WS_REPO)
74300c 160
a93d79 161 COMPONENT_SRC_NAME =    $(COMPONENT_NAME)
RB 162
fd5ab5 163 COMPONENT_LICENSE_FILE ?= $(COMPONENT_NAME).license
164
5ada66 165 COMPONENT_DIR :=    $(shell pwd)
c843eb 166 SOURCE_DIR =    $(COMPONENT_DIR)/$(COMPONENT_SRC)
PS 167 BUILD_DIR =    $(COMPONENT_DIR)/build
74300c 168 PROTO_DIR =    $(BUILD_DIR)/prototype/$(MACH)
9c75c0 169
9e2024 170 ARCHLIBSUBDIR32    =
637cb6 171 ARCHLIBSUBDIR64    = $(MACH64)
AL 172 ARCHLIBSUBDIR    = $(ARCHLIBSUBDIR$(BITS))
173
38e5af 174 ETCDIR =    /etc
4f8cfa 175 USRDIR =    /usr
MS 176 BINDIR =    /bin
f685ac 177 SBINDIR =    /sbin
4f8cfa 178 LIBDIR =    /lib
ffaa30 179 VARDIR =    /var
AL 180 KERNELDRVDIR =    /kernel/drv
0d49ff 181 KERNELDRVDIR32 =/kernel/drv
ffaa30 182 KERNELDRVDIR64 =/kernel/drv/$(MACH64)
0f426d 183 USRBINDIR =     $(USRDIR)/bin
724840 184 USRBINDIR32 =    $(USRDIR)/bin/$(MACH32)
2cda1c 185 USRBINDIR64 =    $(USRDIR)/bin/$(MACH64)
0f426d 186 USRSBINDIR =     $(USRDIR)/sbin
724840 187 USRSBINDIR32 =    $(USRDIR)/sbin/$(MACH32)
AL 188 USRSBINDIR64 =    $(USRDIR)/sbin/$(MACH64)
f540dc 189 USRLIBDIR =     $(USRDIR)/lib
JK 190 USRLIBDIR32 =    $(USRDIR)/lib
ffaa30 191 USRLIBDIR64 =    $(USRDIR)/lib/$(MACH64)
4f8cfa 192 USRSHAREDIR =    $(USRDIR)/share
0f426d 193 USRINCDIR =     $(USRDIR)/include
f685ac 194 USRSHARELOCALEDIR =    $(USRSHAREDIR)/locale
4f8cfa 195 USRSHAREMANDIR =    $(USRSHAREDIR)/man
8a614a 196 USRSHAREDOCDIR =    $(USRSHAREDIR)/doc
93837d 197 USRSHARELIBDIR =    $(USRSHAREDIR)/lib
4f8cfa 198 USRSHAREMAN1DIR =    $(USRSHAREMANDIR)/man1
8a614a 199 USRSHAREMAN1MDIR =    $(USRSHAREMANDIR)/man1m
4f8cfa 200 USRSHAREMAN3DIR =    $(USRSHAREMANDIR)/man3
f1282e 201 USRSHAREMAN4DIR =    $(USRSHAREMANDIR)/man4
5bb235 202 USRSHAREMAN5DIR =    $(USRSHAREMANDIR)/man5
cb0963 203 USRSHAREMAN8DIR =    $(USRSHAREMANDIR)/man8
ffaa30 204 USRKERNELDRVDIR =    $(USRDIR)/kernel/drv
0d49ff 205 USRKERNELDRVDIR32 =    $(USRDIR)/kernel/drv
ffaa30 206 USRKERNELDRVDIR64 =    $(USRDIR)/kernel/drv/$(MACH64)
AL 207
fae1ca 208 # The *.$(BITS) variables are different from those above (better suited for
JK 209 # isaexec wrapper), and allow for default 32-bit vs. nondefault 64-bit setups
210 USRBINDIR.32 =     $(USRBINDIR)
211 USRBINDIR.64 =     $(USRBINDIR64)
212 USRSBINDIR.32 =    $(USRSBINDIR)
213 USRSBINDIR.64 =    $(USRSBINDIR64)
214 USRLIBDIR.32 =     $(USRLIBDIR)
215 USRLIBDIR.64 =     $(USRLIBDIR64)
216
38e5af 217 PROTOETCDIR =    $(PROTO_DIR)/$(ETCDIR)
8a614a 218 PROTOETCSECDIR = $(PROTO_DIR)/$(ETCDIR)/security
4f8cfa 219 PROTOUSRDIR =    $(PROTO_DIR)/$(USRDIR)
ffaa30 220 PROTOBINDIR =    $(PROTO_DIR)/$(BINDIR)
AL 221 PROTOSBINDIR =    $(PROTO_DIR)/$(SBINDIR)
8a614a 222 PROTOLIBDIR =    $(PROTO_DIR)/$(LIBDIR)
ffaa30 223 PROTOVARDIR =    $(PROTO_DIR)/$(VARDIR)
0d49ff 224 PROTOKERNELDRVDIR =      $(PROTO_DIR)/$(KERNELDRVDIR)
JK 225 PROTOKERNELDRVDIR32 =    $(PROTO_DIR)/$(KERNELDRVDIR32)
ffaa30 226 PROTOKERNELDRVDIR64 =    $(PROTO_DIR)/$(KERNELDRVDIR64)
4f8cfa 227 PROTOUSRBINDIR =    $(PROTO_DIR)/$(USRBINDIR)
724840 228 PROTOUSRBINDIR32 =    $(PROTO_DIR)/$(USRBINDIR32)
2cda1c 229 PROTOUSRBINDIR64 =    $(PROTO_DIR)/$(USRBINDIR64)
8a614a 230 PROTOUSRSBINDIR =    $(PROTO_DIR)/$(USRSBINDIR)
724840 231 PROTOUSRSBINDIR32 =    $(PROTO_DIR)/$(USRSBINDIR32)
AL 232 PROTOUSRSBINDIR64 =    $(PROTO_DIR)/$(USRSBINDIR64)
4f8cfa 233 PROTOUSRLIBDIR =    $(PROTO_DIR)/$(USRLIBDIR)
f540dc 234 PROTOUSRLIBDIR32 =    $(PROTO_DIR)/$(USRLIBDIR32)
4f8cfa 235 PROTOUSRLIBDIR64 =    $(PROTO_DIR)/$(USRLIBDIR64)
f685ac 236 PROTOUSRINCDIR =    $(PROTO_DIR)/$(USRINCDIR)
4f8cfa 237 PROTOUSRSHAREDIR =    $(PROTO_DIR)/$(USRSHAREDIR)
93837d 238 PROTOUSRSHARELIBDIR =    $(PROTO_DIR)/$(USRSHARELIBDIR)
4f8cfa 239 PROTOUSRSHAREMANDIR =    $(PROTO_DIR)/$(USRSHAREMANDIR)
8a614a 240 PROTOUSRSHAREDOCDIR =    $(PROTO_DIR)/$(USRSHAREDOCDIR)
4f8cfa 241 PROTOUSRSHAREMAN1DIR =    $(PROTO_DIR)/$(USRSHAREMAN1DIR)
8a614a 242 PROTOUSRSHAREMAN1MDIR =    $(PROTO_DIR)/$(USRSHAREMAN1MDIR)
4f8cfa 243 PROTOUSRSHAREMAN3DIR =    $(PROTO_DIR)/$(USRSHAREMAN3DIR)
f1282e 244 PROTOUSRSHAREMAN4DIR =    $(PROTO_DIR)/$(USRSHAREMAN4DIR)
CM 245 PROTOUSRSHAREMAN5DIR =    $(PROTO_DIR)/$(USRSHAREMAN5DIR)
cb0963 246 PROTOUSRSHAREMAN8DIR =    $(PROTO_DIR)/$(USRSHAREMAN8DIR)
f685ac 247 PROTOUSRSHARELOCALEDIR =    $(PROTO_DIR)/$(USRSHARELOCALEDIR)
0d49ff 248 PROTOUSRKERNELDRVDIR =      $(PROTO_DIR)/$(USRKERNELDRVDIR)
JK 249 PROTOUSRKERNELDRVDIR32 =    $(PROTO_DIR)/$(USRKERNELDRVDIR32)
ffaa30 250 PROTOUSRKERNELDRVDIR64 =    $(PROTO_DIR)/$(USRKERNELDRVDIR64)
4f8cfa 251
fae1ca 252 PROTOUSRBINDIR.32 =     $(PROTOUSRBINDIR)
JK 253 PROTOUSRBINDIR.64 =     $(PROTOUSRBINDIR64)
254 PROTOUSRSBINDIR.32 =    $(PROTOUSRSBINDIR)
255 PROTOUSRSBINDIR.64 =    $(PROTOUSRSBINDIR64)
256 PROTOUSRLIBDIR.32 =     $(PROTOUSRLIBDIR)
257 PROTOUSRLIBDIR.64 =     $(PROTOUSRLIBDIR64)
4f8cfa 258
b728c5 259 # NOTE: We do not build SFW contents
JK 260 # /usr/sfw/bin is just a historic artefact, containing symlinks
3d7f8d 261 SFWBIN =    /usr/sfw/bin
b728c5 262 SFWBIN32 =    $(SFWBIN)
JK 263 SFWBIN64 =    $(SFWBIN)/$(MACH64)
264 SFWSBIN =    /usr/sfw/sbin
265 SFWSBIN32 =    $(SFWSBIN)
266 SFWSBIN64 =    $(SFWSBIN)/$(MACH64)
f685ac 267 SFWINCLUDE =    /usr/sfw/include
3d7f8d 268 SFWLIB =    /usr/sfw/lib
b728c5 269 SFWLIB32 =    $(SFWLIB)
JK 270 SFWLIB64 =    $(SFWLIB)/$(MACH64)
1932c6 271 SFWSHARE =    /usr/sfw/share
b728c5 272 SFWSHAREMAN =    $(SFWSHARE)/man
JK 273 SFWSHAREMAN1 =    $(SFWSHAREMAN)/man1
274 PROTOSFWBIN =       $(PROTO_DIR)/$(SFWBIN)
275 PROTOSFWBIN32 =     $(PROTO_DIR)/$(SFWBIN32)
276 PROTOSFWBIN64 =     $(PROTO_DIR)/$(SFWBIN64)
277 PROTOSFWSBIN =      $(PROTO_DIR)/$(SFWSBIN)
278 PROTOSFWSBIN32 =    $(PROTO_DIR)/$(SFWSBIN32)
279 PROTOSFWSBIN64 =    $(PROTO_DIR)/$(SFWSBIN64)
3d7f8d 280 PROTOSFWLIB =    $(PROTO_DIR)/$(SFWLIB)
b728c5 281 PROTOSFWLIB32 =    $(PROTO_DIR)/$(SFWLIB32)
d92147 282 PROTOSFWLIB64 =    $(PROTO_DIR)/$(SFWLIB64)
1932c6 283 PROTOSFWSHARE =    $(PROTO_DIR)/$(SFWSHARE)
MS 284 PROTOSFWSHAREMAN =    $(PROTO_DIR)/$(SFWSHAREMAN)
285 PROTOSFWSHAREMAN1 =    $(PROTO_DIR)/$(SFWSHAREMAN1)
f685ac 286 PROTOSFWINCLUDE =    $(PROTO_DIR)/$(SFWINCLUDE)
1932c6 287
b728c5 288 # The *.$(BITS) variables are different from those above (better suited for
JK 289 # isaexec wrapper), and allow for default 32-bit vs. nondefault 64-bit setups
290 SFWBIN.32 =     $(SFWBIN)
291 SFWBIN.64 =     $(SFWBIN64)
292 SFWSBIN.32 =    $(SFWSBIN)
293 SFWSBIN.64 =    $(SFWSBIN64)
294 SFWLIB.32 =     $(SFWLIB)
295 SFWLIB.64 =     $(SFWLIB64)
296 PROTOSFWBIN.32 =    $(PROTOSFWBIN)
297 PROTOSFWBIN.64 =    $(PROTOSFWBIN64)
298 PROTOSFWSBIN.32 =    $(PROTOSFWSBIN)
299 PROTOSFWSBIN.64 =    $(PROTOSFWSBIN64)
300 PROTOSFWLIB.32 =    $(PROTOSFWLIB)
301 PROTOSFWLIB.64 =    $(PROTOSFWLIB64)
302
8a52c2 303 CLDIR =    /usr/share/common-lisp
J'S 304 PROTOCLDIR =    $(PROTO_DIR)/$(CLDIR)
305
449120 306 GNUDIR =    /usr/gnu
AL 307 GNUBIN =    $(GNUDIR)/bin
b323a7 308 GNUBIN32 =    $(GNUBIN)/$(MACH32)
JK 309 GNUBIN64 =    $(GNUBIN)/$(MACH64)
449120 310 GNUSBIN =    $(GNUDIR)/sbin
b323a7 311 GNUSBIN32 =    $(GNUSBIN)/$(MACH32)
JK 312 GNUSBIN64 =    $(GNUSBIN)/$(MACH64)
449120 313 GNULIB =    $(GNUDIR)/lib
b323a7 314 GNULIB32 =    $(GNULIB)
JK 315 GNULIB64 =    $(GNULIB)/$(MACH64)
449120 316 GNUSHARE =    $(GNUDIR)/share
b323a7 317 GNUSHAREMAN =    $(GNUSHARE)/man
JK 318 GNUSHAREMAN1 =    $(GNUSHAREMAN)/man1
319 PROTOGNUBIN =       $(PROTO_DIR)/$(GNUBIN)
320 PROTOGNUBIN32 =     $(PROTO_DIR)/$(GNUBIN32)
321 PROTOGNUBIN64 =     $(PROTO_DIR)/$(GNUBIN64)
322 PROTOGNUSBIN =      $(PROTO_DIR)/$(GNUSBIN)
323 PROTOGNUSBIN32 =    $(PROTO_DIR)/$(GNUSBIN32)
324 PROTOGNUSBIN64 =    $(PROTO_DIR)/$(GNUSBIN64)
325 PROTOGNULIB =       $(PROTO_DIR)/$(GNULIB)
326 PROTOGNULIB32 =     $(PROTO_DIR)/$(GNULIB32)
327 PROTOGNULIB64 =     $(PROTO_DIR)/$(GNULIB64)
328 PROTOGNUSHARE =     $(PROTO_DIR)/$(GNUSHARE)
1932c6 329 PROTOGNUSHAREMAN =    $(PROTO_DIR)/$(GNUSHAREMAN)
MS 330 PROTOGNUSHAREMAN1 =    $(PROTO_DIR)/$(GNUSHAREMAN1)
3d7f8d 331
fae1ca 332 # The *.$(BITS) variables are different from those above (better suited for
JK 333 # isaexec wrapper), and allow for default 32-bit vs. nondefault 64-bit setups
334 GNUBIN.32 =     $(GNUBIN)
335 GNUBIN.64 =     $(GNUBIN64)
336 GNUSBIN.32 =    $(GNUSBIN)
337 GNUSBIN.64 =    $(GNUSBIN64)
338 GNULIB.32 =     $(GNULIB)
339 GNULIB.64 =     $(GNULIB64)
340 PROTOGNUBIN.32 =    $(PROTOGNUBIN)
341 PROTOGNUBIN.64 =    $(PROTOGNUBIN64)
342 PROTOGNUSBIN.32 =    $(PROTOGNUSBIN)
343 PROTOGNUSBIN.64 =    $(PROTOGNUSBIN64)
344 PROTOGNULIB.32 =    $(PROTOGNULIB)
345 PROTOGNULIB.64 =    $(PROTOGNULIB64)
346
61c373 347 # work around _TIME, _DATE, embedded date chatter in component builds
NJ 348 # to use, set TIME_CONSTANT in the component Makefile and add $(CONSTANT_TIME)
349 # to the appropriate {CONFIGURE|BUILD|INSTALL}_ENV
79b849 350 CONSTANT_TIME =        LD_PRELOAD_32=$(WS_TOOLS)/time-$(MACH32).so
NJ 351 CONSTANT_TIME +=    LD_PRELOAD_64=$(WS_TOOLS)/time-$(MACH64).so
61c373 352 CONSTANT_TIME +=    TIME_CONSTANT=$(TIME_CONSTANT)
80b1b4 353
5d461f 354 # set MACH from uname -p to either sparc or i386
5ada66 355 MACH :=        $(shell uname -p)
5d461f 356
NJ 357 # set MACH32 from MACH to either sparcv7 or i86
358 MACH32_1 =    $(MACH:sparc=sparcv7)
359 MACH32 =    $(MACH32_1:i386=i86)
360
361 # set MACH64 from MACH to either sparcv9 or amd64
362 MACH64_1 =    $(MACH:sparc=sparcv9)
363 MACH64 =    $(MACH64_1:i386=amd64)
364
c2319a 365 CONFIGURE_32 =        $(BUILD_DIR_32)/.configured
BC 366 CONFIGURE_64 =        $(BUILD_DIR_64)/.configured
367
4f8cfa 368 BUILD_DIR_32 =        $(BUILD_DIR)/$(MACH32)
MS 369 BUILD_DIR_64 =        $(BUILD_DIR)/$(MACH64)
370
371 BUILD_32 =        $(BUILD_DIR_32)/.built
372 BUILD_64 =        $(BUILD_DIR_64)/.built
5d461f 373 BUILD_32_and_64 =    $(BUILD_32) $(BUILD_64)
4158c0 374 $(BUILD_DIR_32)/.built:        BITS=32
NJ 375 $(BUILD_DIR_64)/.built:        BITS=64
5d461f 376
4f8cfa 377 INSTALL_32 =        $(BUILD_DIR_32)/.installed
MS 378 INSTALL_64 =        $(BUILD_DIR_64)/.installed
5d461f 379 INSTALL_32_and_64 =    $(INSTALL_32) $(INSTALL_64)
a7cc57 380 $(BUILD_DIR_32)/.installed:       BITS=32
AC 381 $(BUILD_DIR_64)/.installed:       BITS=64
4158c0 382
NJ 383 # set the default target for installation of the component
384 COMPONENT_INSTALL_TARGETS =    install
9c75c0 385
237543 386 # set the default build test results directory
AP 387 COMPONENT_TEST_BUILD_DIR =    $(BUILD_DIR)/test/$(MACH$(BITS))
388
389 # set the default master test results directory
8d70f8 390 COMPONENT_TEST_RESULTS_DIR =    $(COMPONENT_DIR)/test
RB 391
392 # set the default master test results file
393 COMPONENT_TEST_MASTER =        $(COMPONENT_TEST_RESULTS_DIR)/results-$(BITS).master
394
395 # set the default test results output file
237543 396 COMPONENT_TEST_OUTPUT =        $(COMPONENT_TEST_BUILD_DIR)/test-$(BITS)-results
8d70f8 397
RB 398 # set the default test results comparison diffs file
237543 399 COMPONENT_TEST_DIFFS =        $(COMPONENT_TEST_BUILD_DIR)/test-$(BITS)-diffs
8d70f8 400
RB 401 # set the default test snapshot file
237543 402 COMPONENT_TEST_SNAPSHOT =    $(COMPONENT_TEST_BUILD_DIR)/results-$(BITS).snapshot
AP 403
404 # Normally $(GSED) is simplest, but some results files need more power.
405 COMPONENT_TEST_TRANSFORMER =    $(GSED)
8d70f8 406
RB 407 # The set of default transforms to be applied to the test results to try
408 # to normalize them.
409 COMPONENT_TEST_TRANSFORMS = \
410     '-e "s|$(@D)|\\$$(@D)|g" ' \
411     '-e "s|$(PERL)|\\$$(PERL)|g" ' \
412     '-e "s|$(SOURCE_DIR)|\\$$(SOURCE_DIR)|g" '
413
414 # set the default commands used to generate the file containing the set
415 # of transforms to be applied to the test results to try to normalize them.
416 COMPONENT_TEST_CREATE_TRANSFORMS = \
417     if [ -e $(COMPONENT_TEST_MASTER) ]; \
418     then \
419         print "\#!/bin/sh" > $(COMPONENT_TEST_TRANSFORM_CMD); \
237543 420             print '$(COMPONENT_TEST_TRANSFORMER) ' \
8d70f8 421             $(COMPONENT_TEST_TRANSFORMS) \
RB 422                     ' \\' >> $(COMPONENT_TEST_TRANSFORM_CMD); \
423             print '$(COMPONENT_TEST_OUTPUT) \\' \
424                     >> $(COMPONENT_TEST_TRANSFORM_CMD); \
425             print '> $(COMPONENT_TEST_SNAPSHOT)' \
426                     >> $(COMPONENT_TEST_TRANSFORM_CMD); \
427     fi
428
429 # set the default command for performing any test result munging
237543 430 COMPONENT_TEST_TRANSFORM_CMD =    $(COMPONENT_TEST_BUILD_DIR)/transform-$(BITS)-results
8d70f8 431
RB 432 # set the default operation to run to perform test result normalization
433 COMPONENT_TEST_PERFORM_TRANSFORM = \
434     if [ -e $(COMPONENT_TEST_MASTER) ]; \
435     then \
436         $(SHELL) $(COMPONENT_TEST_TRANSFORM_CMD); \
437     fi
438
439 # set the default command used to compare the master results with the snapshot
440 COMPONENT_TEST_COMPARE_CMD =    $(GDIFF) -uN
441
442 # set the default way that master and snapshot test results are compared
443 COMPONENT_TEST_COMPARE = \
444     if [ -e $(COMPONENT_TEST_MASTER) ]; \
445     then \
446         $(COMPONENT_TEST_COMPARE_CMD) \
447             $(COMPONENT_TEST_MASTER) $(COMPONENT_TEST_SNAPSHOT) \
448             > $(COMPONENT_TEST_DIFFS); \
449         print "Test results in $(COMPONENT_TEST_OUTPUT)"; \
450         if [ -s $(COMPONENT_TEST_DIFFS) ]; \
451         then \
452             print "Differences found."; \
453             $(CAT) $(COMPONENT_TEST_DIFFS); \
454             exit 2; \
455         else \
456             print "No differences found."; \
457         fi \
458     fi
459
460 # set the default env command to use for test of the component
461 COMPONENT_TEST_ENV_CMD =    $(ENV)
462
463 # set the default command to use for test of the component
464 COMPONENT_TEST_CMD =    $(GMAKE)
4158c0 465
NJ 466 # set the default target for test of the component
467 COMPONENT_TEST_TARGETS =    check
35a012 468
702558 469 # set the default directory for test of the component
AP 470 COMPONENT_TEST_DIR =    $(@D)
8d70f8 471
RB 472 # determine the type of tests we want to run.
473 ifeq ($(strip $(wildcard $(COMPONENT_TEST_RESULTS_DIR)/results-*.master)),)
474 TEST_32 =        $(BUILD_DIR_32)/.tested
475 TEST_64 =        $(BUILD_DIR_64)/.tested
476 else
477 TEST_32 =        $(BUILD_DIR_32)/.tested-and-compared
478 TEST_64 =        $(BUILD_DIR_64)/.tested-and-compared
479 endif
480 TEST_32_and_64 =    $(TEST_32) $(TEST_64)
481 $(BUILD_DIR_32)/.tested:        BITS=32
482 $(BUILD_DIR_64)/.tested:        BITS=64
483 $(BUILD_DIR_32)/.tested-and-compared:    BITS=32
484 $(BUILD_DIR_64)/.tested-and-compared:    BITS=64
871b03 485
50cda8 486 # BUILD_TOOLS is the root of all tools not normally installed on the system.
617c23 487 BUILD_TOOLS ?=    /opt
50cda8 488
6d6808 489 SPRO_VERSION =    12.1
AL 490 SPRO_ROOT =    $(BUILD_TOOLS)/sunstudio$(SPRO_VERSION)
617c23 491 SPRO_VROOT =    $(SPRO_ROOT)
50cda8 492
0c2d4d 493 PARFAIT_ROOT =    $(BUILD_TOOLS)/parfait/parfait-tools-1.0.1/
7999b2 494 PARFAIT= $(PARFAIT_ROOT)/bin/parfait
MS 495 export PARFAIT_NATIVESUNCC=$(SPRO_VROOT)/bin/cc
496 export PARFAIT_NATIVESUNCXX=$(SPRO_VROOT)/bin/CC
497 export PARFAIT_NATIVEGCC=$(GCC_ROOT)/bin/gcc
498 export PARFAIT_NATIVEGXX=$(GCC_ROOT)/bin/g++
499
fcf34c 500 #
c5572a 501 # The CCACHE makefile variable should evaluate to empty string or a pathname
JK 502 # like /usr/bin/ccache depending on your PATH value and "which" implementation.
503 # The assignment via ":=" is important, to only do this once in a Makefile,
504 # and not on every reference to the value as "=" assignment would result in.
505 # Review `man ccache` for optional configuration tuning, like cache size etc.
506 #
507 # For production builds or suspected errors you can disable this feature by
508 # setting ENABLE_CCACHE=false (as makefile or environment variable, which
509 # is currently the default) to not even define the usage of wrapper in the
510 # userland-building makefile system.
511 # If you want to speed up your re-builds, you must set ENABLE_CCACHE=true.
fcf34c 512 # For legacy reasons, the CCACHE_DISABLE and CCACHE_NODISABLE variables (from
JK 513 # configuration of the "ccache" program itself) are also supported, but direct
514 # use is discouraged, since their syntax and usage are counter-intuitive.
c5572a 515 #
JK 516 # Still, absence of ccache in PATH is not considered a fatal error since the
517 # build would just proceed well with original compiler.
518 # Note: In code below we fast-track if the makefile CCACHE variable is defined
519 # but fall back to shell executability tests if just envvar CCACHE is passed.
fcf34c 520 #
c5572a 521 export CCACHE := $(shell \
JK 522     if test -n "$(CCACHE)" ; then \
523         echo "$(CCACHE)"; \
524     else \
fcf34c 525         if test x"$${CCACHE_DISABLE-}" != x -o x"$(CCACHE_DISABLE)" != x \
c5572a 526              -o x"$${ENABLE_CCACHE-}" = xfalse -o x"$(ENABLE_CCACHE)" = xfalse \
JK 527         ; then \
528                 echo "NOT USING CCACHE FOR OI-USERLAND because explicitly disabled" >&2 ; \
529         else \
fcf34c 530             if test x"$${CCACHE_NODISABLE-}" != x -o x"$(CCACHE_NODISABLE)" != x \
c5572a 531                  -o x"$${ENABLE_CCACHE-}" = xtrue -o x"$(ENABLE_CCACHE)" = xtrue \
JK 532             ; then \
533                 for F in \
534                     "$$CCACHE" \
535                     `which ccache 2>/dev/null | egrep '^/'` \
536                     /usr/bin/ccache \
537                 ; do if test -n "$$F" && test -x "$$F" ; then \
538                         echo "$$F" ; \
539                         echo "USING CCACHE FOR OI-USERLAND: $$F" >&2 ; \
fcf34c 540                         if test x"$${CCACHE_DISABLE-}" != x ; then \
JK 541                             echo "WARNING: envvar CCACHE_DISABLE is set, so effectively ccache will not act!" >&2 ; \
542                         fi; \
c5572a 543                         exit 0; \
JK 544                     fi; \
545                 done; \
546                 echo "NOT USING CCACHE FOR OI-USERLAND because not found" >&2 ; \
547             fi; \
548         fi; \
549     fi)
550
0607b2 551 GCC_VERSION =    6
6d6808 552 GCC_ROOT =    /usr/gcc/$(GCC_VERSION)
9c75c0 553
e6ade5 554 # Define runtime package names to be used in dependencies
AL 555 GCC_VERSION_MAJOR    = $(shell echo $(GCC_VERSION) | $(GSED) -e 's/\([0-9]\+\)\.[0-9]\+.*/\1/')
556 GCC_RUNTIME_PKG      = system/library/gcc-$(GCC_VERSION_MAJOR)-runtime
557 GXX_RUNTIME_PKG      = system/library/g++-$(GCC_VERSION_MAJOR)-runtime
558 GFORTRAN_RUNTIME_PKG = system/library/gfortran-$(GCC_VERSION_MAJOR)-runtime
559 GOBJC_RUNTIME_PKG    = system/library/gobjc-$(GCC_VERSION_MAJOR)-runtime
560
35a012 561 CC.studio.32 =    $(SPRO_VROOT)/bin/cc
3cec7d 562 CXX.studio.32 =    $(SPRO_VROOT)/bin/CC
dcd7ba 563 F77.studio.32 = $(SPRO_VROOT)/bin/f77
bd9d92 564 FC.studio.32 =  $(SPRO_VROOT)/bin/f90
9c75c0 565
35a012 566 CC.studio.64 =    $(SPRO_VROOT)/bin/cc
3cec7d 567 CXX.studio.64 =    $(SPRO_VROOT)/bin/CC
dcd7ba 568 F77.studio.64 = $(SPRO_VROOT)/bin/f77
bd9d92 569 FC.studio.64 =  $(SPRO_VROOT)/bin/f90
9c75c0 570
bd9d92 571 CC.gcc.32 =    $(GCC_ROOT)/bin/gcc
3cec7d 572 CXX.gcc.32 =    $(GCC_ROOT)/bin/g++
dcd7ba 573 F77.gcc.32 =    $(GCC_ROOT)/bin/gfortran
bd9d92 574 FC.gcc.32 =    $(GCC_ROOT)/bin/gfortran
9c75c0 575
bd9d92 576 CC.gcc.64 =    $(GCC_ROOT)/bin/gcc
3cec7d 577 CXX.gcc.64 =    $(GCC_ROOT)/bin/g++
dcd7ba 578 F77.gcc.64 =    $(GCC_ROOT)/bin/gfortran
bd9d92 579 FC.gcc.64 =    $(GCC_ROOT)/bin/gfortran
9c75c0 580
8e5cd8 581 # GCC directory macros
AL 582 GCC_FULL_VERSION = $(shell $(CC.gcc.$(BITS)) -dumpversion)
583 GCC_BINDIR =    $(GCC_ROOT)/bin
584 GCC_LIBDIR.32 =    $(GCC_ROOT)/lib
585 GCC_LIBDIR.64 =    $(GCC_ROOT)/lib/$(MACH64)
586 GCC_LIBDIR =    $(GCC_LIBDIR.$(BITS))
587 GCC_INCDIR =    $(GCC_ROOT)/include
588 GCC_LIBGCCDIR =    $(GCC_ROOT)/lib/gcc
589 GCC_INCGXXDIR =    $(GCC_ROOT)/include/c++/$(GCC_FULL_VERSION)
590
c5572a 591 ifneq ($(strip $(CCACHE)),)
JK 592
593 CCACHE_WRAP_ROOT   =    $(WS_TOOLS)/ccache-wrap
594 export CC_gcc_32  :=    $(CC.gcc.32)
595 export CC_gcc_64  :=    $(CC.gcc.64)
596 export CXX_gcc_32 :=    $(CXX.gcc.32)
597 export CXX_gcc_64 :=    $(CXX.gcc.64)
598 CC.gcc.32  :=    $(CCACHE_WRAP_ROOT)/CC.gcc.32
599 CC.gcc.64  :=    $(CCACHE_WRAP_ROOT)/CC.gcc.64
600 CXX.gcc.32 :=    $(CCACHE_WRAP_ROOT)/CXX.gcc.32
601 CXX.gcc.64 :=    $(CCACHE_WRAP_ROOT)/CXX.gcc.64
602
603 ifneq ($(strip $(CCACHE_DIR)),)
604 export CCACHE_DIR :=    $(CCACHE_DIR)
605 endif
606
607 ifneq ($(strip $(CCACHE_LOGFILE)),)
608 export CCACHE_LOGFILE :=    $(CCACHE_LOGFILE)
609 endif
610
611 endif
9c75c0 612
4f8cfa 613 lint.32 =    $(SPRO_VROOT)/bin/lint -m32
MS 614 lint.64 =    $(SPRO_VROOT)/bin/lint -m64
615
616 LINT =        $(lint.$(BITS))
617
61c373 618 LD =        /usr/bin/ld
9c75c0 619
fa74c0 620 PYTHON.2.7.VENDOR_PACKAGES.32 = /usr/lib/python2.7/vendor-packages
NJ 621 PYTHON.2.7.VENDOR_PACKAGES.64 = /usr/lib/python2.7/vendor-packages/64
622 PYTHON.2.7.VENDOR_PACKAGES = $(PYTHON.2.7.VENDOR_PACKAGES.$(BITS))
d64b79 623
AP 624 PYTHON.3.4.VENDOR_PACKAGES.32 = /usr/lib/python3.4/vendor-packages
625 PYTHON.3.4.VENDOR_PACKAGES.64 = /usr/lib/python3.4/vendor-packages/64
626 PYTHON.3.4.VENDOR_PACKAGES = $(PYTHON.3.4.VENDOR_PACKAGES.$(BITS))
7999b2 627
44f1c2 628 PYTHON.3.5.VENDOR_PACKAGES.64 = /usr/lib/python3.5/vendor-packages
955da2 629 PYTHON.3.5.VENDOR_PACKAGES.32 = /usr/lib/python3.5/vendor-packages
44f1c2 630 PYTHON.3.5.VENDOR_PACKAGES = $(PYTHON.3.5.VENDOR_PACKAGES.$(BITS))
AP 631
7999b2 632 ifeq   ($(strip $(PARFAIT_BUILD)),yes)
MS 633 CC.studio.32 =    $(WS_TOOLS)/parfait/cc
634 CXX.studio.32 =    $(WS_TOOLS)/parfait/CC
635 CC.studio.64 =    $(WS_TOOLS)/parfait/cc
636 CXX.studio.64 =    $(WS_TOOLS)/parfait/CC
637 CC.gcc.32 =    $(WS_TOOLS)/parfait/gcc
638 CXX.gcc.32 =    $(WS_TOOLS)/parfait/g++
639 CC.gcc.64 =    $(WS_TOOLS)/parfait/gcc
640 CXX.gcc.64 =    $(WS_TOOLS)/parfait/g++
641 LD =        $(WS_TOOLS)/parfait/ld
642 endif
643
644 CC =        $(CC.$(COMPILER).$(BITS))
645 CXX =        $(CXX.$(COMPILER).$(BITS))
dcd7ba 646 F77 =        $(F77.$(COMPILER).$(BITS))
AL 647 FC =        $(FC.$(COMPILER).$(BITS))
7999b2 648
1e5ead 649 RUBY_VERSION =  2.3
404117 650 RUBY_LIB_VERSION.2.2 = 2.2.0
1e5ead 651 RUBY_LIB_VERSION.2.3 = 2.3.0
AP 652 RUBY.2.2 =    /usr/ruby/2.2/bin/ruby
653 RUBY.2.3 =    /usr/ruby/2.3/bin/ruby
18b823 654 RUBY =          $(RUBY.$(RUBY_VERSION))
1e5ead 655 RUBY_LIB_VERSION = $(RUBY_LIB_VERSION.$(RUBY_VERSION))
AP 656
657 # Transform Ruby scripts to call the supported
658 # version-specific ruby; used in multiple *.mk files
659 RUBY_SCRIPT_FIX_FUNC = \
660     $(GNU_GREP) -Rl '^\#! */usr/bin/env ruby' | \
661         /usr/bin/xargs -I\{\} $(GSED) -i -e \
662         '1s%^\#! */usr/bin/env ruby%\#!/usr/ruby/$(RUBY_VERSION)/bin/ruby%' \
663         \{\}
664
18b823 665 # Use the ruby lib versions to represent the RUBY_VERSIONS that
AP 666 # need to get built.  This is done because during package transformations
0de8ff 667 # both the ruby version and the ruby library version are needed.
18b823 668 RUBY_VERSIONS = $(RUBY_LIB_VERSION)
fa74c0 669
955da2 670 PYTHON_VENDOR_PACKAGES.32 = $(PYTHON.$(PYTHON_VERSION).VENDOR_PACKAGES.32)
AP 671 PYTHON_VENDOR_PACKAGES.64 = $(PYTHON.$(PYTHON_VERSION).VENDOR_PACKAGES.64)
a0613d 672 PYTHON_VENDOR_PACKAGES = $(PYTHON_VENDOR_PACKAGES.$(BITS))
fa74c0 673
NJ 674 PYTHON.2.7.32 =    /usr/bin/python2.7
675 PYTHON.2.7.64 =    /usr/bin/$(MACH64)/python2.7
9c75c0 676
94deda 677 PYTHON.3.4.32 =    /usr/bin/python3.4
AP 678 PYTHON.3.4.64 =    /usr/bin/$(MACH64)/python3.4
679
44f1c2 680 PYTHON.3.5.32 =    /usr/bin/python3.5
AP 681 PYTHON.3.5.64 =    /usr/bin/python3.5
682
4e6f9b 683 PYTHON.32 =    $(PYTHON.$(PYTHON_VERSION).32)
RB 684 PYTHON.64 =    $(PYTHON.$(PYTHON_VERSION).64)
a0613d 685 PYTHON =    $(PYTHON.$(PYTHON_VERSION).$(BITS))
9c75c0 686
5bdc52 687 # The default is site-packages, but that directory belongs to the end-user.
SS 688 # Modules which are shipped by the OS but not with the core Python distribution
689 # belong in vendor-packages.
690 PYTHON_LIB= /usr/lib/python$(PYTHON_VERSION)/vendor-packages
fa74c0 691 PYTHON_DATA= $(PYTHON_LIB)
5bdc52 692
b66ecd 693 JAVA7_HOME =    /usr/jdk/instances/openjdk1.7.0
a419a5 694 JAVA8_HOME =    /usr/jdk/instances/openjdk1.8.0
AP 695 JAVA_HOME = $(JAVA8_HOME)
61a323 696
f627ef 697 # Location of pod2man, etc
GM 698 PERL5BINDIR =     /usr/perl5/bin
699
6bc9bf 700 # This is the default BUILD version of perl
CM 701 # Not necessarily the system's default version, i.e. /usr/bin/perl
dcbce3 702 PERL_VERSION =  5.22
9aea33 703
1ff27b 704 PERL_VERSIONS = 5.22 5.24
6bc9bf 705
4c3dde 706 PERL.5.22 =    /usr/perl5/5.22/bin/perl
ed0038 707 PERL.5.24 =    /usr/perl5/5.24/bin/perl
6bc9bf 708
9e2024 709 POD2MAN.5.22 =    /usr/perl5/5.22/bin/pod2man
ed0038 710 POD2MAN.5.24 =    /usr/perl5/5.24/bin/pod2man
9e2024 711
712 PERL =        $(PERL.$(PERL_VERSION))
713 POD2MAN =    $(POD2MAN.$(PERL_VERSION))
6bc9bf 714
5ada66 715 PERL_ARCH :=    $(shell $(PERL) -e 'use Config; print $$Config{archname}')
9581d1 716 PERL_ARCH_FUNC=    $(shell $(1) -e 'use Config; print $$Config{archname}')
6bc9bf 717 # Optimally we should ask perl which C compiler was used but it doesn't
CM 718 # result in a full path name.  Only "c" is being recorded
719 # inside perl builds while we actually need a full path to
720 # the studio compiler.
5ada66 721 #PERL_CC :=    $(shell $(PERL) -e 'use Config; print $$Config{cc}')
6bc9bf 722
CM 723 PKG_MACROS +=   PERL_ARCH=$(PERL_ARCH)
724 PKG_MACROS +=   PERL_VERSION=$(PERL_VERSION)
725
eb149b 726 # Config magic for Postgres/EnterpriseDB/...
JK 727 # Default DB version is the oldest one, for hopefully best built complatibility
f05ab0 728 PG_VERSION ?=   9.4
eb149b 729 PG_IMPLEM ?=    postgres
7fd1f9 730 PG_VERNUM =     $(subst .,,$(PG_VERSION))
eb149b 731 # For dependencies, including REQUIRED_PACKAGES if needed
JK 732 PG_BASEPKG =    database/$(PG_IMPLEM)-$(PG_VERNUM)
733
734 PG_HOME =       $(USRDIR)/$(PG_IMPLEM)/$(PG_VERSION)
7fd1f9 735 PG_BINDIR.32 =  $(PG_HOME)/bin
AP 736 PG_BINDIR.64 =  $(PG_HOME)/bin/$(MACH64)
eb149b 737 PG_BINDIR =     $(PG_BINDIR.$(BITS))
7fd1f9 738 PG_INCDIR =     $(PG_HOME)/include
AP 739 PG_MANDIR =     $(PG_HOME)/man
740 PG_SHAREDIR =   $(PG_HOME)/share
741 PG_DOCDIR =     $(PG_HOME)/doc
742 PG_LIBDIR.32 =  $(PG_HOME)/lib
743 PG_LIBDIR.64 =  $(PG_HOME)/lib/$(MACH64)
eb149b 744 PG_LIBDIR =     $(PG_LIBDIR.$(BITS))
7fd1f9 745 PG_CONFIG.32 =  $(PG_BINDIR.32)/pg_config
AP 746 PG_CONFIG.64 =  $(PG_BINDIR.64)/pg_config
eb149b 747 PG_CONFIG =     $(PG_CONFIG.$(BITS))
7fd1f9 748
AP 749 PKG_MACROS +=   PG_VERSION=$(PG_VERSION)
750 PKG_MACROS +=   PG_VERNUM=$(PG_VERNUM)
eb149b 751 PKG_MACROS +=   PG_BASEPKG=$(PG_BASEPKG)
JK 752
753 # Config magic for MySQL/MariaDB/Percona/...
754 # Default DB version is the oldest one, for hopefully best built compatibility
755 # NOTE: At this time the gate does not provide a recipe for actual "mysql"
756 # The "/usr/mysql/*" trees are mediated to preferred MariaDB or Percona variant
973673 757 MYSQL_VERSION ?=   10.1
eb149b 758 MYSQL_IMPLEM ?=    mariadb
JK 759 MYSQL_VERNUM =     $(subst .,,$(MYSQL_VERSION))
760 # For dependencies, including REQUIRED_PACKAGES if needed
761 MYSQL_BASEPKG =    database/$(MYSQL_IMPLEM)-$(MYSQL_VERNUM)
762
763 MYSQL_HOME =       $(USRDIR)/$(MYSQL_IMPLEM)/$(MYSQL_VERSION)
764 MYSQL_BINDIR.32 =  $(MYSQL_HOME)/bin
765 MYSQL_BINDIR.64 =  $(MYSQL_HOME)/bin/$(MACH64)
766 MYSQL_BINDIR =     $(MYSQL_BINDIR.$(BITS))
767 MYSQL_INCDIR =     $(MYSQL_HOME)/include
768 MYSQL_MANDIR =     $(MYSQL_HOME)/man
769 MYSQL_SHAREDIR =   $(MYSQL_HOME)/share
770 MYSQL_DOCDIR =     $(MYSQL_HOME)/doc
771 MYSQL_LIBDIR.32 =  $(MYSQL_HOME)/lib
772 MYSQL_LIBDIR.64 =  $(MYSQL_HOME)/lib/$(MACH64)
773 MYSQL_LIBDIR =     $(MYSQL_LIBDIR.$(BITS))
774 MYSQL_CONFIG.32 =  $(MYSQL_BINDIR.32)/mysql_config
775 MYSQL_CONFIG.64 =  $(MYSQL_BINDIR.64)/mysql_config
776 MYSQL_CONFIG =     $(MYSQL_CONFIG.$(BITS))
777
778 PKG_MACROS +=   MYSQL_VERSION=$(MYSQL_VERSION)
779 PKG_MACROS +=   MYSQL_VERNUM=$(MYSQL_VERNUM)
780 PKG_MACROS +=   MYSQL_BASEPKG=$(MYSQL_BASEPKG)
7fd1f9 781
6f7416 782 # Default libjpeg implementation layout
AL 783 JPEG_IMPLEM ?=     libjpeg8-turbo
784 JPEG_HOME =        $(USRLIBDIR)/$(JPEG_IMPLEM)
785 JPEG_BINDIR.32 =   $(JPEG_HOME)/bin
786 JPEG_BINDIR.64 =   $(JPEG_HOME)/bin/$(MACH64)
787 JPEG_BINDIR =      $(JPEG_BINDIR.$(BITS))
788 JPEG_INCDIR =      $(USRINCDIR)/$(JPEG_IMPLEM)
789 JPEG_LIBDIR.32 =   $(JPEG_HOME)/lib
790 JPEG_LIBDIR.64 =   $(JPEG_HOME)/lib/$(MACH64)
791 JPEG_LIBDIR =      $(JPEG_LIBDIR.$(BITS))
792 JPEG_CPPFLAGS =    -I$(JPEG_INCDIR)
793 JPEG_CFLAGS.32 =   -Wl,-L$(JPEG_LIBDIR.32) -Wl,-R$(JPEG_LIBDIR.32)
794 JPEG_CFLAGS.64 =   -Wl,-L$(JPEG_LIBDIR.64) -Wl,-R$(JPEG_LIBDIR.64)
795 JPEG_CFLAGS =      $(JPEG_CFLAGS.$(BITS))
796 JPEG_CXXFLAGS.32 = -Wl,-L$(JPEG_LIBDIR.32) -Wl,-R$(JPEG_LIBDIR.32)
797 JPEG_CXXFLAGS.64 = -Wl,-L$(JPEG_LIBDIR.64) -Wl,-R$(JPEG_LIBDIR.64)
798 JPEG_CXXFLAGS =    $(JPEG_CXXFLAGS.$(BITS))
799 JPEG_LDFLAGS.32 =  -L$(JPEG_LIBDIR.32) -R$(JPEG_LIBDIR.32)
800 JPEG_LDFLAGS.64 =  -L$(JPEG_LIBDIR.64) -R$(JPEG_LIBDIR.64)
801 JPEG_LDFLAGS =     $(JPEG_LDFLAGS.$(BITS))
802
23aaef 803 # This is the default BUILD version of tcl
DL 804 # Not necessarily the system's default version, i.e. /usr/bin/tclsh
26b2cb 805 TCL_VERSION =  8.6
AP 806 TCLSH.8.6.i386.32 =    /usr/bin/i86/tclsh8.6
807 TCLSH.8.6.i386.64 =    /usr/bin/amd64/tclsh8.6
808 TCLSH.8.6.sparc.32 =    /usr/bin/sparcv7/tclsh8.6
809 TCLSH.8.6.sparc.64 =    /usr/bin/sparcv9/tclsh8.6
23aaef 810 TCLSH =        $(TCLSH.$(TCL_VERSION).$(MACH).$(BITS))
DL 811
6bc9bf 812 CCSMAKE =    /usr/ccs/bin/make
9c75c0 813 GMAKE =        /usr/gnu/bin/make
NJ 814 GPATCH =    /usr/gnu/bin/patch
ff1c63 815 PATCH_LEVEL =    1
35a012 816 GPATCH_BACKUP =    --backup --version-control=numbered
NJ 817 GPATCH_FLAGS =    -p$(PATCH_LEVEL) $(GPATCH_BACKUP)
960e5b 818 GSED =        /usr/gnu/bin/sed
8d70f8 819 GDIFF =        /usr/gnu/bin/diff
RB 820 GSORT =        /usr/gnu/bin/sort
fbf173 821 GUNZIP =    /usr/bin/gunzip
9c75c0 822
dd0336 823 PKGREPO =    /usr/bin/pkgrepo
9c75c0 824 PKGSEND =    /usr/bin/pkgsend
7bf47e 825 ifeq   ($(strip $(PKGLINT_COMPONENT)),)
d08673 826 PKGLINT =    /usr/bin/pkglint
7bf47e 827 else
MS 828 PKGLINT =    ${WS_TOOLS}/pkglint
829 endif
9c75c0 830
b06748 831 ACLOCAL =    /usr/bin/aclocal-1.10
VM 832 AUTOMAKE =    /usr/bin/automake-1.10
833 AUTORECONF =     /usr/bin/autoreconf
834
9b6169 835 KSH93 =         /usr/bin/ksh93
9c75c0 836 TOUCH =        /usr/bin/touch
NJ 837 MKDIR =        /bin/mkdir -p
838 RM =        /bin/rm -f
153732 839 CP =        /bin/cp -f
2515dc 840 MV =        /bin/mv -f
3d7f8d 841 LN =        /bin/ln
8d70f8 842 CAT =        /bin/cat
3d7f8d 843 SYMLINK =    /bin/ln -s
61c373 844 ENV =        /usr/bin/env
14fe6e 845 FIND =        /usr/bin/find
3d7f8d 846 INSTALL =    /usr/bin/ginstall
1e5ead 847 GNU_GREP =    /usr/gnu/bin/grep
81db49 848 CHMOD =        /usr/bin/chmod
e5e44e 849 NAWK =        /usr/bin/nawk
SM 850 TEE =        /usr/bin/tee
3168d6 851 GAS =        /usr/gnu/bin/as
e2ca11 852 GTAR =        /usr/gnu/bin/tar
3168d6 853 STRIP =    /usr/bin/strip
617c23 854 IPS2TGZ =     $(WS_TOOLS)/ips2tgz
4f8cfa 855
MS 856 INS.dir=        $(INSTALL) -d $@
857 INS.file=       $(INSTALL) -m 444 $< $(@D)
3cec7d 858
NJ 859 PKG_CONFIG_PATH.32 = /usr/lib/pkgconfig
860 PKG_CONFIG_PATH.64 = /usr/lib/$(MACH64)/pkgconfig
4e6f9b 861 PKG_CONFIG_PATH = $(PKG_CONFIG_PATH.$(BITS))
3cec7d 862
b55e44 863 # Set default path for environment modules
AL 864 MODULE_VERSION =    3.2.10
865 MODULE_PATH =        /usr/share/Modules/modulefiles
866 MODULE_VERSIONS_PATH =    /usr/share/Modules/versions
867
868 # Path to bash completions
869 BASH_COMPLETIONS_PATH =    /usr/share/bash-completion/completions
4f8cfa 870
MS 871 #
35a012 872 # C preprocessor flag sets to ease feature selection.  Add the required
NJ 873 # feature to your Makefile with CPPFLAGS += $(FEATURE_MACRO) and add to
874 # the component build with CONFIGURE_OPTIONS += CPPFLAGS="$(CPPFLAGS)" or
875 # similiar.
876 #
4f8cfa 877
35a012 878 # Enables visibility of some c99 math functions that aren't visible by default.
NJ 879 # What other side-effects are there?
880 CPP_C99_EXTENDED_MATH =    -D_STDC_99
e4bbaf 881
35a012 882 # Enables large file support for components that have no other means of doing
NJ 883 # so.  Use CPP_LARGEFILES and not the .32/.64 variety directly
5ada66 884 CPP_LARGEFILES.32 :=    $(shell getconf LFS_CFLAGS)
DD 885 CPP_LARGEFILES.64 :=    $(shell getconf LFS64_CFLAGS)
35a012 886 CPP_LARGEFILES =        $(CPP_LARGEFILES.$(BITS))
4f8cfa 887
35a012 888 # Enables some #pragma redefine_extname to POSIX-compliant Standard C Library
NJ 889 # functions. Also avoids the component's #define _POSIX_C_SOURCE to some value
890 # we currently do not support.
891 CPP_POSIX =    -D_POSIX_C_SOURCE=200112L -D_POSIX_PTHREAD_SEMANTICS
4f8cfa 892
afe8c5 893 # XPG7 mode.  This option enables XPG7 conformance, plus extensions.
AL 894 CPP_XPG7MODE=    -D_XOPEN_SOURCE=700 -D__EXTENSIONS__=1 -D_XPG7
895
4f8cfa 896 # XPG6 mode.  This option enables XPG6 conformance, plus extensions.
MS 897 # Amongst other things, this option will cause system calls like
898 # popen (3C) and system (3C) to invoke the standards-conforming
35a012 899 # shell, /usr/xpg4/bin/sh, instead of /usr/bin/sh.  Add studio_XPG6MODE to
NJ 900 # CFLAGS instead of using this directly
901 CPP_XPG6MODE=    -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1 -D_XPG6
4f8cfa 902
0aeacd 903 # XPG5 mode. These options are specific for C++, where _XPG6,
ST 904 # _XOPEN_SOURCE=600 and C99 are illegal. -D__EXTENSIONS__=1 is legal in C++.
905 CPP_XPG5MODE=   -D_XOPEN_SOURCE=500 -D__EXTENSIONS__=1 -D_XPG5
35a012 906
NJ 907 #
908 # Studio C compiler flag sets to ease feature selection.  Add the required
909 # feature to your Makefile with CFLAGS += $(FEATURE_MACRO) and add to the
910 # component build with CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar.
911 #
912
913 # Generate 32/64 bit objects
914 CC_BITS =    -m$(BITS)
915
916 # Code generation instruction set and optimization 'hints'.  Use studio_XBITS
917 # and not the .arch.bits variety directly.
918 studio_XBITS.sparc.32 =    -xtarget=ultra2 -xarch=sparcvis -xchip=ultra2
0de8ff 919 studio_XBITS.sparc.64 =
65f457 920 ifneq   ($(strip $(PARFAIT_BUILD)),yes)
MS 921 studio_XBITS.sparc.64 += -xtarget=ultra2
922 endif
923 studio_XBITS.sparc.64 += -xarch=sparcvis -xchip=ultra2
780aa6 924 studio_XBITS.i386.32 =    -xchip=pentium
63f346 925 studio_XBITS.i386.64 =    -xchip=generic -Ui386 -U__i386
780aa6 926 studio_XBITS = $(studio_XBITS.$(MACH).$(BITS))
35a012 927
NJ 928 # Turn on recognition of supported C99 language features and enable the 1999 C
929 # standard library semantics of routines that appear in    both the 1990 and
930 # 1999 C standard. To use set studio_C99MODE=$(studio_99_ENABLE) in your
931 # component Makefile.
932 studio_C99_ENABLE =        -xc99=all
933
934 # Turn off recognition of C99 language features, and do not enable the 1999 C
935 # standard library semantics of routines that appeared in both the 1990    and
936 # 1999 C standard.  To use set studio_C99MODE=$(studio_99_DISABLE) in your
937 # component Makefile.
938 studio_C99_DISABLE =    -xc99=none
939
940 # Use the compiler default 'xc99=all,no_lib'
941 studio_C99MODE =
0aeacd 942
ST 943 # For C++, compatibility with C99 (which is technically illegal) is
944 # enabled in a different way. So, we must use a different macro for it.
945 studio_cplusplus_C99_ENABLE =     -xlang=c99
946
947 # Turn it off.
948 studio_cplusplus_C99_DISABLE =
949
950 # And this is the macro you should actually use
0de8ff 951 studio_cplusplus_C99MODE =
35a012 952
9d5dbf 953 # Turn on C99 for gcc
DH 954 gcc_C99_ENABLE =    -std=c99
955
35a012 956 # Allow zero-sized struct/union declarations and void functions with return
NJ 957 # statements.
958 studio_FEATURES_EXTENSIONS =    -features=extensions
9b6169 959
35a012 960 # Control the Studio optimization level.
780aa6 961 studio_OPT.sparc.32 =    -xO4
NJ 962 studio_OPT.sparc.64 =    -xO4
963 studio_OPT.i386.32 =    -xO4
964 studio_OPT.i386.64 =    -xO4
965 studio_OPT =        $(studio_OPT.$(MACH).$(BITS))
35a012 966
NJ 967 # Studio PIC code generation.  Use CC_PIC instead to select PIC code generation.
968 studio_PIC =     -KPIC -DPIC
4f8cfa 969
MS 970 # The Sun Studio 11 compiler has changed the behaviour of integer
971 # wrap arounds and so a flag is needed to use the legacy behaviour
972 # (without this flag panics/hangs could be exposed within the source).
35a012 973 # This is used through studio_IROPTS, not the 'sparc' variety.
NJ 974 studio_IROPTS.sparc =    -W2,-xwrap_int
780aa6 975 studio_IROPTS =        $(studio_IROPTS.$(MACH))
35a012 976
NJ 977 # Control register usage for generated code.  SPARC ABI requires system
978 # libraries not to use application registers.  x86 requires 'no%frameptr' at
979 # x04 or higher.
15d3df 980
MS 981 # We should just use -xregs but we need to workaround 7030022. Note
982 # that we can't use the (documented) -Wc,-xregs workaround because
983 # libtool really hates -Wc and thinks it should be -Wl. Instead
984 # we use an (undocumented) option which actually happens to be what
985 # CC would use.
986 studio_XREGS.sparc =    -Qoption cg -xregs=no%appl
35a012 987 studio_XREGS.i386 =    -xregs=no%frameptr
780aa6 988 studio_XREGS =        $(studio_XREGS.$(MACH))
15d3df 989
MS 990 gcc_XREGS.sparc =    -mno-app-regs
991 gcc_XREGS.i386 =
992 gcc_XREGS =        $(gcc_XREGS.$(MACH))
35a012 993
24dc68 994 # Set data alignment on sparc to reasonable values, 8 byte alignment for 32 bit
NJ 995 # objects and 16 byte alignment for 64 bit objects.  This is added to CFLAGS by
996 # default.
997 studio_ALIGN.sparc.32 =    -xmemalign=8s
998 studio_ALIGN.sparc.64 =    -xmemalign=16s
999 studio_ALIGN =        $(studio_ALIGN.$(MACH).$(BITS))
1000
1001 # Studio shorthand for building multi-threaded code,  enables -D_REENTRANT and
1002 # linking with threadin support.  This is added to CFLAGS by default, override
1003 # studio_MT to turn this off.
1004 studio_MT =        -mt
1005
35a012 1006 # See CPP_XPG6MODE comment above.
NJ 1007 studio_XPG6MODE =    $(studio_C99MODE) $(CPP_XPG6MODE)
1008 XPG6MODE =        $(studio_XPG6MODE)
1009
0aeacd 1010 # See CPP_XPG5MODE comment above. You can only use this in C++, not in C99.
ST 1011 studio_XPG5MODE =    $(studio_cplusplus_C99MODE) $(CPP_XPG5MODE)
1012 XPG5MODE =        $(studio_XPG5MODE)
1013
35a012 1014 # Default Studio C compiler flags.  Add the required feature to your Makefile
NJ 1015 # with CFLAGS += $(FEATURE_MACRO) and add to the component build with
1016 # CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar.  In most cases, it
1017 # should not be necessary to add CFLAGS to any environment other than the
1018 # configure environment.
1019 CFLAGS.studio +=    $(studio_OPT) $(studio_XBITS) $(studio_XREGS) \
24dc68 1020             $(studio_IROPTS) $(studio_C99MODE) $(studio_ALIGN) \
NJ 1021             $(studio_MT)
35a012 1022
4f8cfa 1023 #
35a012 1024 # GNU C compiler flag sets to ease feature selection.  Add the required
NJ 1025 # feature to your Makefile with CFLAGS += $(FEATURE_MACRO) and add to the
1026 # component build with CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar.
1027 #
4f8cfa 1028
97299f 1029 # Control the GCC optimization level.
GM 1030 gcc_OPT.sparc.32 =    -O3
1031 gcc_OPT.sparc.64 =    -O3
1032 gcc_OPT.i386.32 =    -O3
1033 gcc_OPT.i386.64 =    -O3
1034 gcc_OPT =        $(gcc_OPT.$(MACH).$(BITS))
4f8cfa 1035
35a012 1036 # GCC PIC code generation.  Use CC_PIC instead to select PIC code generation.
NJ 1037 gcc_PIC =    -fPIC -DPIC
4f8cfa 1038
35a012 1039 # Generic macro for PIC code generation.  Use this macro instead of the
NJ 1040 # compiler specific variant.
1041 CC_PIC =    $($(COMPILER)_PIC)
4f8cfa 1042
MS 1043
35a012 1044 # Default GNU C compiler flags.  Add the required feature to your Makefile
NJ 1045 # with CFLAGS += $(FEATURE_MACRO) and add to the component build with
1046 # CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar.  In most cases, it
1047 # should not be necessary to add CFLAGS to any environment other than the
1048 # configure environment.
1049 CFLAGS.gcc +=    $(gcc_OPT)
15d3df 1050 CFLAGS.gcc +=    $(gcc_XREGS)
4f8cfa 1051
9789f8 1052 # Default GNU C++ compiler flags.  Add the required feature to your Makefile
AL 1053 # with CXXFLAGS += $(FEATURE_MACRO) and add to the component build with
1054 # CONFIGURE_OPTIONS += CXXFLAGS="$(CXXFLAGS)" or similiar.  In most cases, it
1055 # should not be necessary to add CXXFLAGS to any environment other than the
1056 # configure environment.
1057 CXXFLAGS.gcc +=    $(gcc_OPT)
1058 CXXFLAGS.gcc +=    $(gcc_XREGS)
1059
1060 # Default GNU FORTRAN compiler flags.  Add the required feature to your Makefile
1061 # with FCFLAGS += $(FEATURE_MACRO) and add to the component build with
1062 # CONFIGURE_OPTIONS += FCFLAGS="$(FCFLAGS)" or similiar.  In most cases, it
1063 # should not be necessary to add FCFLAGS to any environment other than the
1064 # configure environment.
1065 FCFLAGS.gcc +=    $(gcc_OPT)
1066 FCFLAGS.gcc +=    $(gcc_XREGS)
35a012 1067
NJ 1068 # Build 32 or 64 bit objects.
1069 CFLAGS +=    $(CC_BITS)
1070
1071 # Add compiler specific 'default' features
1072 CFLAGS +=    $(CFLAGS.$(COMPILER))
1073
1074
3cec7d 1075 # Studio C++ requires -norunpath to avoid adding its location into the RUNPATH
NJ 1076 # to C++ applications.
1077 studio_NORUNPATH =     -norunpath
1078
1079 # To link in standard mode (the default mode) without any C++ libraries
1080 # (except libCrun), use studio_LIBRARY_NONE in your component Makefile.
1081 studio_LIBRARY_NONE =     -library=%none
1082
1083 # Don't link C++ with any C++ Runtime or Standard C++ library
1084 studio_CXXLIB_NONE =    -xnolib
1085
1086 # Link C++ with the Studio C++ Runtime and Standard C++ library.  This is the
1087 # default for "standard" mode.
1088 studio_CXXLIB_CSTD =    -library=Cstd,Crun
1089
1090 # link C++ with the Studio  C++ Runtime and Apache Standard C++ library
1091 studio_CXXLIB_APACHE =    -library=stdcxx4,Crun
1092
1093 # Add the C++ ABI compatibility flags for older ABI compatibility.  The default
1094 # is "standard mode" (-compat=5)
1095 studio_COMPAT_VERSION_4 =    -compat=4
1096
1097 # Tell the compiler that we don't want the studio runpath added to the
1098 # linker flags.  We never want the Studio location added to the RUNPATH.
1099 CXXFLAGS +=    $($(COMPILER)_NORUNPATH)
1100
614c6a 1101 # Build 32 or 64 bit objects in C++ as well.
ST 1102 CXXFLAGS +=    $(CC_BITS)
1103
9789f8 1104 # Add compiler specific 'default' features
AL 1105 CXXFLAGS +=    $(CXXFLAGS.$(COMPILER))
1106
dcd7ba 1107 # Build 32 or 64 bit objects in FORTRAN as well.
AL 1108 F77FLAGS +=    $(CC_BITS)
1109 FCFLAGS +=    $(CC_BITS)
1110
9789f8 1111 # Add compiler specific 'default' features
AL 1112 F77FLAGS +=    $(FCFLAGS.$(COMPILER))
1113 FCFLAGS +=    $(FCFLAGS.$(COMPILER))
dcd7ba 1114
35a012 1115 #
NJ 1116 # Solaris linker flag sets to ease feature selection.  Add the required
1117 # feature to your Makefile with LDFLAGS += $(FEATURE_MACRO) and add to the
1118 # component build with CONFIGURE_OPTIONS += LDFLAGS="$(LDFLAGS)" or similiar.
1119 #
3cec7d 1120
NJ 1121 # set the bittedness that we want to link
db2ec7 1122 ccs.ld.64 = -64
AS 1123 gcc.ld.32 = -m32
1124 gcc.ld.64 = -m64
1125 LD_BITS =      $($(LINKER).ld.$(BITS))
1126 LDFLAGS =      $(LD_BITS)
35a012 1127
NJ 1128 # Reduce the symbol table size, effectively conflicting with -g.  We should
1129 # get linker guidance here.
1130 LD_Z_REDLOCSYM =    -z redlocsym
1131
1132 # Cause the linker to rescan archive libraries and resolve remaining unresolved
1133 # symbols recursively until all symbols are resolved.  Components should be
1134 # linking in the libraries they need, in the required order.  This should
1135 # only be required if the component's native build is horribly broken.
1136 LD_Z_RESCAN_NOW =    -z rescan-now
1137
1138 LD_Z_TEXT =        -z direct
1139
3a5b3f 1140 # make sure that -lc is always present when building shared objects.
RB 1141 LD_DEF_LIBS +=        -lc
1142
35a012 1143 # make sure all symbols are defined.
NJ 1144 LD_Z_DEFS =        -z defs
1145
17fc9e 1146 # eliminate unreferenced dynamic dependencies
NJ 1147 LD_Z_IGNORE =        -z ignore
1148
35a012 1149 # use direct binding
NJ 1150 LD_B_DIRECT =        -Bdirect
1151
0f1b63 1152 # use generic macro names for enabling/disabling ASLR
AC 1153 ASLR_ENABLE =         -z aslr=enable
1154 ASLR_DISABLE =         -z aslr=disable
1155 ASLR_MODE =         $(ASLR_DISABLE)
1156
1157 # by default, turn off Address Space Layout Randomization for ELF executables;
1158 # to explicitly enable ASLR, set ASLR_MODE = $(ASLR_ENABLE)
1159 # in that component's Makefile
1160 LD_Z_ASLR =        $(ASLR_MODE)
1161
35a012 1162 #
NJ 1163 # More Solaris linker flags that we want to be sure that everyone gets.  This
1164 # is automatically added to the calling environment during the 'build' and
1165 # 'install' phases of the component build.  Each individual feature can be
1166 # turned off by adding FEATURE_MACRO= to the component Makefile.
1167 #
1168
1169 # Create a non-executable stack when linking.
ad8773 1170 LD_MAP_NOEXSTK.i386 =    -M /usr/lib/ld/map.noexstk
AB 1171 LD_MAP_NOEXSTK.sparc =    -M /usr/lib/ld/map.noexstk
35a012 1172
NJ 1173 # Create a non-executable bss segment when linking.
1174 LD_MAP_NOEXBSS =    -M /usr/lib/ld/map.noexbss
1175
1176 # Create a non-executable data segment when linking.  Due to PLT needs, the
1177 # data segment must be executable on sparc, but the bss does not.
1178 # see mapfile comments for more information
1179 LD_MAP_NOEXDATA.i386 =    -M /usr/lib/ld/map.noexdata
1180 LD_MAP_NOEXDATA.sparc =    $(LD_MAP_NOEXBSS)
1181
1182 # Page alignment
1183 LD_MAP_PAGEALIGN =    -M /usr/lib/ld/map.pagealign
1184
1185 # Linker options to add when only building libraries
3a5b3f 1186 LD_OPTIONS_SO +=    $(LD_Z_TEXT) $(LD_Z_DEFS) $(LD_DEF_LIBS)
35a012 1187
NJ 1188 # Default linker options that everyone should get.  Do not add additional
1189 # libraries to this macro, as it will apply to everything linked during the
1190 # component build.
ad8773 1191 LD_OPTIONS +=    $(LD_MAP_NOEXSTK.$(MACH)) $(LD_MAP_NOEXDATA.$(MACH)) \
17fc9e 1192         $(LD_MAP_PAGEALIGN) $(LD_B_DIRECT) $(LD_Z_IGNORE)
1932c6 1193
0f1b63 1194 # only used on executables
AC 1195 LD_EXEC_OPTIONS = $(LD_Z_ASLR)
1196
e83e52 1197 # Environment variables and arguments passed into the build and install
1932c6 1198 # environment(s).  These are the initial settings.
MS 1199 COMPONENT_BUILD_ENV= \
0f1b63 1200     LD_OPTIONS="$(LD_OPTIONS)" \
AC 1201     LD_EXEC_OPTIONS="$(LD_EXEC_OPTIONS)"
1932c6 1202 COMPONENT_INSTALL_ENV= \
0f1b63 1203     LD_OPTIONS="$(LD_OPTIONS)" \
AC 1204     LD_EXEC_OPTIONS="$(LD_EXEC_OPTIONS)"
1932c6 1205
1a7b67 1206 # PERL options which depend on C options should be placed here
AP 1207 # Don't trust Perl $Config{optimize}, we can get Studio flags
1208 PERL_OPTIMIZE =$(gcc_OPT)
1209
1210 # We need this to overwrite options of perl used to compile illumos-gate
1211 PERL_STUDIO_OVERWRITE = cc="$(CC)" cccdlflags="$(CC_PIC)" ld="$(CC)" ccname="$(shell basename $(CC))" optimize="$(gcc_OPT)"
1212
a2af51 1213 # Allow user to override default maximum number of archives
8bcaef 1214 NUM_EXTRA_ARCHIVES= 1 2 3 4 5 6 7 8 9 10
AP 1215
c5572a 1216 # Rewrite absolute source-code paths into relative for ccache, so that any
JK 1217 # workspace with a shared CCACHE_DIR can benefit when compiling a component
1218 ifneq ($(strip $(CCACHE)),)
1219 export CCACHE_BASEDIR = $(BUILD_DIR_$(BITS))
1220 COMPONENT_BUILD_ENV += CCACHE="$(CCACHE)"
1221 COMPONENT_INSTALL_ENV += CCACHE="$(CCACHE)"
1222 COMPONENT_TEST_ENV += CCACHE="$(CCACHE)"
1223 COMPONENT_BUILD_ENV += CC_gcc_32="$(CC_gcc_32)"
1224 COMPONENT_BUILD_ENV += CC_gcc_64="$(CC_gcc_32)"
1225 COMPONENT_BUILD_ENV += CXX_gcc_32="$(CXX_gcc_64)"
1226 COMPONENT_BUILD_ENV += CXX_gcc_64="$(CXX_gcc_64)"
1227 COMPONENT_INSTALL_ENV += CC_gcc_32="$(CC_gcc_32)"
1228 COMPONENT_INSTALL_ENV += CC_gcc_64="$(CC_gcc_32)"
1229 COMPONENT_INSTALL_ENV += CXX_gcc_32="$(CXX_gcc_64)"
1230 COMPONENT_INSTALL_ENV += CXX_gcc_64="$(CXX_gcc_64)"
1231 COMPONENT_TEST_ENV += CC_gcc_32="$(CC_gcc_32)"
1232 COMPONENT_TEST_ENV += CC_gcc_64="$(CC_gcc_32)"
1233 COMPONENT_TEST_ENV += CXX_gcc_32="$(CXX_gcc_64)"
1234 COMPONENT_TEST_ENV += CXX_gcc_64="$(CXX_gcc_64)"
1235 COMPONENT_BUILD_ENV.$(BITS) += CCACHE_BASEDIR="$(BUILD_DIR_$(BITS))"
1236 COMPONENT_INSTALL_ENV.$(BITS) += CCACHE_BASEDIR="$(BUILD_DIR_$(BITS))"
1237 COMPONENT_TEST_ENV.$(BITS) += CCACHE_BASEDIR="$(BUILD_DIR_$(BITS))"
1238
1239 ifneq ($(strip $(CCACHE_DIR)),)
1240 COMPONENT_BUILD_ENV += CCACHE_DIR="$(CCACHE_DIR)"
1241 COMPONENT_INSTALL_ENV += CCACHE_DIR="$(CCACHE_DIR)"
1242 COMPONENT_TEST_ENV += CCACHE_DIR="$(CCACHE_DIR)"
1243 endif
1244
1245 ifneq ($(strip $(CCACHE_LOGFILE)),)
1246 COMPONENT_BUILD_ENV += CCACHE_LOGFILE="$(CCACHE_LOGFILE)"
1247 COMPONENT_INSTALL_ENV += CCACHE_LOGFILE="$(CCACHE_LOGFILE)"
1248 COMPONENT_TEST_ENV += CCACHE_LOGFILE="$(CCACHE_LOGFILE)"
1249 endif
1250
1251 endif
1252
1932c6 1253 # Add any bit-specific settings
e83e52 1254 COMPONENT_BUILD_ENV += $(COMPONENT_BUILD_ENV.$(BITS))
NJ 1255 COMPONENT_BUILD_ARGS += $(COMPONENT_BUILD_ARGS.$(BITS))
1256 COMPONENT_INSTALL_ENV += $(COMPONENT_INSTALL_ENV.$(BITS))
1257 COMPONENT_INSTALL_ARGS += $(COMPONENT_INSTALL_ARGS.$(BITS))
4158c0 1258
3cec7d 1259 # declare these phony so that we avoid filesystem conflicts.
7999b2 1260 .PHONY:    prep build install publish test clean clobber parfait
3cec7d 1261
4158c0 1262 # If there are no tests to execute
NJ 1263 NO_TESTS =    test-nothing
1264 test-nothing:
1265     @echo "There are no tests available at this time."
764663 1266
NJ 1267 # default behaviour for 'component-hook' target is to echo the component
1268 # name and version information, but more complex behaviour can be implemented
1269 # via command line setting of the COMPONENT_HOOK macro.
1270 COMPONENT_HOOK ?=    echo $(COMPONENT_NAME) $(COMPONENT_VERSION)
1271
1272 component-hook:
1273     @$(COMPONENT_HOOK)
1274
fed875 1275 # Add default dependency to SUNWcs
AL 1276 REQUIRED_PACKAGES += SUNWcs
1277
d180f2 1278 #
1279 # Packages with tools that are required to build Userland components
1280 #
4d720d 1281 REQUIRED_PACKAGES += metapackages/build-essential
d180f2 1282
1283 # Only a default dependency if component being built produces binaries.
1284 ifneq ($(strip $(BUILD_BITS)),NO_ARCH)
1285 REQUIRED_PACKAGES += system/library
1286 endif
1287
e6ade5 1288 # Define substitution rules for some packages.
AL 1289 # Such package names may change and would be better defined with a macro to
1290 # avoid mass modification of the Makefiles.
1291
1292 # Runtime package names are changed at compiler version major bumps.
1293 REQUIRED_PACKAGES_SUBST+= GCC_RUNTIME_PKG
1294 REQUIRED_PACKAGES_SUBST+= GXX_RUNTIME_PKG
1295 REQUIRED_PACKAGES_SUBST+= GFORTRAN_RUNTIME_PKG
1296 REQUIRED_PACKAGES_SUBST+= GOBJC_RUNTIME_PKG
1297
d180f2 1298 include $(WS_MAKE_RULES)/environment.mk
1299
1300 # A simple rule to print the value of any macro.  Ex:
1301 #    $ gmake print-REQUIRED_PACKAGES
1302 # Note that some macros are set on a per target basis, so what you see
1303 # is not always what you get.
1304 print-%:
1305     @echo '$(subst ','\'',$*=$($*)) (origin: $(origin $*), flavor: $(flavor $*))'
404117 1306
1307 # A simple rule to print only the value of any macro.
1308 print-value-%:
1309     @echo '$(subst ','\'',$($*))'
1310