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