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/OPENSOLARIS.LICENSE 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/OPENSOLARIS.LICENSE. 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# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. 24# Copyright (c) 2012 by Delphix. All rights reserved. 25# Copyright 2014 Garrett D'Amore <garrett@damore.org> 26# Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved. 27# Copyright 2015 Gary Mills 28# Copyright 2015 Igor Kozhukhov <ikozhukhov@gmail.com> 29# Copyright 2016 Toomas Soome <tsoome@me.com> 30# Copyright 2018 OmniOS Community Edition (OmniOSce) Association. 31# Copyright 2020 Joyent, Inc. 32# Copyright 2019 RackTop Systems. 33# 34 35# 36# Makefile.master, global definitions for system source 37# 38ROOT= /proto 39 40# 41# Adjunct root, containing an additional proto area to be used for headers 42# and libraries. 43# 44ADJUNCT_PROTO= 45# HAVE_ADJUNCT_PROTO - ADJUNCT_PROTO is set to a non-default value 46# NO_ADJUNCT_PROTO - ADJUNCT_PROTO is unset 47# 48# This works by replacing any value in ADJUNCT_PROTO with POUND_SIGN, which 49# only happens if it has some value, and then setting HAVE_ADJUNCT_PROTO 50# oppositely. 51NO_ADJUNCT_PROTO=$(ADJUNCT_PROTO:%=$(POUND_SIGN)) 52$(NO_ADJUNCT_PROTO)HAVE_ADJUNCT_PROTO=$(POUND_SIGN) 53 54# 55# Adjunct for building things that run on the build machine. 56# 57NATIVE_ADJUNCT= /usr 58 59# 60# RELEASE_BUILD should be cleared for final release builds. 61# NOT_RELEASE_BUILD is exactly what the name implies. 62# 63# __GNUC toggles the building of ON components using gcc and related tools. 64# Normally set to `#', set it to `' to do gcc build. 65# 66# The declaration POUND_SIGN is always '#'. This is needed to get around the 67# make feature that '#' is always a comment delimiter, even when escaped or 68# quoted. We use this macro expansion method to get POUND_SIGN rather than 69# always breaking out a shell because the general case can cause a noticable 70# slowdown in build times when so many Makefiles include Makefile.master. 71# 72# While the majority of users are expected to override the setting below 73# with an env file (via nightly or bldenv), if you aren't building that way 74# (ie, you're using "ws" or some other bootstrapping method) then you need 75# this definition in order to avoid the subshell invocation mentioned above. 76# 77 78PRE_POUND= pre\# 79POUND_SIGN= $(PRE_POUND:pre\%=%) 80 81NOT_RELEASE_BUILD= 82RELEASE_BUILD= $(POUND_SIGN) 83$(RELEASE_BUILD)NOT_RELEASE_BUILD= $(POUND_SIGN) 84PATCH_BUILD= $(POUND_SIGN) 85 86# SPARC_BLD is '#' for an Intel build. 87# INTEL_BLD is '#' for a Sparc build. 88SPARC_BLD_1= $(MACH:i386=$(POUND_SIGN)) 89SPARC_BLD= $(SPARC_BLD_1:sparc=) 90INTEL_BLD_1= $(MACH:sparc=$(POUND_SIGN)) 91INTEL_BLD= $(INTEL_BLD_1:i386=) 92 93# The variables below control the compilers used during the build. 94# There are a number of permutations. 95# 96# __GNUC and __SUNC control (and indicate) the primary compiler. Whichever 97# one is not POUND_SIGN is the primary, with the other as the shadow. They 98# may also be used to control entirely compiler-specific Makefile assignments. 99# __GNUC and GCC are the default. 100# 101# __GNUC64 indicates that the 64bit build should use the GNU C compiler. 102# There is no Sun C analogue. 103# 104# The following version-specific options are operative regardless of which 105# compiler is primary, and control the versions of the given compilers to be 106# used. They also allow compiler-version specific Makefile fragments. 107# 108 109__SUNC= $(POUND_SIGN) 110$(__SUNC)__GNUC= $(POUND_SIGN) 111__GNUC64= $(__GNUC) 112 113# Allow build-time "configuration" to enable or disable some things. 114# The default is POUND_SIGN, meaning "not enabled". If the environment 115# passes in an override like ENABLE_SMB_PRINTING= (empty) that will 116# uncomment things in the lower Makefiles to enable the feature. 117ENABLE_SMB_PRINTING= $(POUND_SIGN) 118 119# CLOSED is the root of the tree that contains source which isn't released 120# as open source 121CLOSED= $(SRC)/../closed 122 123# BUILD_TOOLS is the root of all tools including compilers. 124# ONBLD_TOOLS is the root of all the tools that are part of SUNWonbld. 125 126BUILD_TOOLS= /ws/onnv-tools 127ONBLD_TOOLS= $(BUILD_TOOLS)/onbld 128 129# define runtime JAVA_HOME, primarily for cmd/pools/poold 130JAVA_HOME= /usr/java 131# define buildtime JAVA_ROOT 132JAVA_ROOT= /usr/java 133# Build uses java7 by default. Pass one the variables below set to empty 134# string in the environment to override. 135BLD_JAVA_6= $(POUND_SIGN) 136BLD_JAVA_8= $(POUND_SIGN) 137 138GNUC_ROOT= /usr/gcc/7 139GCCLIBDIR= $(GNUC_ROOT)/lib 140GCCLIBDIR64= $(GNUC_ROOT)/lib/$(MACH64) 141 142DOCBOOK_XSL_ROOT= /usr/share/sgml/docbook/xsl-stylesheets 143 144RPCGEN= /usr/bin/rpcgen 145STABS= $(ONBLD_TOOLS)/bin/$(MACH)/stabs 146ELFEXTRACT= $(ONBLD_TOOLS)/bin/$(MACH)/elfextract 147MBH_PATCH= $(ONBLD_TOOLS)/bin/$(MACH)/mbh_patch 148BTXLD= $(ONBLD_TOOLS)/bin/$(MACH)/btxld 149VTFONTCVT= $(ONBLD_TOOLS)/bin/$(MACH)/vtfontcvt 150# echo(1) and true(1) are specified without absolute paths, so that the shell 151# spawned by make(1) may use the built-in versions. This is minimally 152# problematic, as the shell spawned by make(1) is known and under control, the 153# only risk being if the shell falls back to $PATH. 154# 155# We specifically want an echo(1) that does interpolation of escape sequences, 156# which ksh93, /bin/sh, and bash will all provide. 157ECHO= echo 158TRUE= true 159INS= $(ONBLD_TOOLS)/bin/$(MACH)/install 160SYMLINK= /usr/bin/ln -s 161LN= /usr/bin/ln 162MKDIR= /usr/bin/mkdir 163CHMOD= /usr/bin/chmod 164MV= /usr/bin/mv -f 165RM= /usr/bin/rm -f 166CUT= /usr/bin/cut 167NM= /usr/ccs/bin/nm 168DIFF= /usr/bin/diff 169GREP= /usr/bin/grep 170EGREP= /usr/bin/egrep 171ELFWRAP= /usr/bin/elfwrap 172KSH93= /usr/bin/ksh93 173SED= /usr/bin/sed 174AWK= /usr/bin/nawk 175CP= /usr/bin/cp -f 176MCS= /usr/ccs/bin/mcs 177CAT= /usr/bin/cat 178ELFDUMP= /usr/ccs/bin/elfdump 179M4= /usr/bin/m4 180GM4= /usr/bin/gm4 181STRIP= /usr/ccs/bin/strip 182LEX= /usr/ccs/bin/lex 183FLEX= /usr/bin/flex 184YACC= /usr/ccs/bin/yacc 185BISON= /usr/bin/bison 186CPP= /usr/lib/cpp 187ANSI_CPP= $(GNUC_ROOT)/bin/cpp 188JAVAC= $(JAVA_ROOT)/bin/javac 189JAVAH= $(JAVA_ROOT)/bin/javah 190JAVADOC= $(JAVA_ROOT)/bin/javadoc 191RMIC= $(JAVA_ROOT)/bin/rmic 192JAR= $(JAVA_ROOT)/bin/jar 193CTFCONVERT= $(ONBLD_TOOLS)/bin/$(MACH)/ctfconvert 194CTFDIFF= $(ONBLD_TOOLS)/bin/$(MACH)/ctfdiff 195CTFMERGE= $(ONBLD_TOOLS)/bin/$(MACH)/ctfmerge 196CTFSTABS= $(ONBLD_TOOLS)/bin/$(MACH)/ctfstabs 197CTFSTRIP= $(ONBLD_TOOLS)/bin/$(MACH)/ctfstrip 198NDRGEN= $(ONBLD_TOOLS)/bin/$(MACH)/ndrgen 199GENOFFSETS= $(ONBLD_TOOLS)/bin/genoffsets 200XREF= $(ONBLD_TOOLS)/bin/xref 201FIND= /usr/bin/find 202PERL= /usr/bin/perl 203PERL_VERSION= 5.10.0 204PERL_PKGVERS= -510 205PERL_MACH= i86pc 206$(SPARC_BLD)PERL_MACH= sun4 207PERL_VARIANT= 208PERL_ARCH= $(PERL_MACH)-solaris$(PERL_VARIANT)-64int 209PERL_ARCH64= $(PERL_MACH)-solaris$(PERL_VARIANT)-64 210PYTHON_VERSION= 2.7 211PYTHON_PKGVERS= -27 212PYTHON_SUFFIX= 213PYTHON= /usr/bin/python$(PYTHON_VERSION) 214PYTHON3_VERSION= 3.5 215PYTHON3_PKGVERS= -35 216PYTHON3_SUFFIX= m 217PYTHON3= /usr/bin/python$(PYTHON3_VERSION) 218$(BUILDPY3TOOLS)TOOLS_PYTHON= $(PYTHON3) 219$(BUILDPY2TOOLS)TOOLS_PYTHON= $(PYTHON) 220SORT= /usr/bin/sort 221TR= /usr/bin/tr 222TOUCH= /usr/bin/touch 223WC= /usr/bin/wc 224XARGS= /usr/bin/xargs 225ELFEDIT= /usr/bin/elfedit 226DTRACE= /usr/sbin/dtrace -xnolibs 227UNIQ= /usr/bin/uniq 228TAR= /usr/bin/tar 229ASTBINDIR= /usr/ast/bin 230MSGCC= $(ASTBINDIR)/msgcc 231MSGFMT= /usr/bin/msgfmt -s 232LCDEF= $(ONBLD_TOOLS)/bin/$(MACH)/localedef 233TIC= $(ONBLD_TOOLS)/bin/$(MACH)/tic 234ZIC= $(ONBLD_TOOLS)/bin/$(MACH)/zic 235OPENSSL= /usr/bin/openssl 236CPCGEN= $(ONBLD_TOOLS)/bin/$(MACH)/cpcgen 237 238DEFAULT_CONSOLE_COLOR= \ 239 -DDEFAULT_ANSI_FOREGROUND=ANSI_COLOR_WHITE \ 240 -DDEFAULT_ANSI_BACKGROUND=ANSI_COLOR_BLACK 241 242FILEMODE= 644 243DIRMODE= 755 244 245# Declare that nothing should be built in parallel. 246# Individual Makefiles can use the .PARALLEL target to declare otherwise. 247.NO_PARALLEL: 248 249# For stylistic checks 250# 251# Note that the X and C checks are not used at this time and may need 252# modification when they are actually used. 253# 254CSTYLE= $(ONBLD_TOOLS)/bin/cstyle 255CSTYLE_TAIL= 256HDRCHK= $(ONBLD_TOOLS)/bin/hdrchk 257HDRCHK_TAIL= 258JSTYLE= $(ONBLD_TOOLS)/bin/jstyle 259 260DOT_H_CHECK= \ 261 @$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL); \ 262 $(HDRCHK) $< $(HDRCHK_TAIL) 263 264DOT_X_CHECK= \ 265 @$(ECHO) "checking $<"; $(RPCGEN) -C -h $< | $(CSTYLE) $(CSTYLE_TAIL); \ 266 $(RPCGEN) -C -h $< | $(HDRCHK) $< $(HDRCHK_TAIL) 267 268DOT_C_CHECK= \ 269 @$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL) 270 271MANIFEST_CHECK= \ 272 @$(ECHO) "checking $<"; \ 273 SVCCFG_DTD=$(SRC)/cmd/svc/dtd/service_bundle.dtd.1 \ 274 SVCCFG_REPOSITORY=$(SRC)/cmd/svc/seed/global.db \ 275 SVCCFG_CONFIGD_PATH=$(SRC)/cmd/svc/configd/svc.configd-native \ 276 $(SRC)/cmd/svc/svccfg/svccfg-native validate $< 277 278INS.file= $(RM) $@; $(INS) -s -m $(FILEMODE) -f $(@D) $< 279INS.dir= $(INS) -s -d -m $(DIRMODE) $@ 280# installs and renames at once 281# 282INS.rename= $(INS.file); $(MV) $(@D)/$(<F) $@ 283 284# install a link 285INSLINKTARGET= $< 286INS.link= $(RM) $@; $(LN) $(INSLINKTARGET) $@ 287INS.symlink= $(RM) $@; $(SYMLINK) $(INSLINKTARGET) $@ 288 289# The path to python that will be used for the shebang line when installing 290# python scripts to the proto area. This is overridden by makefiles to 291# select to the correct version. 292PYSHEBANG= $(PYTHON) 293$(BUILDPY3)PYSHEBANG= $(PYTHON3) 294$(BUILDPY2)PYSHEBANG= $(PYTHON) 295 296# 297# Python bakes the mtime of the .py file into the compiled .pyc and 298# rebuilds if the baked-in mtime != the mtime of the source file 299# (rather than only if it's less than), thus when installing python 300# files we must make certain to not adjust the mtime of the source 301# (.py) file. 302# 303INS.pyfile= $(RM) $@; $(SED) \ 304 -e "1s:^\#!@PYTHON@:\#!$(PYSHEBANG):" \ 305 -e "1s:^\#!@TOOLS_PYTHON@:\#!$(TOOLS_PYTHON):" \ 306 < $< > $@; $(CHMOD) $(FILEMODE) $@; $(TOUCH) -r $< $@ 307 308# MACH must be set in the shell environment per uname -p on the build host 309# More specific architecture variables should be set in lower makefiles. 310# 311# MACH64 is derived from MACH, and BUILD64 is set to `#' for 312# architectures on which we do not build 64-bit versions. 313# (There are no such architectures at the moment.) 314# 315# Set BUILD64=# in the environment to disable 64-bit amd64 316# builds on i386 machines. 317 318MACH64_1= $(MACH:sparc=sparcv9) 319MACH64= $(MACH64_1:i386=amd64) 320 321MACH32_1= $(MACH:sparc=sparcv7) 322MACH32= $(MACH32_1:i386=i86) 323 324sparc_BUILD64= 325i386_BUILD64= 326BUILD64= $($(MACH)_BUILD64) 327 328# 329# C compiler mode. Future compilers may change the default on us, 330# so force extended ANSI mode globally. Lower level makefiles can 331# override this by setting CCMODE. 332# 333CCMODE= -Xa 334CCMODE64= -Xa 335 336# 337# C compiler verbose mode. This is so we can enable it globally, 338# but turn it off in the lower level makefiles of things we cannot 339# (or aren't going to) fix. 340# 341CCVERBOSE= -v 342 343# set this to the secret flag "-Wc,-Qiselect-v9abiwarn=1" to get warnings 344# from the compiler about places the -xarch=v9 may differ from -xarch=v9c. 345V9ABIWARN= 346 347# set this to the secret flag "-Wc,-Qiselect-regsym=0" to disable register 348# symbols (used to detect conflicts between objects that use global registers) 349# we disable this now for safety, and because genunix doesn't link with 350# this feature (the v9 default) enabled. 351# 352# REGSYM is separate since the C++ driver syntax is different. 353CCREGSYM= -Wc,-Qiselect-regsym=0 354CCCREGSYM= -Qoption cg -Qiselect-regsym=0 355 356# Prevent the removal of static symbols by the SPARC code generator (cg). 357# The x86 code generator (ube) does not remove such symbols and as such 358# using this workaround is not applicable for x86. 359# 360CCSTATICSYM= -Wc,-Qassembler-ounrefsym=0 361# 362# generate 32-bit addresses in the v9 kernel. Saves memory. 363CCABS32= -Wc,-xcode=abs32 364# 365# generate v9 code which tolerates callers using the v7 ABI, for the sake of 366# system calls. 367CC32BITCALLERS= -_gcc=-massume-32bit-callers 368 369# GCC, especially, is increasingly beginning to auto-inline functions and 370# sadly does so separately not under the general -fno-inline-functions 371# Additionally, we wish to prevent optimisations which cause GCC to clone 372# functions -- in particular, these may cause unhelpful symbols to be 373# emitted instead of function names 374CCNOAUTOINLINE= \ 375 -_gcc=-fno-inline-small-functions \ 376 -_gcc=-fno-inline-functions-called-once \ 377 -_gcc=-fno-ipa-cp \ 378 -_gcc7=-fno-ipa-icf \ 379 -_gcc8=-fno-ipa-icf \ 380 -_gcc9=-fno-ipa-icf \ 381 -_gcc7=-fno-clone-functions \ 382 -_gcc8=-fno-clone-functions \ 383 -_gcc9=-fno-clone-functions 384 385# GCC may put functions in different named sub-sections of .text based on 386# their presumed calling frequency. At least in the kernel, where we actually 387# deliver relocatable objects, we don't want this to happen. 388# 389# Since at present we don't benefit from this even in userland, we disable it globally, 390# but the application of this may move into usr/src/uts/ in future. 391CCNOREORDER= \ 392 -_gcc7=-fno-reorder-functions \ 393 -_gcc8=-fno-reorder-functions \ 394 -_gcc9=-fno-reorder-functions 395 396# 397# gcc has a rather aggressive optimization on by default that infers loop 398# bounds based on undefined behavior (!!). This can lead to some VERY 399# surprising optimizations -- ones that may be technically correct in the 400# strictest sense but also result in incorrect program behavior. We turn 401# this optimization off, with extreme prejudice. 402# 403CCNOAGGRESSIVELOOPS= \ 404 -_gcc7=-fno-aggressive-loop-optimizations \ 405 -_gcc8=-fno-aggressive-loop-optimizations \ 406 -_gcc9=-fno-aggressive-loop-optimizations 407 408# One optimization the compiler might perform is to turn this: 409# #pragma weak foo 410# extern int foo; 411# if (&foo) 412# foo = 5; 413# into 414# foo = 5; 415# Since we do some of this (foo might be referenced in common kernel code 416# but provided only for some cpu modules or platforms), we disable this 417# optimization. 418# 419sparc_CCUNBOUND = -Wd,-xsafe=unboundsym 420i386_CCUNBOUND = 421CCUNBOUND = $($(MACH)_CCUNBOUND) 422 423# 424# compiler '-xarch' flag. This is here to centralize it and make it 425# overridable for testing. 426sparc_XARCH= -m32 427sparcv9_XARCH= -m64 428i386_XARCH= -m32 429amd64_XARCH= -m64 -Ui386 -U__i386 430 431# assembler '-xarch' flag. Different from compiler '-xarch' flag. 432sparc_AS_XARCH= -xarch=v8plus 433sparcv9_AS_XARCH= -xarch=v9 434i386_AS_XARCH= 435amd64_AS_XARCH= -xarch=amd64 -P -Ui386 -U__i386 436 437# 438# These flags define what we need to be 'standalone' i.e. -not- part 439# of the rather more cosy userland environment. This basically means 440# the kernel. 441# 442# XX64 future versions of gcc will make -mcmodel=kernel imply -mno-red-zone 443# 444sparc_STAND_FLAGS= -_gcc=-ffreestanding 445sparcv9_STAND_FLAGS= -_gcc=-ffreestanding 446# Disabling MMX also disables 3DNow, disabling SSE also disables all later 447# additions to SSE (SSE2, AVX ,etc.) 448NO_SIMD= -_gcc=-mno-mmx -_gcc=-mno-sse 449i386_STAND_FLAGS= -_gcc=-ffreestanding $(NO_SIMD) 450amd64_STAND_FLAGS= -xmodel=kernel $(NO_SIMD) 451 452SAVEARGS= -Wu,-save_args 453amd64_STAND_FLAGS += $(SAVEARGS) 454 455STAND_FLAGS_32 = $($(MACH)_STAND_FLAGS) 456STAND_FLAGS_64 = $($(MACH64)_STAND_FLAGS) 457 458# 459# disable the incremental linker 460ILDOFF= -xildoff 461# 462XFFLAG= -xF=%all 463XESS= -xs 464XSTRCONST= -xstrconst 465 466# 467# turn warnings into errors (C) 468CERRWARN = -errtags=yes -errwarn=%all 469CERRWARN += -erroff=E_EMPTY_TRANSLATION_UNIT 470CERRWARN += -erroff=E_STATEMENT_NOT_REACHED 471 472CERRWARN += -_gcc=-Wno-missing-braces 473CERRWARN += -_gcc=-Wno-sign-compare 474CERRWARN += -_gcc=-Wno-unknown-pragmas 475CERRWARN += -_gcc=-Wno-unused-parameter 476CERRWARN += -_gcc=-Wno-missing-field-initializers 477 478# Unfortunately, this option can misfire very easily and unfixably. 479CERRWARN += -_gcc=-Wno-array-bounds 480 481# gcc4 lacks -Wno-maybe-uninitialized 482CNOWARN_UNINIT = -_gcc4=-Wno-uninitialized \ 483 -_gcc7=-Wno-maybe-uninitialized \ 484 -_gcc8=-Wno-maybe-uninitialized \ 485 -_gcc9=-Wno-maybe-uninitialized 486 487CERRWARN += -_smatch=-p=illumos_user 488include $(SRC)/Makefile.smatch 489 490# 491# turn warnings into errors (C++) 492CCERRWARN = -errtags=yes -errwarn=%all 493CCERRWARN += -erroff=E_EMPTY_TRANSLATION_UNIT 494CCERRWARN += -erroff=E_STATEMENT_NOT_REACHED 495 496CCERRWARN += -_gcc=-Wno-missing-braces 497CCERRWARN += -_gcc=-Wno-sign-compare 498CCERRWARN += -_gcc=-Wno-unknown-pragmas 499CCERRWARN += -_gcc=-Wno-unused-parameter 500CCERRWARN += -_gcc=-Wno-missing-field-initializers 501 502# C standard. Keep Studio flags until we get rid of lint. 503CSTD_GNU89= -xc99=%none 504CSTD_GNU99= -xc99=%all 505CSTD= $(CSTD_GNU89) 506C99LMODE= $(CSTD:-xc99%=-Xc99%) 507 508# In most places, assignments to these macros should be appended with += 509# (CPPFLAGS.first allows values to be prepended to CPPFLAGS). 510sparc_CFLAGS= $(sparc_XARCH) $(CCSTATICSYM) 511sparcv9_CFLAGS= $(sparcv9_XARCH) -dalign $(CCVERBOSE) $(V9ABIWARN) $(CCREGSYM) \ 512 $(CCSTATICSYM) 513i386_CFLAGS= $(i386_XARCH) 514amd64_CFLAGS= $(amd64_XARCH) 515 516sparc_ASFLAGS= $(sparc_AS_XARCH) 517sparcv9_ASFLAGS=$(sparcv9_AS_XARCH) 518i386_ASFLAGS= $(i386_AS_XARCH) 519amd64_ASFLAGS= $(amd64_AS_XARCH) 520 521# 522sparc_COPTFLAG= -xO3 523sparcv9_COPTFLAG= -xO3 524i386_COPTFLAG= -O 525amd64_COPTFLAG= -xO3 526 527COPTFLAG= $($(MACH)_COPTFLAG) 528COPTFLAG64= $($(MACH64)_COPTFLAG) 529 530# When -g is used, the compiler globalizes static objects 531# (gives them a unique prefix). Disable that. 532CNOGLOBAL= -W0,-noglobal 533 534# Direct the Sun Studio compiler to use a static globalization prefix based on the 535# name of the module rather than something unique. Otherwise, objects 536# will not build deterministically, as subsequent compilations of identical 537# source will yeild objects that always look different. 538# 539# In the same spirit, this will also remove the date from the N_OPT stab. 540CGLOBALSTATIC= -W0,-xglobalstatic 541 542# Sometimes we want all symbols and types in debugging information even 543# if they aren't used. 544CALLSYMS= -W0,-xdbggen=no%usedonly 545 546# 547# We force the compilers to generate the debugging information best understood 548# by the CTF tools. With Sun Studio this is stabs due to bugs in the Studio 549# compilers. With GCC this is DWARF v2. 550# 551DEBUGFORMAT= -_cc=-xdebugformat=stabs -_gcc=-gdwarf-2 552 553# 554# Ask the compiler to include debugging information 555# 556CCGDEBUG= -g $(DEBUGFORMAT) 557 558# 559# Flags used to build in debug mode for ctf generation. 560# 561CTF_FLAGS_sparc = $(CCGDEBUG) -Wc,-Qiselect-T1 $(CSTD) $(CNOGLOBAL) 562CTF_FLAGS_i386 = $(CCGDEBUG) $(CSTD) $(CNOGLOBAL) 563 564CTF_FLAGS_sparcv9 = $(CTF_FLAGS_sparc) 565CTF_FLAGS_amd64 = $(CTF_FLAGS_i386) 566 567# Sun Studio produces broken userland code when saving arguments. 568$(__GNUC)CTF_FLAGS_amd64 += $(SAVEARGS) 569 570CTF_FLAGS_32 = $(CTF_FLAGS_$(MACH)) 571CTF_FLAGS_64 = $(CTF_FLAGS_$(MACH64)) 572CTF_FLAGS = $(CTF_FLAGS_32) 573 574# 575# Flags used with genoffsets 576# 577GENOFFSETS_FLAGS = $(CALLSYMS) 578 579OFFSETS_CREATE = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \ 580 $(CW) --noecho $(CW_CC_COMPILERS) -- $(GENOFFSETS_FLAGS) \ 581 $(CFLAGS) $(CPPFLAGS) 582 583OFFSETS_CREATE64 = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \ 584 $(CW) --noecho $(CW_CC_COMPILERS) -- $(GENOFFSETS_FLAGS) \ 585 $(CFLAGS64) $(CPPFLAGS) 586 587# 588# tradeoff time for space (smaller is better) 589# 590sparc_SPACEFLAG = -xspace -W0,-Lt 591sparcv9_SPACEFLAG = -xspace -W0,-Lt 592i386_SPACEFLAG = -xspace 593amd64_SPACEFLAG = 594 595SPACEFLAG = $($(MACH)_SPACEFLAG) 596SPACEFLAG64 = $($(MACH64)_SPACEFLAG) 597 598# 599# The Sun Studio 11 compiler has changed the behaviour of integer 600# wrap arounds and so a flag is needed to use the legacy behaviour 601# (without this flag panics/hangs could be exposed within the source). 602# 603sparc_IROPTFLAG = -W2,-xwrap_int 604sparcv9_IROPTFLAG = -W2,-xwrap_int 605i386_IROPTFLAG = 606amd64_IROPTFLAG = 607 608IROPTFLAG = $($(MACH)_IROPTFLAG) 609IROPTFLAG64 = $($(MACH64)_IROPTFLAG) 610 611sparc_XREGSFLAG = -xregs=no%appl 612sparcv9_XREGSFLAG = -xregs=no%appl 613i386_XREGSFLAG = 614amd64_XREGSFLAG = 615 616XREGSFLAG = $($(MACH)_XREGSFLAG) 617XREGSFLAG64 = $($(MACH64)_XREGSFLAG) 618 619# dmake SOURCEDEBUG=yes ... enables source-level debugging information, and 620# avoids stripping it. 621SOURCEDEBUG = $(POUND_SIGN) 622SRCDBGBLD = $(SOURCEDEBUG:yes=) 623 624# 625# These variables are intended ONLY for use by developers to safely pass extra 626# flags to the compilers without unintentionally overriding Makefile-set 627# flags. They should NEVER be set to any value in a Makefile. 628# 629# They come last in the associated FLAGS variable such that they can 630# explicitly override things if necessary, there are gaps in this, but it's 631# the best we can manage. 632# 633CUSERFLAGS = 634CUSERFLAGS64 = $(CUSERFLAGS) 635CCUSERFLAGS = 636CCUSERFLAGS64 = $(CCUSERFLAGS) 637 638CSOURCEDEBUGFLAGS = 639CCSOURCEDEBUGFLAGS = 640$(SRCDBGBLD)CSOURCEDEBUGFLAGS = $(CCGDEBUG) -xs 641$(SRCDBGBLD)CCSOURCEDEBUGFLAGS = $(CCGDEBUG) -xs 642 643CFLAGS= $(COPTFLAG) $($(MACH)_CFLAGS) $(SPACEFLAG) $(CCMODE) \ 644 $(ILDOFF) $(CERRWARN) $(CSTD) $(CCUNBOUND) $(IROPTFLAG) \ 645 $(CGLOBALSTATIC) $(CCNOAUTOINLINE) $(CCNOREORDER) \ 646 $(CCNOAGGRESSIVELOOPS) \ 647 $(CSOURCEDEBUGFLAGS) $(CUSERFLAGS) 648CFLAGS64= $(COPTFLAG64) $($(MACH64)_CFLAGS) $(SPACEFLAG64) $(CCMODE64) \ 649 $(ILDOFF) $(CERRWARN) $(CSTD) $(CCUNBOUND) $(IROPTFLAG64) \ 650 $(CGLOBALSTATIC) $(CCNOAUTOINLINE) $(CCNOREORDER) \ 651 $(CCNOAGGRESSIVELOOPS) \ 652 $(CSOURCEDEBUGFLAGS) $(CUSERFLAGS64) 653# 654# Flags that are used to build parts of the code that are subsequently 655# run on the build machine (also known as the NATIVE_BUILD). 656# 657NATIVE_CFLAGS= $(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) $(CCMODE) \ 658 $(ILDOFF) $(CERRWARN) $(CSTD) $($(NATIVE_MACH)_CCUNBOUND) \ 659 $(IROPTFLAG) $(CGLOBALSTATIC) $(CCNOAUTOINLINE) \ 660 $(CCNOREORDER) $(CSOURCEDEBUGFLAGS) $(CUSERFLAGS) 661 662NATIVE_CCFLAGS= $(CCOPTFLAG) $($(NATIVE_MACH)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \ 663 $(CCUSERFLAGS) 664 665DTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\" # For messaging. 666DTS_ERRNO=-D_TS_ERRNO 667CPPFLAGS.first= # Please keep empty. Only lower makefiles should set this. 668CPPFLAGS.master=$(DTEXTDOM) $(DTS_ERRNO) \ 669 $(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4) \ 670 $(ADJUNCT_PROTO:%=-I%/usr/include) 671CPPFLAGS.native=$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) \ 672 $(ENVCPPFLAGS4) -I$(NATIVE_ADJUNCT)/include 673CPPFLAGS= $(CPPFLAGS.first) $(CPPFLAGS.master) 674AS_CPPFLAGS= $(CPPFLAGS.first) $(CPPFLAGS.master) 675JAVAFLAGS= -source 1.6 -target 1.6 -Xlint:deprecation,-options 676 677# 678# For source message catalogue 679# 680.SUFFIXES: $(SUFFIXES) .i .po 681MSGROOT= $(ROOT)/catalog 682MSGDOMAIN= $(MSGROOT)/$(TEXT_DOMAIN) 683MSGDOMAINPOFILE = $(MSGDOMAIN)/$(POFILE) 684DCMSGDOMAIN= $(MSGROOT)/LC_TIME/$(TEXT_DOMAIN) 685DCMSGDOMAINPOFILE = $(DCMSGDOMAIN)/$(DCFILE:.dc=.po) 686 687CLOBBERFILES += $(POFILE) $(POFILES) 688COMPILE.cpp= $(CC) -E -C $(CFLAGS) $(CPPFLAGS) 689XGETTEXT= /usr/bin/xgettext 690XGETFLAGS= -c TRANSLATION_NOTE 691GNUXGETTEXT= /usr/gnu/bin/xgettext 692GNUXGETFLAGS= --add-comments=TRANSLATION_NOTE --keyword=_ \ 693 --strict --no-location --omit-header 694BUILD.po= $(XGETTEXT) $(XGETFLAGS) -d $(<F) $<.i ;\ 695 $(RM) $@ ;\ 696 $(SED) "/^domain/d" < $(<F).po > $@ ;\ 697 $(RM) $(<F).po $<.i 698 699# 700# This is overwritten by local Makefile when PROG is a list. 701# 702POFILE= $(PROG).po 703 704sparc_CCFLAGS= $(sparc_XARCH) -cg92 -compat=4 \ 705 -Qoption ccfe -messages=no%anachronism \ 706 $(CCERRWARN) 707sparcv9_CCFLAGS= $(sparcv9_XARCH) -dalign -compat=5 \ 708 -Qoption ccfe -messages=no%anachronism \ 709 -Qoption ccfe -features=no%conststrings \ 710 $(CCCREGSYM) \ 711 $(CCERRWARN) 712i386_CCFLAGS= $(i386_XARCH) -compat=4 \ 713 -Qoption ccfe -messages=no%anachronism \ 714 -Qoption ccfe -features=no%conststrings \ 715 $(CCERRWARN) 716amd64_CCFLAGS= $(amd64_XARCH) -compat=5 \ 717 -Qoption ccfe -messages=no%anachronism \ 718 -Qoption ccfe -features=no%conststrings \ 719 $(CCERRWARN) 720 721sparc_CCOPTFLAG= -O 722sparcv9_CCOPTFLAG= -O 723i386_CCOPTFLAG= -O 724amd64_CCOPTFLAG= -O 725 726CCOPTFLAG= $($(MACH)_CCOPTFLAG) 727CCOPTFLAG64= $($(MACH64)_CCOPTFLAG) 728CCFLAGS= $(CCOPTFLAG) $($(MACH)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \ 729 $(CCUSERFLAGS) 730CCFLAGS64= $(CCOPTFLAG64) $($(MACH64)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \ 731 $(CCUSERFLAGS64) 732 733# 734# 735# 736ELFWRAP_FLAGS = 737ELFWRAP_FLAGS64 = -64 738 739# 740# Various mapfiles that are used throughout the build, and delivered to 741# /usr/lib/ld. 742# 743MAPFILE.NED_i386 = $(SRC)/common/mapfiles/common/map.noexdata 744MAPFILE.NED_sparc = 745MAPFILE.NED = $(MAPFILE.NED_$(MACH)) 746MAPFILE.PGA = $(SRC)/common/mapfiles/common/map.pagealign 747MAPFILE.NES = $(SRC)/common/mapfiles/common/map.noexstk 748MAPFILE.FLT = $(SRC)/common/mapfiles/common/map.filter 749MAPFILE.LEX = $(SRC)/common/mapfiles/common/map.lex.yy 750 751# 752# Generated mapfiles that are compiler specific, and used throughout the 753# build. These mapfiles are not delivered in /usr/lib/ld. 754# 755MAPFILE.NGB_sparc= $(SRC)/common/mapfiles/gen/sparc_cc_map.noexeglobs 756$(__GNUC64)MAPFILE.NGB_sparc= \ 757 $(SRC)/common/mapfiles/gen/sparc_gcc_map.noexeglobs 758MAPFILE.NGB_sparcv9= $(SRC)/common/mapfiles/gen/sparcv9_cc_map.noexeglobs 759$(__GNUC64)MAPFILE.NGB_sparcv9= \ 760 $(SRC)/common/mapfiles/gen/sparcv9_gcc_map.noexeglobs 761MAPFILE.NGB_i386= $(SRC)/common/mapfiles/gen/i386_cc_map.noexeglobs 762$(__GNUC64)MAPFILE.NGB_i386= \ 763 $(SRC)/common/mapfiles/gen/i386_gcc_map.noexeglobs 764MAPFILE.NGB_amd64= $(SRC)/common/mapfiles/gen/amd64_cc_map.noexeglobs 765$(__GNUC64)MAPFILE.NGB_amd64= \ 766 $(SRC)/common/mapfiles/gen/amd64_gcc_map.noexeglobs 767MAPFILE.NGB = $(MAPFILE.NGB_$(MACH)) 768 769# 770# A generic interface mapfile name, used by various dynamic objects to define 771# the interfaces and interposers the object must export. 772# 773MAPFILE.INT = mapfile-intf 774 775# 776# LDLIBS32 and LDLIBS64 can be set in the environment to override the following 777# assignments. 778# 779# These environment settings make sure that no libraries are searched outside 780# of the local workspace proto area: 781# LDLIBS32=-YP,$ROOT/lib:$ROOT/usr/lib 782# LDLIBS64=-YP,$ROOT/lib/$MACH64:$ROOT/usr/lib/$MACH64 783# 784LDLIBS32 = $(ENVLDLIBS1) $(ENVLDLIBS2) $(ENVLDLIBS3) 785LDLIBS32 += $(ADJUNCT_PROTO:%=-L%/usr/lib -L%/lib) 786LDLIBS.cmd = $(LDLIBS32) 787LDLIBS.lib = $(LDLIBS32) 788 789LDLIBS64 = $(ENVLDLIBS1:%=%/$(MACH64)) \ 790 $(ENVLDLIBS2:%=%/$(MACH64)) \ 791 $(ENVLDLIBS3:%=%/$(MACH64)) 792LDLIBS64 += $(ADJUNCT_PROTO:%=-L%/usr/lib/$(MACH64) -L%/lib/$(MACH64)) 793 794# 795# Define compilation macros. 796# 797COMPILE.c= $(CC) $(CFLAGS) $(CPPFLAGS) -c 798COMPILE64.c= $(CC) $(CFLAGS64) $(CPPFLAGS) -c 799COMPILE.cc= $(CCC) $(CCFLAGS) $(CPPFLAGS) -c 800COMPILE64.cc= $(CCC) $(CCFLAGS64) $(CPPFLAGS) -c 801COMPILE.s= $(AS) $(ASFLAGS) $(AS_CPPFLAGS) 802COMPILE64.s= $(AS) $(ASFLAGS) $($(MACH64)_AS_XARCH) $(AS_CPPFLAGS) 803COMPILE.d= $(DTRACE) -G -32 804COMPILE64.d= $(DTRACE) -G -64 805COMPILE.b= $(ELFWRAP) $(ELFWRAP_FLAGS$(CLASS)) 806COMPILE64.b= $(ELFWRAP) $(ELFWRAP_FLAGS$(CLASS)) 807 808CLASSPATH= . 809COMPILE.java= $(JAVAC) $(JAVAFLAGS) -classpath $(CLASSPATH) 810 811# 812# Link time macros 813# 814CCNEEDED = -lC 815CCEXTNEEDED = -lCrun -lCstd 816NATIVECCNEEDED = -lC 817$(__GNUC)CCNEEDED = -L$(GCCLIBDIR) -lstdc++ -lgcc_s 818$(__GNUC)CCEXTNEEDED = $(CCNEEDED) 819$(__GNUC)NATIVECCNEEDED = -R$(GCCLIBDIR) -L$(GCCLIBDIR) -lstdc++ -lgcc_s 820 821CCNEEDED64 = -lCrun 822CCEXTNEEDED64 = -lCrun -lCstd 823NATIVECCNEEDED64 = -lCrun 824$(__GNUC64)CCNEEDED64 = -L$(GCCLIBDIR) -lstdc++ -lgcc_s 825$(__GNUC64)NATIVECCNEEDED64 = -R$(GCCLIBDIR) -L$(GCCLIBDIR) -lstdc++ -lgcc_s 826$(__GNUC64)CCEXTNEEDED = $(CCNEEDED64) 827 828# Libraries we expect to use natively on the build machine 829NATIVE_LIBS= 830 831LDCHECKS = $(ZASSERTDEFLIB) $(ZGUIDANCE) $(ZFATALWARNINGS) 832LDCHECKS += $(NATIVE_LIBS:%=$(ZASSERTDEFLIB)=%) 833 834LINK.c= $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LDCHECKS) 835LINK64.c= $(CC) $(CFLAGS64) $(CPPFLAGS) $(LDFLAGS) $(LDCHECKS) 836NORUNPATH= -norunpath -nolib 837LINK.cc= $(CCC) $(CCFLAGS) $(CPPFLAGS) $(NORUNPATH) \ 838 $(LDFLAGS) $(CCNEEDED) $(LDCHECKS) 839LINK64.cc= $(CCC) $(CCFLAGS64) $(CPPFLAGS) $(NORUNPATH) \ 840 $(LDFLAGS) $(CCNEEDED64) $(LDCHECKS) 841 842# 843# lint macros 844# 845# Note that the undefine of __PRAGMA_REDEFINE_EXTNAME can be removed once 846# ON is built with a version of lint that has the fix for 4484186. 847# 848ALWAYS_LINT_DEFS = -errtags=yes -s 849ALWAYS_LINT_DEFS += -erroff=E_PTRDIFF_OVERFLOW 850ALWAYS_LINT_DEFS += -erroff=E_ASSIGN_NARROW_CONV 851ALWAYS_LINT_DEFS += -U__PRAGMA_REDEFINE_EXTNAME 852ALWAYS_LINT_DEFS += $(C99LMODE) 853ALWAYS_LINT_DEFS += -errsecurity=$(SECLEVEL) 854ALWAYS_LINT_DEFS += -erroff=E_SEC_CREAT_WITHOUT_EXCL 855ALWAYS_LINT_DEFS += -erroff=E_SEC_FORBIDDEN_WARN_CREAT 856# XX64 -- really only needed for amd64 lint 857ALWAYS_LINT_DEFS += -erroff=E_ASSIGN_INT_TO_SMALL_INT 858ALWAYS_LINT_DEFS += -erroff=E_CAST_INT_CONST_TO_SMALL_INT 859ALWAYS_LINT_DEFS += -erroff=E_CAST_INT_TO_SMALL_INT 860ALWAYS_LINT_DEFS += -erroff=E_CAST_TO_PTR_FROM_INT 861ALWAYS_LINT_DEFS += -erroff=E_COMP_INT_WITH_LARGE_INT 862ALWAYS_LINT_DEFS += -erroff=E_INTEGRAL_CONST_EXP_EXPECTED 863ALWAYS_LINT_DEFS += -erroff=E_PASS_INT_TO_SMALL_INT 864ALWAYS_LINT_DEFS += -erroff=E_PTR_CONV_LOSES_BITS 865 866# This forces lint to pick up note.h and sys/note.h from Devpro rather than 867# from the proto area. The note.h that ON delivers would disable NOTE(). 868ONLY_LINT_DEFS = -I$(SPRO_VROOT)/prod/include/lint 869 870SECLEVEL= core 871LINT.c= $(LINT) $(ONLY_LINT_DEFS) $(LINTFLAGS) $(CPPFLAGS) \ 872 $(ALWAYS_LINT_DEFS) 873LINT64.c= $(LINT) $(ONLY_LINT_DEFS) $(LINTFLAGS64) $(CPPFLAGS) \ 874 $(ALWAYS_LINT_DEFS) 875LINT.s= $(LINT.c) 876 877# For some future builds, NATIVE_MACH and MACH might be different. 878# Therefore, NATIVE_MACH needs to be redefined in the 879# environment as `uname -p` to override this macro. 880# 881# For now at least, we cross-compile amd64 on i386 machines. 882NATIVE_MACH= $(MACH:amd64=i386) 883NATIVE_MACH64= $(MACH64) 884 885# Define native compilation macros 886# 887 888# Base directory where compilers are loaded. 889# Defined here so it can be overridden by developer. 890# 891SPRO_ROOT= $(BUILD_TOOLS)/SUNWspro 892SPRO_VROOT= $(SPRO_ROOT)/SS12 893GNU_ROOT= /usr 894 895$(__GNUC)PRIMARY_CC= gcc7,$(GNUC_ROOT)/bin/gcc,gnu 896$(__SUNC)PRIMARY_CC= studio12,$(SPRO_VROOT)/bin/cc,sun 897$(__GNUC)PRIMARY_CCC= gcc7,$(GNUC_ROOT)/bin/g++,gnu 898$(__SUNC)PRIMARY_CCC= studio12,$(SPRO_VROOT)/bin/CC,sun 899 900CW_CC_COMPILERS= $(PRIMARY_CC:%=--primary %) $(SHADOW_CCS:%=--shadow %) 901CW_CCC_COMPILERS= $(PRIMARY_CCC:%=--primary %) $(SHADOW_CCCS:%=--shadow %) 902 903CW_LINKER= --linker $(LD) 904 905# Till SS12u1 formally becomes the NV CBE, LINT is hard 906# coded to be picked up from the $SPRO_ROOT/sunstudio12.1/ 907# location. Impacted variables are sparc_LINT, sparcv9_LINT, 908# i386_LINT, amd64_LINT. 909# Reset them when SS12u1 is rolled out. 910# 911 912# Specify platform compiler versions for languages 913# that we use (currently only c and c++). 914# 915CW= $(ONBLD_TOOLS)/bin/$(MACH)/cw 916 917BUILD_CC= $(CW) $(CW_LINKER) $(CW_CC_COMPILERS) -- 918BUILD_CCC= $(CW) -C $(CW_LINKER) $(CW_CCC_COMPILERS) -- 919BUILD_CPP= /usr/ccs/lib/cpp 920BUILD_LD= $(ONBLD_TOOLS)/bin/$(MACH)/ld 921BUILD_LINT= $(SPRO_ROOT)/sunstudio12.1/bin/lint 922 923$(MACH)_CC= $(BUILD_CC) 924$(MACH)_CCC= $(BUILD_CCC) 925$(MACH)_CPP= $(BUILD_CPP) 926$(MACH)_LD= $(BUILD_LD) 927$(MACH)_LINT= $(BUILD_LINT) 928$(MACH64)_CC= $(BUILD_CC) 929$(MACH64)_CCC= $(BUILD_CCC) 930$(MACH64)_CPP= $(BUILD_CPP) 931$(MACH64)_LD= $(BUILD_LD) 932$(MACH64)_LINT= $(BUILD_LINT) 933 934sparc_AS= /usr/ccs/bin/as -xregsym=no 935sparcv9_AS= $($(MACH)_AS) 936 937i386_AS= /usr/ccs/bin/as 938$(__GNUC)i386_AS= $(ONBLD_TOOLS)/bin/$(MACH)/aw 939amd64_AS= $(ONBLD_TOOLS)/bin/$(MACH)/aw 940 941NATIVECC= $($(NATIVE_MACH)_CC) 942NATIVECCC= $($(NATIVE_MACH)_CCC) 943NATIVECPP= $($(NATIVE_MACH)_CPP) 944NATIVEAS= $($(NATIVE_MACH)_AS) 945NATIVELD= $($(NATIVE_MACH)_LD) 946NATIVELINT= $($(NATIVE_MACH)_LINT) 947 948NATIVECC64= $($(NATIVE_MACH64)_CC) 949NATIVECCC64= $($(NATIVE_MACH64)_CCC) 950NATIVECPP64= $($(NATIVE_MACH64)_CPP) 951NATIVEAS64= $($(NATIVE_MACH64)_AS) 952NATIVELD64= $($(NATIVE_MACH64)_LD) 953NATIVELINT64= $($(NATIVE_MACH64)_LINT) 954 955# 956# Makefile.master.64 overrides these settings 957# 958CC= $(NATIVECC) 959CCC= $(NATIVECCC) 960CPP= $(NATIVECPP) 961AS= $(NATIVEAS) 962LD= $(NATIVELD) 963LINT= $(NATIVELINT) 964 965CC64= $(NATIVECC64) 966CCC64= $(NATIVECCC64) 967CPP64= $(NATIVECPP64) 968AS64= $(NATIVEAS64) 969LD64= $(NATIVELD64) 970LINT64= $(NATIVELINT64) 971 972# Pass -Y flag to cpp (method of which is release-dependent) 973CCYFLAG= -Y I, 974 975BDIRECT= -Bdirect 976BDYNAMIC= -Bdynamic 977BLOCAL= -Blocal 978BNODIRECT= -Bnodirect 979BREDUCE= -Breduce 980BSTATIC= -Bstatic 981 982ZDEFS= -zdefs 983ZDIRECT= -zdirect 984ZIGNORE= -zignore 985ZINITFIRST= -zinitfirst 986ZINTERPOSE= -zinterpose 987ZLAZYLOAD= -zlazyload 988ZLOADFLTR= -zloadfltr 989ZMULDEFS= -zmuldefs 990ZNODEFAULTLIB= -znodefaultlib 991ZNODEFS= -znodefs 992ZNODELETE= -znodelete 993ZNODLOPEN= -znodlopen 994ZNODUMP= -znodump 995ZNOLAZYLOAD= -znolazyload 996ZNOLDYNSYM= -znoldynsym 997ZNORELOC= -znoreloc 998ZNOVERSION= -znoversion 999ZRECORD= -zrecord 1000ZREDLOCSYM= -zredlocsym 1001ZTEXT= -ztext 1002ZVERBOSE= -zverbose 1003ZASSERTDEFLIB= -zassert-deflib 1004ZGUIDANCE= -zguidance 1005ZFATALWARNINGS= -zfatal-warnings 1006 1007GSHARED= -G 1008CCMT= -mt 1009 1010# Handle different PIC models on different ISAs 1011# (May be overridden by lower-level Makefiles) 1012 1013sparc_C_PICFLAGS = -fpic 1014sparcv9_C_PICFLAGS = -fpic 1015i386_C_PICFLAGS = -fpic 1016amd64_C_PICFLAGS = -fpic 1017C_PICFLAGS = $($(MACH)_C_PICFLAGS) 1018C_PICFLAGS64 = $($(MACH64)_C_PICFLAGS) 1019 1020sparc_C_BIGPICFLAGS = -fPIC 1021sparcv9_C_BIGPICFLAGS = -fPIC 1022i386_C_BIGPICFLAGS = -fPIC 1023amd64_C_BIGPICFLAGS = -fPIC 1024C_BIGPICFLAGS = $($(MACH)_C_BIGPICFLAGS) 1025C_BIGPICFLAGS64 = $($(MACH64)_C_BIGPICFLAGS) 1026 1027# CC requires there to be no space between '-K' and 'pic' or 'PIC'. 1028# and does not support -f 1029sparc_CC_PICFLAGS = -_cc=-Kpic -_gcc=-fpic 1030sparcv9_CC_PICFLAGS = -_cc=-KPIC -_gcc=-fPIC 1031i386_CC_PICFLAGS = -_cc=-Kpic -_gcc=-fpic 1032amd64_CC_PICFLAGS = -_cc=-Kpic -_gcc=-fpic 1033CC_PICFLAGS = $($(MACH)_CC_PICFLAGS) 1034CC_PICFLAGS64 = $($(MACH64)_CC_PICFLAGS) 1035 1036AS_PICFLAGS= -K pic 1037AS_BIGPICFLAGS= -K PIC 1038 1039# 1040# Default label for CTF sections 1041# 1042CTFCVTFLAGS= -L VERSION 1043 1044# 1045# Override to pass module-specific flags to ctfmerge. Currently used only by 1046# krtld to turn on fuzzy matching, and source-level debugging to inhibit 1047# stripping. 1048# 1049CTFMRGFLAGS= 1050 1051CTFCONVERT_O = $(CTFCONVERT) $(CTFCVTFLAGS) $@ 1052 1053# Rules (normally from make.rules) and macros which are used for post 1054# processing files. Normally, these do stripping of the comment section 1055# automatically. 1056# RELEASE_CM: Should be edited to reflect the release. 1057# POST_PROCESS_O: Post-processing for `.o' files (typically C source) 1058# POST_PROCESS_S_O: Post-processing for `.o' files built from asssembly 1059# POST_PROCESS_CC_O: Post-processing for `.o' files built from C++ 1060# POST_PROCESS_A: Post-processing for `.a' files (currently null). 1061# POST_PROCESS_SO: Post-processing for `.so' files. 1062# POST_PROCESS: Post-processing for executable files (no suffix). 1063# 1064# Note that these macros are not completely generalized as they are to be 1065# used with the file name to be processed following. 1066# 1067# It is left as an exercise to Release Engineering to embellish the generation 1068# of the release comment string. 1069# 1070# If this is a standard development build: 1071# compress the comment section (mcs -c) 1072# add the standard comment (mcs -a $(RELEASE_CM)) 1073# add the development specific comment (mcs -a $(DEV_CM)) 1074# 1075# If this is an installation build: 1076# delete the comment section (mcs -d) 1077# add the standard comment (mcs -a $(RELEASE_CM)) 1078# add the development specific comment (mcs -a $(DEV_CM)) 1079# 1080# If this is an release build: 1081# delete the comment section (mcs -d) 1082# add the standard comment (mcs -a $(RELEASE_CM)) 1083# 1084# The following list of macros are used in the definition of RELEASE_CM 1085# which is used to label all binaries in the build: 1086# 1087# RELEASE Specific release of the build, eg: 5.2 1088# RELEASE_MAJOR Major version number part of $(RELEASE) 1089# RELEASE_MINOR Minor version number part of $(RELEASE) 1090# VERSION Version of the build (alpha, beta, Generic) 1091# PATCHID If this is a patch this value should contain 1092# the patchid value (eg: "Generic 100832-01"), otherwise 1093# it will be set to $(VERSION) 1094# RELEASE_DATE Date of the Release Build 1095# PATCH_DATE Date the patch was created, if this is blank it 1096# will default to the RELEASE_DATE 1097# 1098RELEASE_MAJOR= 5 1099RELEASE_MINOR= 11 1100RELEASE= $(RELEASE_MAJOR).$(RELEASE_MINOR) 1101VERSION= SunOS Development 1102PATCHID= $(VERSION) 1103RELEASE_DATE= release date not set 1104PATCH_DATE= $(RELEASE_DATE) 1105RELEASE_CM= "@($(POUND_SIGN))SunOS $(RELEASE) $(PATCHID) $(PATCH_DATE)" 1106DEV_CM= "@($(POUND_SIGN))SunOS Internal Development: non-nightly build" 1107UTS_LABEL= $(RELEASE) 1108 1109PROCESS_COMMENT= @?${MCS} -d -a $(RELEASE_CM) -a $(DEV_CM) 1110$(RELEASE_BUILD)PROCESS_COMMENT= @?${MCS} -d -a $(RELEASE_CM) 1111 1112STRIP_STABS= $(STRIP) -x $@ 1113$(SRCDBGBLD)STRIP_STABS= : 1114 1115POST_PROCESS_O= 1116POST_PROCESS_S_O= 1117POST_PROCESS_CC_O= 1118POST_PROCESS_A= 1119POST_PROCESS_SO= $(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \ 1120 $(ELFSIGN_OBJECT) 1121POST_PROCESS= $(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \ 1122 $(ELFSIGN_OBJECT) 1123 1124# 1125# chk4ubin is a tool that inspects a module for a symbol table 1126# ELF section size which can trigger an OBP bug on older platforms. 1127# This problem affects only specific sun4u bootable modules. 1128# 1129CHK4UBIN= $(ONBLD_TOOLS)/bin/$(MACH)/chk4ubin 1130CHK4UBINFLAGS= 1131CHK4UBINARY= $(CHK4UBIN) $(CHK4UBINFLAGS) $@ 1132 1133# 1134# PKGARCHIVE specifies the default location where packages should be 1135# placed if built. 1136# 1137$(RELEASE_BUILD)PKGARCHIVESUFFIX= -nd 1138PKGARCHIVE=$(SRC)/../../packages/$(MACH)/nightly$(PKGARCHIVESUFFIX) 1139 1140# 1141# The repositories will be created with these publisher settings. To 1142# update an image to the resulting repositories, this must match the 1143# publisher name provided to "pkg set-publisher." 1144# 1145PKGPUBLISHER_REDIST= on-nightly 1146PKGPUBLISHER_NONREDIST= on-extra 1147 1148# Default build rules which perform comment section post-processing. 1149# 1150.c: 1151 $(LINK.c) -o $@ $< $(LDLIBS) 1152 $(POST_PROCESS) 1153.c.o: 1154 $(COMPILE.c) $(OUTPUT_OPTION) $< $(CTFCONVERT_HOOK) 1155 $(POST_PROCESS_O) 1156.c.a: 1157 $(COMPILE.c) -o $% $< 1158 $(PROCESS_COMMENT) $% 1159 $(AR) $(ARFLAGS) $@ $% 1160 $(RM) $% 1161.s.o: 1162 $(COMPILE.s) -o $@ $< 1163 $(POST_PROCESS_S_O) 1164.s.a: 1165 $(COMPILE.s) -o $% $< 1166 $(PROCESS_COMMENT) $% 1167 $(AR) $(ARFLAGS) $@ $% 1168 $(RM) $% 1169.cc: 1170 $(LINK.cc) -o $@ $< $(LDLIBS) 1171 $(POST_PROCESS) 1172.cc.o: 1173 $(COMPILE.cc) $(OUTPUT_OPTION) $< 1174 $(POST_PROCESS_CC_O) 1175.cc.a: 1176 $(COMPILE.cc) -o $% $< 1177 $(AR) $(ARFLAGS) $@ $% 1178 $(PROCESS_COMMENT) $% 1179 $(RM) $% 1180.y: 1181 $(YACC.y) $< 1182 $(LINK.c) -o $@ y.tab.c $(LDLIBS) 1183 $(POST_PROCESS) 1184 $(RM) y.tab.c 1185.y.o: 1186 $(YACC.y) $< 1187 $(COMPILE.c) -o $@ y.tab.c $(CTFCONVERT_HOOK) 1188 $(POST_PROCESS_O) 1189 $(RM) y.tab.c 1190.l: 1191 $(RM) $*.c 1192 $(LEX.l) $< > $*.c 1193 $(LINK.c) -o $@ $*.c -ll $(LDLIBS) 1194 $(POST_PROCESS) 1195 $(RM) $*.c 1196.l.o: 1197 $(RM) $*.c 1198 $(LEX.l) $< > $*.c 1199 $(COMPILE.c) -o $@ $*.c $(CTFCONVERT_HOOK) 1200 $(POST_PROCESS_O) 1201 $(RM) $*.c 1202 1203.bin.o: 1204 $(COMPILE.b) -o $@ $< 1205 $(POST_PROCESS_O) 1206 1207.java.class: 1208 $(COMPILE.java) $< 1209 1210# Bourne and Korn shell script message catalog build rules. 1211# We extract all gettext strings with sed(1) (being careful to permit 1212# multiple gettext strings on the same line), weed out the dups, and 1213# build the catalogue with awk(1). 1214 1215.sh.po .ksh.po: 1216 $(SED) -n -e ":a" \ 1217 -e "h" \ 1218 -e "s/.*gettext *\(\"[^\"]*\"\).*/\1/p" \ 1219 -e "x" \ 1220 -e "s/\(.*\)gettext *\"[^\"]*\"\(.*\)/\1\2/" \ 1221 -e "t a" \ 1222 $< | sort -u | $(AWK) '{ print "msgid\t" $$0 "\nmsgstr" }' > $@ 1223 1224# 1225# Python and Perl executable and message catalog build rules. 1226# 1227.SUFFIXES: .pl .pm .py .pyc 1228 1229.pl: 1230 $(RM) $@; 1231 $(SED) -e "s@TEXT_DOMAIN@\"$(TEXT_DOMAIN)\"@" $< > $@; 1232 $(CHMOD) +x $@ 1233 1234.py: 1235 $(RM) $@; $(SED) \ 1236 -e "1s:^\#!@PYTHON@:\#!$(PYSHEBANG):" \ 1237 -e "1s:^\#!@TOOLS_PYTHON@:\#!$(TOOLS_PYTHON):" \ 1238 < $< > $@; $(CHMOD) +x $@ 1239 1240.py.pyc: 1241 $(RM) $@ 1242 $(PYTHON) -mpy_compile $< 1243 @[ $(<)c = $@ ] || $(MV) $(<)c $@ 1244 1245.py.po: 1246 $(GNUXGETTEXT) $(GNUXGETFLAGS) -d $(<F:%.py=%) $< ; 1247 1248.pl.po .pm.po: 1249 $(XGETTEXT) $(XGETFLAGS) -d $(<F) $< ; 1250 $(RM) $@ ; 1251 $(SED) "/^domain/d" < $(<F).po > $@ ; 1252 $(RM) $(<F).po 1253 1254# 1255# When using xgettext, we want messages to go to the default domain, 1256# rather than the specified one. This special version of the 1257# COMPILE.cpp macro effectively prevents expansion of TEXT_DOMAIN, 1258# causing xgettext to put all messages into the default domain. 1259# 1260CPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN) 1261 1262.c.i: 1263 $(CPPFORPO) $< > $@ 1264 1265.h.i: 1266 $(CPPFORPO) $< > $@ 1267 1268.y.i: 1269 $(YACC) -d $< 1270 $(CPPFORPO) y.tab.c > $@ 1271 $(RM) y.tab.c 1272 1273.l.i: 1274 $(LEX) $< 1275 $(CPPFORPO) lex.yy.c > $@ 1276 $(RM) lex.yy.c 1277 1278.c.po: 1279 $(CPPFORPO) $< > $<.i 1280 $(BUILD.po) 1281 1282.cc.po: 1283 $(CPPFORPO) $< > $<.i 1284 $(BUILD.po) 1285 1286.y.po: 1287 $(YACC) -d $< 1288 $(CPPFORPO) y.tab.c > $<.i 1289 $(BUILD.po) 1290 $(RM) y.tab.c 1291 1292.l.po: 1293 $(LEX) $< 1294 $(CPPFORPO) lex.yy.c > $<.i 1295 $(BUILD.po) 1296 $(RM) lex.yy.c 1297 1298# 1299# Rules to perform stylistic checks 1300# 1301.SUFFIXES: .x .xml .check .xmlchk 1302 1303.h.check: 1304 $(DOT_H_CHECK) 1305 1306.x.check: 1307 $(DOT_X_CHECK) 1308 1309.xml.xmlchk: 1310 $(MANIFEST_CHECK) 1311