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 2007 Sun Microsystems, Inc. All rights reserved. 24# Use is subject to license terms. 25# 26# ident "%Z%%M% %I% %E% SMI" 27# 28 29# 30# Makefile.master, global definitions for system source 31# 32ROOT= /proto 33 34# Historically, ON builds were always done with root permissions, and the 35# owner/group information was duplicated in the Makefiles and the packaging 36# data and kept in sync by manual intervention. This is no longer true. 37# The only source of this information is packaging. The proto area ($ROOT) 38# does not have definitive onwer/group information, and no Makefile should 39# attempt to set this. CH once toggled operations restricted to root. It 40# is now just set to `#'. 41# 42# At some point in the future, CH, CHOWN, CHGRP, OWNER, and GROUP should all 43# be stripped completely from the source base. They are kept for now until 44# on10-based projects can merge and transition away from them. 45# 46# RELEASE_BUILD should be cleared for final release builds. This is completely 47# independent of CH. NOT_RELEASE_BUILD is exactly what the name implies. 48# 49# INTERNAL_RELEASE_BUILD is a subset of RELEASE_BUILD. It mostly controls 50# identification strings. Enabling RELEASE_BUILD automatically enables 51# INTERNAL_RELEASE_BUILD. 52# 53# EXPORT_RELEASE_BUILD controls whether binaries are built in a form that 54# can be released for export under a binary license. It is orthogonal to 55# the other *RELEASE_BUILD settings. ("#" means do an export release 56# build, "" means do a normal build.) 57# 58# CLOSED_BUILD controls whether we try to build files under 59# usr/closed. ("" means to build closed code, "#" means don't try to 60# build it.) Skipping the closed code implies doing an export release 61# build. 62# 63# STRIP_COMMENTS toggles comment section striping. Generally the same setting 64# as INTERNAL_RELEASE_BUILD. 65# 66# __GNUC toggles the building of ON components using gcc and related tools. 67# Normally set to `#', set it to `' to do gcc build. 68# 69# The declaration POUND_SIGN is always '#'. This is needed to get around the 70# make feature that '#' is always a comment delimiter, even when escaped or 71# quoted. The only way of generating this is the :sh macro mechanism. Note 72# however that in general :sh macros should be avoided in makefiles that are 73# widely included into other makefiles, as the resulting shell executions can 74# cause a noticable slowdown in build times. 75# 76POUND_SIGN:sh= echo \\043 77CH= $(POUND_SIGN) 78 79NOT_RELEASE_BUILD= 80INTERNAL_RELEASE_BUILD= $(POUND_SIGN) 81RELEASE_BUILD= $(POUND_SIGN) 82$(RELEASE_BUILD)NOT_RELEASE_BUILD= $(POUND_SIGN) 83$(RELEASE_BUILD)INTERNAL_RELEASE_BUILD= 84PATCH_BUILD= $(POUND_SIGN) 85 86# If CLOSED_IS_PRESENT is not set, assume the closed tree is present. 87CLOSED_BUILD_1= $(CLOSED_IS_PRESENT:yes=) 88CLOSED_BUILD= $(CLOSED_BUILD_1:no=$(POUND_SIGN)) 89 90EXPORT_RELEASE_BUILD= $(POUND_SIGN) 91$(CLOSED_BUILD)EXPORT_RELEASE_BUILD= 92 93# SPARC_BLD is '#' for an Intel build. 94# INTEL_BLD is '#' for a Sparc build. 95SPARC_BLD_1= $(MACH:i386=$(POUND_SIGN)) 96SPARC_BLD= $(SPARC_BLD_1:sparc=) 97INTEL_BLD_1= $(MACH:sparc=$(POUND_SIGN)) 98INTEL_BLD= $(INTEL_BLD_1:i386=) 99 100STRIP_COMMENTS= $(INTERNAL_RELEASE_BUILD) 101 102# set __GNUC= in the environment to build 32-bit with the gcc compiler. 103# The default is to use the Sun Studio compiler for all processor types. 104__GNUC= $(POUND_SIGN) 105 106# set __GNUC64= in the environment to build 64-bit with the gcc compiler. 107# Inherit the __GNUC value by default, and if that is set to $(POUND_SIGN) 108# then this means use the Sun Studio compiler. 109__GNUC64= $(__GNUC) 110 111# set __SSNEXT= in the enviroment to build with the 'next' release of 112# the Sun Studio compiler. This will cause command line options specific 113# to the 'next' version of the Sun Studio compiler to be used. 114__SSNEXT= $(POUND_SIGN) 115 116# CLOSED is the root of the tree that contains source which isn't released 117# as open source 118CLOSED= $(SRC)/../closed 119 120# BUILD_TOOLS is the root of all tools including compilers. 121# ONBLD_TOOLS is the root of all the tools that are part of SUNWonbld. 122 123BUILD_TOOLS= /ws/onnv-tools 124ONBLD_TOOLS= $(BUILD_TOOLS)/onbld 125 126JAVA_ROOT= /usr/java 127 128SFW_ROOT= /usr/sfw 129SFWINCDIR= $(SFW_ROOT)/include 130SFWLIBDIR= $(SFW_ROOT)/lib 131SFWLIBDIR64= $(SFW_ROOT)/lib/$(MACH64) 132 133RPCGEN= /usr/bin/rpcgen 134STABS= $(ONBLD_TOOLS)/bin/$(MACH)/stabs 135ELFEXTRACT= $(ONBLD_TOOLS)/bin/$(MACH)/elfextract 136MBH_PATCH= $(ONBLD_TOOLS)/bin/$(MACH)/mbh_patch 137ECHO= echo 138INS= install 139TRUE= true 140SYMLINK= /usr/bin/ln -s 141LN= /usr/bin/ln 142CHMOD= /usr/bin/chmod 143CHOWN= $(TRUE) 144CHGRP= $(TRUE) 145MV= /usr/bin/mv -f 146RM= /usr/bin/rm -f 147CUT= /usr/bin/cut 148NM= /usr/ccs/bin/nm 149DIFF= /usr/bin/diff 150GREP= /usr/bin/grep 151EGREP= /usr/bin/egrep 152SED= /usr/bin/sed 153NAWK= /usr/bin/nawk 154CP= /usr/bin/cp -f 155MCS= /usr/ccs/bin/mcs 156CAT= /usr/bin/cat 157M4= /usr/ccs/bin/m4 158STRIP= /usr/ccs/bin/strip 159LEX= /usr/ccs/bin/lex 160YACC= /usr/ccs/bin/yacc 161CPP= /usr/lib/cpp 162JAVAC= $(JAVA_ROOT)/bin/javac 163JAVAH= $(JAVA_ROOT)/bin/javah 164JAVADOC= $(JAVA_ROOT)/bin/javadoc 165RMIC= $(JAVA_ROOT)/bin/rmic 166JAR= $(JAVA_ROOT)/bin/jar 167CTFCONVERT= $(ONBLD_TOOLS)/bin/$(MACH)/ctfconvert 168CTFMERGE= $(ONBLD_TOOLS)/bin/$(MACH)/ctfmerge 169CTFSTABS= $(ONBLD_TOOLS)/bin/$(MACH)/ctfstabs 170GENOFFSETS= $(ONBLD_TOOLS)/bin/genoffsets 171CTFCVTPTBL= $(ONBLD_TOOLS)/bin/ctfcvtptbl 172CTFFINDMOD= $(ONBLD_TOOLS)/bin/ctffindmod 173XREF= $(ONBLD_TOOLS)/bin/xref 174FIND= /usr/bin/find 175PERL= /usr/bin/perl 176SORT= /usr/bin/sort 177TOUCH= /usr/bin/touch 178WC= /usr/bin/wc 179XARGS= /usr/bin/xargs 180ELFSIGN= /usr/bin/elfsign 181DTRACE= /usr/sbin/dtrace 182CHECK_FNAMES= $(ONBLD_TOOLS)/bin/check_fnames 183 184# Due to 6367203, objects built with gcc will fail the namespace checks. 185# Remove this override once the compiler bug is fixed. 186$(__GNUC)CHECK_FNAMES= $(TRUE) 187 188FILEMODE= 644 189DIRMODE= 755 190 191# Note: owner and group for proto area objects is no longer set by 192# Makefiles at all. These have no real effect and are kept here for 193# transition purposes. They (along with CH, CHOWN, and CHGRP) should be 194# removed early in the s11 development cycle. 195OWNER= root 196GROUP= bin 197 198# 199# The version of the patch makeup table optimized for build-time use. Used 200# during patch builds only. 201$(PATCH_BUILD)PMTMO_FILE=$(SRC)/patch_makeup_table.mo 202 203# Declare that nothing should be built in parallel. 204# Individual Makefiles can use the .PARALLEL target to declare otherwise. 205.NO_PARALLEL: 206 207# For stylistic checks 208# 209# Note that the X and C checks are not used at this time and may need 210# modification when they are actually used. 211# 212CSTYLE= cstyle 213CSTYLE_TAIL= 214HDRCHK= hdrchk 215HDRCHK_TAIL= 216JSTYLE= jstyle 217 218DOT_H_CHECK= \ 219 @$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL); \ 220 $(HDRCHK) $< $(HDRCHK_TAIL) 221 222DOT_X_CHECK= \ 223 @$(ECHO) "checking $<"; $(RPCGEN) -C -h $< | $(CSTYLE) $(CSTYLE_TAIL); \ 224 $(RPCGEN) -C -h $< | $(HDRCHK) $< $(HDRCHK_TAIL) 225 226DOT_C_CHECK= \ 227 @$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL) 228 229MANIFEST_CHECK= \ 230 @$(ECHO) "checking $<"; \ 231 SVCCFG_DTD=$(SRC)/cmd/svc/dtd/service_bundle.dtd.1 \ 232 $(SRC)/cmd/svc/svccfg/svccfg-native validate $< 233 234INS.file= $(RM) $@; $(INS) -s -m $(FILEMODE) -f $(@D) $< 235INS.dir= $(INS) -s -d -m $(DIRMODE) $@ 236# installs and renames at once 237# 238INS.rename= $(INS.file); $(MV) $(@D)/$(<F) $@ 239 240# install a link 241INSLINKTARGET= $< 242INS.link= $(RM) $@; $(LN) $(INSLINKTARGET) $@ 243 244# MACH must be set in the shell environment per uname -p on the build host 245# More specific architecture variables should be set in lower makefiles. 246# 247# MACH64 is derived from MACH, and BUILD64 is set to `#' for 248# architectures on which we do not build 64-bit versions. 249# (There are no such architectures at the moment.) 250# 251# Set BUILD64=# in the environment to disable 64-bit amd64 252# builds on i386 machines. 253 254MACH64_1= $(MACH:sparc=sparcv9) 255MACH64= $(MACH64_1:i386=amd64) 256 257MACH32_1= $(MACH:sparc=sparcv7) 258MACH32= $(MACH32_1:i386=i86) 259 260sparc_BUILD64= 261i386_BUILD64= 262BUILD64= $($(MACH)_BUILD64) 263 264# 265# C compiler mode. Future compilers may change the default on us, 266# so force extended ANSI mode globally. Lower level makefiles can 267# override this by setting CCMODE. 268# 269CCMODE= -Xa 270CCMODE64= -Xa 271 272# 273# C compiler verbose mode. This is so we can enable it globally, 274# but turn it off in the lower level makefiles of things we cannot 275# (or aren't going to) fix. 276# 277CCVERBOSE= -v 278 279# set this to the secret flag "-Wc,-Qiselect-v9abiwarn=1" to get warnings 280# from the compiler about places the -xarch=v9 may differ from -xarch=v9c. 281V9ABIWARN= 282 283# set this to the secret flag "-Wc,-Qiselect-regsym=0" to disable register 284# symbols (used to detect conflicts between objects that use global registers) 285# we disable this now for safety, and because genunix doesn't link with 286# this feature (the v9 default) enabled. 287# 288# REGSYM is separate since the C++ driver syntax is different. 289CCREGSYM= -Wc,-Qiselect-regsym=0 290CCCREGSYM= -Qoption cg -Qiselect-regsym=0 291 292# Prevent the removal of static symbols by the SPARC code generator (cg). 293# The x86 code generator (ube) does not remove such symbols and as such 294# using this workaround is not applicable for x86. 295# 296CCSTATICSYM= -Wc,-Qassembler-ounrefsym=0 297# 298# generate 32-bit addresses in the v9 kernel. Saves memory. 299CCABS32= -Wc,-xcode=abs32 300 301# One optimization the compiler might perform is to turn this: 302# #pragma weak foo 303# extern int foo; 304# if (&foo) 305# foo = 5; 306# into 307# foo = 5; 308# Since we do some of this (foo might be referenced in common kernel code 309# but provided only for some cpu modules or platforms), we disable this 310# optimization. 311# 312sparc_CCUNBOUND = -Wd,-xsafe=unboundsym 313i386_CCUNBOUND = 314CCUNBOUND = $($(MACH)_CCUNBOUND) 315 316# 317# compiler '-xarch' flag. This is here to centralize it and make it 318# overridable for testing. 319sparc_XARCH= -xarch=v8 320sparcv9_XARCH= -xarch=v9 321i386_XARCH= 322amd64_XARCH= -xarch=amd64 -Ui386 -U__i386 323 324# assembler '-xarch' flag. Different from compiler '-xarch' flag. 325sparc_AS_XARCH= -xarch=v8plus 326sparcv9_AS_XARCH= -xarch=v9 327i386_AS_XARCH= 328amd64_AS_XARCH= -xarch=amd64 -P -Ui386 -U__i386 329 330# 331# These flags define what we need to be 'standalone' i.e. -not- part 332# of the rather more cosy userland environment. This basically means 333# the kernel. 334# 335# XX64 future versions of gcc will make -mcmodel=kernel imply -mno-red-zone 336# 337sparc_STAND_FLAGS= -_gcc=-ffreestanding 338sparcv9_STAND_FLAGS= -_gcc=-ffreestanding 339i386_STAND_FLAGS= -_gcc=-ffreestanding 340amd64_STAND_FLAGS= -Wu,-xmodel=kernel 341$(__SSNEXT)amd64_STAND_FLAGS= -xmodel=kernel 342 343SAVEARGS= -Wu,-save_args 344amd64_STAND_FLAGS += $(SAVEARGS) 345 346STAND_FLAGS_32 = $($(MACH)_STAND_FLAGS) 347STAND_FLAGS_64 = $($(MACH64)_STAND_FLAGS) 348 349# 350# disable the incremental linker 351ILDOFF= -xildoff 352# 353XDEPEND= -xdepend 354XFFLAG= -xF 355XESS= -xs 356XSTRCONST= -xstrconst 357 358# 359# turn warnings into errors (C) 360CERRWARN = -errtags=yes -errwarn=%all 361CERRWARN += -erroff=E_EMPTY_TRANSLATION_UNIT 362CERRWARN += -erroff=E_STATEMENT_NOT_REACHED 363 364# 365# turn warnings into errors (C++) 366CCERRWARN= -xwe 367 368# C99 mode 369C99_ENABLE= -xc99=%all 370C99_DISABLE= -xc99=%none 371C99MODE= $(C99_DISABLE) 372C99LMODE= $(C99MODE:-xc99%=-Xc99%) 373 374# In most places, assignments to these macros should be appended with += 375# (CPPFLAGS.master allows values to be prepended to CPPFLAGS). 376sparc_CFLAGS= $(sparc_XARCH) $(CCSTATICSYM) 377sparcv9_CFLAGS= $(sparcv9_XARCH) -dalign $(CCVERBOSE) $(V9ABIWARN) $(CCREGSYM) \ 378 $(CCSTATICSYM) 379i386_CFLAGS= $(i386_XARCH) 380amd64_CFLAGS= $(amd64_XARCH) 381 382sparc_ASFLAGS= $(sparc_AS_XARCH) 383sparcv9_ASFLAGS=$(sparcv9_AS_XARCH) 384i386_ASFLAGS= $(i386_AS_XARCH) 385amd64_ASFLAGS= $(amd64_AS_XARCH) 386 387# 388sparc_COPTFLAG= -xO3 389sparcv9_COPTFLAG= -xO3 390i386_COPTFLAG= -O 391amd64_COPTFLAG= -xO3 392 393COPTFLAG= $($(MACH)_COPTFLAG) 394COPTFLAG64= $($(MACH64)_COPTFLAG) 395 396# When -g is used, the compiler globalizes static objects 397# (gives them a unique prefix). Disable that. 398CNOGLOBAL= -W0,-noglobal 399 400# Direct the Sun Studio compiler to use a static globalization prefix based on the 401# name of the module rather than something unique. Otherwise, objects 402# will not build deterministically, as subsequent compilations of identical 403# source will yeild objects that always look different. 404# 405# In the same spirit, this will also remove the date from the N_OPT stab. 406CGLOBALSTATIC= -W0,-xglobalstatic 407 408# Normally, gcc uses indirect DWARF strings to save space. However, 409# this causes relocations that ctfconvert cannot handle. Disable this. 410CDWARFSTR= -_gcc=-fno-dwarf2-indirect-strings 411 412# Sometimes we want all symbols and types in debugging information even 413# if they aren't used. 414CALLSYMS= -W0,-xdbggen=no%usedonly 415 416# 417# Default debug format for Sun Studio 11 is dwarf, so force it to 418# generate stabs. 419# 420DEBUGFORMAT= -xdebugformat=stabs 421 422# 423# Flags used to build in debug mode for ctf generation. Bugs in the Devpro 424# compilers currently prevent us from building with cc-emitted DWARF. 425# 426CTF_FLAGS_sparc = -g -Wc,-Qiselect-T1 $(C99MODE) $(CNOGLOBAL) $(CDWARFSTR) 427CTF_FLAGS_i386 = -g $(C99MODE) $(CNOGLOBAL) $(CDWARFSTR) 428CTF_FLAGS = $(CTF_FLAGS_$(MACH)) $(DEBUGFORMAT) 429 430# 431# Flags used with genoffsets 432# 433GOFLAGS = -_noecho \ 434 $(CALLSYMS) \ 435 $(CDWARFSTR) 436 437OFFSETS_CREATE = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \ 438 $(CC) $(GOFLAGS) $(CFLAGS) $(CPPFLAGS) 439 440OFFSETS_CREATE64 = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \ 441 $(CC) $(GOFLAGS) $(CFLAGS64) $(CPPFLAGS) 442 443# 444# tradeoff time for space (smaller is better) 445# 446sparc_SPACEFLAG = -xspace -W0,-Lt 447sparcv9_SPACEFLAG = -xspace -W0,-Lt 448i386_SPACEFLAG = -xspace 449amd64_SPACEFLAG = 450 451SPACEFLAG = $($(MACH)_SPACEFLAG) 452SPACEFLAG64 = $($(MACH64)_SPACEFLAG) 453 454# 455# The Sun Studio 11 compiler has changed the behaviour of integer 456# wrap arounds and so a flag is needed to use the legacy behaviour 457# (without this flag panics/hangs could be exposed within the source). 458# 459sparc_IROPTFLAG = -W2,-xwrap_int 460sparcv9_IROPTFLAG = -W2,-xwrap_int 461i386_IROPTFLAG = 462amd64_IROPTFLAG = 463 464IROPTFLAG = $($(MACH)_IROPTFLAG) 465IROPTFLAG64 = $($(MACH64)_IROPTFLAG) 466 467sparc_XREGSFLAG = -xregs=no%appl 468sparcv9_XREGSFLAG = -xregs=no%appl 469i386_XREGSFLAG = 470amd64_XREGSFLAG = 471 472XREGSFLAG = $($(MACH)_XREGSFLAG) 473XREGSFLAG64 = $($(MACH64)_XREGSFLAG) 474 475CFLAGS= $(COPTFLAG) $($(MACH)_CFLAGS) $(SPACEFLAG) $(CCMODE) \ 476 $(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND) $(IROPTFLAG) \ 477 $(CGLOBALSTATIC) 478CFLAGS64= $(COPTFLAG64) $($(MACH64)_CFLAGS) $(SPACEFLAG64) $(CCMODE64) \ 479 $(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND) $(IROPTFLAG64) \ 480 $(CGLOBALSTATIC) 481# 482# Flags that are used to build parts of the code that are subsequently 483# run on the build machine (also known as the NATIVE_BUILD). 484# 485NATIVE_CFLAGS= $(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) $(CCMODE) \ 486 $(ILDOFF) $(CERRWARN) $(C99MODE) $($(NATIVE_MACH)_CCUNBOUND) \ 487 $(IROPTFLAG) $(CGLOBALSTATIC) 488 489DTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\" # For messaging. 490DTS_ERRNO=-D_TS_ERRNO 491CPPFLAGS.master=$(DTEXTDOM) $(DTS_ERRNO) \ 492 $(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4) 493CPPFLAGS= $(CPPFLAGS.master) 494AS_CPPFLAGS= $(CPPFLAGS.master) 495JAVAFLAGS= -deprecation 496 497# 498# For source message catalogue 499# 500.SUFFIXES: $(SUFFIXES) .i .po 501MSGROOT= $(ROOT)/catalog 502MSGDOMAIN= $(MSGROOT)/$(TEXT_DOMAIN) 503MSGDOMAINPOFILE = $(MSGDOMAIN)/$(POFILE) 504DCMSGDOMAIN= $(MSGROOT)/LC_TIME/$(TEXT_DOMAIN) 505DCMSGDOMAINPOFILE = $(DCMSGDOMAIN)/$(DCFILE:.dc=.po) 506 507CLOBBERFILES += $(POFILE) $(POFILES) 508COMPILE.cpp= $(CC) -E -C $(CFLAGS) $(CPPFLAGS) 509XGETTEXT= /usr/bin/xgettext 510XGETFLAGS= -c TRANSLATION_NOTE 511BUILD.po= $(XGETTEXT) $(XGETFLAGS) -d $(<F) $<.i ;\ 512 $(RM) $@ ;\ 513 sed "/^domain/d" < $(<F).po > $@ ;\ 514 $(RM) $(<F).po $<.i 515# 516# This is overwritten by local Makefile when PROG is a list. 517# 518POFILE= $(PROG).po 519 520sparc_CCFLAGS= -cg92 -compat=4 \ 521 -Qoption ccfe -messages=no%anachronism \ 522 $(CCERRWARN) 523sparcv9_CCFLAGS= $(sparcv9_XARCH) -dalign -compat=5 \ 524 -Qoption ccfe -messages=no%anachronism \ 525 -Qoption ccfe -features=no%conststrings \ 526 $(CCCREGSYM) \ 527 $(CCERRWARN) 528i386_CCFLAGS= -compat=4 \ 529 -Qoption ccfe -messages=no%anachronism \ 530 -Qoption ccfe -features=no%conststrings \ 531 $(CCERRWARN) 532amd64_CCFLAGS= $(amd64_XARCH) -compat=5 \ 533 -Qoption ccfe -messages=no%anachronism \ 534 -Qoption ccfe -features=no%conststrings \ 535 $(CCERRWARN) 536 537sparc_CCOPTFLAG= -O 538sparcv9_CCOPTFLAG= -O 539i386_CCOPTFLAG= -O 540amd64_CCOPTFLAG= -O 541 542CCOPTFLAG= $($(MACH)_CCOPTFLAG) 543CCOPTFLAG64= $($(MACH64)_CCOPTFLAG) 544CCFLAGS= $(CCOPTFLAG) $($(MACH)_CCFLAGS) 545CCFLAGS64= $(CCOPTFLAG64) $($(MACH64)_CCFLAGS) 546# 547# Used by Makefile.cmd, Makefile.lib and Makefile.ucbcmd 548# 549PGA_MAPFILE = $(SRC)/cmd/sgs/mapfiles/$(MACH)/map.pagealign 550# 551# 552# LDLIBS32 can be set in the environment to override the following assignment. 553# LDLIBS64 can be set to override the assignment made in Makefile.master.64. 554# These environment settings make sure that no libraries are searched outside 555# of the local workspace proto area: 556# LDLIBS32=-YP,$ROOT/lib:$ROOT/usr/lib 557# LDLIBS64=-YP,$ROOT/lib/$MACH64:$ROOT/usr/lib/$MACH64 558# 559LDLIBS32 = $(ENVLDLIBS1) $(ENVLDLIBS2) $(ENVLDLIBS3) 560LDLIBS.cmd = $(LDLIBS32) 561LDLIBS.lib = $(LDLIBS32) 562# 563# Define compilation macros. 564# 565COMPILE.c= $(CC) $(CFLAGS) $(CPPFLAGS) -c 566COMPILE64.c= $(CC) $(CFLAGS64) $(CPPFLAGS) -c 567COMPILE.cc= $(CCC) $(CCFLAGS) $(CPPFLAGS) -c 568COMPILE64.cc= $(CCC) $(CCFLAGS64) $(CPPFLAGS) -c 569COMPILE.s= $(AS) $(ASFLAGS) $(AS_CPPFLAGS) 570COMPILE64.s= $(AS) $(ASFLAGS) $($(MACH64)_AS_XARCH) $(AS_CPPFLAGS) 571COMPILE.d= $(DTRACE) -G -32 572COMPILE64.d= $(DTRACE) -G -64 573 574CLASSPATH= . 575COMPILE.java= $(JAVAC) $(JAVAFLAGS) -classpath $(CLASSPATH) 576 577# 578# Link time macros 579# 580CCNEEDED = -lC 581$(__GNUC)CCNEEDED = -L$(SFWLIBDIR) -R$(SFWLIBDIR) -lstdc++ -lgcc_s 582 583LINK.c= $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) 584LINK64.c= $(CC) $(CFLAGS64) $(CPPFLAGS) $(LDFLAGS) 585NORUNPATH= -norunpath -nolib 586LINK.cc= $(CCC) $(CCFLAGS) $(CPPFLAGS) $(NORUNPATH) \ 587 $(LDFLAGS) $(CCNEEDED) 588LINK64.cc= $(CCC) $(CCFLAGS64) $(CPPFLAGS) $(NORUNPATH) \ 589 $(LDFLAGS) $(CCNEEDED) 590 591# 592# lint macros 593# 594# Note that the undefine of __PRAGMA_REDEFINE_EXTNAME can be removed once 595# ON is built with a version of lint that has the fix for 4484186. 596# 597ALWAYS_LINT_DEFS = -errtags=yes -s 598ALWAYS_LINT_DEFS += -erroff=E_PTRDIFF_OVERFLOW 599ALWAYS_LINT_DEFS += -erroff=E_ASSIGN_NARROW_CONV 600ALWAYS_LINT_DEFS += -U__PRAGMA_REDEFINE_EXTNAME 601ALWAYS_LINT_DEFS += $(C99LMODE) 602ALWAYS_LINT_DEFS += -errsecurity=$(SECLEVEL) 603ALWAYS_LINT_DEFS += -erroff=E_SEC_CREAT_WITHOUT_EXCL 604ALWAYS_LINT_DEFS += -erroff=E_SEC_FORBIDDEN_WARN_CREAT 605# XX64 -- really only needed for amd64 lint 606ALWAYS_LINT_DEFS += -erroff=E_ASSIGN_INT_TO_SMALL_INT 607ALWAYS_LINT_DEFS += -erroff=E_CAST_INT_CONST_TO_SMALL_INT 608ALWAYS_LINT_DEFS += -erroff=E_CAST_INT_TO_SMALL_INT 609ALWAYS_LINT_DEFS += -erroff=E_CAST_TO_PTR_FROM_INT 610ALWAYS_LINT_DEFS += -erroff=E_COMP_INT_WITH_LARGE_INT 611ALWAYS_LINT_DEFS += -erroff=E_INTEGRAL_CONST_EXP_EXPECTED 612ALWAYS_LINT_DEFS += -erroff=E_PASS_INT_TO_SMALL_INT 613ALWAYS_LINT_DEFS += -erroff=E_PTR_CONV_LOSES_BITS 614 615SECLEVEL= core 616LINT.c= $(LINT) $(LINTFLAGS) $(CPPFLAGS) $(ALWAYS_LINT_DEFS) 617LINT64.c= $(LINT) $(LINTFLAGS64) $(CPPFLAGS) $(ALWAYS_LINT_DEFS) 618LINT.s= $(LINT.c) 619 620# For some future builds, NATIVE_MACH and MACH might be different. 621# Therefore, NATIVE_MACH needs to be redefined in the 622# environment as `uname -p` to override this macro. 623# 624# For now at least, we cross-compile amd64 on i386 machines. 625NATIVE_MACH= $(MACH:amd64=i386) 626 627# Define native compilation macros 628# 629 630# Base directory where compilers are loaded. 631# Defined here so it can be overridden by developer. 632# 633SPRO_ROOT= $(BUILD_TOOLS)/SUNWspro 634SPRO_VROOT= $(SPRO_ROOT)/SS11 635GNU_ROOT= $(SFW_ROOT) 636 637# Specify platform compiler versions for languages 638# that we use (currently only c and c++). 639# 640sparc_CC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc 641$(__GNUC)sparc_CC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc 642sparc_CCC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC 643$(__GNUC)sparc_CCC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++ 644sparc_CPP= /usr/ccs/lib/cpp 645sparc_AS= /usr/ccs/bin/as -xregsym=no 646sparc_LD= /usr/ccs/bin/ld 647sparc_LINT= $(SPRO_VROOT)/bin/lint 648 649sparcv9_CC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc 650$(__GNUC64)sparcv9_CC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc 651sparcv9_CCC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC 652$(__GNUC64)sparcv9_CCC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++ 653sparcv9_CPP= /usr/ccs/lib/cpp 654sparcv9_AS= /usr/ccs/bin/as -xregsym=no 655sparcv9_LD= /usr/ccs/bin/ld 656sparcv9_LINT= $(SPRO_VROOT)/bin/lint 657 658# We compile 32-bit objects with cc by default 659i386_CC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc 660$(__GNUC)i386_CC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc 661i386_CCC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC 662$(__GNUC)i386_CCC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++ 663i386_CPP= /usr/ccs/lib/cpp 664i386_AS= /usr/ccs/bin/as 665$(__GNUC)i386_AS= $(ONBLD_TOOLS)/bin/$(MACH)/aw 666i386_LD= /usr/ccs/bin/ld 667i386_LINT= $(SPRO_VROOT)/bin/lint 668 669# We compile 64-bit objects with gcc 670amd64_CC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc 671$(__GNUC64)amd64_CC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc 672amd64_CCC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC 673$(__GNUC64)amd64_CCC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++ 674amd64_CPP= /usr/ccs/lib/cpp 675amd64_AS= $(ONBLD_TOOLS)/bin/$(MACH)/aw 676amd64_LD= /usr/ccs/bin/ld 677amd64_LINT= $(SPRO_VROOT)/bin/lint 678 679NATIVECC= $($(NATIVE_MACH)_CC) 680NATIVECCC= $($(NATIVE_MACH)_CCC) 681NATIVECPP= $($(NATIVE_MACH)_CPP) 682NATIVEAS= $($(NATIVE_MACH)_AS) 683NATIVELD= $($(NATIVE_MACH)_LD) 684NATIVELINT= $($(NATIVE_MACH)_LINT) 685 686# 687# Makefile.master.64 overrides these settings 688# 689CC= $(NATIVECC) 690CCC= $(NATIVECCC) 691CPP= $(NATIVECPP) 692AS= $(NATIVEAS) 693LD= $(NATIVELD) 694LINT= $(NATIVELINT) 695 696# The real compilers used for this build 697CW_CC_CMD= $(CC) -_compiler 698CW_CCC_CMD= $(CCC) -_compiler 699REAL_CC= $(CW_CC_CMD:sh) 700REAL_CCC= $(CW_CCC_CMD:sh) 701 702# Pass -Y flag to cpp (method of which is release-dependent) 703CCYFLAG= -Y I, 704 705BDIRECT= -Bdirect 706BDYNAMIC= -Bdynamic 707BLOCAL= -Blocal 708BREDUCE= -Breduce 709BSTATIC= -Bstatic 710 711ZCOMBRELOC= -zcombreloc 712ZDEFS= -zdefs 713ZIGNORE= -zignore 714ZINITFIRST= -zinitfirst 715ZINTERPOSE= -zinterpose 716ZLAZYLOAD= -zlazyload 717ZLOADFLTR= -zloadfltr 718ZMULDEFS= -zmuldefs 719ZNODEFAULTLIB= -znodefaultlib 720ZNODEFS= -znodefs 721ZNODELETE= -znodelete 722ZNODLOPEN= -znodlopen 723ZNODUMP= -znodump 724ZNOLAZYLOAD= -znolazyload 725ZNORELOC= -znoreloc 726ZNOVERSION= -znoversion 727ZREDLOCSYM= -zredlocsym 728ZTEXT= -ztext 729 730GSHARED= -G 731CCMT= -mt 732 733# Handle different PIC models on different ISAs 734# (May be overridden by lower-level Makefiles) 735 736sparc_C_PICFLAGS = -K pic 737sparcv9_C_PICFLAGS = -K pic 738i386_C_PICFLAGS = -K pic 739amd64_C_PICFLAGS = -K pic 740C_PICFLAGS = $($(MACH)_C_PICFLAGS) 741C_PICFLAGS64 = $($(MACH64)_C_PICFLAGS) 742 743sparc_C_BIGPICFLAGS = -K PIC 744sparcv9_C_BIGPICFLAGS = -K PIC 745i386_C_BIGPICFLAGS = -K PIC 746amd64_C_BIGPICFLAGS = -K PIC 747C_BIGPICFLAGS = $($(MACH)_C_BIGPICFLAGS) 748C_BIGPICFLAGS64 = $($(MACH64)_C_BIGPICFLAGS) 749 750# CC requires there to be no space between '-K' and 'pic' or 'PIC'. 751sparc_CC_PICFLAGS = -Kpic 752sparcv9_CC_PICFLAGS = -KPIC 753i386_CC_PICFLAGS = -Kpic 754amd64_CC_PICFLAGS = -Kpic 755CC_PICFLAGS = $($(MACH)_CC_PICFLAGS) 756CC_PICFLAGS64 = $($(MACH64)_CC_PICFLAGS) 757 758AS_PICFLAGS= $(C_PICFLAGS) 759AS_BIGPICFLAGS= $(C_BIGPICFLAGS) 760 761# 762# Default label for CTF sections 763# 764CTFCVTFLAGS= -i -L VERSION 765 766# 767# Override to pass module-specific flags to ctfmerge. Currently used 768# only by krtld to turn on fuzzy matching. 769# 770CTFMRGFLAGS= 771 772CTFCONVERT_O = $(CTFCONVERT) $(CTFCVTFLAGS) $@ 773 774ELFSIGN_O= $(TRUE) 775ELFSIGN_CRYPTO= $(ELFSIGN_O) 776ELFSIGN_OBJECT= $(ELFSIGN_O) 777$(EXPORT_RELEASE_BUILD)ELFSIGN_O = $(ELFSIGN) 778$(EXPORT_RELEASE_BUILD)ELFSIGN_CFNAME = SUNWosnetCF 779$(EXPORT_RELEASE_BUILD)ELFSIGN_KEY = \ 780 $(CLOSED)/cmd/cmd-crypto/etc/keys/$(ELFSIGN_CFNAME) 781$(EXPORT_RELEASE_BUILD)ELFSIGN_CERT= \ 782 $(CLOSED)/cmd/cmd-crypto/etc/certs/$(ELFSIGN_CFNAME) 783$(EXPORT_RELEASE_BUILD)ELFSIGN_CLNAME = SUNWosnetCFLimited 784$(EXPORT_RELEASE_BUILD)ELFSIGN_KEY_LIMITED = \ 785 $(CLOSED)/cmd/cmd-crypto/etc/keys/$(ELFSIGN_CLNAME) 786$(EXPORT_RELEASE_BUILD)ELFSIGN_CERT_LIMITED= \ 787 $(CLOSED)/cmd/cmd-crypto/etc/certs/$(ELFSIGN_CLNAME) 788$(EXPORT_RELEASE_BUILD)ELFSIGN_SENAME = SUNWosnetSE 789$(EXPORT_RELEASE_BUILD)ELFSIGN_SEKEY = \ 790 $(CLOSED)/cmd/cmd-crypto/etc/keys/$(ELFSIGN_SENAME) 791$(EXPORT_RELEASE_BUILD)ELFSIGN_SECERT= \ 792 $(CLOSED)/cmd/cmd-crypto/etc/certs/$(ELFSIGN_SENAME) 793$(EXPORT_RELEASE_BUILD)ELFSIGN_CRYPTO= $(ELFSIGN_O) sign \ 794 $(ELFSIGN_FORMAT_OPTION) \ 795 -k $(ELFSIGN_KEY) -c $(ELFSIGN_CERT) -e $@ 796$(EXPORT_RELEASE_BUILD)ELFSIGN_CRYPTO_LIMITED= $(ELFSIGN_O) sign \ 797 $(ELFSIGN_FORMAT_OPTION) \ 798 -k $(ELFSIGN_KEY_LIMITED) -c $(ELFSIGN_CERT_LIMITED) \ 799 -e $@ 800$(EXPORT_RELEASE_BUILD)ELFSIGN_OBJECT= $(ELFSIGN_O) sign \ 801 $(ELFSIGN_FORMAT_OPTION) \ 802 -k $(ELFSIGN_SEKEY) -c $(ELFSIGN_SECERT) -e $@ 803 804# Rules (normally from make.rules) and macros which are used for post 805# processing files. Normally, these do stripping of the comment section 806# automatically. 807# RELEASE_CM: Should be editted to reflect the release. 808# POST_PROCESS_O: Post-processing for `.o' files. 809# POST_PROCESS_A: Post-processing for `.a' files (currently null). 810# POST_PROCESS_SO: Post-processing for `.so' files. 811# POST_PROCESS: Post-processing for executable files (no suffix). 812# Note that these macros are not completely generalized as they are to be 813# used with the file name to be processed following. 814# 815# It is left as an exercise to Release Engineering to embellish the generation 816# of the release comment string. 817# 818# If this is a standard development build: 819# compress the comment section (mcs -c) 820# add the standard comment (mcs -a $(RELEASE_CM)) 821# add the development specific comment (mcs -a $(DEV_CM)) 822# 823# If this is an installation build: 824# delete the comment section (mcs -d) 825# add the standard comment (mcs -a $(RELEASE_CM)) 826# add the development specific comment (mcs -a $(DEV_CM)) 827# 828# If this is an release build: 829# delete the comment section (mcs -d) 830# add the standard comment (mcs -a $(RELEASE_CM)) 831# 832# The ONVERS macro sets the default value for the VERSION string 833# within pkginfo. 834# 835# The following list of macros are used in the definition of RELEASE_CM 836# which is used to label all binaries in the build: 837# 838# RELEASE Specific release of the build, eg: 5.2 839# VERSION Version of the build (alpha, beta, Generic) 840# PATCHID If this is a patch this value should contain 841# the patchid value (eg: "Generic 100832-01"), otherwise 842# it will be set to $(VERSION) 843# RELEASE_DATE Date of the Release Build 844# PATCH_DATE Date the patch was created, if this is blank it 845# will default to the RELEASE_DATE 846# 847ONVERS= "11.11" 848RELEASE= 5.11 849VERSION= SunOS Development 850PATCHID= $(VERSION) 851RELEASE_DATE= October 2007 852PATCH_DATE= $(RELEASE_DATE) 853RELEASE_CM= "@($(POUND_SIGN))SunOS $(RELEASE) $(PATCHID) $(PATCH_DATE)" 854DEV_CM= "@($(POUND_SIGN))SunOS Internal Development: \ 855`$(ECHO) $$LOGNAME` `date +%Y-%m-%d` `$(ECHO) [\`basename $$CODEMGR_WS\`]`" 856 857PROCESS_COMMENT= @?${MCS} -c -a $(RELEASE_CM) -a $(DEV_CM) 858$(STRIP_COMMENTS)PROCESS_COMMENT= @?${MCS} -d -a $(RELEASE_CM) -a $(DEV_CM) 859$(RELEASE_BUILD)PROCESS_COMMENT= @?${MCS} -d -a $(RELEASE_CM) 860 861STRIP_STABS= : 862$(RELEASE_BUILD)STRIP_STABS= $(STRIP) -x $@ 863 864POST_PROCESS_O= $(PROCESS_COMMENT) $@ 865POST_PROCESS_A= 866POST_PROCESS_SO= $(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \ 867 $(ELFSIGN_OBJECT) 868POST_PROCESS= $(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \ 869 $(ELFSIGN_OBJECT) 870 871# 872# The PKGDEFS macro points to the source directory containing the majority 873# of ON's package definitions plus Makefiles with general package creation 874# rules. 875# 876# PKGARCHIVE specifies the default location where packages should be 877# placed if built. 878# 879PKGDEFS=$(SRC)/pkgdefs 880$(RELEASE_BUILD)PKGARCHIVESUFFIX= -nd 881PKGARCHIVE=$(SRC)/../../packages/$(MACH)/nightly$(PKGARCHIVESUFFIX) 882 883# Default build rules which perform comment section post-processing. 884# 885.c: 886 $(LINK.c) -o $@ $< $(LDLIBS) 887 $(POST_PROCESS) 888.c.o: 889 $(COMPILE.c) $(OUTPUT_OPTION) $< $(CTFCONVERT_HOOK) 890 $(POST_PROCESS_O) 891.c.a: 892 $(COMPILE.c) -o $% $< 893 $(PROCESS_COMMENT) $% 894 $(AR) $(ARFLAGS) $@ $% 895 $(RM) $% 896.s.o: 897 $(COMPILE.s) -o $@ $< 898 $(POST_PROCESS_O) 899.s.a: 900 $(COMPILE.s) -o $% $< 901 $(PROCESS_COMMENT) $% 902 $(AR) $(ARFLAGS) $@ $% 903 $(RM) $% 904.cc: 905 $(LINK.cc) -o $@ $< $(LDLIBS) 906 $(POST_PROCESS) 907.cc.o: 908 $(COMPILE.cc) $(OUTPUT_OPTION) $< 909 $(POST_PROCESS_O) 910.cc.a: 911 $(COMPILE.cc) -o $% $< 912 $(AR) $(ARFLAGS) $@ $% 913 $(PROCESS_COMMENT) $% 914 $(RM) $% 915.y: 916 $(YACC.y) $< 917 $(LINK.c) -o $@ y.tab.c $(LDLIBS) 918 $(POST_PROCESS) 919 $(RM) y.tab.c 920.y.o: 921 $(YACC.y) $< 922 $(COMPILE.c) -o $@ y.tab.c $(CTFCONVERT_HOOK) 923 $(POST_PROCESS_O) 924 $(RM) y.tab.c 925.l: 926 $(RM) $*.c 927 $(LEX.l) $< > $*.c 928 $(LINK.c) -o $@ $*.c -ll $(LDLIBS) 929 $(POST_PROCESS) 930 $(RM) $*.c 931.l.o: 932 $(RM) $*.c 933 $(LEX.l) $< > $*.c 934 $(COMPILE.c) -o $@ $*.c $(CTFCONVERT_HOOK) 935 $(POST_PROCESS_O) 936 $(RM) $*.c 937 938.java.class: 939 $(COMPILE.java) $< 940 941# 942# Rules to create message catalogue files from .sh, .ksh, .c, .y, and .l 943# files. For .sh and .ksh files, we extract all gettext strings with 944# sed(1) (being careful to permit multiple gettext strings on the same 945# line), weed out the dups, and build the catalogue with awk(1). 946# 947 948.sh.po: 949 $(SED) -n -e ":a" \ 950 -e "h" \ 951 -e "s/.*gettext *\(\"[^\"]*\"\).*/\1/p" \ 952 -e "x" \ 953 -e "s/\(.*\)gettext *\"[^\"]*\"\(.*\)/\1\2/" \ 954 -e "t a" \ 955 $< | sort -u | awk '{ print "msgid\t" $$0 "\nmsgstr" }' > $@ 956 957.ksh.po: 958 $(SED) -n -e ":a" \ 959 -e "h" \ 960 -e "s/.*gettext *\(\"[^\"]*\"\).*/\1/p" \ 961 -e "x" \ 962 -e "s/\(.*\)gettext *\"[^\"]*\"\(.*\)/\1\2/" \ 963 -e "t a" \ 964 $< | sort -u | awk '{ print "msgid\t" $$0 "\nmsgstr" }' > $@ 965 966# 967# When using xgettext, we want messages to go to the default domain, 968# rather than the specified one. This special version of the 969# COMPILE.cpp macro effectively prevents expansion of TEXT_DOMAIN, 970# causing xgettext to put all messages into the default domain. 971# 972CPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN) 973 974.c.i: 975 $(CPPFORPO) $< > $@ 976 977.h.i: 978 $(CPPFORPO) $< > $@ 979 980.y.i: 981 $(YACC) -d $< 982 $(CPPFORPO) y.tab.c > $@ 983 $(RM) y.tab.c 984 985.l.i: 986 $(LEX) $< 987 $(CPPFORPO) lex.yy.c > $@ 988 $(RM) lex.yy.c 989 990.c.po: 991 $(CPPFORPO) $< > $<.i 992 $(BUILD.po) 993 994.y.po: 995 $(YACC) -d $< 996 $(CPPFORPO) y.tab.c > $<.i 997 $(BUILD.po) 998 $(RM) y.tab.c 999 1000.l.po: 1001 $(LEX) $< 1002 $(CPPFORPO) lex.yy.c > $<.i 1003 $(BUILD.po) 1004 $(RM) lex.yy.c 1005 1006# 1007# Rules to perform stylistic checks 1008# 1009.SUFFIXES: $(SUFFIXES) .x .xml .check .xmlchk 1010 1011.h.check: 1012 $(DOT_H_CHECK) 1013 1014.x.check: 1015 $(DOT_X_CHECK) 1016 1017.xml.xmlchk: 1018 $(MANIFEST_CHECK) 1019 1020# 1021# Rules to process ONC+ Source partial files 1022# 1023%_onc_plus: % 1024 @$(ECHO) "extracting code from $< ... " 1025 sed -n -e '/ONC_PLUS EXTRACT START/,/ONC_PLUS EXTRACT END/p' $< > $@ 1026 1027# 1028# Include rules to render automated sccs get rules "safe". 1029# 1030include $(SRC)/Makefile.noget 1031