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