shared-macros.mk revision 61
94N/A#
94N/A# CDDL HEADER START
94N/A#
94N/A# The contents of this file are subject to the terms of the
94N/A# Common Development and Distribution License (the "License").
94N/A# You may not use this file except in compliance with the License.
94N/A#
94N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
94N/A# or http://www.opensolaris.org/os/licensing.
94N/A# See the License for the specific language governing permissions
94N/A# and limitations under the License.
94N/A#
94N/A# When distributing Covered Code, include this CDDL HEADER in each
94N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
94N/A# If applicable, add the following below this CDDL HEADER, with the
94N/A# fields enclosed by brackets "[]" replaced with your own identifying
94N/A# information: Portions Copyright [yyyy] [name of copyright owner]
94N/A#
94N/A# CDDL HEADER END
94N/A#
94N/A# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
94N/A#
3035N/A
94N/APATH=/usr/bin:/usr/gnu/bin
94N/A
94N/ACONSOLIDATION = userland
94N/APUBLISHER = $(CONSOLIDATION)-build
94N/A
1425N/AIS_GLOBAL_ZONE = $(shell /usr/sbin/zoneadm list | grep -c global)
1425N/AROOT = /
618N/A
94N/A# get the most recent build number from the last mercurial tag
94N/ALAST_HG_TAG = $(shell hg tags -q | head -2 | tail -1)
844N/ALAST_BUILD_NUM = $(LAST_HG_TAG:build-%=%)
1425N/A
94N/AOS_VERSION = $(shell uname -r)
1273N/ASOLARIS_VERSION = $(OS_VERSION:5.%=2.%)
94N/ABUILD_NUM = 0.$(shell expr $(LAST_BUILD_NUM) + 1)
3661N/ABUILD_VERSION = $(OS_VERSION)-$(BUILD_NUM)
3661N/A
94N/A
94N/ACOMPILER = studio
94N/ABITS = 32
94N/APYTHON_VERSION = 2.6
94N/APYTHON_VERSIONS = 2.6
94N/A
94N/AWS_LOGS = $(WS_TOP)/logs
94N/AWS_REPO = $(WS_TOP)/repo
94N/AWS_TOOLS = $(WS_TOP)/tools
94N/AWS_MAKE_RULES = $(WS_TOP)/make-rules
94N/AWS_COMPONENTS = $(WS_TOP)/components
94N/AWS_INCORPORATIONS = $(WS_TOP)/incorporations
3035N/AWS_LINT_CACHE = $(WS_TOP)/cache
3035N/A
3035N/ABASS_O_MATIC = $(WS_TOOLS)/bass-o-matic
3035N/A
3035N/APKG_REPO = file:$(WS_REPO)
94N/A
94N/ASOURCE_DIR = $(shell pwd)/$(COMPONENT_SRC)
94N/ABUILD_DIR = $(shell pwd)/build
94N/APROTO_DIR = $(BUILD_DIR)/prototype/$(MACH)
94N/A
94N/AUSRDIR = /usr
181N/ABINDIR = /bin
94N/ALIBDIR = /lib
94N/AUSRBINDIR = $(USRDIR)/bin
94N/AUSRLIBDIR = $(USRDIR)/lib
181N/AUSRSHAREDIR = $(USRDIR)/share
94N/AUSRSHAREMANDIR = $(USRSHAREDIR)/man
94N/AUSRSHAREMAN1DIR = $(USRSHAREMANDIR)/man1
USRSHAREMAN3DIR = $(USRSHAREMANDIR)/man3
USRLIBDIR64 = $(USRDIR)/lib/$(MACH64)
PROTOUSRDIR = $(PROTO_DIR)/$(USRDIR)
PROTOUSRBINDIR = $(PROTO_DIR)/$(USRBINDIR)
PROTOUSRLIBDIR = $(PROTO_DIR)/$(USRLIBDIR)
PROTOUSRLIBDIR64 = $(PROTO_DIR)/$(USRLIBDIR64)
PROTOUSRSHAREDIR = $(PROTO_DIR)/$(USRSHAREDIR)
PROTOUSRSHAREMANDIR = $(PROTO_DIR)/$(USRSHAREMANDIR)
PROTOUSRSHAREMAN1DIR = $(PROTO_DIR)/$(USRSHAREMAN1DIR)
PROTOUSRSHAREMAN3DIR = $(PROTO_DIR)/$(USRSHAREMAN3DIR)
SFWBIN = /usr/sfw/bin
SFWLIB = /usr/sfw/lib
PROTOSFWBIN = $(PROTO_DIR)/$(SFWBIN)
PROTOSFWLIB = $(PROTO_DIR)/$(SFWLIB)
# work around _TIME, _DATE, embedded date chatter in component builds
# to use, set TIME_CONSTANT in the component Makefile and add $(CONSTANT_TIME)
# to the appropriate {CONFIGURE|BUILD|INSTALL}_ENV
CONSTANT_TIME = LD_PRELOAD_32=$(WS_TOOLS)/time-$(MACH32).so
CONSTANT_TIME += LD_PRELOAD_64=$(WS_TOOLS)/time-$(MACH64).so
CONSTANT_TIME += TIME_CONSTANT=$(TIME_CONSTANT)
# set MACH from uname -p to either sparc or i386
MACH = $(shell uname -p)
# set MACH32 from MACH to either sparcv7 or i86
MACH32_1 = $(MACH:sparc=sparcv7)
MACH32 = $(MACH32_1:i386=i86)
# set MACH64 from MACH to either sparcv9 or amd64
MACH64_1 = $(MACH:sparc=sparcv9)
MACH64 = $(MACH64_1:i386=amd64)
BUILD_DIR_32 = $(BUILD_DIR)/$(MACH32)
BUILD_DIR_64 = $(BUILD_DIR)/$(MACH64)
BUILD_32 = $(BUILD_DIR_32)/.built
BUILD_64 = $(BUILD_DIR_64)/.built
BUILD_32_and_64 = $(BUILD_32) $(BUILD_64)
INSTALL_32 = $(BUILD_DIR_32)/.installed
INSTALL_64 = $(BUILD_DIR_64)/.installed
INSTALL_32_and_64 = $(INSTALL_32) $(INSTALL_64)
# BUILD_TOOLS is the root of all tools not normally installed on the system.
BUILD_TOOLS = /ws/onnv-tools
SPRO_ROOT = $(BUILD_TOOLS)/SUNWspro
SPRO_VROOT = $(SPRO_ROOT)/sunstudio12.1
GCC_ROOT = /usr/gnu
CC.studio.32 = $(SPRO_VROOT)/bin/cc -m32
CCC.studio.32 = $(SPRO_VROOT)/bin/CC -m32
CC.studio.64 = $(SPRO_VROOT)/bin/cc -m64
CCC.studio.64 = $(SPRO_VROOT)/bin/CC -m64
CC.gcc.32 = $(GCC_ROOT)/bin/cc -m32
CCC.gcc.32 = $(GCC_ROOT)/bin/CC -m32
CC.gcc.64 = $(GCC_ROOT)/bin/cc -m64
CCC.gcc.64 = $(GCC_ROOT)/bin/CC -m64
CC = $(CC.$(COMPILER).$(BITS))
CCC = $(CCC.$(COMPILER).$(BITS))
lint.32 = $(SPRO_VROOT)/bin/lint -m32
lint.64 = $(SPRO_VROOT)/bin/lint -m64
LINT = $(lint.$(BITS))
LD = /usr/bin/ld
PYTHON.2.6.32 = /usr/bin/python2.6
PYTHON.2.6.64 = /usr/bin/$(MACH64)/python2.6
PYTHON.32 = $(PYTHON.$(PYTHON_VERSION).$(BITS))
PYTHON.64 = $(PYTHON.$(PYTHON_VERSION).$(BITS))
GMAKE = /usr/gnu/bin/make
GPATCH = /usr/gnu/bin/patch
GPATCH_FLAGS = -p1 -b
PKGSEND = /usr/bin/pkgsend
TOUCH = /usr/bin/touch
MKDIR = /bin/mkdir -p
RM = /bin/rm -f
CP = /bin/cp -f
LN = /bin/ln
SYMLINK = /bin/ln -s
ENV = /usr/bin/env
INSTALL = /usr/bin/ginstall
INS.dir= $(INSTALL) -d $@
INS.file= $(INSTALL) -m 444 $< $(@D)
# C compiler mode. Future compilers may change the default on us,
# so force transition mode globally. Lower level makefiles can
# override this by setting CCMODE.
#
CCMODE= -Xa
CCMODE64= -Xa
# compiler '-xarch' flag. This is here to centralize it and make it
# overridable for testing.
sparc_XARCH= $(CCBITS32) -xarch=sparc
sparcv9_XARCH= $(CCBITS64) -xcode=abs64
i386_XARCH= $(CCBITS32) -xchip=pentium
amd64_XARCH= $(CCBITS64) -xarch=generic -Ui386 -U__i386
# disable the incremental linker
ILDOFF= -xildoff
# C99 mode
C99_ENABLE= -xc99=all
C99_DISABLE= -xc99=none
C99MODE= $(C99_ENABLE)
C99LMODE= $(C99MODE:-xc99%=-Xc99%)
# XPG6 mode. This option enables XPG6 conformance, plus extensions.
# Amongst other things, this option will cause system calls like
# popen (3C) and system (3C) to invoke the standards-conforming
# shell, /usr/xpg4/bin/sh, instead of /usr/bin/sh.
XPG6MODE= $(C99MODE) -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1
# The Sun Studio 11 compiler has changed the behaviour of integer
# wrap arounds and so a flag is needed to use the legacy behaviour
# (without this flag panics/hangs could be exposed within the source).
#
sparc_IROPTFLAG = -W2,-xwrap_int
sparcv9_IROPTFLAG = -W2,-xwrap_int
i386_IROPTFLAG =
amd64_IROPTFLAG =
IROPTFLAG = $($(MACH)_IROPTFLAG)
IROPTFLAG64 = $($(MACH64)_IROPTFLAG)
sparc_CFLAGS= $(sparc_XARCH)
sparcv9_CFLAGS= $(sparcv9_XARCH) -dalign $(CCVERBOSE)
i386_CFLAGS= $(i386_XARCH)
amd64_CFLAGS= $(amd64_XARCH)
sparc_COPTFLAG= -xO3
sparcv9_COPTFLAG= -xO3
i386_COPTFLAG= -xO3
amd64_COPTFLAG= -xO3
COPTFLAG= $($(MACH)_COPTFLAG)
COPTFLAG64= $($(MACH64)_COPTFLAG)
sparc_XREGSFLAG = -xregs=no%appl
sparcv9_XREGSFLAG = -xregs=no%appl
i386_XREGSFLAG =
amd64_XREGSFLAG =
XREGSFLAG = $($(MACH)_XREGSFLAG)
XREGSFLAG64 = $($(MACH64)_XREGSFLAG)
CFLAGS= \
$(COPTFLAG) $($(MACH)_CFLAGS) $(CCMODE) \
$(ILDOFF) $(C99MODE) $(IROPTFLAG)
CFLAGS64= \
$(COPTFLAG64) $($(MACH64)_CFLAGS) $(CCMODE64) \
$(ILDOFF) $(C99MODE) $(IROPTFLAG64)