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