shared-macros.mk revision 99
2N/A#
2N/A# CDDL HEADER START
2N/A#
2N/A# The contents of this file are subject to the terms of the
2N/A# Common Development and Distribution License (the "License").
2N/A# You may not use this file except in compliance with the License.
2N/A#
2N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A# or http://www.opensolaris.org/os/licensing.
2N/A# See the License for the specific language governing permissions
2N/A# and limitations under the License.
2N/A#
2N/A# When distributing Covered Code, include this CDDL HEADER in each
2N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A# If applicable, add the following below this CDDL HEADER, with the
2N/A# fields enclosed by brackets "[]" replaced with your own identifying
2N/A# information: Portions Copyright [yyyy] [name of copyright owner]
2N/A#
2N/A# CDDL HEADER END
2N/A#
3783N/A# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
2N/A#
2N/A
32N/APATH=/usr/bin:/usr/gnu/bin
32N/A
313N/ACONSOLIDATION = userland
313N/APUBLISHER = $(CONSOLIDATION)-build
313N/A
313N/AIS_GLOBAL_ZONE = $(shell /usr/sbin/zoneadm list | grep -c global)
313N/AROOT = /
313N/A
313N/A# get the most recent build number from the last mercurial tag
313N/ALAST_HG_TAG = $(shell hg tags -q | grep build- | head -1)
313N/ALAST_BUILD_NUM = $(LAST_HG_TAG:build-%=%)
2238N/A
6033N/AOS_VERSION = $(shell uname -r)
313N/ASOLARIS_VERSION = $(OS_VERSION:5.%=2.%)
313N/ABUILD_NUM = 0.$(shell expr $(LAST_BUILD_NUM) + 1)
313N/ABUILD_VERSION = $(OS_VERSION)-$(BUILD_NUM)
313N/A
2238N/A
313N/ACOMPILER = studio
2238N/ABITS = 32
127N/APYTHON_VERSION = 2.6
127N/APYTHON_VERSIONS = 2.6
1622N/A
1622N/AWS_LOGS = $(WS_TOP)/logs
1622N/AWS_REPO = $(WS_TOP)/repo
127N/AWS_TOOLS = $(WS_TOP)/tools
3996N/AWS_MAKE_RULES = $(WS_TOP)/make-rules
3996N/AWS_COMPONENTS = $(WS_TOP)/components
3996N/AWS_INCORPORATIONS = $(WS_TOP)/incorporations
538N/AWS_LINT_CACHE = $(WS_TOP)/pkglint-cache
538N/A
538N/ABASS_O_MATIC = $(WS_TOOLS)/bass-o-matic
4561N/A
538N/ACLONEY = $(WS_TOOLS)/cloney
3996N/A
538N/APKG_REPO = file:$(WS_REPO)
327N/A
327N/ACOMPONENT_DIR = $(shell pwd)
327N/ASOURCE_DIR = $(COMPONENT_DIR)/$(COMPONENT_SRC)
327N/ABUILD_DIR = $(COMPONENT_DIR)/build
327N/APROTO_DIR = $(BUILD_DIR)/prototype/$(MACH)
327N/A
327N/AETCDIR = /etc
327N/AUSRDIR = /usr
327N/ABINDIR = /bin
327N/ALIBDIR = /lib
327N/AUSRBINDIR = $(USRDIR)/bin
327N/AUSRLIBDIR = $(USRDIR)/lib
3996N/AUSRSHAREDIR = $(USRDIR)/share
3996N/AUSRSHAREMANDIR = $(USRSHAREDIR)/man
3996N/AUSRSHAREMAN1DIR = $(USRSHAREMANDIR)/man1
2238N/AUSRSHAREMAN3DIR = $(USRSHAREMANDIR)/man3
2238N/AUSRSHAREMAN5DIR = $(USRSHAREMANDIR)/man5
2238N/AUSRLIBDIR64 = $(USRDIR)/lib/$(MACH64)
2238N/APROTOETCDIR = $(PROTO_DIR)/$(ETCDIR)
177N/APROTOUSRDIR = $(PROTO_DIR)/$(USRDIR)
177N/APROTOUSRBINDIR = $(PROTO_DIR)/$(USRBINDIR)
3987N/APROTOUSRLIBDIR = $(PROTO_DIR)/$(USRLIBDIR)
3987N/APROTOUSRLIBDIR64 = $(PROTO_DIR)/$(USRLIBDIR64)
3987N/APROTOUSRSHAREDIR = $(PROTO_DIR)/$(USRSHAREDIR)
2N/APROTOUSRSHAREMANDIR = $(PROTO_DIR)/$(USRSHAREMANDIR)
3987N/APROTOUSRSHAREMAN1DIR = $(PROTO_DIR)/$(USRSHAREMAN1DIR)
883N/APROTOUSRSHAREMAN3DIR = $(PROTO_DIR)/$(USRSHAREMAN3DIR)
26N/A
38N/A
38N/ASFWBIN = /usr/sfw/bin
4519N/ASFWLIB = /usr/sfw/lib
4519N/ASFWSHARE = /usr/sfw/share
4519N/ASFWSHAREMAN = /usr/sfw/share/man
4519N/ASFWSHAREMAN1 = /usr/sfw/share/man/man1
3996N/APROTOSFWBIN = $(PROTO_DIR)/$(SFWBIN)
1622N/APROTOSFWLIB = $(PROTO_DIR)/$(SFWLIB)
26N/APROTOSFWSHARE = $(PROTO_DIR)/$(SFWSHARE)
3996N/APROTOSFWSHAREMAN = $(PROTO_DIR)/$(SFWSHAREMAN)
4493N/APROTOSFWSHAREMAN1 = $(PROTO_DIR)/$(SFWSHAREMAN1)
3996N/A
477N/AGNUBIN = /usr/gnu/bin
538N/AGNUSHARE = /usr/gnu/share
38N/AGNUSHAREMAN = /usr/gnu/share/man
3996N/AGNUSHAREMAN1 = /usr/gnu/share/man/man1
6N/APROTOGNUBIN = $(PROTO_DIR)/$(GNUBIN)
3778N/APROTOGNUSHARE = $(PROTO_DIR)/$(GNUSHARE)
3985N/APROTOGNUSHAREMAN = $(PROTO_DIR)/$(GNUSHAREMAN)
3985N/APROTOGNUSHAREMAN1 = $(PROTO_DIR)/$(GNUSHAREMAN1)
3985N/A
3778N/A# work around _TIME, _DATE, embedded date chatter in component builds
3778N/A# to use, set TIME_CONSTANT in the component Makefile and add $(CONSTANT_TIME)
2N/A# to the appropriate {CONFIGURE|BUILD|INSTALL}_ENV
34N/ACONSTANT_TIME = LD_PRELOAD_32=$(WS_TOOLS)/time-$(MACH32).so
34N/ACONSTANT_TIME += LD_PRELOAD_64=$(WS_TOOLS)/time-$(MACH64).so
94N/ACONSTANT_TIME += TIME_CONSTANT=$(TIME_CONSTANT)
94N/A
156N/A# set MACH from uname -p to either sparc or i386
156N/AMACH = $(shell uname -p)
34N/A
59N/A# set MACH32 from MACH to either sparcv7 or i86
1273N/AMACH32_1 = $(MACH:sparc=sparcv7)
1273N/AMACH32 = $(MACH32_1:i386=i86)
1622N/A
72N/A# set MACH64 from MACH to either sparcv9 or amd64
72N/AMACH64_1 = $(MACH:sparc=sparcv9)
59N/AMACH64 = $(MACH64_1:i386=amd64)
2N/A
85N/ABUILD_DIR_32 = $(BUILD_DIR)/$(MACH32)
61N/ABUILD_DIR_64 = $(BUILD_DIR)/$(MACH64)
61N/A
220N/ABUILD_32 = $(BUILD_DIR_32)/.built
61N/ABUILD_64 = $(BUILD_DIR_64)/.built
61N/ABUILD_32_and_64 = $(BUILD_32) $(BUILD_64)
1762N/A
172N/AINSTALL_32 = $(BUILD_DIR_32)/.installed
61N/AINSTALL_64 = $(BUILD_DIR_64)/.installed
61N/AINSTALL_32_and_64 = $(INSTALL_32) $(INSTALL_64)
220N/A
220N/ATEST_32 = $(BUILD_DIR_32)/.tested
61N/ATEST_64 = $(BUILD_DIR_64)/.tested
172N/ATEST_32_and_64 = $(TEST_32) $(TEST_64)
454N/A
61N/A# BUILD_TOOLS is the root of all tools not normally installed on the system.
172N/ABUILD_TOOLS = /ws/onnv-tools
61N/A
152N/ASPRO_ROOT = $(BUILD_TOOLS)/SUNWspro
74N/ASPRO_VROOT = $(SPRO_ROOT)/sunstudio12.1
61N/A
220N/AGCC_ROOT = /usr/gnu
85N/A
172N/ACC.studio.32 = $(SPRO_VROOT)/bin/cc
61N/ACCC.studio.32 = $(SPRO_VROOT)/bin/CC
172N/A
61N/ACC.studio.64 = $(SPRO_VROOT)/bin/cc
3996N/ACCC.studio.64 = $(SPRO_VROOT)/bin/CC
172N/A
61N/ACC.gcc.32 = $(GCC_ROOT)/bin/cc -m32
61N/ACCC.gcc.32 = $(GCC_ROOT)/bin/CC -m32
220N/A
61N/ACC.gcc.64 = $(GCC_ROOT)/bin/cc -m64
454N/ACCC.gcc.64 = $(GCC_ROOT)/bin/CC -m64
61N/A
172N/ACC = $(CC.$(COMPILER).$(BITS))
61N/ACCC = $(CCC.$(COMPILER).$(BITS))
172N/A
61N/Alint.32 = $(SPRO_VROOT)/bin/lint -m32
152N/Alint.64 = $(SPRO_VROOT)/bin/lint -m64
152N/A
220N/ALINT = $(lint.$(BITS))
61N/A
61N/ALD = /usr/bin/ld
43N/A
220N/APYTHON.2.6.32 = /usr/bin/python2.6
43N/APYTHON.2.6.64 = /usr/bin/$(MACH64)/python2.6
120N/A
64N/APYTHON.32 = $(PYTHON.$(PYTHON_VERSION).$(BITS))
64N/APYTHON.64 = $(PYTHON.$(PYTHON_VERSION).$(BITS))
64N/A
43N/AGMAKE = /usr/gnu/bin/make
43N/AGPATCH = /usr/gnu/bin/patch
120N/APATCH_LEVEL = 1
64N/AGPATCH_BACKUP = --backup --version-control=numbered
64N/AGPATCH_FLAGS = -p$(PATCH_LEVEL) $(GPATCH_BACKUP)
64N/A
220N/APKGSEND = /usr/bin/pkgsend
64N/APKGLINT = /usr/bin/pkglint
64N/A
486N/ATOUCH = /usr/bin/touch
486N/AMKDIR = /bin/mkdir -p
64N/ARM = /bin/rm -f
64N/ACP = /bin/cp -f
64N/ALN = /bin/ln
64N/ASYMLINK = /bin/ln -s
64N/AENV = /usr/bin/env
64N/AINSTALL = /usr/bin/ginstall
64N/A
43N/AINS.dir= $(INSTALL) -d $@
16N/AINS.file= $(INSTALL) -m 444 $< $(@D)
16N/A
16N/A#
34N/A# C preprocessor flag sets to ease feature selection. Add the required
34N/A# feature to your Makefile with CPPFLAGS += $(FEATURE_MACRO) and add to
16N/A# the component build with CONFIGURE_OPTIONS += CPPFLAGS="$(CPPFLAGS)" or
6N/A# similiar.
12N/A#
1622N/A
12N/A# Enables visibility of some c99 math functions that aren't visible by default.
12N/A# What other side-effects are there?
12N/ACPP_C99_EXTENDED_MATH = -D_STDC_99
12N/A
12N/A# Enables large file support for components that have no other means of doing
12N/A# so. Use CPP_LARGEFILES and not the .32/.64 variety directly
12N/ACPP_LARGEFILES.32 = $(shell getconf LFS_CFLAGS)
12N/ACPP_LARGEFILES.64 = $(shell getconf LFS64_CFLAGS)
12N/ACPP_LARGEFILES = $(CPP_LARGEFILES.$(BITS))
369N/A
369N/A# Enables some #pragma redefine_extname to POSIX-compliant Standard C Library
3781N/A# functions. Also avoids the component's #define _POSIX_C_SOURCE to some value
369N/A# we currently do not support.
6033N/ACPP_POSIX = -D_POSIX_C_SOURCE=200112L -D_POSIX_PTHREAD_SEMANTICS
61N/A
61N/A# XPG6 mode. This option enables XPG6 conformance, plus extensions.
61N/A# Amongst other things, this option will cause system calls like
61N/A# popen (3C) and system (3C) to invoke the standards-conforming
61N/A# shell, /usr/xpg4/bin/sh, instead of /usr/bin/sh. Add studio_XPG6MODE to
12N/A# CFLAGS instead of using this directly
181N/ACPP_XPG6MODE= -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1 -D_XPG6
181N/A
12N/A
6033N/A#
61N/A# Studio C compiler flag sets to ease feature selection. Add the required
61N/A# feature to your Makefile with CFLAGS += $(FEATURE_MACRO) and add to the
12N/A# component build with CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar.
279N/A#
279N/A
181N/A# Generate 32/64 bit objects
181N/ACC_BITS = -m$(BITS)
181N/A
2N/A# Code generation instruction set and optimization 'hints'. Use studio_XBITS
4239N/A# and not the .arch.bits variety directly.
4239N/Astudio_XBITS.sparc.32 = -xtarget=ultra2 -xarch=sparcvis -xchip=ultra2
4239N/Astudio_XBITS.sparc.64 = -xtarget=ultra2 -xarch=sparcvis -xchip=ultra2
99N/Astudio_XBITS.i386.32 = -xarch=pentium
99N/Astudio_XBITS.i386.64 = -xarch=generic64 -Ui386 -U__i386
99N/Astudio_XBITS = $(studio_XBITS.$(ARCH).$(BITS))
3996N/A
3996N/A# Turn on recognition of supported C99 language features and enable the 1999 C
3996N/A# standard library semantics of routines that appear in both the 1990 and
181N/A# 1999 C standard. To use set studio_C99MODE=$(studio_99_ENABLE) in your
181N/A# component Makefile.
181N/Astudio_C99_ENABLE = -xc99=all
99N/A
40N/A# Turn off recognition of C99 language features, and do not enable the 1999 C
844N/A# standard library semantics of routines that appeared in both the 1990 and
40N/A# 1999 C standard. To use set studio_C99MODE=$(studio_99_DISABLE) in your
40N/A# component Makefile.
43N/Astudio_C99_DISABLE = -xc99=none
40N/A
4275N/A# Use the compiler default 'xc99=all,no_lib'
3996N/Astudio_C99MODE =
3996N/A
814N/A# Allow zero-sized struct/union declarations and void functions with return
814N/A# statements.
814N/Astudio_FEATURES_EXTENSIONS = -features=extensions
814N/A
814N/A# Control the Studio optimization level.
814N/Astudio_OPT.sparc.32 = -x04
814N/Astudio_OPT.sparc.64 = -x04
814N/Astudio_OPT.i386.32 = -x04
3996N/Astudio_OPT.i386.64 = -x04
2238N/Astudio_OPT = $(studio_OPT.$(ARCH).$(BITS))
2N/A
99N/A# Studio PIC code generation. Use CC_PIC instead to select PIC code generation.
206N/Astudio_PIC = -KPIC -DPIC
2N/A
814N/A# The Sun Studio 11 compiler has changed the behaviour of integer
99N/A# wrap arounds and so a flag is needed to use the legacy behaviour
206N/A# (without this flag panics/hangs could be exposed within the source).
2N/A# This is used through studio_IROPTS, not the 'sparc' variety.
151N/Astudio_IROPTS.sparc = -W2,-xwrap_int
206N/Astudio_IROPTS = $(studio_IROPTS.$(ARCH))
2N/A
151N/A# Control register usage for generated code. SPARC ABI requires system
206N/A# libraries not to use application registers. x86 requires 'no%frameptr' at
2N/A# x04 or higher.
3996N/Astudio_XREGS.sparc = -xregs=no%appl,float
3996N/Astudio_XREGS.i386 = -xregs=no%frameptr
2238N/Astudio_XREGS = $(studio_XREGS.$(ARCH))
3996N/A
3996N/A# See CPP_XPG6MODE comment above.
2N/Astudio_XPG6MODE = $(studio_C99MODE) $(CPP_XPG6MODE)
61N/AXPG6MODE = $(studio_XPG6MODE)
61N/A
61N/A# Default Studio C compiler flags. Add the required feature to your Makefile
61N/A# with CFLAGS += $(FEATURE_MACRO) and add to the component build with
61N/A# CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar. In most cases, it
16N/A# should not be necessary to add CFLAGS to any environment other than the
16N/A# configure environment.
814N/ACFLAGS.studio += $(studio_OPT) $(studio_XBITS) $(studio_XREGS) \
2238N/A $(studio_IROPTS) $(studio_C99MODE)
2238N/A
2238N/A
2238N/A#
2238N/A# GNU C compiler flag sets to ease feature selection. Add the required
2238N/A# feature to your Makefile with CFLAGS += $(FEATURE_MACRO) and add to the
2238N/A# component build with CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar.
2238N/A#
3996N/A
3996N/A# GCC Compiler optimization flag
3996N/Agcc_OPT = -O3
3996N/A
2238N/A# GCC PIC code generation. Use CC_PIC instead to select PIC code generation.
814N/Agcc_PIC = -fPIC -DPIC
814N/A
814N/A# Generic macro for PIC code generation. Use this macro instead of the
814N/A# compiler specific variant.
814N/ACC_PIC = $($(COMPILER)_PIC)
2140N/A
2140N/A
2127N/A# Default GNU C compiler flags. Add the required feature to your Makefile
4324N/A# with CFLAGS += $(FEATURE_MACRO) and add to the component build with
2127N/A# CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar. In most cases, it
3293N/A# should not be necessary to add CFLAGS to any environment other than the
3293N/A# configure environment.
3293N/ACFLAGS.gcc += $(gcc_OPT)
3293N/A
2140N/A
3783N/A# Build 32 or 64 bit objects.
3783N/ACFLAGS += $(CC_BITS)
3783N/A
3783N/A# Add compiler specific 'default' features
3783N/ACFLAGS += $(CFLAGS.$(COMPILER))
3783N/A
3783N/A
3783N/A#
3783N/A# Solaris linker flag sets to ease feature selection. Add the required
3783N/A# feature to your Makefile with LDFLAGS += $(FEATURE_MACRO) and add to the
3783N/A# component build with CONFIGURE_OPTIONS += LDFLAGS="$(LDFLAGS)" or similiar.
148N/A#
148N/A
148N/A# Reduce the symbol table size, effectively conflicting with -g. We should
148N/A# get linker guidance here.
4225N/ALD_Z_REDLOCSYM = -z redlocsym
4225N/A
4225N/A# Cause the linker to rescan archive libraries and resolve remaining unresolved
2N/A# symbols recursively until all symbols are resolved. Components should be
4225N/A# linking in the libraries they need, in the required order. This should
4225N/A# only be required if the component's native build is horribly broken.
4225N/ALD_Z_RESCAN_NOW = -z rescan-now
4225N/A
4225N/ALD_Z_TEXT = -z direct
4225N/A
4225N/A# make sure all symbols are defined.
727N/ALD_Z_DEFS = -z defs
3778N/A
3778N/A# use direct binding
3778N/ALD_B_DIRECT = -Bdirect
3778N/A
4225N/A#
4225N/A# More Solaris linker flags that we want to be sure that everyone gets. This
4225N/A# is automatically added to the calling environment during the 'build' and
3778N/A# 'install' phases of the component build. Each individual feature can be
1192N/A# turned off by adding FEATURE_MACRO= to the component Makefile.
1192N/A#
148N/A
2N/A# Create a non-executable stack when linking.
146N/ALD_MAP_NOEXSTK = -M /usr/lib/ld/map.noexstk
146N/A
146N/A# Create a non-executable bss segment when linking.
146N/ALD_MAP_NOEXBSS = -M /usr/lib/ld/map.noexbss
727N/A
146N/A# Create a non-executable data segment when linking. Due to PLT needs, the
4005N/A# data segment must be executable on sparc, but the bss does not.
3996N/A# see mapfile comments for more information
4005N/ALD_MAP_NOEXDATA.i386 = -M /usr/lib/ld/map.noexdata
116N/ALD_MAP_NOEXDATA.sparc = $(LD_MAP_NOEXBSS)
260N/A
260N/A# Page alignment
3996N/ALD_MAP_PAGEALIGN = -M /usr/lib/ld/map.pagealign
260N/A
260N/A# Linker options to add when only building libraries
260N/ALD_OPTIONS_SO += $(LD_Z_TEXT) $(LD_Z_DEFS)
3996N/A
260N/A# Default linker options that everyone should get. Do not add additional
1767N/A# libraries to this macro, as it will apply to everything linked during the
260N/A# component build.
260N/ALD_OPTIONS += $(LD_MAP_NOEXSTK) $(LD_MAP_NOEXDATA.$(ARCH)) \
127N/A $(LD_MAP_PAGEALIGN) $(LD_B_DIRECT)
3996N/A
1767N/A# Environment variables and arguments passed into the build and install
260N/A# environment(s). These are the initial settings.
260N/ACOMPONENT_BUILD_ENV= \
260N/A LD_OPTIONS="$(LD_OPTIONS)"
260N/ACOMPONENT_INSTALL_ENV= \
3996N/A LD_OPTIONS="$(LD_OPTIONS)"
3996N/A
260N/A# Add any bit-specific settings
260N/ACOMPONENT_BUILD_ENV += $(COMPONENT_BUILD_ENV.$(BITS))
260N/ACOMPONENT_BUILD_ARGS += $(COMPONENT_BUILD_ARGS.$(BITS))
260N/ACOMPONENT_INSTALL_ENV += $(COMPONENT_INSTALL_ENV.$(BITS))
1713N/ACOMPONENT_INSTALL_ARGS += $(COMPONENT_INSTALL_ARGS.$(BITS))
1713N/A