Adam Stevko
2013-08-17 72a528d848df3792520ec6ac492e18e80bda3f3e
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 #
605dc5 21 # Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
9c75c0 22 #
NJ 23
a325d4 24 PATH=/usr/bin:/usr/gnu/bin
NJ 25
b643a2 26 # The location of an internal mirror of community source archives that we build
NJ 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.
58c0dd 31 #INTERNAL_ARCHIVE_MIRROR =    http://userland.us.oracle.com/source-archives
b643a2 32
NJ 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.
58c0dd 35 #EXTERNAL_ARCHIVE_MIRROR = \
AS 36 #    http://static.opensolaris.org/action/browse/userland/tarball/userland
b643a2 37
NJ 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)
9aea33 42
NJ 43 # The workspace starts at the mercurial root
5ada66 44 ifeq ($(origin WS_TOP), undefined)
58c0dd 45 export WS_TOP := \
AS 46     $(shell hg root 2>/dev/null || git rev-parse --show-toplevel)
5ada66 47 endif
9aea33 48
4cfb92 49 WS_LOGS =    $(WS_TOP)/$(MACH)/logs
NJ 50 WS_REPO =    $(WS_TOP)/$(MACH)/repo
51 WS_TOOLS =    $(WS_TOP)/tools
52 WS_MAKE_RULES =    $(WS_TOP)/make-rules
53 WS_COMPONENTS =    $(WS_TOP)/components
54 WS_INCORPORATIONS =    $(WS_TOP)/incorporations
55 WS_LINT_CACHE =    $(WS_TOP)/$(MACH)/pkglint-cache
56
5c422f 57 # we want our pkg piplines to fail if there is an error
MS 58 # (like if pkgdepend fails in the middle of a pipe), but
59 # we don't want the builds or ./configure's failing as well.
60 # so we only set pipefail for the publish target and have
61 # to reset it for the others since they might be invoked
62 # as dependencies of publish.
63 export SHELLOPTS
64 build:        SHELLOPTS=
65 test:        SHELLOPTS=
66 install:    SHELLOPTS=
67 publish:    SHELLOPTS=pipefail
68
b602c5 69 SHELL=    /bin/bash
MS 70
9c75c0 71 CONSOLIDATION =    userland
d05a6f 72 PUBLISHER ?=    $(CONSOLIDATION)
c4768d 73 PUBLISHER_LOCALIZABLE ?=    $(CONSOLIDATION)-localizable
6514ee 74
3dc823 75 ROOT =            /
NJ 76
097eb5 77 # Native OS version
5ada66 78 OS_VERSION :=        $(shell uname -r)
6514ee 79 SOLARIS_VERSION =    $(OS_VERSION:5.%=2.%)
097eb5 80 # Target OS version
52d240 81 PKG_SOLARIS_VERSION ?= 5.11
9c75c0 82
4cfb92 83 include $(WS_MAKE_RULES)/ips-buildinfo.mk
3dc823 84
2eec07 85 COMPILER =        gcc
72a528 86 LINKER =        gcc
80b1b4 87 BITS =            32
9c75c0 88 PYTHON_VERSION =    2.6
1a7b67 89 PYTHON_VERSIONS =    2.6
9c75c0 90
79b849 91 BASS_O_MATIC =    $(WS_TOOLS)/bass-o-matic
NJ 92
81cc19 93 CLONEY =    $(WS_TOOLS)/cloney
MS 94
b73714 95 CONFIG_SHELL =    /bin/bash
CM 96
79b849 97 PKG_REPO =    file:$(WS_REPO)
74300c 98
a93d79 99 COMPONENT_SRC_NAME =    $(COMPONENT_NAME)
RB 100
5ada66 101 COMPONENT_DIR :=    $(shell pwd)
c843eb 102 SOURCE_DIR =    $(COMPONENT_DIR)/$(COMPONENT_SRC)
PS 103 BUILD_DIR =    $(COMPONENT_DIR)/build
74300c 104 PROTO_DIR =    $(BUILD_DIR)/prototype/$(MACH)
9c75c0 105
38e5af 106 ETCDIR =    /etc
4f8cfa 107 USRDIR =    /usr
MS 108 BINDIR =    /bin
f685ac 109 SBINDIR =    /sbin
4f8cfa 110 LIBDIR =    /lib
MS 111 USRBINDIR =    $(USRDIR)/bin
2cda1c 112 USRBINDIR64 =    $(USRDIR)/bin/$(MACH64)
8a614a 113 USRSBINDIR =    $(USRDIR)/sbin
4f8cfa 114 USRLIBDIR =    $(USRDIR)/lib
MS 115 USRSHAREDIR =    $(USRDIR)/share
f685ac 116 USRINCDIR =    $(USRDIR)/include
JS 117 USRSHARELOCALEDIR =    $(USRSHAREDIR)/locale
4f8cfa 118 USRSHAREMANDIR =    $(USRSHAREDIR)/man
8a614a 119 USRSHAREDOCDIR =    $(USRSHAREDIR)/doc
93837d 120 USRSHARELIBDIR =    $(USRSHAREDIR)/lib
4f8cfa 121 USRSHAREMAN1DIR =    $(USRSHAREMANDIR)/man1
8a614a 122 USRSHAREMAN1MDIR =    $(USRSHAREMANDIR)/man1m
4f8cfa 123 USRSHAREMAN3DIR =    $(USRSHAREMANDIR)/man3
f1282e 124 USRSHAREMAN4DIR =    $(USRSHAREMANDIR)/man4
5bb235 125 USRSHAREMAN5DIR =    $(USRSHAREMANDIR)/man5
4f8cfa 126 USRLIBDIR64 =    $(USRDIR)/lib/$(MACH64)
f685ac 127 PROTOBINDIR =    $(PROTO_DIR)/$(BINDIR)
38e5af 128 PROTOETCDIR =    $(PROTO_DIR)/$(ETCDIR)
8a614a 129 PROTOETCSECDIR = $(PROTO_DIR)/$(ETCDIR)/security
4f8cfa 130 PROTOUSRDIR =    $(PROTO_DIR)/$(USRDIR)
8a614a 131 PROTOLIBDIR =    $(PROTO_DIR)/$(LIBDIR)
4f8cfa 132 PROTOUSRBINDIR =    $(PROTO_DIR)/$(USRBINDIR)
2cda1c 133 PROTOUSRBINDIR64 =    $(PROTO_DIR)/$(USRBINDIR64)
8a614a 134 PROTOUSRSBINDIR =    $(PROTO_DIR)/$(USRSBINDIR)
4f8cfa 135 PROTOUSRLIBDIR =    $(PROTO_DIR)/$(USRLIBDIR)
MS 136 PROTOUSRLIBDIR64 =    $(PROTO_DIR)/$(USRLIBDIR64)
f685ac 137 PROTOUSRINCDIR =    $(PROTO_DIR)/$(USRINCDIR)
4f8cfa 138 PROTOUSRSHAREDIR =    $(PROTO_DIR)/$(USRSHAREDIR)
93837d 139 PROTOUSRSHARELIBDIR =    $(PROTO_DIR)/$(USRSHARELIBDIR)
4f8cfa 140 PROTOUSRSHAREMANDIR =    $(PROTO_DIR)/$(USRSHAREMANDIR)
8a614a 141 PROTOUSRSHAREDOCDIR =    $(PROTO_DIR)/$(USRSHAREDOCDIR)
4f8cfa 142 PROTOUSRSHAREMAN1DIR =    $(PROTO_DIR)/$(USRSHAREMAN1DIR)
8a614a 143 PROTOUSRSHAREMAN1MDIR =    $(PROTO_DIR)/$(USRSHAREMAN1MDIR)
4f8cfa 144 PROTOUSRSHAREMAN3DIR =    $(PROTO_DIR)/$(USRSHAREMAN3DIR)
f1282e 145 PROTOUSRSHAREMAN4DIR =    $(PROTO_DIR)/$(USRSHAREMAN4DIR)
CM 146 PROTOUSRSHAREMAN5DIR =    $(PROTO_DIR)/$(USRSHAREMAN5DIR)
f685ac 147 PROTOUSRSHARELOCALEDIR =    $(PROTO_DIR)/$(USRSHARELOCALEDIR)
4f8cfa 148
MS 149
3d7f8d 150 SFWBIN =    /usr/sfw/bin
f685ac 151 SFWINCLUDE =    /usr/sfw/include
3d7f8d 152 SFWLIB =    /usr/sfw/lib
d92147 153 SFWLIB64 =    /usr/sfw/lib/$(MACH64)
1932c6 154 SFWSHARE =    /usr/sfw/share
MS 155 SFWSHAREMAN =    /usr/sfw/share/man
156 SFWSHAREMAN1 =    /usr/sfw/share/man/man1
3d7f8d 157 PROTOSFWBIN =    $(PROTO_DIR)/$(SFWBIN)
NJ 158 PROTOSFWLIB =    $(PROTO_DIR)/$(SFWLIB)
d92147 159 PROTOSFWLIB64 =    $(PROTO_DIR)/$(SFWLIB64)
1932c6 160 PROTOSFWSHARE =    $(PROTO_DIR)/$(SFWSHARE)
MS 161 PROTOSFWSHAREMAN =    $(PROTO_DIR)/$(SFWSHAREMAN)
162 PROTOSFWSHAREMAN1 =    $(PROTO_DIR)/$(SFWSHAREMAN1)
f685ac 163 PROTOSFWINCLUDE =    $(PROTO_DIR)/$(SFWINCLUDE)
1932c6 164
MS 165 GNUBIN =    /usr/gnu/bin
d1c159 166 GNULIB =    /usr/gnu/lib
RB 167 GNULIB64 =    /usr/gnu/lib/$(MACH64)
1932c6 168 GNUSHARE =    /usr/gnu/share
MS 169 GNUSHAREMAN =    /usr/gnu/share/man
170 GNUSHAREMAN1 =    /usr/gnu/share/man/man1
171 PROTOGNUBIN =    $(PROTO_DIR)/$(GNUBIN)
172 PROTOGNUSHARE =    $(PROTO_DIR)/$(GNUSHARE)
173 PROTOGNUSHAREMAN =    $(PROTO_DIR)/$(GNUSHAREMAN)
174 PROTOGNUSHAREMAN1 =    $(PROTO_DIR)/$(GNUSHAREMAN1)
3d7f8d 175
61c373 176 # work around _TIME, _DATE, embedded date chatter in component builds
NJ 177 # to use, set TIME_CONSTANT in the component Makefile and add $(CONSTANT_TIME)
178 # to the appropriate {CONFIGURE|BUILD|INSTALL}_ENV
79b849 179 CONSTANT_TIME =        LD_PRELOAD_32=$(WS_TOOLS)/time-$(MACH32).so
NJ 180 CONSTANT_TIME +=    LD_PRELOAD_64=$(WS_TOOLS)/time-$(MACH64).so
61c373 181 CONSTANT_TIME +=    TIME_CONSTANT=$(TIME_CONSTANT)
80b1b4 182
5d461f 183 # set MACH from uname -p to either sparc or i386
5ada66 184 MACH :=        $(shell uname -p)
5d461f 185
NJ 186 # set MACH32 from MACH to either sparcv7 or i86
187 MACH32_1 =    $(MACH:sparc=sparcv7)
188 MACH32 =    $(MACH32_1:i386=i86)
189
190 # set MACH64 from MACH to either sparcv9 or amd64
191 MACH64_1 =    $(MACH:sparc=sparcv9)
192 MACH64 =    $(MACH64_1:i386=amd64)
193
c2319a 194 CONFIGURE_32 =        $(BUILD_DIR_32)/.configured
BC 195 CONFIGURE_64 =        $(BUILD_DIR_64)/.configured
196
4f8cfa 197 BUILD_DIR_32 =        $(BUILD_DIR)/$(MACH32)
MS 198 BUILD_DIR_64 =        $(BUILD_DIR)/$(MACH64)
199
200 BUILD_32 =        $(BUILD_DIR_32)/.built
201 BUILD_64 =        $(BUILD_DIR_64)/.built
5d461f 202 BUILD_32_and_64 =    $(BUILD_32) $(BUILD_64)
4158c0 203 $(BUILD_DIR_32)/.built:        BITS=32
NJ 204 $(BUILD_DIR_64)/.built:        BITS=64
5d461f 205
4f8cfa 206 INSTALL_32 =        $(BUILD_DIR_32)/.installed
MS 207 INSTALL_64 =        $(BUILD_DIR_64)/.installed
5d461f 208 INSTALL_32_and_64 =    $(INSTALL_32) $(INSTALL_64)
a7cc57 209 $(BUILD_DIR_32)/.installed:       BITS=32
AC 210 $(BUILD_DIR_64)/.installed:       BITS=64
4158c0 211
NJ 212 # set the default target for installation of the component
213 COMPONENT_INSTALL_TARGETS =    install
9c75c0 214
35a012 215 TEST_32 =        $(BUILD_DIR_32)/.tested
NJ 216 TEST_64 =        $(BUILD_DIR_64)/.tested
217 TEST_32_and_64 =    $(TEST_32) $(TEST_64)
4158c0 218 $(BUILD_DIR_32)/.tested:       BITS=32
NJ 219 $(BUILD_DIR_64)/.tested:       BITS=64
220
221 # set the default target for test of the component
222 COMPONENT_TEST_TARGETS =    check
35a012 223
50cda8 224 # BUILD_TOOLS is the root of all tools not normally installed on the system.
617c23 225 BUILD_TOOLS ?=    /opt
50cda8 226
617c23 227 SPRO_ROOT =    $(BUILD_TOOLS)/sunstudio12.1
AS 228 SPRO_VROOT =    $(SPRO_ROOT)
50cda8 229
0c2d4d 230 PARFAIT_ROOT =    $(BUILD_TOOLS)/parfait/parfait-tools-1.0.1/
7999b2 231 PARFAIT= $(PARFAIT_ROOT)/bin/parfait
MS 232 export PARFAIT_NATIVESUNCC=$(SPRO_VROOT)/bin/cc
233 export PARFAIT_NATIVESUNCXX=$(SPRO_VROOT)/bin/CC
234 export PARFAIT_NATIVEGCC=$(GCC_ROOT)/bin/gcc
235 export PARFAIT_NATIVEGXX=$(GCC_ROOT)/bin/g++
236
522d64 237 GCC_ROOT =    /usr/gcc/4.7
9c75c0 238
35a012 239 CC.studio.32 =    $(SPRO_VROOT)/bin/cc
3cec7d 240 CXX.studio.32 =    $(SPRO_VROOT)/bin/CC
7999b2 241
9c75c0 242
35a012 243 CC.studio.64 =    $(SPRO_VROOT)/bin/cc
3cec7d 244 CXX.studio.64 =    $(SPRO_VROOT)/bin/CC
9c75c0 245
9dfd18 246 CC.gcc.32 =    $(GCC_ROOT)/bin/gcc
3cec7d 247 CXX.gcc.32 =    $(GCC_ROOT)/bin/g++
9c75c0 248
9dfd18 249 CC.gcc.64 =    $(GCC_ROOT)/bin/gcc
3cec7d 250 CXX.gcc.64 =    $(GCC_ROOT)/bin/g++
9c75c0 251
NJ 252
4f8cfa 253 lint.32 =    $(SPRO_VROOT)/bin/lint -m32
MS 254 lint.64 =    $(SPRO_VROOT)/bin/lint -m64
255
256 LINT =        $(lint.$(BITS))
257
61c373 258 LD =        /usr/bin/ld
9c75c0 259
fa74c0 260 PYTHON.2.6.VENDOR_PACKAGES.32 = /usr/lib/python2.6/vendor-packages
NJ 261 PYTHON.2.6.VENDOR_PACKAGES.64 = /usr/lib/python2.6/vendor-packages/64
262 PYTHON.2.6.VENDOR_PACKAGES = $(PYTHON.2.6.VENDOR_PACKAGES.$(BITS))
263
264 PYTHON.2.7.VENDOR_PACKAGES.32 = /usr/lib/python2.7/vendor-packages
265 PYTHON.2.7.VENDOR_PACKAGES.64 = /usr/lib/python2.7/vendor-packages/64
266 PYTHON.2.7.VENDOR_PACKAGES = $(PYTHON.2.7.VENDOR_PACKAGES.$(BITS))
7999b2 267
MS 268 ifeq   ($(strip $(PARFAIT_BUILD)),yes)
269 CC.studio.32 =    $(WS_TOOLS)/parfait/cc
270 CXX.studio.32 =    $(WS_TOOLS)/parfait/CC
271 CC.studio.64 =    $(WS_TOOLS)/parfait/cc
272 CXX.studio.64 =    $(WS_TOOLS)/parfait/CC
273 CC.gcc.32 =    $(WS_TOOLS)/parfait/gcc
274 CXX.gcc.32 =    $(WS_TOOLS)/parfait/g++
275 CC.gcc.64 =    $(WS_TOOLS)/parfait/gcc
276 CXX.gcc.64 =    $(WS_TOOLS)/parfait/g++
277 LD =        $(WS_TOOLS)/parfait/ld
278 endif
279
280 CC =        $(CC.$(COMPILER).$(BITS))
281 CXX =        $(CXX.$(COMPILER).$(BITS))
282
00a720 283 RUBY_VERSION =    1.8
DF 284 RUBY.1.8 =    /usr/bin/ruby18
285 VENDOR_RUBY =    /usr/ruby/$(RUBY_VERSION)/lib/ruby/vendor_ruby/$(RUBY_VERSION)
fa74c0 286
a0613d 287 PYTHON_VENDOR_PACKAGES.32 = /usr/lib/python$(PYTHON_VERSION)/vendor-packages
NJ 288 PYTHON_VENDOR_PACKAGES.64 = /usr/lib/python$(PYTHON_VERSION)/vendor-packages/64
289 PYTHON_VENDOR_PACKAGES = $(PYTHON_VENDOR_PACKAGES.$(BITS))
290
9c75c0 291 PYTHON.2.6.32 =    /usr/bin/python2.6
ca4d33 292 PYTHON.2.6.64 =    /usr/bin/$(MACH64)/python2.6
fa74c0 293
NJ 294 PYTHON.2.7.32 =    /usr/bin/python2.7
295 PYTHON.2.7.64 =    /usr/bin/$(MACH64)/python2.7
9c75c0 296
4e6f9b 297 PYTHON.32 =    $(PYTHON.$(PYTHON_VERSION).32)
RB 298 PYTHON.64 =    $(PYTHON.$(PYTHON_VERSION).64)
a0613d 299 PYTHON =    $(PYTHON.$(PYTHON_VERSION).$(BITS))
9c75c0 300
5bdc52 301 # The default is site-packages, but that directory belongs to the end-user.
SS 302 # Modules which are shipped by the OS but not with the core Python distribution
303 # belong in vendor-packages.
304 PYTHON_LIB= /usr/lib/python$(PYTHON_VERSION)/vendor-packages
fa74c0 305 PYTHON_DATA= $(PYTHON_LIB)
5bdc52 306
6d69e0 307 JAVA7_HOME =    /usr/jdk/instances/jdk1.7.0
MS 308 JAVA6_HOME =    /usr/jdk/instances/jdk1.6.0
309 JAVA_HOME = $(JAVA7_HOME)
61a323 310
6bc9bf 311 # This is the default BUILD version of perl
CM 312 # Not necessarily the system's default version, i.e. /usr/bin/perl
cacdb3 313 #PERL_VERSION =  5.10.0
AP 314 PERL_VERSION =  5.16
9aea33 315
cacdb3 316 #PERL_VERSIONS = 5.10.0 5.12 5.16
AP 317 PERL_VERSIONS = 5.10.0 5.16
6bc9bf 318
32b206 319 PERL.5.10.0 =     /usr/perl5/5.10.0/bin/perl
6bc9bf 320 PERL.5.12 =     /usr/perl5/5.12/bin/perl
9581d1 321 PERL.5.16 =    /usr/perl5/5.16/bin/perl
6bc9bf 322
CM 323 PERL =          $(PERL.$(PERL_VERSION))
324
5ada66 325 PERL_ARCH :=    $(shell $(PERL) -e 'use Config; print $$Config{archname}')
9581d1 326 PERL_ARCH_FUNC=    $(shell $(1) -e 'use Config; print $$Config{archname}')
6bc9bf 327 # Optimally we should ask perl which C compiler was used but it doesn't
CM 328 # result in a full path name.  Only "c" is being recorded
329 # inside perl builds while we actually need a full path to
330 # the studio compiler.
5ada66 331 #PERL_CC :=    $(shell $(PERL) -e 'use Config; print $$Config{cc}')
6bc9bf 332
CM 333 PKG_MACROS +=   PERL_ARCH=$(PERL_ARCH)
334 PKG_MACROS +=   PERL_VERSION=$(PERL_VERSION)
335
23aaef 336 # This is the default BUILD version of tcl
DL 337 # Not necessarily the system's default version, i.e. /usr/bin/tclsh
338 TCL_VERSION =  8.5
339 TCLSH.8.5.i386.32 =    /usr/bin/i86/tclsh8.5
340 TCLSH.8.5.i386.64 =    /usr/bin/amd64/tclsh8.5
341 TCLSH.8.5.sparc.32 =    /usr/bin/sparcv7/tclsh8.5
342 TCLSH.8.5.sparc.64 =    /usr/bin/sparcv9/tclsh8.5
343 TCLSH =        $(TCLSH.$(TCL_VERSION).$(MACH).$(BITS))
344
6bc9bf 345 CCSMAKE =    /usr/ccs/bin/make
9c75c0 346 GMAKE =        /usr/gnu/bin/make
NJ 347 GPATCH =    /usr/gnu/bin/patch
ff1c63 348 PATCH_LEVEL =    1
35a012 349 GPATCH_BACKUP =    --backup --version-control=numbered
NJ 350 GPATCH_FLAGS =    -p$(PATCH_LEVEL) $(GPATCH_BACKUP)
960e5b 351 GSED =        /usr/gnu/bin/sed
9c75c0 352
dd0336 353 PKGREPO =    /usr/bin/pkgrepo
9c75c0 354 PKGSEND =    /usr/bin/pkgsend
7bf47e 355 ifeq   ($(strip $(PKGLINT_COMPONENT)),)
d08673 356 PKGLINT =    /usr/bin/pkglint
7bf47e 357 else
MS 358 PKGLINT =    ${WS_TOOLS}/pkglint
359 endif
9c75c0 360
b06748 361 ACLOCAL =    /usr/bin/aclocal-1.10
VM 362 AUTOMAKE =    /usr/bin/automake-1.10
363 AUTORECONF =     /usr/bin/autoreconf
364
9b6169 365 KSH93 =         /usr/bin/ksh93
9c75c0 366 TOUCH =        /usr/bin/touch
NJ 367 MKDIR =        /bin/mkdir -p
368 RM =        /bin/rm -f
153732 369 CP =        /bin/cp -f
2515dc 370 MV =        /bin/mv -f
3d7f8d 371 LN =        /bin/ln
NJ 372 SYMLINK =    /bin/ln -s
61c373 373 ENV =        /usr/bin/env
3d7f8d 374 INSTALL =    /usr/bin/ginstall
81db49 375 CHMOD =        /usr/bin/chmod
e5e44e 376 NAWK =        /usr/bin/nawk
SM 377 TEE =        /usr/bin/tee
617c23 378 IPS2TGZ =     $(WS_TOOLS)/ips2tgz
4f8cfa 379
MS 380 INS.dir=        $(INSTALL) -d $@
381 INS.file=       $(INSTALL) -m 444 $< $(@D)
3cec7d 382
NJ 383 PKG_CONFIG_PATH.32 = /usr/lib/pkgconfig
384 PKG_CONFIG_PATH.64 = /usr/lib/$(MACH64)/pkgconfig
4e6f9b 385 PKG_CONFIG_PATH = $(PKG_CONFIG_PATH.$(BITS))
3cec7d 386
4f8cfa 387
MS 388 #
35a012 389 # C preprocessor flag sets to ease feature selection.  Add the required
NJ 390 # feature to your Makefile with CPPFLAGS += $(FEATURE_MACRO) and add to
391 # the component build with CONFIGURE_OPTIONS += CPPFLAGS="$(CPPFLAGS)" or
392 # similiar.
393 #
4f8cfa 394
35a012 395 # Enables visibility of some c99 math functions that aren't visible by default.
NJ 396 # What other side-effects are there?
397 CPP_C99_EXTENDED_MATH =    -D_STDC_99
e4bbaf 398
35a012 399 # Enables large file support for components that have no other means of doing
NJ 400 # so.  Use CPP_LARGEFILES and not the .32/.64 variety directly
5ada66 401 CPP_LARGEFILES.32 :=    $(shell getconf LFS_CFLAGS)
DD 402 CPP_LARGEFILES.64 :=    $(shell getconf LFS64_CFLAGS)
35a012 403 CPP_LARGEFILES =        $(CPP_LARGEFILES.$(BITS))
4f8cfa 404
35a012 405 # Enables some #pragma redefine_extname to POSIX-compliant Standard C Library
NJ 406 # functions. Also avoids the component's #define _POSIX_C_SOURCE to some value
407 # we currently do not support.
408 CPP_POSIX =    -D_POSIX_C_SOURCE=200112L -D_POSIX_PTHREAD_SEMANTICS
4f8cfa 409
MS 410 # XPG6 mode.  This option enables XPG6 conformance, plus extensions.
411 # Amongst other things, this option will cause system calls like
412 # popen (3C) and system (3C) to invoke the standards-conforming
35a012 413 # shell, /usr/xpg4/bin/sh, instead of /usr/bin/sh.  Add studio_XPG6MODE to
NJ 414 # CFLAGS instead of using this directly
415 CPP_XPG6MODE=    -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1 -D_XPG6
4f8cfa 416
0aeacd 417 # XPG5 mode. These options are specific for C++, where _XPG6,
ST 418 # _XOPEN_SOURCE=600 and C99 are illegal. -D__EXTENSIONS__=1 is legal in C++.
419 CPP_XPG5MODE=   -D_XOPEN_SOURCE=500 -D__EXTENSIONS__=1 -D_XPG5
35a012 420
NJ 421 #
422 # Studio C compiler flag sets to ease feature selection.  Add the required
423 # feature to your Makefile with CFLAGS += $(FEATURE_MACRO) and add to the
424 # component build with CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar.
425 #
426
427 # Generate 32/64 bit objects
428 CC_BITS =    -m$(BITS)
429
430 # Code generation instruction set and optimization 'hints'.  Use studio_XBITS
431 # and not the .arch.bits variety directly.
432 studio_XBITS.sparc.32 =    -xtarget=ultra2 -xarch=sparcvis -xchip=ultra2
65f457 433 studio_XBITS.sparc.64 =    
MS 434 ifneq   ($(strip $(PARFAIT_BUILD)),yes)
435 studio_XBITS.sparc.64 += -xtarget=ultra2
436 endif
437 studio_XBITS.sparc.64 += -xarch=sparcvis -xchip=ultra2
780aa6 438 studio_XBITS.i386.32 =    -xchip=pentium
63f346 439 studio_XBITS.i386.64 =    -xchip=generic -Ui386 -U__i386
780aa6 440 studio_XBITS = $(studio_XBITS.$(MACH).$(BITS))
35a012 441
NJ 442 # Turn on recognition of supported C99 language features and enable the 1999 C
443 # standard library semantics of routines that appear in    both the 1990 and
444 # 1999 C standard. To use set studio_C99MODE=$(studio_99_ENABLE) in your
445 # component Makefile.
446 studio_C99_ENABLE =        -xc99=all
447
448 # Turn off recognition of C99 language features, and do not enable the 1999 C
449 # standard library semantics of routines that appeared in both the 1990    and
450 # 1999 C standard.  To use set studio_C99MODE=$(studio_99_DISABLE) in your
451 # component Makefile.
452 studio_C99_DISABLE =    -xc99=none
453
454 # Use the compiler default 'xc99=all,no_lib'
455 studio_C99MODE =
0aeacd 456
ST 457 # For C++, compatibility with C99 (which is technically illegal) is
458 # enabled in a different way. So, we must use a different macro for it.
459 studio_cplusplus_C99_ENABLE =     -xlang=c99
460
461 # Turn it off.
462 studio_cplusplus_C99_DISABLE =
463
464 # And this is the macro you should actually use
465 studio_cplusplus_C99MODE = 
35a012 466
9d5dbf 467 # Turn on C99 for gcc
DH 468 gcc_C99_ENABLE =    -std=c99
469
35a012 470 # Allow zero-sized struct/union declarations and void functions with return
NJ 471 # statements.
472 studio_FEATURES_EXTENSIONS =    -features=extensions
9b6169 473
35a012 474 # Control the Studio optimization level.
780aa6 475 studio_OPT.sparc.32 =    -xO4
NJ 476 studio_OPT.sparc.64 =    -xO4
477 studio_OPT.i386.32 =    -xO4
478 studio_OPT.i386.64 =    -xO4
479 studio_OPT =        $(studio_OPT.$(MACH).$(BITS))
35a012 480
NJ 481 # Studio PIC code generation.  Use CC_PIC instead to select PIC code generation.
482 studio_PIC =     -KPIC -DPIC
4f8cfa 483
MS 484 # The Sun Studio 11 compiler has changed the behaviour of integer
485 # wrap arounds and so a flag is needed to use the legacy behaviour
486 # (without this flag panics/hangs could be exposed within the source).
35a012 487 # This is used through studio_IROPTS, not the 'sparc' variety.
NJ 488 studio_IROPTS.sparc =    -W2,-xwrap_int
780aa6 489 studio_IROPTS =        $(studio_IROPTS.$(MACH))
35a012 490
NJ 491 # Control register usage for generated code.  SPARC ABI requires system
492 # libraries not to use application registers.  x86 requires 'no%frameptr' at
493 # x04 or higher.
15d3df 494
MS 495 # We should just use -xregs but we need to workaround 7030022. Note
496 # that we can't use the (documented) -Wc,-xregs workaround because
497 # libtool really hates -Wc and thinks it should be -Wl. Instead
498 # we use an (undocumented) option which actually happens to be what
499 # CC would use.
500 studio_XREGS.sparc =    -Qoption cg -xregs=no%appl
35a012 501 studio_XREGS.i386 =    -xregs=no%frameptr
780aa6 502 studio_XREGS =        $(studio_XREGS.$(MACH))
15d3df 503
MS 504 gcc_XREGS.sparc =    -mno-app-regs
505 gcc_XREGS.i386 =
506 gcc_XREGS =        $(gcc_XREGS.$(MACH))
35a012 507
24dc68 508 # Set data alignment on sparc to reasonable values, 8 byte alignment for 32 bit
NJ 509 # objects and 16 byte alignment for 64 bit objects.  This is added to CFLAGS by
510 # default.
511 studio_ALIGN.sparc.32 =    -xmemalign=8s
512 studio_ALIGN.sparc.64 =    -xmemalign=16s
513 studio_ALIGN =        $(studio_ALIGN.$(MACH).$(BITS))
514
515 # Studio shorthand for building multi-threaded code,  enables -D_REENTRANT and
516 # linking with threadin support.  This is added to CFLAGS by default, override
517 # studio_MT to turn this off.
518 studio_MT =        -mt
519
35a012 520 # See CPP_XPG6MODE comment above.
NJ 521 studio_XPG6MODE =    $(studio_C99MODE) $(CPP_XPG6MODE)
522 XPG6MODE =        $(studio_XPG6MODE)
523
0aeacd 524 # See CPP_XPG5MODE comment above. You can only use this in C++, not in C99.
ST 525 studio_XPG5MODE =    $(studio_cplusplus_C99MODE) $(CPP_XPG5MODE)
526 XPG5MODE =        $(studio_XPG5MODE)
527
35a012 528 # Default Studio C compiler flags.  Add the required feature to your Makefile
NJ 529 # with CFLAGS += $(FEATURE_MACRO) and add to the component build with
530 # CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar.  In most cases, it
531 # should not be necessary to add CFLAGS to any environment other than the
532 # configure environment.
533 CFLAGS.studio +=    $(studio_OPT) $(studio_XBITS) $(studio_XREGS) \
24dc68 534             $(studio_IROPTS) $(studio_C99MODE) $(studio_ALIGN) \
NJ 535             $(studio_MT)
35a012 536
4f8cfa 537 #
35a012 538 # GNU C compiler flag sets to ease feature selection.  Add the required
NJ 539 # feature to your Makefile with CFLAGS += $(FEATURE_MACRO) and add to the
540 # component build with CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar.
541 #
4f8cfa 542
35a012 543 # GCC Compiler optimization flag
NJ 544 gcc_OPT =    -O3
4f8cfa 545
35a012 546 # GCC PIC code generation.  Use CC_PIC instead to select PIC code generation.
NJ 547 gcc_PIC =    -fPIC -DPIC
4f8cfa 548
35a012 549 # Generic macro for PIC code generation.  Use this macro instead of the
NJ 550 # compiler specific variant.
551 CC_PIC =    $($(COMPILER)_PIC)
4f8cfa 552
MS 553
35a012 554 # Default GNU C compiler flags.  Add the required feature to your Makefile
NJ 555 # with CFLAGS += $(FEATURE_MACRO) and add to the component build with
556 # CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar.  In most cases, it
557 # should not be necessary to add CFLAGS to any environment other than the
558 # configure environment.
559 CFLAGS.gcc +=    $(gcc_OPT)
15d3df 560 CFLAGS.gcc +=    $(gcc_XREGS)
4f8cfa 561
35a012 562
NJ 563 # Build 32 or 64 bit objects.
564 CFLAGS +=    $(CC_BITS)
565
566 # Add compiler specific 'default' features
567 CFLAGS +=    $(CFLAGS.$(COMPILER))
568
569
3cec7d 570 # Studio C++ requires -norunpath to avoid adding its location into the RUNPATH
NJ 571 # to C++ applications.
572 studio_NORUNPATH =     -norunpath
573
574 # To link in standard mode (the default mode) without any C++ libraries
575 # (except libCrun), use studio_LIBRARY_NONE in your component Makefile.
576 studio_LIBRARY_NONE =     -library=%none
577
578 # Don't link C++ with any C++ Runtime or Standard C++ library
579 studio_CXXLIB_NONE =    -xnolib
580
581 # Link C++ with the Studio C++ Runtime and Standard C++ library.  This is the
582 # default for "standard" mode.
583 studio_CXXLIB_CSTD =    -library=Cstd,Crun
584
585 # link C++ with the Studio  C++ Runtime and Apache Standard C++ library
586 studio_CXXLIB_APACHE =    -library=stdcxx4,Crun
587
588 # Add the C++ ABI compatibility flags for older ABI compatibility.  The default
589 # is "standard mode" (-compat=5)
590 studio_COMPAT_VERSION_4 =    -compat=4
591
592 # Tell the compiler that we don't want the studio runpath added to the
593 # linker flags.  We never want the Studio location added to the RUNPATH.
594 CXXFLAGS +=    $($(COMPILER)_NORUNPATH)
595
614c6a 596 # Build 32 or 64 bit objects in C++ as well.
ST 597 CXXFLAGS +=    $(CC_BITS)
598
35a012 599 #
NJ 600 # Solaris linker flag sets to ease feature selection.  Add the required
601 # feature to your Makefile with LDFLAGS += $(FEATURE_MACRO) and add to the
602 # component build with CONFIGURE_OPTIONS += LDFLAGS="$(LDFLAGS)" or similiar.
603 #
3cec7d 604
NJ 605 # set the bittedness that we want to link
db2ec7 606 ccs.ld.64 = -64
AS 607 gcc.ld.32 = -m32
608 gcc.ld.64 = -m64
609 LD_BITS =      $($(LINKER).ld.$(BITS))
610 LDFLAGS =      $(LD_BITS)
35a012 611
NJ 612 # Reduce the symbol table size, effectively conflicting with -g.  We should
613 # get linker guidance here.
614 LD_Z_REDLOCSYM =    -z redlocsym
615
616 # Cause the linker to rescan archive libraries and resolve remaining unresolved
617 # symbols recursively until all symbols are resolved.  Components should be
618 # linking in the libraries they need, in the required order.  This should
619 # only be required if the component's native build is horribly broken.
620 LD_Z_RESCAN_NOW =    -z rescan-now
621
622 LD_Z_TEXT =        -z direct
623
3a5b3f 624 # make sure that -lc is always present when building shared objects.
RB 625 LD_DEF_LIBS +=        -lc
626
35a012 627 # make sure all symbols are defined.
NJ 628 LD_Z_DEFS =        -z defs
629
17fc9e 630 # eliminate unreferenced dynamic dependencies
NJ 631 LD_Z_IGNORE =        -z ignore
632
35a012 633 # use direct binding
NJ 634 LD_B_DIRECT =        -Bdirect
635
0f1b63 636 # use generic macro names for enabling/disabling ASLR
AC 637 ASLR_ENABLE =         -z aslr=enable
638 ASLR_DISABLE =         -z aslr=disable
639 ASLR_MODE =         $(ASLR_DISABLE)
640
641 # by default, turn off Address Space Layout Randomization for ELF executables;
642 # to explicitly enable ASLR, set ASLR_MODE = $(ASLR_ENABLE)
643 # in that component's Makefile
644 LD_Z_ASLR =        $(ASLR_MODE)
645
35a012 646 #
NJ 647 # More Solaris linker flags that we want to be sure that everyone gets.  This
648 # is automatically added to the calling environment during the 'build' and
649 # 'install' phases of the component build.  Each individual feature can be
650 # turned off by adding FEATURE_MACRO= to the component Makefile.
651 #
652
653 # Create a non-executable stack when linking.
ad8773 654 LD_MAP_NOEXSTK.i386 =    -M /usr/lib/ld/map.noexstk
AB 655 LD_MAP_NOEXSTK.sparc =    -M /usr/lib/ld/map.noexstk
35a012 656
NJ 657 # Create a non-executable bss segment when linking.
658 LD_MAP_NOEXBSS =    -M /usr/lib/ld/map.noexbss
659
660 # Create a non-executable data segment when linking.  Due to PLT needs, the
661 # data segment must be executable on sparc, but the bss does not.
662 # see mapfile comments for more information
663 LD_MAP_NOEXDATA.i386 =    -M /usr/lib/ld/map.noexdata
664 LD_MAP_NOEXDATA.sparc =    $(LD_MAP_NOEXBSS)
665
666 # Page alignment
667 LD_MAP_PAGEALIGN =    -M /usr/lib/ld/map.pagealign
668
669 # Linker options to add when only building libraries
3a5b3f 670 LD_OPTIONS_SO +=    $(LD_Z_TEXT) $(LD_Z_DEFS) $(LD_DEF_LIBS)
35a012 671
NJ 672 # Default linker options that everyone should get.  Do not add additional
673 # libraries to this macro, as it will apply to everything linked during the
674 # component build.
ad8773 675 LD_OPTIONS +=    $(LD_MAP_NOEXSTK.$(MACH)) $(LD_MAP_NOEXDATA.$(MACH)) \
17fc9e 676         $(LD_MAP_PAGEALIGN) $(LD_B_DIRECT) $(LD_Z_IGNORE)
1932c6 677
0f1b63 678 # only used on executables
AC 679 LD_EXEC_OPTIONS = $(LD_Z_ASLR)
680
e83e52 681 # Environment variables and arguments passed into the build and install
1932c6 682 # environment(s).  These are the initial settings.
MS 683 COMPONENT_BUILD_ENV= \
0f1b63 684     LD_OPTIONS="$(LD_OPTIONS)" \
AC 685     LD_EXEC_OPTIONS="$(LD_EXEC_OPTIONS)"
1932c6 686 COMPONENT_INSTALL_ENV= \
0f1b63 687     LD_OPTIONS="$(LD_OPTIONS)" \
AC 688     LD_EXEC_OPTIONS="$(LD_EXEC_OPTIONS)"
1932c6 689
1a7b67 690 # PERL options which depend on C options should be placed here
AP 691 # Don't trust Perl $Config{optimize}, we can get Studio flags
692 PERL_OPTIMIZE =$(gcc_OPT)
693
694 # We need this to overwrite options of perl used to compile illumos-gate
695 PERL_STUDIO_OVERWRITE = cc="$(CC)" cccdlflags="$(CC_PIC)" ld="$(CC)" ccname="$(shell basename $(CC))" optimize="$(gcc_OPT)"
696
1932c6 697 # Add any bit-specific settings
e83e52 698 COMPONENT_BUILD_ENV += $(COMPONENT_BUILD_ENV.$(BITS))
NJ 699 COMPONENT_BUILD_ARGS += $(COMPONENT_BUILD_ARGS.$(BITS))
700 COMPONENT_INSTALL_ENV += $(COMPONENT_INSTALL_ENV.$(BITS))
701 COMPONENT_INSTALL_ARGS += $(COMPONENT_INSTALL_ARGS.$(BITS))
4158c0 702
3cec7d 703 # declare these phony so that we avoid filesystem conflicts.
7999b2 704 .PHONY:    prep build install publish test clean clobber parfait
3cec7d 705
4158c0 706 # If there are no tests to execute
NJ 707 NO_TESTS =    test-nothing
708 test-nothing:
709     @echo "There are no tests available at this time."
764663 710
NJ 711 # default behaviour for 'component-hook' target is to echo the component
712 # name and version information, but more complex behaviour can be implemented
713 # via command line setting of the COMPONENT_HOOK macro.
714 COMPONENT_HOOK ?=    echo $(COMPONENT_NAME) $(COMPONENT_VERSION)
715
716 component-hook:
717     @$(COMPONENT_HOOK)
718