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