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