Makefile.master
author Alasdair Lumsden <alasdairrr@gmail.com>
Tue, 20 Sep 2011 18:51:35 +0000
branchoi_151a
changeset 570 869a4dca4ecf
parent 525 21efe377a4de
permissions -rw-r--r--
Adding tag oi_151a_release

#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
# Copyright 2011 Every City Ltd. All rights reserved.
#
# ident	"@(#)Makefile.master	1.0	06/03/07 SMI"
#

MACH :sh= echo ${MACH-`uname -p`}
MACH64:sh = isainfo -k

#
# Global path variables - change these to suit your own build environment
#

# Base directory where compilers are located.
SPRO_VROOT=             /opt/sunstudio12.1

# List of all our locales - if you need to add/remove any, do it here

ALL_LOCALES = ar_EG ar_SA bg_BG ca cs_CZ da_DK da_DK de_DE de_AT de_CH de_LU el_GR el_CY \
en_AU en_CA en_GB en_IE en_MT en_NZ en_US es_ES es_AR es_BO es_CL es_CO es_CR es_EC es_GT \
es_MX es_NI es_PA es_PE es_PY es_SV es_UY es_VE et_EE fi_FI fr_FR fr_BE fr_CA fr_CH fr_LU \
he_IL hi_IN hr_HR hu_HU is_IS it_IT ja_JP ko_KR lt_LT lv_LV mk_MK nb_NO nl_NL nl_BE nn_NO \
no_NO no_NY pl_PL pt_PT pt_BR ro_RO ru_RU sh_BA sk_SK sl_SI sq_AL sr_CS sr_SP sr_YU sv_SE \
ta_IN th_TH tr_TR zh_CN zh_HK zh_TW iconv

# Method version - the suffix for all shared objects
METHOD_VERSION = 3

#
# End global variables - you shouldn't need to change anything from here down
#


# the location of the built pkgs
DEST = $(SRC)/dist/$(MACH)

# the location of the built binary-only tarballs
TB_DEST = $(SRC)/dist/closed_tarballs

# the location of the pkg building files
ROOT = $(SRC)/proto/$(MACH)
PKGROOT = $(ROOT)/pkgroot
FILEROOT = $(ROOT)/fileroot


# BUILD_TOOLS is the root of all tools including compilers.
# ONBLD_TOOLS is the root of all the tools that are part of SUNWonbld.

BUILD_TOOLS=            /ws/onnv-tools
ONBLD_TOOLS=            $(BUILD_TOOLS)/onbld

JAVA_ROOT=      /usr/java

SFW_ROOT=       /usr/sfw
SFWINCDIR=      $(SFW_ROOT)/include
SFWLIBDIR=      $(SFW_ROOT)/lib
SFWLIBDIR64=    $(SFW_ROOT)/lib/$(MACH64)

RPCGEN=         /usr/bin/rpcgen
STABS=          $(ONBLD_TOOLS)/bin/$(MACH)/stabs
ECHO=           echo
INS=            /usr/sbin/install -f
INSDIR=		/usr/sbin/install -d	
TRUE=           true
TR = 		/usr/bin/tr
SYMLINK=        /usr/bin/ln -s
LN=             /usr/bin/ln
CHMOD=          /usr/bin/chmod
CHOWN=          $(TRUE)
CHGRP=          $(TRUE)
COMPRESS=	/usr/bin/compress
MV=             /usr/bin/mv -f
RM=             /usr/bin/rm -f
GREP=           /usr/bin/grep
SED=            /usr/bin/sed
NAWK=           /usr/bin/nawk
CP=             /usr/bin/cp -f
MCS=            /usr/ccs/bin/mcs
CAT=            /usr/bin/cat
M4=             /usr/ccs/bin/m4
STRIP=          /usr/ccs/bin/strip
LEX=            /usr/ccs/bin/lex
YACC=           /usr/ccs/bin/yacc
CPP=            /usr/lib/cpp
JAVAC=          $(JAVA_ROOT)/bin/javac
JAVAH=          $(JAVA_ROOT)/bin/javah
JAVADOC=        $(JAVA_ROOT)/bin/javadoc
RMIC=           $(JAVA_ROOT)/bin/rmic
JAR=            $(JAVA_ROOT)/bin/jar
GENOFFSETS=     $(ONBLD_TOOLS)/bin/genoffsets
CTFCVTPTBL=     $(ONBLD_TOOLS)/bin/ctfcvtptbl
CTFFINDMOD=     $(ONBLD_TOOLS)/bin/ctffindmod
XREF=           $(ONBLD_TOOLS)/bin/xref
FIND=           /usr/bin/find
PERL=           /usr/bin/perl
SORT=           /usr/bin/sort
TOUCH=          /usr/bin/touch
WC=             /usr/bin/wc
XARGS=          /usr/bin/xargs
ELFSIGN=        /usr/bin/elfsign
PKGMK= 		pkgmk
TAR=		/usr/bin/tar
LD=		/usr/ccs/bin/ld
BDFTOPCF =	/usr/openwin/bin/bdftopcf
BZIP2=		/usr/bin/bzip2 -9
RSYNC=		/usr/bin/rsync
UNPACKARCHIVE=	$(SRC)/tools/unpack-archive

# SUNWwgetu
WGET=		/usr/bin/wget

# SUNWxorg-server
XKBCOMP=	/usr/bin/xkbcomp

# locale_cldr
GNU_PATCH=	/usr/bin/gpatch


# MACH must be set in the shell environment per uname -p on the build host
# More specific architecture variables should be set in lower makefiles.
#
# MACH64 is derived from MACH, and BUILD64 is set to `#' for
# architectures on which we do not build 64-bit versions.
# (There are no such architectures at the moment.)
#
# Set BUILD64=# in the environment to disable 64-bit amd64
# builds on i386 machines.

MACH64_1=	$(MACH:sparc=sparcv9)
MACH64=		$(MACH64_1:i386=amd64)

MACH32_1=	$(MACH:sparc=sparcv7)
MACH32=		$(MACH32_1:i386=i86)

sparc_BUILD64=
i386_BUILD64=
BUILD64=	$($(MACH)_BUILD64)

#
# C compiler mode. Future compilers may change the default on us,
# so force extended ANSI mode globally. Lower level makefiles can
# override this by setting CCMODE.
#
CCMODE=			-Xa
CCMODE64=		-Xa

#
# C compiler verbose mode. This is so we can enable it globally,
# but turn it off in the lower level makefiles of things we cannot
# (or aren't going to) fix.
#
CCVERBOSE=		-v

# set this to the secret flag "-Wc,-Qiselect-v9abiwarn=1" to get warnings
# from the compiler about places the -xarch=v9 may differ from -xarch=v9c.
V9ABIWARN=

# set this to the secret flag "-Wc,-Qiselect-regsym=0" to disable register
# symbols (used to detect conflicts between objects that use global registers)
# we disable this now for safety, and because genunix doesn't link with
# this feature (the v9 default) enabled.
#
# REGSYM is separate since the C++ driver syntax is different.
CCREGSYM=		-Wc,-Qiselect-regsym=0
CCCREGSYM=		-Qoption cg -Qiselect-regsym=0

#
# generate 32-bit addresses in the v9 kernel. Saves memory.
CCABS32=		-Wc,-xcode=abs32

# One optimization the compiler might perform is to turn this:
#	#pragma weak foo
#	extern int foo;
#	if (&foo)
#		foo = 5;
# into
#	foo = 5;
# Since we do some of this (foo might be referenced in common kernel code
# but provided only for some cpu modules or platforms), we disable this
# optimization.
# 
sparc_CCUNBOUND	= -Wd,-xsafe=unboundsym
i386_CCUNBOUND	=
CCUNBOUND	= $($(MACH)_CCUNBOUND)

#
# compiler '-xarch' flag. This is here to centralize it and make it
# overridable for testing.
#sparc_XARCH=		-xarch=v8
#sparcv9_XARCH=		-xarch=v9
#i386_XARCH=
#amd64_XARCH=		-xarch=amd64 -Ui386 -U__i386

#replace with ss12 specific flags
sparc_XARCH=		-xarch=sparc -m32
sparcv9_XARCH=		-xarch=sparc -m64
i386_XARCH=
amd64_XARCH=		-xarch=sse2 -m64 -Ui386 -U__i386

# assembler '-xarch' flag.  Different from compiler '-xarch' flag.
#sparc_AS_XARCH=		-xarch=v8
#sparcv9_AS_XARCH=	-xarch=v9
#i386_AS_XARCH=
#amd64_AS_XARCH=		-xarch=amd64 -P -Ui386 -U__i386

#replace with ss12 specific flags
sparc_AS_XARCH=         -xarch=sparc -m32
sparcv9_AS_XARCH=       -xarch=sparc -64
i386_AS_XARCH=
amd64_AS_XARCH=         -xarch=sse2 -m64 -P -Ui386 -U__i386

#
# These flags define what we need to be 'standalone' i.e. -not- part
# of the rather more cosy userland environment.  This basically means
# the kernel.
#
# XX64	future versions of gcc will make -mcmodel=kernel imply -mno-red-zone
#
sparc_STAND_FLAGS=	-_gcc=-ffreestanding
sparcv9_STAND_FLAGS=	-_gcc=-ffreestanding
i386_STAND_FLAGS=	-_gcc=-ffreestanding
amd64_STAND_FLAGS=	-xmodel=kernel

SAVEARGS=		-Wu,-save_args
amd64_STAND_FLAGS	+= $(SAVEARGS)

STAND_FLAGS_32 = $($(MACH)_STAND_FLAGS)
STAND_FLAGS_64 = $($(MACH64)_STAND_FLAGS)

#
# disable the incremental linker
ILDOFF=			-xildoff
#
XDEPEND=		-xdepend
XFFLAG=			-xF
XESS=			-xs
XSTRCONST=		-xstrconst 

#
# turn warnings into errors (C)
CERRWARN = -errtags=yes -errwarn=%all
CERRWARN += -erroff=E_EMPTY_TRANSLATION_UNIT
CERRWARN += -erroff=E_STATEMENT_NOT_REACHED

#
# turn warnings into errors (C++)
CCERRWARN=		-xwe

# C99 mode
C99_ENABLE=	-xc99=%all
C99_DISABLE=	-xc99=%none
C99MODE=	$(C99_DISABLE)
C99LMODE=	$(C99MODE:-xc99%=-Xc99%)

# In most places, assignments to these macros should be appended with +=
# (CPPFLAGS.master allows values to be prepended to CPPFLAGS).
sparc_CFLAGS=	$(sparc_XARCH)
sparcv9_CFLAGS=	$(sparcv9_XARCH) -dalign $(CCVERBOSE) $(V9ABIWARN) $(CCREGSYM)
i386_CFLAGS=	$(i386_XARCH)
amd64_CFLAGS=	$(amd64_XARCH)

sparc_ASFLAGS=	$(sparc_AS_XARCH)
sparcv9_ASFLAGS=$(sparcv9_AS_XARCH)
i386_ASFLAGS=	$(i386_AS_XARCH)
amd64_ASFLAGS=	$(amd64_AS_XARCH)

#
sparc_COPTFLAG=		-xO3
sparcv9_COPTFLAG=	-xO3
i386_COPTFLAG=		-O
amd64_COPTFLAG=		-xO3

COPTFLAG= $($(MACH)_COPTFLAG)
COPTFLAG64= $($(MACH64)_COPTFLAG)

#
# tradeoff time for space (smaller is better)
#
sparc_SPACEFLAG		= -xspace -W0,-Lt -W2,-Rcond_elim
sparcv9_SPACEFLAG	= -xspace -W0,-Lt -W2,-Rcond_elim
i386_SPACEFLAG		= -xspace
amd64_SPACEFLAG		=

SPACEFLAG		= $($(MACH)_SPACEFLAG)
SPACEFLAG64		= $($(MACH64)_SPACEFLAG)

sparc_XREGSFLAG		= -xregs=no%appl
sparcv9_XREGSFLAG	= -xregs=no%appl
i386_XREGSFLAG		=
amd64_XREGSFLAG		=

XREGSFLAG		= $($(MACH)_XREGSFLAG)
XREGSFLAG64		= $($(MACH64)_XREGSFLAG)

CFLAGS=         $(COPTFLAG) $($(MACH)_CFLAGS) $(SPACEFLAG) $(CCMODE) \
		$(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND)
CFLAGS64=       $(COPTFLAG64) $($(MACH64)_CFLAGS) $(SPACEFLAG64) $(CCMODE64) \
		$(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND)
NATIVE_CFLAGS=	$(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) $(CCMODE) \
		$(ILDOFF) $(CERRWARN) $(C99MODE) $($(NATIVE_MACH)_CCUNBOUND)

DTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\"	# For messaging.
DTS_ERRNO=-D_TS_ERRNO
CPPFLAGS.master=$(DTEXTDOM) $(DTS_ERRNO) \
	$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
CPPFLAGS=	$(CPPFLAGS.master)
AS_CPPFLAGS=	$(CPPFLAGS.master)
JAVAFLAGS=	-deprecation
#
# This is overwritten by local Makefile when PROG is a list.
#
POFILE= $(PROG).po

sparc_CCFLAGS=		-cg92 -compat=4 \
			-Qoption ccfe -messages=no%anachronism \
			$(CCERRWARN)
sparcv9_CCFLAGS=	$(sparcv9_XARCH) -dalign -compat=5 \
			-Qoption ccfe -messages=no%anachronism \
			-Qoption ccfe -features=no%conststrings \
			$(CCCREGSYM) \
			$(CCERRWARN)
i386_CCFLAGS=		-compat=4 \
			-Qoption ccfe -messages=no%anachronism \
			-Qoption ccfe -features=no%conststrings \
			$(CCERRWARN)
amd64_CCFLAGS=		$(amd64_XARCH) -compat=5 \
			-Qoption ccfe -messages=no%anachronism \
			-Qoption ccfe -features=no%conststrings \
			$(CCERRWARN)

sparc_CCOPTFLAG=	-O
sparcv9_CCOPTFLAG=	-O
i386_CCOPTFLAG=		-O
amd64_CCOPTFLAG=	-O

CCOPTFLAG=	$($(MACH)_CCOPTFLAG)
CCOPTFLAG64=	$($(MACH64)_CCOPTFLAG)
CCFLAGS=	$(CCOPTFLAG) $($(MACH)_CCFLAGS)
CCFLAGS64=	$(CCOPTFLAG64) $($(MACH64)_CCFLAGS)

# For some future builds, NATIVE_MACH and MACH might be different.
# Therefore, NATIVE_MACH needs to be redefined in the
# environment as `uname -p` to override this macro.
#
# For now at least, we cross-compile amd64 on i386 machines.
NATIVE_MACH=	$(MACH:amd64=i386)

# Define native compilation macros
#

# Specify platform compiler versions for languages
# that we use (currently only c and c++).
#
sparc_CC=		$(SPRO_VROOT)/bin/cc
sparc_CCC=		$(SPRO_VROOT)/bin/CC
sparc_CPP=		/usr/ccs/lib/cpp
sparc_LD=		/usr/ccs/bin/ld
sparc_LINT=		$(SPRO_VROOT)/bin/lint

sparcv9_CC=		$(SPRO_VROOT)/bin/cc
sparcv9_CCC=		$(SPRO_VROOT)/bin/CC
sparcv9_CPP=		/usr/ccs/lib/cpp
sparcv9_LD=		/usr/ccs/bin/ld
sparcv9_LINT=		$(SPRO_VROOT)/bin/lint

# We compile 32-bit objects with cc by default
i386_CC=		$(SPRO_VROOT)/bin/cc
i386_CCC=		$(SPRO_VROOT)/bin/CC
i386_CPP=		/usr/ccs/lib/cpp
i386_LD=		/usr/ccs/bin/ld
i386_LINT=		$(SPRO_VROOT)/bin/lint

# We compile 64-bit objects with cc by default
amd64_CC=		$(SPRO_VROOT)/bin/cc
amd64_CCC=		$(SPRO_VROOT)/bin/CC
amd64_CPP=		/usr/ccs/lib/cpp
amd64_LD=		/usr/ccs/bin/ld
amd64_LINT=		$(SPRO_VROOT)/bin/lint

NATIVECC=		$($(NATIVE_MACH)_CC)
NATIVECCC=		$($(NATIVE_MACH)_CCC)
NATIVECPP=		$($(NATIVE_MACH)_CPP)
NATIVELD=		$($(NATIVE_MACH)_LD)
NATIVELINT=		$($(NATIVE_MACH)_LINT)

#
# Makefile.master.64 overrides these settings
#
CC=			$(NATIVECC)
CCC=			$(NATIVECCC)
CPP=			$(NATIVECPP)
LD=			$(NATIVELD)
LINT=			$(NATIVELINT)

#
# Optimization CFLAG
#

CFLAG_OPT =    -D_REENTRANT

CFLAG_OPT +=    $(SPACEFLAG) $(C99MODE) $(ILDOFF) $(CCUNBOUND)

CFLAG_OPT_64:sh=if [ "`isainfo -k`" = "sparcv9" ]; then \
			echo "-m64 -dalign -D`/usr/bin/uname -p`" ;\
		elif [ "`isainfo -k`" = "amd64" ]; then \
			echo "-m64" ;\
		else \
			echo ""; \
		fi

CFLAG_OPT_64 += $(CFLAG_OPT)