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