Print this page
9128 cw(1onbld) should be able to run multiple shadows
9129 file-locking tests shouldn't build multiple source files in one compiler invocation
9130 DTrace tst.gcc.d isn't useful
9132 cw(1onbld) shouldn't shadow pure preprocessing
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed? by: Yuri Pankov <yuripv@yuripv.net>
Reviewed? by: Robert Mustacchi <rm@joyent.com>
Reviewed? by: Jason King <jason.king@joyent.com>


 467 #
 468 # Flags used to build in debug mode for ctf generation.  Bugs in the Devpro
 469 # compilers currently prevent us from building with cc-emitted DWARF.
 470 #
 471 CTF_FLAGS_sparc = -g -Wc,-Qiselect-T1 $(CSTD) $(CNOGLOBAL) $(CDWARFSTR)
 472 CTF_FLAGS_i386  = -g $(CSTD) $(CNOGLOBAL) $(CDWARFSTR)
 473 
 474 CTF_FLAGS_sparcv9       = $(CTF_FLAGS_sparc)
 475 CTF_FLAGS_amd64         = $(CTF_FLAGS_i386)
 476 
 477 # Sun Studio produces broken userland code when saving arguments.
 478 $(__GNUC)CTF_FLAGS_amd64 += $(SAVEARGS)
 479 
 480 CTF_FLAGS_32    = $(CTF_FLAGS_$(MACH)) $(DEBUGFORMAT)
 481 CTF_FLAGS_64    = $(CTF_FLAGS_$(MACH64)) $(DEBUGFORMAT)
 482 CTF_FLAGS       = $(CTF_FLAGS_32)
 483 
 484 #
 485 # Flags used with genoffsets
 486 #
 487 GOFLAGS = -_noecho \
 488         $(CALLSYMS) \
 489         $(CDWARFSTR)
 490 
 491 OFFSETS_CREATE = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
 492         $(CC) $(GOFLAGS) $(CFLAGS) $(CPPFLAGS)
 493 
 494 OFFSETS_CREATE64 = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
 495         $(CC) $(GOFLAGS) $(CFLAGS64) $(CPPFLAGS)
 496 
 497 #
 498 # tradeoff time for space (smaller is better)
 499 #
 500 sparc_SPACEFLAG         = -xspace -W0,-Lt
 501 sparcv9_SPACEFLAG       = -xspace -W0,-Lt
 502 i386_SPACEFLAG          = -xspace
 503 amd64_SPACEFLAG         =
 504 
 505 SPACEFLAG               = $($(MACH)_SPACEFLAG)
 506 SPACEFLAG64             = $($(MACH64)_SPACEFLAG)
 507 
 508 #
 509 # The Sun Studio 11 compiler has changed the behaviour of integer
 510 # wrap arounds and so a flag is needed to use the legacy behaviour
 511 # (without this flag panics/hangs could be exposed within the source).
 512 #
 513 sparc_IROPTFLAG         = -W2,-xwrap_int
 514 sparcv9_IROPTFLAG       = -W2,-xwrap_int
 515 i386_IROPTFLAG          =


 764                 $(ALWAYS_LINT_DEFS)
 765 LINT.s=         $(LINT.c)
 766 
 767 # For some future builds, NATIVE_MACH and MACH might be different.
 768 # Therefore, NATIVE_MACH needs to be redefined in the
 769 # environment as `uname -p` to override this macro.
 770 #
 771 # For now at least, we cross-compile amd64 on i386 machines.
 772 NATIVE_MACH=    $(MACH:amd64=i386)
 773 
 774 # Define native compilation macros
 775 #
 776 
 777 # Base directory where compilers are loaded.
 778 # Defined here so it can be overridden by developer.
 779 #
 780 SPRO_ROOT=              $(BUILD_TOOLS)/SUNWspro
 781 SPRO_VROOT=             $(SPRO_ROOT)/SS12
 782 GNU_ROOT=               /usr
 783 









 784 # Till SS12u1 formally becomes the NV CBE, LINT is hard
 785 # coded to be picked up from the $SPRO_ROOT/sunstudio12.1/
 786 # location. Impacted variables are sparc_LINT, sparcv9_LINT,
 787 # i386_LINT, amd64_LINT.
 788 # Reset them when SS12u1 is rolled out.
 789 #
 790 
 791 # Specify platform compiler versions for languages
 792 # that we use (currently only c and c++).
 793 #
 794 sparc_CC=               $(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
 795 $(__GNUC)sparc_CC=      $(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
 796 sparc_CCC=              $(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
 797 $(__GNUC)sparc_CCC=     $(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
 798 sparc_CPP=              /usr/ccs/lib/cpp
 799 sparc_AS=               /usr/ccs/bin/as -xregsym=no
 800 sparc_LD=               /usr/ccs/bin/ld
 801 sparc_LINT=             $(SPRO_ROOT)/sunstudio12.1/bin/lint
 802 
 803 sparcv9_CC=             $(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
 804 $(__GNUC64)sparcv9_CC=  $(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
 805 sparcv9_CCC=            $(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
 806 $(__GNUC64)sparcv9_CCC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
 807 sparcv9_CPP=            /usr/ccs/lib/cpp
 808 sparcv9_AS=             /usr/ccs/bin/as -xregsym=no
 809 sparcv9_LD=             /usr/ccs/bin/ld
 810 sparcv9_LINT=           $(SPRO_ROOT)/sunstudio12.1/bin/lint
 811 
 812 i386_CC=                $(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
 813 $(__GNUC)i386_CC=       $(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
 814 i386_CCC=               $(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
 815 $(__GNUC)i386_CCC=      $(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
 816 i386_CPP=               /usr/ccs/lib/cpp
 817 i386_AS=                /usr/ccs/bin/as
 818 $(__GNUC)i386_AS=       $(ONBLD_TOOLS)/bin/$(MACH)/aw
 819 i386_LD=                /usr/ccs/bin/ld
 820 i386_LINT=              $(SPRO_ROOT)/sunstudio12.1/bin/lint
 821 
 822 amd64_CC=               $(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
 823 $(__GNUC64)amd64_CC=    $(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
 824 amd64_CCC=              $(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
 825 $(__GNUC64)amd64_CCC=   $(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
 826 amd64_CPP=              /usr/ccs/lib/cpp
 827 amd64_AS=               $(ONBLD_TOOLS)/bin/$(MACH)/aw
 828 amd64_LD=               /usr/ccs/bin/ld
 829 amd64_LINT=             $(SPRO_ROOT)/sunstudio12.1/bin/lint
 830 
 831 NATIVECC=               $($(NATIVE_MACH)_CC)
 832 NATIVECCC=              $($(NATIVE_MACH)_CCC)
 833 NATIVECPP=              $($(NATIVE_MACH)_CPP)
 834 NATIVEAS=               $($(NATIVE_MACH)_AS)
 835 NATIVELD=               $($(NATIVE_MACH)_LD)
 836 NATIVELINT=             $($(NATIVE_MACH)_LINT)
 837 
 838 #
 839 # Makefile.master.64 overrides these settings
 840 #
 841 CC=                     $(NATIVECC)
 842 CCC=                    $(NATIVECCC)
 843 CPP=                    $(NATIVECPP)
 844 AS=                     $(NATIVEAS)
 845 LD=                     $(NATIVELD)
 846 LINT=                   $(NATIVELINT)
 847 
 848 # The real compilers used for this build
 849 CW_CC_CMD=              $(CC) -_compiler
 850 CW_CCC_CMD=             $(CCC) -_compiler
 851 REAL_CC=                $(CW_CC_CMD:sh)
 852 REAL_CCC=               $(CW_CCC_CMD:sh)
 853 
 854 # Pass -Y flag to cpp (method of which is release-dependent)
 855 CCYFLAG=                -Y I,
 856 
 857 BDIRECT=        -Bdirect
 858 BDYNAMIC=       -Bdynamic
 859 BLOCAL=         -Blocal
 860 BNODIRECT=      -Bnodirect
 861 BREDUCE=        -Breduce
 862 BSTATIC=        -Bstatic
 863 
 864 ZDEFS=          -zdefs
 865 ZDIRECT=        -zdirect
 866 ZIGNORE=        -zignore
 867 ZINITFIRST=     -zinitfirst
 868 ZINTERPOSE=     -zinterpose
 869 ZLAZYLOAD=      -zlazyload
 870 ZLOADFLTR=      -zloadfltr
 871 ZMULDEFS=       -zmuldefs
 872 ZNODEFAULTLIB=  -znodefaultlib




 467 #
 468 # Flags used to build in debug mode for ctf generation.  Bugs in the Devpro
 469 # compilers currently prevent us from building with cc-emitted DWARF.
 470 #
 471 CTF_FLAGS_sparc = -g -Wc,-Qiselect-T1 $(CSTD) $(CNOGLOBAL) $(CDWARFSTR)
 472 CTF_FLAGS_i386  = -g $(CSTD) $(CNOGLOBAL) $(CDWARFSTR)
 473 
 474 CTF_FLAGS_sparcv9       = $(CTF_FLAGS_sparc)
 475 CTF_FLAGS_amd64         = $(CTF_FLAGS_i386)
 476 
 477 # Sun Studio produces broken userland code when saving arguments.
 478 $(__GNUC)CTF_FLAGS_amd64 += $(SAVEARGS)
 479 
 480 CTF_FLAGS_32    = $(CTF_FLAGS_$(MACH)) $(DEBUGFORMAT)
 481 CTF_FLAGS_64    = $(CTF_FLAGS_$(MACH64)) $(DEBUGFORMAT)
 482 CTF_FLAGS       = $(CTF_FLAGS_32)
 483 
 484 #
 485 # Flags used with genoffsets
 486 #
 487 GOFLAGS = $(CALLSYMS) $(CDWARFSTR)


 488 
 489 OFFSETS_CREATE = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
 490         $(CW) --noecho $(CW_CC_COMPILERS) -- $(GOFLAGS) $(CFLAGS) $(CPPFLAGS)
 491 
 492 OFFSETS_CREATE64 = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
 493         $(CW) --noecho $(CW_CC_COMPILERS) -- $(GOFLAGS) $(CFLAGS64) $(CPPFLAGS)
 494 
 495 #
 496 # tradeoff time for space (smaller is better)
 497 #
 498 sparc_SPACEFLAG         = -xspace -W0,-Lt
 499 sparcv9_SPACEFLAG       = -xspace -W0,-Lt
 500 i386_SPACEFLAG          = -xspace
 501 amd64_SPACEFLAG         =
 502 
 503 SPACEFLAG               = $($(MACH)_SPACEFLAG)
 504 SPACEFLAG64             = $($(MACH64)_SPACEFLAG)
 505 
 506 #
 507 # The Sun Studio 11 compiler has changed the behaviour of integer
 508 # wrap arounds and so a flag is needed to use the legacy behaviour
 509 # (without this flag panics/hangs could be exposed within the source).
 510 #
 511 sparc_IROPTFLAG         = -W2,-xwrap_int
 512 sparcv9_IROPTFLAG       = -W2,-xwrap_int
 513 i386_IROPTFLAG          =


 762                 $(ALWAYS_LINT_DEFS)
 763 LINT.s=         $(LINT.c)
 764 
 765 # For some future builds, NATIVE_MACH and MACH might be different.
 766 # Therefore, NATIVE_MACH needs to be redefined in the
 767 # environment as `uname -p` to override this macro.
 768 #
 769 # For now at least, we cross-compile amd64 on i386 machines.
 770 NATIVE_MACH=    $(MACH:amd64=i386)
 771 
 772 # Define native compilation macros
 773 #
 774 
 775 # Base directory where compilers are loaded.
 776 # Defined here so it can be overridden by developer.
 777 #
 778 SPRO_ROOT=              $(BUILD_TOOLS)/SUNWspro
 779 SPRO_VROOT=             $(SPRO_ROOT)/SS12
 780 GNU_ROOT=               /usr
 781 
 782 $(__GNUC)PRIMARY_CC=    gcc4,$(GCC_ROOT)/bin/gcc,gnu
 783 $(__SUNC)PRIMARY_CC=    studio12,$(SPRO_VROOT)/bin/cc,sun
 784 $(__GNUC)PRIMARY_CCC=   gcc4,$(GCC_ROOT)/bin/g++,gnu
 785 $(__SUNC)PRIMARY_CCC=   studio12,$(SPRO_VROOT)/bin/CC,sun
 786 
 787 CW_CC_COMPILERS=        $(PRIMARY_CC:%=--primary %) $(SHADOW_CCS:%=--shadow %)
 788 CW_CCC_COMPILERS=       $(PRIMARY_CCC:%=--primary %) $(SHADOW_CCCS:%=--shadow %)
 789 
 790 
 791 # Till SS12u1 formally becomes the NV CBE, LINT is hard
 792 # coded to be picked up from the $SPRO_ROOT/sunstudio12.1/
 793 # location. Impacted variables are sparc_LINT, sparcv9_LINT,
 794 # i386_LINT, amd64_LINT.
 795 # Reset them when SS12u1 is rolled out.
 796 #
 797 
 798 # Specify platform compiler versions for languages
 799 # that we use (currently only c and c++).
 800 #
 801 CW=                     $(ONBLD_TOOLS)/bin/$(MACH)/cw
 802 
 803 sparc_CC=               $(CW) $(CW_CC_COMPILERS) --
 804 sparc_CCC=              $(CW) -C $(CW_CCC_COMPILERS) --
 805 sparc_CPP=              /usr/ccs/lib/cpp
 806 sparc_AS=               /usr/ccs/bin/as -xregsym=no
 807 sparc_LD=               /usr/ccs/bin/ld
 808 sparc_LINT=             $(SPRO_ROOT)/sunstudio12.1/bin/lint
 809 
 810 sparcv9_CC=             $(CW) $(CW_CC_COMPILERS) --
 811 sparcv9_CCC=            $(CW) -C $(CW_CCC_COMPILERS) --


 812 sparcv9_CPP=            /usr/ccs/lib/cpp
 813 sparcv9_AS=             /usr/ccs/bin/as -xregsym=no
 814 sparcv9_LD=             /usr/ccs/bin/ld
 815 sparcv9_LINT=           $(SPRO_ROOT)/sunstudio12.1/bin/lint
 816 
 817 i386_CC=                $(CW) $(CW_CC_COMPILERS) --
 818 i386_CCC=               $(CW) -C $(CW_CCC_COMPILERS) --


 819 i386_CPP=               /usr/ccs/lib/cpp
 820 i386_AS=                /usr/ccs/bin/as
 821 $(__GNUC)i386_AS=       $(ONBLD_TOOLS)/bin/$(MACH)/aw
 822 i386_LD=                /usr/ccs/bin/ld
 823 i386_LINT=              $(SPRO_ROOT)/sunstudio12.1/bin/lint
 824 
 825 amd64_CC=               $(CW) $(CW_CC_COMPILERS) --
 826 amd64_CCC=              $(CW) -C $(CW_CCC_COMPILERS) --


 827 amd64_CPP=              /usr/ccs/lib/cpp
 828 amd64_AS=               $(ONBLD_TOOLS)/bin/$(MACH)/aw
 829 amd64_LD=               /usr/ccs/bin/ld
 830 amd64_LINT=             $(SPRO_ROOT)/sunstudio12.1/bin/lint
 831 
 832 NATIVECC=               $($(NATIVE_MACH)_CC)
 833 NATIVECCC=              $($(NATIVE_MACH)_CCC)
 834 NATIVECPP=              $($(NATIVE_MACH)_CPP)
 835 NATIVEAS=               $($(NATIVE_MACH)_AS)
 836 NATIVELD=               $($(NATIVE_MACH)_LD)
 837 NATIVELINT=             $($(NATIVE_MACH)_LINT)
 838 
 839 #
 840 # Makefile.master.64 overrides these settings
 841 #
 842 CC=                     $(NATIVECC)
 843 CCC=                    $(NATIVECCC)
 844 CPP=                    $(NATIVECPP)
 845 AS=                     $(NATIVEAS)
 846 LD=                     $(NATIVELD)
 847 LINT=                   $(NATIVELINT)






 848 
 849 # Pass -Y flag to cpp (method of which is release-dependent)
 850 CCYFLAG=                -Y I,
 851 
 852 BDIRECT=        -Bdirect
 853 BDYNAMIC=       -Bdynamic
 854 BLOCAL=         -Blocal
 855 BNODIRECT=      -Bnodirect
 856 BREDUCE=        -Breduce
 857 BSTATIC=        -Bstatic
 858 
 859 ZDEFS=          -zdefs
 860 ZDIRECT=        -zdirect
 861 ZIGNORE=        -zignore
 862 ZINITFIRST=     -zinitfirst
 863 ZINTERPOSE=     -zinterpose
 864 ZLAZYLOAD=      -zlazyload
 865 ZLOADFLTR=      -zloadfltr
 866 ZMULDEFS=       -zmuldefs
 867 ZNODEFAULTLIB=  -znodefaultlib