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