Home | History | Annotate | Download | only in src
      1 #
      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/CDDL.txt
      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/CDDL.txt.
     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 #
     21 
     22 #
     23 #pragma ident	"@(#)Makefile.master	1.164	08/06/09 SMI"
     24 #
     25 # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
     26 # Use is subject to license terms.
     27 #
     28 # Makefile.master, global definitions for system source
     29 #
     30 ROOT=		/proto
     31 
     32 .KEEP_STATE:
     33 
     34 # The declaration POUND_SIGN is always '#'. This is needed to get around the
     35 # make feature that '#' is always a comment delimiter, even when escaped or
     36 # quoted.  The only way of generating this is the :sh macro mechanism.  Note
     37 # however that in general :sh macros should be avoided in makefiles that are
     38 # widely included into other makefiles, as the resulting shell executions can
     39 # cause a noticeable slowdown in build times. 
     40 #
     41 # The code below handles differences between Solaris make and Linux make.
     42 # On a Solaris machine, $(SUNOS)="", $(LINUX)=#, $(POUND_SIGN)=#
     43 # On a Linux machine, $(SUNOS)=#, $(LINUX)="", $(POUND_SIGN)=#
     44 # Thus, prefixing lines with $(SUNOS) or $(LINUX) will cause the
     45 # lines to be run only on a non-Linux or Linux build respectively.
     46 #
     47 # Note: with gnu make, #a b c: dep will only comment out a, not b and c.
     48 # (Specifically, it will use targets "#a", "b", and "c".
     49 # Thus, you can't put $(SUNOS)a b c: ... and have it work right
     50 #
     51 SUNOS= $(shell echo x | tr x \\043) 
     52 LINUX:sh=       echo \\043 
     53 $(LINUX)POUND_SIGN= $(shell echo x | tr x \\043)
     54 $(SUNOS)POUND_SIGN:sh=        echo \\043
     55 $(LINUX)OSNAME= $(shell uname -s)
     56 $(SUNOS)OSNAME:sh= uname -s
     57 
     58 # CLOSED is the root of the tree that contains source which isn't released
     59 # as open source
     60 CLOSED=         $(SRC)/../closed
     61 
     62 # CLOSED_BUILD controls whether we try to build files under usr/closed.
     63 # ("" means to build closed source, "#" means don't try to build it.)
     64 CLOSED_BUILD_1 = if [ ! -d "$(CLOSED)" ] ; then echo x | tr x \\043; fi
     65 CLOSED_BUILD = $(CLOSED_BUILD_1:sh)
     66 
     67 # BUILD_TOOLS is the root of all tools including compilers.
     68 # An open source build uses the tools installed locally on the build machine,
     69 # whereas a closed build uses the tools installed in a central repository.
     70 BUILD_TOOLS=			/opt
     71 $(CLOSED_BUILD)BUILD_TOOLS=	/ws/sc31u-tools
     72 
     73 # SC_CLOSED_BINS contains the prebuilt closed binaries which are used
     74 # by the open source build
     75 SC_CLOSED_BINS= $${SC_CLOSED_BINS:-$(BUILD_TOOLS)/scbld/ref_proto/ohacds-closed-bins}
     76 
     77 # CLOSED_MSG_CATALOGS specifies which message catalogs are generated
     78 # from closed source
     79 CLOSED_MSG_CATALOGS= SUNW_SC_ORACLE_LISTENER SUNW_SC_ORACLE_SERVER SUNW_SC_SYBASE
     80 
     81 # If the TMPDIR environment variable is set, we set a flag to tell the
     82 # C++ compiler to use it.  It's not necessary to do this for plain C
     83 # compiles, because the C compiler honors TMPDIR without needing an
     84 # explicit flag.
     85 #
     86 # The user (or the calling script) can also override CCTEMPFLAG before
     87 # calling make (or dmake), in order to save make the minor expense of
     88 # re-running this echo command.
     89 CCTEMPFLAG:sh=echo ${TMPDIR:+-temp=$TMPDIR}
     90 
     91 # RELEASE_BUILD should be cleared for non-debug builds.
     92 # NOT_RELEASE_BUILD is exactly what the name implies.
     93 #
     94 # STRIP_COMMENTS toggles comment section striping. Generally the same setting
     95 # as RELEASE_BUILD.
     96 #
     97 # STRIPFLAG is set to a unique value depending upon the value of
     98 # RELEASE_BUILD.  We only strip on release builds.
     99 # It is set here for use in lower level Makefiles to allow a single
    100 # point change to affect the entire build.
    101 NOT_RELEASE_BUILD=
    102 RELEASE_BUILD=				$(POUND_SIGN)
    103 $(RELEASE_BUILD)NOT_RELEASE_BUILD=	$(POUND_SIGN)
    104 
    105 STRIP_COMMENTS=	$(RELEASE_BUILD)
    106 
    107 STRIPFLAG=
    108 $(RELEASE_BUILD)STRIPFLAG=	-s
    109 
    110 # For some future builds, NATIVE_MACH and MACH might be different.
    111 # Therefore, NATIVE_MACH needs to be redefined in the
    112 # environment as `uname -p` to override this macro.
    113 #
    114 NATIVE_MACH=	$(MACH)
    115 
    116 # set __GNUC= in the environment to build 32-bit with the gcc compiler.
    117 # The default is to use the Sun Studio compiler for all processor types.
    118 __GNUC=         $(POUND_SIGN)
    119 
    120 # set __GNUC64= in the environment to build 64-bit with the gcc compiler.
    121 # Inherit the __GNUC value by default, and if that is set to $(POUND_SIGN)
    122 # then this means use the Sun Studio compiler.
    123 __GNUC64=       $(__GNUC)
    124 
    125 # Use the Compiler Wrapper with the GNU C compiler, as the Makefiles
    126 # still contain Sun Studio compiler arguments
    127 __CW=		$(POUND_SIGN)
    128 $(__GNUC)__CW=
    129 
    130 #
    131 # Macros used to switch compilation based on S9/10 reference
    132 # These are set by the nightly script. OS is enforced to be set
    133 # to 5.9 or 5.10 by .INIT. S9_BUILD, PRE_S10_BUILD, and POST_S9_BUILD
    134 # is then set according to OS setting.
    135 # Per bug 4787164, it is necessary to keep specific Solaris build
    136 # setting such that some OS dependable MACROs like SOL_VERSION,
    137 # REFERENCE_PROTO, and OS specific packages can be easily set.
    138 # Following setting can be used up to Solaris 11. To add more
    139 # Solaris, besides updating the check_last_os target, simply follow
    140 # the following method.  
    141 #
    142 5.9=$(POUND_SIGN)
    143 5.10=$(POUND_SIGN)
    144 5.11=$(POUND_SIGN)
    145 Linux=$(POUND_SIGN)
    146 $(OS)=
    147 
    148 S11_BUILD=                      $(5.11)
    149 PRE_S11_BUILD=                  $(POUND_SIGN)
    150 POST_S11_BUILD=                 $(POUND_SIGN)
    151 
    152 S10_BUILD=                      $(5.10)
    153 PRE_S10_BUILD=                  $(POUND_SIGN)
    154 POST_S10_BUILD=                 $(POUND_SIGN)
    155 
    156 S9_BUILD=                       $(5.9)
    157 PRE_S9_BUILD=                   $(POUND_SIGN)
    158 POST_S9_BUILD=                  $(POUND_SIGN)
    159 
    160 $(Linux)S10_BUILD=
    161 
    162 $(S9_BUILD)PRE_S10_BUILD=
    163 $(PRE_S9_BUILD)PRE_S10_BUILD=
    164 $(S10_BUILD)PRE_S11_BUILD=
    165 $(PRE_S10_BUILD)PRE_S11_BUILD=
    166 
    167 $(POST_S11_BUILD)POST_S10_BUILD=
    168 $(S11_BUILD)POST_S10_BUILD=
    169 $(POST_S10_BUILD)POST_S9_BUILD=
    170 $(S10_BUILD)POST_S9_BUILD=
    171 
    172 #
    173 # Use the SOL_VERSION macro to determine the version of OS. The
    174 # value of the SOL_VERSION macro is the release date of the
    175 # version of OS. Its of the form, YYYYMM. So for Solaris 9, its
    176 # 200205 (May 2002) and for Solaris 10, its 200411 (Nov 2004).
    177 #
    178 DSOL_VERSION=-DSOL_VERSION=200205
    179 $(S10_BUILD)DSOL_VERSION=-DSOL_VERSION=200411
    180 $(S11_BUILD)DSOL_VERSION=-DSOL_VERSION=200710
    181 
    182 #
    183 # Separate different builds into their own proto areas.
    184 #
    185 
    186 #
    187 # TARGET_ROOT_NAME	- the platform build name
    188 #
    189 # This identifier is used to separate the platform specific proto areas
    190 # and other development storage areas.
    191 #
    192 TARGET_ROOT_NAME=Sol_9
    193 $(S10_BUILD)TARGET_ROOT_NAME=Sol_10
    194 $(S11_BUILD)TARGET_ROOT_NAME=Sol_11
    195 
    196 #
    197 # TARGET_ROOT_PROTO	- proto area subdirectory
    198 #
    199 # This is the path suffix that is used to specify the proto area
    200 # subdirectory.
    201 #
    202 TARGET_ROOT_PROTO=$(TARGET_ROOT_NAME)/
    203 $(RELEASE_BUILD)TARGET_ROOT_PROTO=$(TARGET_ROOT_NAME)-nd/
    204 
    205 #
    206 # TARGET_ROOT	- name for the proto area root_$(MACH) location
    207 #
    208 TARGET_ROOT=$(TARGET_ROOT_PROTO)root_$(MACH)
    209 
    210 #
    211 # VROOT is used in all other Makefiles to reference the proto
    212 # area rather than ROOT, as the latter is overridden by the
    213 # environment with make -e (the default for the ws script).
    214 #
    215 VROOT=$(ROOT:%/proto/root_$(MACH)=%/proto/$(TARGET_ROOT))
    216 
    217 #
    218 # Some additions to support building with a reference proto area.
    219 # This is the location for reference proto area containing
    220 # libs and headers for version of OS we're building against.
    221 #
    222 REFERENCE_PROTO=s9/s9_58shwpl3
    223 $(S10_BUILD)REFERENCE_PROTO=s10/s10_74L2a
    224 $(S11_BUILD)REFERENCE_PROTO=snv/snv_86
    225 $(LINUX)REFERENCE_PROTO=Linux/Linux_2.4.9-31e
    226 
    227 REF_PROTO=	
    228 $(CLOSED_BUILD)REF_PROTO=	$(BUILD_TOOLS)/ref_proto/$(REFERENCE_PROTO)/root_$(MACH)
    229 REF_LIBS=	$(REF_PROTO)/usr/lib $(REF_PROTO)/lib
    230 REF_LIBS64=	$(REF_PROTO)/usr/lib/$(MACH64) $(REF_PROTO)/lib/$(MACH64)
    231 REF_INC=	$(REF_PROTO)/usr/include
    232 
    233 #
    234 # Core gate ref_proto
    235 #
    236 CL_REF_PROTO=$(BUILD_TOOLS)/scbld/ref_proto/ohac/root_$(MACH)
    237 $(CLOSED_BUILD)CL_REF_PROTO=$(BUILD_TOOLS)/ref_proto/sc32u2_latest.$(TARGET_ROOT_NAME)/root_$(MACH)
    238 
    239 #
    240 # DS Config wizard Constants
    241 #
    242 DSCONFIG_REF_PROTO=$(CL_REF_PROTO)
    243 
    244 REF_CL_INC = $(CL_REF_PROTO)/usr/cluster/include
    245 REF_CL_LIBS = $(CL_REF_PROTO)/usr/cluster/lib
    246 REF_CL_LIBS64 = $(CL_REF_PROTO)/usr/cluster/lib/$(MACH64)
    247 
    248 EXTERNAL_PKGS= $(BUILD_TOOLS)/scbld/ext_pkgs
    249 $(CLOSED_BUILD)EXTERNAL_PKGS= /ws/suncluster/ext_pkgs
    250 
    251 JAVA_ROOT=			/usr/java
    252 $(CLOSED_BUILD)JAVA_ROOT=	$(EXTERNAL_PKGS)/Sun/$(MACH)/jdk_1.4.1_01/j2se
    253 
    254 SFW_ROOT=       /usr/sfw
    255 SFWINCDIR=      $(SFW_ROOT)/include
    256 SFWLIBDIR=      $(SFW_ROOT)/lib
    257 SFWLIBDIR64=    $(SFW_ROOT)/lib/$(MACH64)
    258 
    259 #
    260 # DVD images of external products
    261 #
    262 DVDIMAGES_DIR=$(EXTERNAL_PKGS)/dvdimages/ohac
    263 $(CLOSED_BUILD)DVDIMAGES_DIR=$(EXTERNAL_PKGS)/dvdimages/32u1_latest
    264 $(CLOSED_BUILD)$(S11_BUILD)DVDIMAGES_DIR= $(EXTERNAL_PKGS)/dvdimages/ohac_latest
    265 
    266 #
    267 # Documentation
    268 #
    269 DOCS_DELIVERY=$(EXTERNAL_PKGS)/Docs/ohacds/$(NATIVE_MACH)
    270 $(CLOSED_BUILD)DOCS_DELIVERY=$(EXTERNAL_PKGS)/Docs/sc32u1/$(NATIVE_MACH)
    271 MANPAGE_DIR=$(DOCS_DELIVERY)/SUNWscdsman/reloc
    272 
    273 #
    274 # Localization
    275 #
    276 L10N_DELIVERY=$(EXTERNAL_PKGS)/L10N/ohacds/$(NATIVE_MACH)
    277 $(CLOSED_BUILD)L10N_DELIVERY= $(EXTERNAL_PKGS)/L10N/l10n.ohacds/$(NATIVE_MACH)
    278 
    279 INSTALLED_DBS= $(BUILD_TOOLS)/Ins_DBs
    280 
    281 AR=		/usr/ccs/bin/ar cq
    282 CAT=            /usr/bin/cat
    283 CHMOD=		/usr/bin/chmod
    284 CP=		/usr/bin/cp -f
    285 ECHO=		echo
    286 EGREP=		/usr/bin/egrep
    287 FIND=		/usr/bin/find
    288 GREP=		/usr/bin/grep
    289 INS=		install
    290 JAR=		$(JAVA_ROOT)/bin/jar
    291 JAVAC=		$(JAVA_ROOT)/bin/javac
    292 JAVADOC=	$(JAVA_ROOT)/bin/javadoc
    293 LN=		/usr/bin/ln
    294 MCS=		/usr/ccs/bin/mcs
    295 MKDIR=		/usr/bin/mkdir
    296 MV=		/usr/bin/mv -f
    297 PERL=		/usr/bin/perl
    298 RM=		/usr/bin/rm -f
    299 RPCGEN=		$(REF_PROTO)/usr/bin/rpcgen
    300 SED=		/usr/bin/sed
    301 STABS=		$(BUILD_TOOLS)/misc/bin/stabs
    302 STRIP=		/usr/ccs/bin/strip
    303 SYMLINK=	/usr/bin/ln -s
    304 TOUCH=		/usr/bin/touch
    305 TRUE=		true
    306 XARGS=		/usr/bin/xargs
    307 XREF=		$(BUILD_TOOLS)/onbld/bin/xref
    308 
    309 FILEMODE=	0644
    310 DIRMODE=	0755
    311 
    312 #
    313 # Print out a warning if we're running a build on an OS release
    314 # which is older than Solaris 9.  Building on older releases is
    315 # potentially problematic.
    316 #
    317 # This dumps a copy of uname into a file so the rule is only executed
    318 # once, but is executed by anyone including Makefile.master.
    319 #
    320 # INIT_DEPS is to be used by Makefiles which require their own .INIT
    321 # targets to be executed.  It needs to be set before including Makefile.master
    322 # for those targets to be added (see uts/sparc/modules/Makefile).
    323 #
    324 INIT_DEPS += $(SRC)/.build.OS_version
    325 
    326 #
    327 # Add one more target into INIT_DEPS to check if OS variable is
    328 # set, and if it matches last build OS setting. Build fails if
    329 # OS is not set or it is different from last build OS setting.
    330 #
    331 INIT_DEPS += check_build_os
    332 
    333 REQ_BLD_OS = 59
    334 REQ_BLD_NM = Solaris 9
    335 REQ_BLD_WARNING = "WARNING: Building on a release prior to $(REQ_BLD_NM)"
    336 UNAME = uname
    337 
    338 $(SRC)/.build.%:
    339 	@[ `$(UNAME) -r | \
    340 	    $(SED) -e 's/\(.\).\(.*\)/\1\2/'` -lt $(REQ_BLD_OS) ] \
    341 	    && ($(ECHO) $(REQ_BLD_WARNING) && $(RM) $@) || $(UNAME) -a > $@
    342 
    343 SUPPORTED_OS = 5.9 5.10 5.11 Linux
    344 #
    345 # check if OS is set, and if it is the same as the OS build last
    346 # time; Otherwise it failed.
    347 #
    348 check_build_%:
    349 	@Error_mesg1="\nOS is null or not set. It should be among $(SUPPORTED_OS). Your build is failing.\n"; \
    350 	Error_mesg2="\nUnsupported OS setting. SunOS $(SUPPORTED_OS) is supported. Your build is failing.\n"; \
    351 	Guide_mesg="\nTo build against a different OS, do justsccs to your workspace\n\
    352 first; To make the same build, you still need to specify the\n\
    353 same OS value. Your build is failing. \n" ;\
    354 	os_file=$(SRC)/.build.last_OS; \
    355 	THIS_OS=$${OS:=$$Error_mesg1}; \
    356 	LAST_OS=; \
    357 	if [ -f $$os_file ]; then LAST_OS=`$(CAT) $$os_file`; fi; \
    358 	if [ "$$THIS_OS" = "$$Error_mesg1" ]; then \
    359 		if [ ! -z "$$LAST_OS" ]; then \
    360 			$(ECHO) "\nYour last build was $$LAST_OS, but it is not set this time. \n$$Guide_mesg"; \
    361 			exit 2; \
    362 		else \
    363 			$(ECHO) "$$Error_mesg1"; exit 3; \
    364 		fi; \
    365 	elif [ "$$THIS_OS" = "5.9" ] || [ "$$THIS_OS" = "5.10" ] || \
    366 	    [ "$$THIS_OS" = "5.11" ] || [ "$$THIS_OS" = "Linux" ]; then \
    367 		if [ "$$LAST_OS" = "" ] || [ "$$THIS_OS" = "$$LAST_OS" ]; then \
    368 			if [ -z "$$LAST_OS" -a ! -f $$os_file ]; then $(ECHO) "$$THIS_OS" > $$os_file; fi; \
    369 		elif [ "$$THIS_OS" != "$$LAST_OS" ]; then \
    370 			$(ECHO) "\nYour last build was $$LAST_OS, but it is set to $$THIS_OS this time.\n$$Guide_mesg"; \
    371 			exit 4; \
    372 		fi; \
    373 	else \
    374 		if [ ! -z "$$LAST_OS" ]; then \
    375 			$(ECHO) "\nYour last build was $$LAST_OS. Your current setting is not among the\n\
    376 supported $(SUPPORTED_OS).\n$$Guide_mesg"; exit 5; \
    377 		else \
    378 			$(ECHO) "$$Error_mesg2"; exit 6; \
    379 		fi; \
    380 	fi
    381 
    382 .INIT: $(INIT_DEPS)
    383 
    384 # Declare that nothing should be built in parallel.
    385 # Individual Makefiles can use the .PARALLEL target to declare otherwise.
    386 .NO_PARALLEL:
    387 
    388 # For stylistic checks
    389 #
    390 # Note that the X and C checks are not used at this time and may need
    391 # modification when they are actually used.
    392 #
    393 CSTYLE=		cstyle
    394 CSTYLE_TAIL=
    395 HDRCHK=		hdrchk
    396 HDRCHK_TAIL=
    397 JSTYLE=		jstyle
    398 
    399 DOT_H_CHECK=	\
    400 	@$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL); \
    401 	$(HDRCHK) $< $(HDRCHK_TAIL)
    402 
    403 DOT_X_CHECK=	\
    404 	@$(ECHO) "checking $<"; $(RPCGEN) -C -h $< | $(CSTYLE) $(CSTYLE_TAIL); \
    405 	$(RPCGEN) -C -h $< | $(HDRCHK) $< $(HDRCHK_TAIL)
    406 
    407 DOT_C_CHECK=	\
    408 	@$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL)
    409 
    410 
    411 # modified for use within NSE environments
    412 #
    413 INS.file=	$(RM) $@; $(INS) -s -m $(FILEMODE) -f $(@D) $<
    414 INS.dir=	$(INS) -s -d -m $(DIRMODE) $@
    415 # installs and renames at once
    416 #
    417 INS.rename=	$(INS.file); $(MV) $(@D)/$(<F) $@
    418 
    419 # MACH must be set in the shell environment per uname -p on the build host
    420 # More specific architecture variables should be set in lower makefiles.
    421 #
    422 # MACH64 is derived from MACH, and BUILD64 is set to `#' for
    423 # architectures on which we do not build 64-bit versions.
    424 #
    425 
    426 MACH64_1=	$(MACH:sparc=sparcv9)
    427 MACH64=		$(MACH64_1:i386=amd64)
    428 
    429 MACH32_1=	$(MACH:sparc=sparcv7)
    430 MACH32=		$(MACH32_1:i386=i86)
    431 
    432 #
    433 # On Solaris 10 and beyond we build 64bit x86 (amd64)
    434 #
    435 sparc_BUILD64=
    436 $(POST_S9_BUILD)i386_BUILD64=
    437 BUILD64=	$($(MACH)_BUILD64)
    438 
    439 #
    440 # C compiler mode. Future compilers may change the default on us,
    441 # so force transition mode globally. Lower level makefiles can
    442 # override this by setting CCMODE.
    443 #
    444 CCMODE=		-Xa
    445 CCMODE64=	-Xa
    446 
    447 #
    448 # C compiler verbose mode. This is so we can enable it globally,
    449 # but turn it off in the lower level makefiles of things we cannot
    450 # (or aren't going to) fix.
    451 #
    452 CCVERBOSE=	-v
    453 
    454 # set this to the secret flag "-Wc,-Qiselect-v9abiwarn=1" to get warnings
    455 # from the compiler about places the -xarch=v9 may differ from -xarch=v9c.
    456 V9ABIWARN=
    457 
    458 # set this to the secret flag "-Wc,-Qiselect-regsym=0" to disable register
    459 # symbols (used to detect conflicts between objects that use global registers)
    460 # we disable this now for safety, and because genunix doesn't link with
    461 # this feature (the v9 default) enabled.
    462 #
    463 # REGSYM is separate since the C++ driver syntax is different.
    464 CCREGSYM=	-Wc,-Qiselect-regsym=0
    465 CCCREGSYM=	-Qoption cg -Qiselect-regsym=0
    466 
    467 # generate 32-bit addresses in the v9 kernel. Saves memory.
    468 CCABS32=	-Wc,-xcode=abs32
    469 
    470 #
    471 # compiler '-xarch' flag. This is here to centralize it and make it
    472 # overridable for testing.
    473 sparc_XARCH=	-xarch=v8
    474 sparcv9_XARCH=	-xarch=v9
    475 amd64_XARCH=	-xarch=amd64 -Ui386 -U__i386
    476 
    477 # assembler '-xarch' flag.  Different from compiler '-xarch' flag.
    478 sparc_AS_XARCH=         -xarch=v8
    479 sparcv9_AS_XARCH=       -xarch=v9
    480 i386_AS_XARCH=
    481 amd64_AS_XARCH=         -xarch=amd64 -P -Ui386 -U__i386
    482 
    483 #
    484 # turn warnings into errors (C)
    485 CERRWARN=	-errtags=yes -errwarn=%all -erroff=E_EMPTY_TRANSLATION_UNIT
    486 
    487 #
    488 # C++ compiler flags
    489 #
    490 
    491 #
    492 # Disable the incremental linker, ild(1).
    493 ILDOFF=         -xildoff
    494 
    495 #
    496 # +w
    497 # This flag tells the compiler to identify code that might have
    498 # unintended consequences.  The separate CCWARN macro makes it
    499 # easy to disable it on a target-specific basis by using a
    500 # target-specific reassignment "TARGET:= CCWARN=".
    501 #
    502 CCWARN			= +w
    503 
    504 #
    505 # turn warnings into errors (C++)
    506 #
    507 CCERRWARN=      -xwe
    508 
    509 #
    510 # Disable C++ exceptions.
    511 #
    512 CCNOEXCEPTIONS		= -features=no%except
    513 
    514 #
    515 # There are anachronisms in the dbms code.
    516 # We are already using the compiler option -xwe to turn warnings
    517 # into errors.  However the option -features=anachronisms in combination
    518 # with -xwe doesn't allow anachronisms.  Instead we must use the
    519 # undocumented option -Qoption ccfe -messages=no%anachronism to ignore
    520 # anachronisms.
    521 #
    522 CCNOANACHRONISMS= -Qoption ccfe -messages=no%anachronism
    523 
    524 #
    525 # Do not put literal strings in read-only memory.
    526 #
    527 CCNOCONSTSTRINGS= -features=no%conststrings
    528 
    529 #
    530 # Flag to disable inlining
    531 #
    532 $(SUNOS)NOINLINEFLAG = +d
    533 $(LINUX)NOINLINEFLAG =
    534 
    535 #
    536 # CL_CCFLAGS is used only in compilations of C++ code.
    537 # +p is a flag that tells the preprocessor to ignore so-called
    538 # "preprocessor asserts" such as #cpu.
    539 #
    540 CL_CCFLAGS      = $(CCNOANACHRONISMS) $(CCNOCONSTSTRINGS)
    541 CL_CCFLAGS      += $(CCNOEXCEPTIONS) $(CCERRWARN) $(ILDOFF) +p $(CCWARN)
    542 
    543 # Prevent the removal of static symbols by the SPARC code generator (cg).
    544 # The x86 code generator (ube) does not remove such symbols and as such
    545 # using this workaround is not applicable for x86.
    546 #
    547 CCSTATICSYM=            -Wc,-Qassembler-ounrefsym=0
    548 
    549 # In most places, assignments to these macros should be appended with +=
    550 # (CPPFLAGS.master allows values to be prefixed to CPPFLAGS).
    551 sparc_CFLAGS=   -xcg89 -Wa,-cg92
    552 $(__GNUC)sparc_CFLAGS=	$(sparc_XARCH) $(CCSTATICSYM)
    553 sparcv9_CFLAGS=	$(sparcv9_XARCH) -dalign $(CCVERBOSE) $(V9ABIWARN) $(CCREGSYM)
    554 $(__GNUC)sparcv9_CFLAGS=$(sparcv9_XARCH) -dalign $(CCVERBOSE) $(V9ABIWARN) $(CCREGSYM) $(CCSTATICSYM)
    555 i386_CFLAGS=
    556 amd64_CFLAGS=	$(amd64_XARCH)
    557 
    558 sparc_ASFLAGS=  $(sparc_AS_XARCH)
    559 sparcv9_ASFLAGS=$(sparcv9_AS_XARCH)
    560 i386_ASFLAGS=   $(i386_AS_XARCH)
    561 amd64_ASFLAGS=  $(amd64_AS_XARCH)
    562 
    563 #
    564 # For userland programs,
    565 # -O/-xO3 and -g are mutually exclusive.
    566 # Use the former for non-debug and the latter for debug.
    567 # In the latter case, "OPT" (optimize) is a misnomer.
    568 #
    569 sparc_COPTFLAG=				-g
    570 sparcv9_COPTFLAG=			-g
    571 $(RELEASE_BUILD)sparc_COPTFLAG=		-xO3
    572 $(RELEASE_BUILD)sparcv9_COPTFLAG=	-xO3
    573 
    574 i386_COPTFLAG=				-g
    575 amd64_COPTFLAG=				-g
    576 $(RELEASE_BUILD)i386_COPTFLAG=		-xO3
    577 $(RELEASE_BUILD)amd64_COPTFLAG=		-xO3
    578 
    579 COPTFLAG= $($(MACH)_COPTFLAG)
    580 COPTFLAG64= $($(MACH64)_COPTFLAG)
    581 
    582 #
    583 # tradeoff time for space (smaller is better)
    584 #
    585 sparc_SPACEFLAG		= -xspace -W0,-Lt
    586 sparcv9_SPACEFLAG	= -xspace -W0,-Lt
    587 i386_SPACEFLAG		= -W0,-xc99=%none
    588 SPACEFLAG		= $($(MACH)_SPACEFLAG)
    589 SPACEFLAG64		= $($(MACH64)_SPACEFLAG)
    590 
    591 sparc_XREGSFLAG		= -xregs=no%appl
    592 sparcv9_XREGSFLAG	= -xregs=no%appl
    593 i386_XREGSFLAG		=
    594 XREGSFLAG		= $($(MACH)_XREGSFLAG)
    595 XREGSFLAG64		= $($(MACH64)_XREGSFLAG)
    596 
    597 CFLAGS=         $(COPTFLAG) $($(MACH)_CFLAGS) $(SPACEFLAG) $(CCMODE)
    598 CFLAGS64=       $(COPTFLAG64) $($(MACH64)_CFLAGS) $(SPACEFLAG64) $(CCMODE64)
    599 
    600 JAVAFLAGS=			-deprecation -g
    601 $(RELEASE_BUILD)JAVAFLAGS=	-deprecation
    602 
    603 #
    604 # For source message catalogue
    605 #
    606 .SUFFIXES: $(SUFFIXES) .po
    607 MSGROOT= $(VROOT)/catalog
    608 MSGDOMAIN= $(MSGROOT)/$(TEXT_DOMAIN)
    609 MESSAGE_DIR=	/usr/cluster/lib/locale
    610 DTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\"
    611 DMESSAGE_DIR=	-DMESSAGE_DIR=\"$(MESSAGE_DIR)\"
    612 CLOBBERFILES += $(POFILE) $(POFILES)
    613 COMPILE.CPP= $(CC) -E -C $(CFLAGS) $(CPPFLAGS)
    614 CCOMPILE.CPP= $(CCC) -E $(CCFLAGS) $(CPPFLAGS) -I$(CCC_INCLUDE)
    615 SHMSGPREP= $(BUILD_TOOLS)/scbld/bin/$(MACH)/extract_gettext
    616 $(CLOSED_BUILD)SHMSGPREP= $(BUILD_TOOLS)/onbld/bin/$(MACH)/extract_gettext
    617 SCMSGS_BIN= $(BUILD_TOOLS)/scbld/bin
    618 $(CLOSED_BUILD)SCMSGS_BIN= $(BUILD_TOOLS)/onbld/bin
    619 SH.PP= $(SHMSGPREP) $(XGETFLAGS)
    620 XGETTEXT= xgettext
    621 XGETFLAGS= -c TRANSLATION_NOTE
    622 BUILD.po= $(XGETTEXT) $(XGETFLAGS) $<.i ;\
    623 	$(RM)	$@ ;\
    624 	sed "/^domain/d" < messages.po  > $@ ;\
    625 	$(RM) messages.po $<.i
    626 
    627 %.pi:	%.c
    628 	$(COMPILE.CPP) $< > $@
    629 
    630 %.pi:	%.cc
    631 	$(CCOMPILE.CPP) $< > $@
    632 
    633 %.pi:	%.ksh
    634 	$(SH.PP) < $< > $@
    635 
    636 %.pi:	%.sh
    637 	$(SH.PP) < $< > $@
    638 
    639 #
    640 # This is overwritten by local Makefile when PROG is a list.
    641 #
    642 PIFILES= $(OBJECTS:%.o=%.pi) $(PROG:%=%.pi)
    643 POFILE= $(PROG).po
    644 
    645 sparc_CCFLAGS=		-cg89 -Qoption fbe -cg92 $(CL_CCFLAGS)
    646 $(__GNUC)sparc_CCFLAGS=	-Qoption fbe -cg92 $(CL_CCFLAGS)
    647 sparcv9_CCFLAGS=	$(sparcv9_XARCH) -dalign $(CCCREGSYM) $(CL_CCFLAGS)
    648 i386_CCFLAGS=		$(CL_CCFLAGS)
    649 amd64_CCFLAGS=		$(amd64_XARCH) $(CL_CCFLAGS)
    650 
    651 #
    652 # For userland programs,
    653 # -O/-xO3 and -g are mutually exclusive
    654 # Use the former for non-debug and the latter for debug.
    655 #
    656 sparc_CCOPTFLAG=			-g
    657 sparcv9_CCOPTFLAG=			-g
    658 $(RELEASE_BUILD)sparc_CCOPTFLAG=	-O
    659 $(RELEASE_BUILD)sparcv9_CCOPTFLAG=	-O
    660 
    661 i386_CCOPTFLAG=				-g
    662 amd64_CCOPTFLAG=			-g
    663 $(RELEASE_BUILD)i386_CCOPTFLAG=		-O
    664 $(RELEASE_BUILD)amd64_CCOPTFLAG=	-O
    665 
    666 CCOPTFLAG=	$($(MACH)_CCOPTFLAG)
    667 CCOPTFLAG64=	$($(MACH64)_CCOPTFLAG)
    668 CCFLAGS=	$(CCOPTFLAG) $($(MACH)_CCFLAGS) $(CCTEMPFLAG)
    669 CCFLAGS64=	$(CCOPTFLAG64) $($(MACH64)_CCFLAGS) $(CCTEMPFLAG)
    670 
    671 # Pass -Y flag to cpp (method of which is release-dependent)
    672 CCYFLAG=	-Y I,
    673 
    674 CCYLIBS=	-Y P,
    675 $(__CW)CCYLIBS= -L
    676 
    677 ENVLIBS1= $(ENVROOT1:%=-L%/usr/cluster/lib) $(ENVROOT1:%=-L%/usr/lib) $(ENVROOT1:%=-L%/lib)
    678 ENVLIBS2= $(ENVROOT2:%=-L%/usr/cluster/lib) $(ENVROOT2:%=-L%/usr/lib) $(ENVROOT2:%=-L%/lib)
    679 
    680 DEFAULT_LPATH=	$(ENVLDLIBS1:%usr/ccs/lib=%usr/cluster/lib) \
    681 		$(REF_LIBS:%=-L%) -L$(REF_CL_LIBS) \
    682 		$(ENVLDLIBS2:%usr/ccs/lib=%usr/cluster/lib) \
    683 		$(ENVLDLIBS3:%usr/ccs/lib=%usr/cluster/lib)  \
    684 		$(REF_LIBS:%=$(CCYLIBS)%) $(CCYLIBS)$(REF_CL_LIBS) \
    685 		-R/usr/cluster/lib
    686 LDLIBS.cmd= 	$(DEFAULT_LPATH)
    687 LDLIBS.lib=	$(DEFAULT_LPATH)
    688 
    689 #
    690 # Pass specified MT flags onto the pre-processor and linkage phases.
    691 # CPPFLAGS is also included in LINK.c/LINK.cc.
    692 #
    693 CPP_MTFLAG = $(MTFLAG)
    694 
    695 #
    696 # Flexelint doesn't understand -mt, so -mt generated defines are not
    697 # automatically included.  If -mt shows up in the MTFLAGS that
    698 # have been set by the component, we replace it here with -D_REENTRANT
    699 # so the proper code paths are enabled.
    700 #
    701 # Assembly flags are also not tolerated, so they are eliminated here as well.
    702 #
    703 lint lint.targ:= CPP_MTFLAG = $(MTFLAG:-mt=-D_REENTRANT)
    704 lint lint.targ:= AS_DEFS=
    705 
    706 #
    707 # SS11 - Sun Studio 11 compilers, used for SC-Nevada and beyond
    708 #
    709 SS11 = $(POUND_SIGN)
    710 $(PRE_S11_BUILD)SS11 = $(POUND_SIGN)
    711 PRE_SS11 =
    712 $(SS11)PRE_SS11 = $(POUND_SIGN)
    713 
    714 #
    715 # Compiler macros
    716 #
    717 sparc_SPRO_VERS			= SOS10
    718 sparc_SPRO_VERS64		= SOS10
    719 i386_SPRO_VERS			= SOS10
    720 i386_SPRO_VERS64		= SOS10
    721 SPRO_VERS = 
    722 SPRO_VERS64 = 
    723 $(CLOSED_BUILD)SPRO_VERS	= $($(NATIVE_MACH)_SPRO_VERS)
    724 $(CLOSED_BUILD)SPRO_VERS64	= $($(NATIVE_MACH)_SPRO_VERS64)
    725 $(CLOSED_BUILD)$(SS11)SPRO_VERS = SS11-new
    726 $(CLOSED_BUILD)$(SS11)SPRO_VERS64 = SS11-new
    727 
    728 #
    729 # Environment proto and root_$(MACH) locations
    730 #
    731 ENVPROTO1=$(ENVCPPFLAGS1:-I%/root_$(MACH)/usr/include=%)
    732 ENVROOT1=$(ENVPROTO1:%=%/$(TARGET_ROOT))
    733 ENVPROTO2=$(ENVCPPFLAGS2:-I%/root_$(MACH)/usr/include=%)
    734 ENVROOT2=$(ENVPROTO2:%=%/$(TARGET_ROOT))
    735 ENVPROTO3=$(ENVCPPFLAGS3:-I%/root_$(MACH)/usr/include=%)
    736 ENVROOT3=$(ENVPROTO3:%=%/$(TARGET_ROOT))
    737 CPPFLAGS.master= \
    738 	$(DTEXTDOM) \
    739 	$(DMESSAGE_DIR) \
    740 	$(CPP_MTFLAG) \
    741 	$(DSOL_VERSION) \
    742 	$(ENVROOT1:%=-I%/usr/include) \
    743 	$(ENVROOT1:%=-I%/usr/cluster/include) \
    744 	$(ENVROOT2:%=-I%/usr/include) \
    745 	$(ENVROOT2:%=-I%/usr/cluster/include)
    746 
    747 CPPFLAGS=	$(CPPFLAGS.master) -I$(REF_INC) -I$(REF_CL_INC)
    748 CPPFLAGS += -I$(REF_CL_INC)/rgm $(CCYFLAG)$(REF_INC)
    749 AS_CPPFLAGS=	$(CPPFLAGS.master) -I$(REF_INC)
    750 
    751 #
    752 # Define compilation macros.
    753 #
    754 COMPILE.c=	$(CC) $(CFLAGS) $(CPPFLAGS) -c
    755 COMPILE64.c=	$(CC) $(CFLAGS64) $(CPPFLAGS) -c
    756 COMPILE.cc=	$(CCC) $(CCFLAGS) $(CPPFLAGS) -c
    757 COMPILE64.cc=	$(CCC) $(CCFLAGS64) $(CPPFLAGS) -c
    758 COMPILE.s=	$(AS) $(ASFLAGS) $(AS_CPPFLAGS)
    759 
    760 CLASSPATH=	.
    761 COMPILE.java=	$(JAVAC) $(JAVAFLAGS) -classpath $(CLASSPATH)
    762 
    763 #
    764 # Link time macros
    765 #
    766 CCNEEDED=	$(REF_LIBS:%=-L%) -lCstd -lCrun -lc
    767 $(__GNUC)CCNEEDED=-L$(SFWLIBDIR) -R$(SFWLIBDIR) -lstdc++ -lgcc_s
    768 CCNEEDED64=	$(REF_LIBS64:%=-L%) -lCstd -lCrun -lc
    769 COMPILE64.s=	$(AS) $(ASFLAGS) $($(MACH64)_XARCH) $(AS_CPPFLAGS)
    770 LINK.c=		$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
    771 $(__GNUC)LINK.c=$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(CCNEEDED)
    772 LINK64.c=	$(CC) $(CFLAGS64) $(CPPFLAGS) $(LDFLAGS)
    773 $(__GNUC64)LINK64.c=$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(CCNEEDED64)
    774 LINK.cc=	$(CCC) $(CCFLAGS) $(CPPFLAGS) -norunpath -nolib $(LDFLAGS) $(CCNEEDED)
    775 LINK64.cc=	$(CCC) $(CCFLAGS64) $(CPPFLAGS) -norunpath -nolib $(LDFLAGS) $(CCNEEDED64)
    776 
    777 #
    778 # Use flexelint by default
    779 #
    780 lint:= CCYFLAG = -I
    781 lint:= CCYLIBS = -L
    782 LINTDEFS_=	$(SRC)/tools/etc/gal.lnt
    783 LINTDEFS_32=	$(SRC)/tools/etc/gal.lnt
    784 LINTDEFS_64=	$(SRC)/tools/etc/gal64.lnt
    785 LINTDEFS=	$(LINTDEFS_$(CLASS))
    786 LINTDEFS64=	$(LINTDEFS_64)
    787 LINTCCFLAGS=	+fcp
    788 LINTCCFLAGS64=	+fcp
    789 LINTFLAGS=	$(LINTDEFS) $(AS_CPPFLAGS) -I$(CCC_INCLUDE) -D_REENTRANT
    790 LINTFLAGS64=	$(LINTDEFS64) $(AS_CPPFLAGS) -I$(CCC_INCLUDE) -D_REENTRANT
    791 LINT=		$(TRUE)
    792 LINT64=		$(TRUE)
    793 $(CLOSED_BUILD)LINT=	$(BUILD_TOOLS)/misc/bin/flexelint $(FLEXELINTDEFS)
    794 $(CLOSED_BUILD)LINT64=	$(BUILD_TOOLS)/misc/bin/flexelint $(FLEXELINTDEFS64)
    795 LINT.c=		$(LINT) $(LINTFLAGS) $(CPPFLAGS)
    796 LINT64.c=	$(LINT) $(LINTFLAGS64) $(CPPFLAGS)
    797 LINT.cc=	$(LINT) $(LINTFLAGS) $(LINTCCFLAGS) $(CPPFLAGS)
    798 LINT64.cc=	$(LINT64) $(LINTFLAGS64) $(LINTCCFLAGS64) $(CPPFLAGS)
    799 
    800 # Define native compilation macros
    801 #
    802 
    803 # Base directory where compilers are loaded.
    804 # Defined here so it can be overridden by developer.
    805 #
    806 SPRO_ROOT=	$(BUILD_TOOLS)/SUNWspro
    807 GNU_ROOT=	$(SFW_ROOT)
    808 CW=		SPRO_VROOT=$(SPRO_ROOT)/$(SPRO_VERS) $(BUILD_TOOLS)/onbld/bin/$(MACH)/cw
    809 
    810 # Specify platform compiler versions for languages
    811 # that we use (currently only c and c++).
    812 #
    813 sparc_CC=			$(SPRO_ROOT)/$(SPRO_VERS)/bin/cc
    814 sparc_CCC=			$(SPRO_ROOT)/$(SPRO_VERS)/bin/CC
    815 $(__CW)sparc_CC=		$(CW) -_cc
    816 $(__CW)$(__GNUC)sparc_CC=	$(CW) -_gcc
    817 $(__CW)sparc_CCC=		$(CW) -_CC
    818 $(__CW)$(__GNUC)sparc_CCC=	$(CW) -_g++
    819 sparc_AS=			/usr/ccs/bin/as -xregsym=no
    820 sparc_LD=			/usr/ccs/bin/ld
    821 
    822 sparcv9_CC=			$(SPRO_ROOT)/$(SPRO_VERS64)/bin/cc
    823 sparcv9_CCC=			$(SPRO_ROOT)/$(SPRO_VERS64)/bin/CC
    824 $(__CW)sparcv9_CC=		$(CW) -_cc
    825 $(__CW)$(__GNUC64)sparcv9_CC=	$(CW) -_gcc
    826 $(__CW)sparcv9_CCC=		$(CW) -_CC
    827 $(__CW)$(__GNUC64)sparcv9_CCC=	$(CW) -_g++
    828 sparcv9_AS=			/usr/ccs/bin/as -xregsym=no
    829 sparcv9_LD=			/usr/ccs/bin/ld
    830 
    831 i386_CC=			$(SPRO_ROOT)/$(SPRO_VERS)/bin/