Print this page
Arrange things Gordon's way, and be sure to pass -xs
3735 should include an empty make variable in the default CFLAGS/CCFLAGS
3844 the build should make source-level debugging easier
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>

Split Close
Expand all
Collapse all
          --- old/usr/src/Makefile.master
          +++ new/usr/src/Makefile.master
↓ open down ↓ 342 lines elided ↑ open up ↑
 343  343  # One optimization the compiler might perform is to turn this:
 344  344  #       #pragma weak foo
 345  345  #       extern int foo;
 346  346  #       if (&foo)
 347  347  #               foo = 5;
 348  348  # into
 349  349  #       foo = 5;
 350  350  # Since we do some of this (foo might be referenced in common kernel code
 351  351  # but provided only for some cpu modules or platforms), we disable this
 352  352  # optimization.
 353      -# 
      353 +#
 354  354  sparc_CCUNBOUND = -Wd,-xsafe=unboundsym
 355  355  i386_CCUNBOUND  =
 356  356  CCUNBOUND       = $($(MACH)_CCUNBOUND)
 357  357  
 358  358  #
 359  359  # compiler '-xarch' flag. This is here to centralize it and make it
 360  360  # overridable for testing.
 361  361  sparc_XARCH=    -m32
 362  362  sparcv9_XARCH=  -m64
 363  363  i386_XARCH=
↓ open down ↓ 26 lines elided ↑ open up ↑
 390  390  STAND_FLAGS_32 = $($(MACH)_STAND_FLAGS)
 391  391  STAND_FLAGS_64 = $($(MACH64)_STAND_FLAGS)
 392  392  
 393  393  #
 394  394  # disable the incremental linker
 395  395  ILDOFF=                 -xildoff
 396  396  #
 397  397  XDEPEND=                -xdepend
 398  398  XFFLAG=                 -xF=%all
 399  399  XESS=                   -xs
 400      -XSTRCONST=              -xstrconst 
      400 +XSTRCONST=              -xstrconst
 401  401  
 402  402  #
 403  403  # turn warnings into errors (C)
 404  404  CERRWARN = -errtags=yes -errwarn=%all
 405  405  CERRWARN += -erroff=E_EMPTY_TRANSLATION_UNIT
 406  406  CERRWARN += -erroff=E_STATEMENT_NOT_REACHED
 407  407  
 408  408  CERRWARN += -_gcc=-Wno-missing-braces
 409  409  CERRWARN += -_gcc=-Wno-sign-compare
 410  410  CERRWARN += -_gcc=-Wno-unknown-pragmas
↓ open down ↓ 117 lines elided ↑ open up ↑
 528  528  IROPTFLAG64             = $($(MACH64)_IROPTFLAG)
 529  529  
 530  530  sparc_XREGSFLAG         = -xregs=no%appl
 531  531  sparcv9_XREGSFLAG       = -xregs=no%appl
 532  532  i386_XREGSFLAG          =
 533  533  amd64_XREGSFLAG         =
 534  534  
 535  535  XREGSFLAG               = $($(MACH)_XREGSFLAG)
 536  536  XREGSFLAG64             = $($(MACH64)_XREGSFLAG)
 537  537  
      538 +# dmake SOURCEDEBUG=yes ... enables source-level debugging information, and
      539 +# avoids stripping it.
      540 +SOURCEDEBUG     = $(POUND_SIGN)
      541 +SRCDBGBLD       = $(SOURCEDEBUG:yes=)
      542 +
      543 +#
      544 +# These variables are intended ONLY for use by developers to safely pass extra
      545 +# flags to the compilers without unintentionally overriding Makefile-set
      546 +# flags.  They should NEVER be set to any value in a Makefile.
      547 +#
      548 +# They come last in the associated FLAGS variable such that they can
      549 +# explicitly override things if necessary, there are gaps in this, but it's
      550 +# the best we can manage.
      551 +#
      552 +CUSERFLAGS              =
      553 +CUSERFLAGS64            = $(CUSERFLAGS)
      554 +CCUSERFLAGS             =
      555 +CCUSERFLAGS64           = $(CCUSERFLAGS)
      556 +
      557 +CSOURCEDEBUGFLAGS       =
      558 +CCSOURCEDEBUGFLAGS      =
      559 +$(SRCDBGBLD)CSOURCEDEBUGFLAGS   = -g -xs
      560 +$(SRCDBGBLD)CCSOURCEDEBUGFLAGS  = -g -xs
      561 +
 538  562  CFLAGS=         $(COPTFLAG) $($(MACH)_CFLAGS) $(SPACEFLAG) $(CCMODE) \
 539  563                  $(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND) $(IROPTFLAG) \
 540      -                $(CGLOBALSTATIC) $(CCNOAUTOINLINE)
      564 +                $(CGLOBALSTATIC) $(CCNOAUTOINLINE) $(CSOURCEDEBUGFLAGS) \
      565 +                $(CUSERFLAGS)
 541  566  CFLAGS64=       $(COPTFLAG64) $($(MACH64)_CFLAGS) $(SPACEFLAG64) $(CCMODE64) \
 542  567                  $(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND) $(IROPTFLAG64) \
 543      -                $(CGLOBALSTATIC) $(CCNOAUTOINLINE)
      568 +                $(CGLOBALSTATIC) $(CCNOAUTOINLINE) $(CSOURCEDEBUGFLAGS) \
      569 +                $(CUSERFLAGS64)
 544  570  #
 545  571  # Flags that are used to build parts of the code that are subsequently
 546  572  # run on the build machine (also known as the NATIVE_BUILD).
 547  573  #
 548  574  NATIVE_CFLAGS=  $(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) $(CCMODE) \
 549  575                  $(ILDOFF) $(CERRWARN) $(C99MODE) $($(NATIVE_MACH)_CCUNBOUND) \
 550      -                $(IROPTFLAG) $(CGLOBALSTATIC) $(CCNOAUTOINLINE)
      576 +                $(IROPTFLAG) $(CGLOBALSTATIC) $(CCNOAUTOINLINE) \
      577 +                $(CSOURCEDEBUGFLAGS) $(CUSERFLAGS)
 551  578  
 552  579  DTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\"       # For messaging.
 553  580  DTS_ERRNO=-D_TS_ERRNO
 554  581  CPPFLAGS.master=$(DTEXTDOM) $(DTS_ERRNO) \
 555  582          $(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
 556  583  CPPFLAGS.native=$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
 557  584  CPPFLAGS=       $(CPPFLAGS.master)
 558  585  AS_CPPFLAGS=    $(CPPFLAGS.master)
 559  586  JAVAFLAGS=      -deprecation
 560  587  
 561  588  #
 562  589  # For source message catalogue
 563  590  #
 564  591  .SUFFIXES: $(SUFFIXES) .i .po
 565  592  MSGROOT= $(ROOT)/catalog
 566  593  MSGDOMAIN= $(MSGROOT)/$(TEXT_DOMAIN)
 567  594  MSGDOMAINPOFILE = $(MSGDOMAIN)/$(POFILE)
 568      -DCMSGDOMAIN= $(MSGROOT)/LC_TIME/$(TEXT_DOMAIN) 
      595 +DCMSGDOMAIN= $(MSGROOT)/LC_TIME/$(TEXT_DOMAIN)
 569  596  DCMSGDOMAINPOFILE = $(DCMSGDOMAIN)/$(DCFILE:.dc=.po)
 570  597  
 571  598  CLOBBERFILES += $(POFILE) $(POFILES)
 572  599  COMPILE.cpp= $(CC) -E -C $(CFLAGS) $(CPPFLAGS)
 573  600  XGETTEXT= /usr/bin/xgettext
 574  601  XGETFLAGS= -c TRANSLATION_NOTE
 575  602  GNUXGETTEXT= /usr/gnu/bin/xgettext
 576  603  GNUXGETFLAGS= --add-comments=TRANSLATION_NOTE --keyword=_ \
 577  604          --strict --no-location --omit-header
 578  605  BUILD.po= $(XGETTEXT) $(XGETFLAGS) -d $(<F) $<.i ;\
↓ open down ↓ 23 lines elided ↑ open up ↑
 602  629                          -Qoption ccfe -features=no%conststrings \
 603  630                          $(CCERRWARN)
 604  631  
 605  632  sparc_CCOPTFLAG=        -O
 606  633  sparcv9_CCOPTFLAG=      -O
 607  634  i386_CCOPTFLAG=         -O
 608  635  amd64_CCOPTFLAG=        -O
 609  636  
 610  637  CCOPTFLAG=      $($(MACH)_CCOPTFLAG)
 611  638  CCOPTFLAG64=    $($(MACH64)_CCOPTFLAG)
 612      -CCFLAGS=        $(CCOPTFLAG) $($(MACH)_CCFLAGS)
 613      -CCFLAGS64=      $(CCOPTFLAG64) $($(MACH64)_CCFLAGS)
      639 +CCFLAGS=        $(CCOPTFLAG) $($(MACH)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \
      640 +                $(CCUSERFLAGS)
      641 +CCFLAGS64=      $(CCOPTFLAG64) $($(MACH64)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \
      642 +                $(CCUSERFLAGS64)
 614  643  
 615  644  #
 616  645  #
 617  646  #
 618      -ELFWRAP_FLAGS   =       
      647 +ELFWRAP_FLAGS   =
 619  648  ELFWRAP_FLAGS64 =       -64
 620  649  
 621  650  #
 622  651  # Various mapfiles that are used throughout the build, and delivered to
 623  652  # /usr/lib/ld.
 624  653  #
 625  654  MAPFILE.NED_i386 =      $(SRC)/common/mapfiles/common/map.noexdata
 626  655  MAPFILE.NED_sparc =
 627  656  MAPFILE.NED =           $(MAPFILE.NED_$(MACH))
 628  657  MAPFILE.PGA =           $(SRC)/common/mapfiles/common/map.pagealign
↓ open down ↓ 18 lines elided ↑ open up ↑
 647  676  $(__GNUC64)MAPFILE.NGB_amd64= \
 648  677                          $(SRC)/common/mapfiles/gen/amd64_gcc_map.noexeglobs
 649  678  MAPFILE.NGB =           $(MAPFILE.NGB_$(MACH))
 650  679  
 651  680  #
 652  681  # A generic interface mapfile name, used by various dynamic objects to define
 653  682  # the interfaces and interposers the object must export.
 654  683  #
 655  684  MAPFILE.INT =           mapfile-intf
 656  685  
 657      -# 
      686 +#
 658  687  # LDLIBS32 can be set in the environment to override the following assignment.
 659  688  # LDLIBS64 can be set to override the assignment made in Makefile.master.64.
 660  689  # These environment settings make sure that no libraries are searched outside
 661  690  # of the local workspace proto area:
 662  691  #       LDLIBS32=-YP,$ROOT/lib:$ROOT/usr/lib
 663  692  #       LDLIBS64=-YP,$ROOT/lib/$MACH64:$ROOT/usr/lib/$MACH64
 664  693  #
 665  694  LDLIBS32 =      $(ENVLDLIBS1) $(ENVLDLIBS2) $(ENVLDLIBS3)
 666  695  LDLIBS.cmd =    $(LDLIBS32)
 667  696  LDLIBS.lib =    $(LDLIBS32)
↓ open down ↓ 212 lines elided ↑ open up ↑
 880  909  CC_PICFLAGS =           $($(MACH)_CC_PICFLAGS)
 881  910  CC_PICFLAGS64 =         $($(MACH64)_CC_PICFLAGS)
 882  911  
 883  912  AS_PICFLAGS=            $(C_PICFLAGS)
 884  913  AS_BIGPICFLAGS=         $(C_BIGPICFLAGS)
 885  914  
 886  915  #
 887  916  # Default label for CTF sections
 888  917  #
 889  918  CTFCVTFLAGS=            -i -L VERSION
      919 +$(SRCDBGBLD)CTFCVTFLAGS         += -g
 890  920  
 891  921  #
 892      -# Override to pass module-specific flags to ctfmerge.  Currently used
 893      -# only by krtld to turn on fuzzy matching.
      922 +# Override to pass module-specific flags to ctfmerge.  Currently used only by
      923 +# krtld to turn on fuzzy matching, and source-level debugging to inhibit
      924 +# stripping.
 894  925  #
 895  926  CTFMRGFLAGS=
      927 +$(SRCDBGBLD)CTFMRGFLAGS         += -g
      928 +
 896  929  
 897  930  CTFCONVERT_O            = $(CTFCONVERT) $(CTFCVTFLAGS) $@
 898  931  
 899  932  ELFSIGN_O=      $(TRUE)
 900  933  ELFSIGN_CRYPTO= $(ELFSIGN_O)
 901  934  ELFSIGN_OBJECT= $(ELFSIGN_O)
 902  935  $(EXPORT_RELEASE_BUILD)ELFSIGN_O =      $(ELFSIGN)
 903  936  $(EXPORT_RELEASE_BUILD)ELFSIGN_CFNAME = SUNWosnetCF
 904  937  $(EXPORT_RELEASE_BUILD)ELFSIGN_KEY =    \
 905  938                          $(CLOSED)/cmd/cmd-crypto/etc/keys/$(ELFSIGN_CFNAME)
↓ open down ↓ 62 lines elided ↑ open up ↑
 968 1001  PATCH_DATE=     $(RELEASE_DATE)
 969 1002  RELEASE_CM=     "@($(POUND_SIGN))SunOS $(RELEASE) $(PATCHID) $(PATCH_DATE)"
 970 1003  DEV_CM=         "@($(POUND_SIGN))SunOS Internal Development: non-nightly build"
 971 1004  
 972 1005  PROCESS_COMMENT=                   @?${MCS} -c -a $(RELEASE_CM) -a $(DEV_CM)
 973 1006  $(STRIP_COMMENTS)PROCESS_COMMENT=  @?${MCS} -d -a $(RELEASE_CM) -a $(DEV_CM)
 974 1007  $(RELEASE_BUILD)PROCESS_COMMENT=   @?${MCS} -d -a $(RELEASE_CM)
 975 1008  
 976 1009  STRIP_STABS=                       :
 977 1010  $(RELEASE_BUILD)STRIP_STABS=       $(STRIP) -x $@
     1011 +$(SRCDBGBLD)STRIP_STABS=           :
 978 1012  
 979 1013  POST_PROCESS_O=         $(PROCESS_COMMENT) $@
 980 1014  POST_PROCESS_A=
 981 1015  POST_PROCESS_SO=        $(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
 982 1016                          $(ELFSIGN_OBJECT)
 983 1017  POST_PROCESS=           $(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
 984 1018                          $(ELFSIGN_OBJECT)
 985 1019  
 986 1020  #
 987 1021  # chk4ubin is a tool that inspects a module for a symbol table
↓ open down ↓ 132 lines elided ↑ open up ↑
1120 1154  
1121 1155  .c.i:
1122 1156          $(CPPFORPO) $< > $@
1123 1157  
1124 1158  .h.i:
1125 1159          $(CPPFORPO) $< > $@
1126 1160  
1127 1161  .y.i:
1128 1162          $(YACC) -d $<
1129 1163          $(CPPFORPO) y.tab.c  > $@
1130      -        $(RM) y.tab.c 
     1164 +        $(RM) y.tab.c
1131 1165  
1132 1166  .l.i:
1133 1167          $(LEX) $<
1134 1168          $(CPPFORPO) lex.yy.c  > $@
1135 1169          $(RM) lex.yy.c
1136 1170  
1137 1171  .c.po:
1138 1172          $(CPPFORPO) $< > $<.i
1139 1173          $(BUILD.po)
1140 1174  
1141 1175  .y.po:
1142 1176          $(YACC) -d $<
1143 1177          $(CPPFORPO) y.tab.c  > $<.i
1144 1178          $(BUILD.po)
1145      -        $(RM) y.tab.c 
     1179 +        $(RM) y.tab.c
1146 1180  
1147 1181  .l.po:
1148 1182          $(LEX) $<
1149 1183          $(CPPFORPO) lex.yy.c  > $<.i
1150 1184          $(BUILD.po)
1151 1185          $(RM) lex.yy.c
1152 1186  
1153 1187  #
1154 1188  # Rules to perform stylistic checks
1155 1189  #
↓ open down ↓ 10 lines elided ↑ open up ↑
1166 1200  
1167 1201  #
1168 1202  # Rules to process ONC+ Source partial files
1169 1203  #
1170 1204  %_onc_plus:     %
1171 1205          @$(ECHO) "extracting code from $< ... "
1172 1206          sed -n -e '/ONC_PLUS EXTRACT START/,/ONC_PLUS EXTRACT END/p' $<  > $@
1173 1207  
1174 1208  #
1175 1209  # Include rules to render automated sccs get rules "safe".
1176      -# 
     1210 +#
1177 1211  include $(SRC)/Makefile.noget
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX