Print this page
    
    
      
        | Split | 
	Close | 
      
      | Expand all | 
      | Collapse all | 
    
    
          --- old/usr/src/lib/Makefile.lib
          +++ new/usr/src/lib/Makefile.lib
   1    1  #
   2    2  # CDDL HEADER START
   3    3  #
   4    4  # The contents of this file are subject to the terms of the
   5    5  # Common Development and Distribution License (the "License").
   6    6  # You may not use this file except in compliance with the License.
   7    7  #
   8    8  # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9    9  # or http://www.opensolaris.org/os/licensing.
  10   10  # See the License for the specific language governing permissions
  11   11  # and limitations under the License.
  12   12  #
  13   13  # When distributing Covered Code, include this CDDL HEADER in each
  
    | 
      ↓ open down ↓ | 
    13 lines elided | 
    
      ↑ open up ↑ | 
  
  14   14  # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15  # If applicable, add the following below this CDDL HEADER, with the
  16   16  # fields enclosed by brackets "[]" replaced with your own identifying
  17   17  # information: Portions Copyright [yyyy] [name of copyright owner]
  18   18  #
  19   19  # CDDL HEADER END
  20   20  #
  21   21  # Copyright 2015 Gary Mills
  22   22  # Copyright 2015 Igor Kozhukhov <ikozhukhov@gmail.com>
  23   23  # Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
  24      -# Copyright (c) 2015, Joyent, Inc.
       24 +# Copyright (c) 2014, Joyent, Inc.
  25   25  #
  26   26  #
  27   27  # Definitions common to libraries.
  28   28  #
  29   29  # include global definitions; SRC should be defined in the shell.
  30   30  # SRC is needed until RFE 1026993 is implemented.
  31   31  
  32   32  include         $(SRC)/Makefile.master
  33   33  
  34   34  LORDER=         lorder
  35   35  TSORT=          tsort
  36   36  
  37   37  #
  38   38  # By default, we define the source directory for libraries to be
  39   39  # one level up from the ISA-specific directory, where the code is
  40   40  # actually built.  Many libraries define a 'common' directory to
  41   41  # contain the source.  These libraries must redefine SRCDIR as:
  42   42  #       SRCDIR = ../common
  43   43  # Other variations are possible (../port, ../src, etc).
  44   44  #
  45   45  SRCDIR =        ..
  46   46  
  47   47  #
  48   48  # We define MAPFILES here for the benefit of most libraries, those that
  49   49  # follow the convention of having source files and other common files
  50   50  # in the $(SRCDIR) directory.  Libraries that do not follow this
  51   51  # convention must define MAPFILES, or MAPFILEDIR for themselves.
  52   52  # Libraries that do follow this convention but that need supplemental
  53   53  # ISA-specific mapfiles can augment MAPFILES like this:
  54   54  #       MAPFILES += mapfile-vers
  55   55  #
  56   56  MAPFILEDIR =    $(SRCDIR)
  57   57  MAPFILES =      $(MAPFILEDIR)/mapfile-vers
  58   58  
  59   59  #
  60   60  # If HDRDIR is left unset, then it's possible for the $(ROOTHDRDIR)/%
  61   61  # install rule in lib/Makefile.targ to generate false matches if there
  62   62  # are any common directory names between / and /usr/include (`xfn' is
  63   63  # one common example).  To prevent this, we set HDRDIR to a directory
  64   64  # name that will almost surely not exist on the build machine.
  65   65  #
  66   66  HDRDIR=         /__nonexistent_directory__
  67   67  
  68   68  #
  69   69  # We don't build archive (*.a) libraries by default anymore.
  70   70  # If a component of the build needs to build an archive library
  71   71  # for its own internal purposes, it can define LIBS for itself
  72   72  # after including Makefile.lib, like this:
  73   73  #       LIBS = $(LIBRARY)
  74   74  # or:
  75   75  #       LIBS = $(LIBRARYCCC)
  76   76  # Archive libraries must not be installed in the proto area.
  77   77  #
  78   78  LIBS=
  79   79  MACHLIBS=       $(LIBS:%=$(MACH)/%)
  80   80  MACHLIBS64=     $(LIBS:%=$(MACH64)/%)
  81   81  DYNLIB=         $(LIBRARY:.a=.so$(VERS))
  82   82  DYNLIBPSR=      $(LIBRARY:.a=_psr.so$(VERS))
  83   83  DYNLIBCCC=      $(LIBRARYCCC:.a=.so$(VERS))
  84   84  LIBLINKS=       $(LIBRARY:.a=.so)
  85   85  LIBLINKSCCC=    $(LIBRARYCCC:.a=.so)
  86   86  LIBNAME=        $(LIBRARY:lib%.a=%)
  87   87  LIBLINKPATH=
  88   88  LIBNULL=        null.a
  89   89  ROOTHDRDIR=     $(ROOT)/usr/include
  90   90  ROOTLIBDIR=     $(ROOT)/usr/lib
  91   91  ROOTLIBDIR64=   $(ROOT)/usr/lib/$(MACH64)
  92   92  ROOTFS_LIBDIR=  $(ROOT)/lib
  93   93  ROOTFS_LIBDIR64=        $(ROOT)/lib/$(MACH64)
  94   94  ROOTLINTDIR=    $(ROOTLIBDIR)
  95   95  ROOTFS_LINTDIR= $(ROOTFS_LIBDIR)
  96   96  ROOTFS_LINTDIR64=       $(ROOTFS_LIBDIR64)
  97   97  ROOTHDRS=       $(HDRS:%=$(ROOTHDRDIR)/%)
  98   98  HDRSRCS=        $(HDRS:%=$(HDRDIR)/%)
  99   99  CHECKHDRS=      $(HDRSRCS:%.h=%.check)
 100  100  ROOTLIBS=       $(LIBS:%=$(ROOTLIBDIR)/%)
 101  101  ROOTLIBS64=     $(LIBS:%=$(ROOTLIBDIR64)/%)
 102  102  ROOTFS_LIBS=    $(DYNLIB:%=$(ROOTFS_LIBDIR)/%)
 103  103  ROOTFS_LIBS64=  $(DYNLIB:%=$(ROOTFS_LIBDIR64)/%)
 104  104  ROOTLINKS=      $(ROOTLIBDIR)/$(LIBLINKS)
 105  105  ROOTLINKS64=    $(ROOTLIBDIR64)/$(LIBLINKS)
 106  106  ROOTFS_LINKS=   $(ROOTFS_LIBDIR)/$(LIBLINKS)
 107  107  ROOTFS_LINKS64= $(ROOTFS_LIBDIR64)/$(LIBLINKS)
 108  108  ROOTLINKSCCC=   $(ROOTLIBDIR)/$(LIBLINKSCCC)
 109  109  ROOTLINKSCCC64= $(ROOTLIBDIR64)/$(LIBLINKSCCC)
 110  110  ROOTFS_LINKSCCC=        $(ROOTFS_LIBDIR)/$(LIBLINKSCCC)
 111  111  ROOTFS_LINKSCCC64=      $(ROOTFS_LIBDIR64)/$(LIBLINKSCCC)
 112  112  ROOTLINT=       $(LINTSRC:%=$(ROOTLINTDIR)/%)
 113  113  ROOTFS_LINT=    $(LINTSRC:%=$(ROOTFS_LINTDIR)/%)
 114  114  ROOTFS_LINT64=  $(LINTSRC:%=$(ROOTFS_LINTDIR64)/%)
 115  115  ROOTMAN3=     $(ROOT)/usr/share/man/man3
 116  116  ROOTMAN3FILES=        $(MAN3FILES:%=$(ROOTMAN3)/%)
 117  117  $(ROOTMAN3FILES) := FILEMODE= 444
 118  118  
 119  119  # Demo rules
 120  120  DEMOFILES=
 121  121  DEMOFILESRCDIR=         common
 122  122  ROOTDEMODIRBASE=        __nonexistent_directory__
 123  123  ROOTDEMODIRS=
 124  124  ROOTDEMOFILES=  $(DEMOFILES:%=$(ROOTDEMODIRBASE)/%)
 125  125  $(ROOTDEMODIRS) :=      DIRMODE =       755
 126  126  
 127  127  LINTLIB=        llib-l$(LIBNAME).ln
 128  128  LINTFLAGS=      -uaxm
 129  129  LINTFLAGS64=    -uaxm -m64
 130  130  LINTSRC=        $(LINTLIB:%.ln=%)
 131  131  LINTOUT=        lint.out
 132  132  ARFLAGS=        r
 133  133  SONAME=         $(DYNLIB)
 134  134  # For most libraries, we should be able to resolve all symbols at link time,
 135  135  # either within the library or as dependencies, all text should be pure, and
 136  136  # combining relocations into one relocation table reduces startup costs.
 137  137  # All options are tunable to allow overload/omission from lower makefiles.
 138  138  
 139  139  #
 140  140  # DTrace related rules
 141  141  #
 142  142  # These allow for multiple USDT providers to be specified by a library.
 143  143  # If a library needs to break up the set of objects that are passed to
 144  144  # the dtrace -G invocation, then they can place the following in heir
 145  145  # Makefile.com:
 146  146  #
 147  147  # pics/<provider>.o     := USDT_G_PICS = <files>
 148  148  #
 149  149  # <provider> should be replaced with the basename of one of the USDT
 150  150  # providers specified in USDT_PROVIDERS in their Makefile.com.
 151  151  #
 152  152  USDT_HEADERS=   $(USDT_PROVIDERS:%.d=%_impl.h)
 153  153  USDT_PICS=      $(USDT_PROVIDERS:%.d=pics/%.o)
 154  154  USDT_G_PICS=    $(PICS)
 155  155  
 156  156  
 157  157  HSONAME=        -h$(SONAME)
 158  158  DYNFLAGS=       $(HSONAME) $(ZTEXT) $(ZDEFS) $(BDIRECT) \
 159  159                  $(MAPFILES:%=-M%) $(MAPFILE.PGA:%=-M%) $(MAPFILE.NED:%=-M%)
 160  160  
 161  161  LDLIBS=         $(LDLIBS.lib)
 162  162  
 163  163  OBJS=           $(OBJECTS:%=objs/%)
 164  164  PICS=           $(OBJECTS:%=pics/%)
 165  165  
 166  166  # Declare that all library .o's can all be made in parallel.
 167  167  # The DUMMY target is for those instances where OBJS and PICS
 168  168  # are empty (to avoid an unconditional .PARALLEL declaration).
 169  169  .PARALLEL:      $(OBJS) $(PICS) DUMMY
 170  170  
 171  171  # default value for "portable" source
 172  172  SRCS=           $(OBJECTS:%.o=$(SRCDIR)/%.c)
 173  173  
 174  174  # default build of an archive and a shared object,
 175  175  # overridden locally when extra processing is needed
 176  176  BUILD.AR=       $(AR) $(ARFLAGS) $@ $(AROBJS)
 177  177  BUILD.SO=       $(CC) $(CFLAGS) -o $@ $(GSHARED) $(DYNFLAGS) \
 178  178                  $(PICS) $(EXTPICS) $(USDT_PICS) $(LDLIBS)
 179  179  BUILDCCC.SO=    $(CCC) $(CCFLAGS) -o $@ $(GSHARED) $(DYNFLAGS) \
 180  180                  $(PICS) $(EXTPICS) $(LDLIBS)
 181  181  
 182  182  # default dynamic library symlink
 183  183  INS.liblink=    -$(RM) $@; $(SYMLINK) $(LIBLINKPATH)$(LIBLINKS)$(VERS) $@
 184  184  INS.liblinkccc= -$(RM) $@; $(SYMLINK) $(LIBLINKPATH)$(LIBLINKSCCC)$(VERS) $@
 185  185  
 186  186  # default 64-bit dynamic library symlink
 187  187  INS.liblink64=  -$(RM) $@; $(SYMLINK) $(LIBLINKPATH)$(LIBLINKS)$(VERS) $@
 188  188  INS.liblinkccc64= -$(RM) $@; $(SYMLINK) $(LIBLINKPATH)$(LIBLINKSCCC)$(VERS) $@
 189  189  
 190  190  #
 191  191  # If appropriate, augment POST_PROCESS_O and POST_PROCESS_SO to do CTF
 192  192  # processing.  We'd like to just conditionally append to POST_PROCESS_O and
 193  193  # POST_PROCESS_SO, but ParallelMake has a bug which causes the same value to
 194  194  # sometimes get appended more than once, which will cause ctfconvert to fail.
 195  195  # So, instead we introduce CTFCONVERT_POST and CTFMERGE_POST, which are always
 196  196  # appended to POST_PROCESS_O and POST_PROCESS_SO but are no-ops unless CTF
 197  197  # processing should be done.
 198  198  #
 199  199  CTFCONVERT_POST = :
 200  200  CTFMERGE_POST   = :
 201  201  POST_PROCESS_O += ; $(CTFCONVERT_POST)
 202  202  POST_PROCESS_SO += ; $(CTFMERGE_POST)
 203  203  
 204  204  CTFMERGE_LIB    = $(CTFMERGE) $(CTFMRGFLAGS) -t -f -L VERSION -o $@ $(PICS)
 205  205  
 206  206  # conditional assignments
 207  207  
 208  208  $(OBJS)  :=     sparc_CFLAGS += -xregs=no%appl
 209  209  
 210  210  $(PICS)  :=     sparc_CFLAGS += -xregs=no%appl $(sparc_C_PICFLAGS)
 211  211  $(PICS)  :=     sparcv9_CFLAGS += -xregs=no%appl $(sparcv9_C_PICFLAGS)
 212  212  $(PICS)  :=     i386_CFLAGS += $(i386_C_PICFLAGS)
 213  213  $(PICS)  :=     amd64_CFLAGS += $(amd64_C_PICFLAGS)
 214  214  $(PICS)  :=     CCFLAGS += $(CC_PICFLAGS)
 215  215  $(PICS)  :=     CPPFLAGS += -DPIC -D_REENTRANT
 216  216  $(PICS)  :=     sparcv9_CCFLAGS += -xregs=no%appl $(sparcv9_CC_PICFLAGS)
 217  217  $(PICS)  :=     amd64_CCFLAGS += $(amd64_CC_PICFLAGS)
 218  218  $(PICS)  :=     CFLAGS += $(CTF_FLAGS)
 219  219  $(PICS)  :=     CFLAGS64 += $(CTF_FLAGS)
 220  220  $(PICS)  :=     CTFCONVERT_POST = $(CTFCONVERT_O)
 221  221  $(DYNLIB) :=    CTFMERGE_POST = $(CTFMERGE_LIB)
 222  222  
 223  223  $(LINTLIB):=    LOG = -DLOGGING
 224  224  $(LIBRARY):=    AROBJS = $(OBJS)
 225  225  $(LIBRARY):=    DIR = objs
 226  226  $(DYNLIB):=     DIR = pics
 227  227  $(DYNLIBCCC):=  DIR = pics
 228  228  
 229  229  SONAMECCC=      $(DYNLIBCCC)
 230  230  HSONAMECCC=     -h $(SONAMECCC)
 231  231  #
 232  232  # Keep in sync with the standard DYNFLAGS
 233  233  #
 234  234  $(DYNLIBCCC):=  DYNFLAGS = $(HSONAMECCC) $(ZTEXT) $(ZDEFS) \
 235  235                  $(MAPFILES:%=-M%) $(MAPFILE.PGA:%=-M%) $(MAPFILE.NED:%=-M%) \
 236  236                  $(BDIRECT) $(NORUNPATH)
 237  237  
 238  238  
 239  239  # build rule for "portable" source 
 240  240  objs/%.o pics/%.o: %.c
 241  241          $(COMPILE.c) -o $@ $<
 242  242          $(POST_PROCESS_O)
 243  243  
 244  244  objs/%.o pics/%.o: %.cc
 245  245          $(COMPILE.cc) -o $@ $<
 246  246          $(POST_PROCESS_O)
 247  247  
 248  248  .PRECIOUS: $(LIBS)
 249  249  
 250  250  # Define the majority text domain in this directory.
 251  251  TEXT_DOMAIN= SUNW_OST_OSLIB
 252  252  
 253  253  $(ROOTMAN3)/%: %.sunman
 254  254          $(INS.rename)
 255  255  
 256  256  #
 257  257  # For library source code, we expect that some symbols may not be used or
 258  258  # may *appear* to be able to rescoped to static; shut lint up.  Never add
 259  259  # a flag here unless you're *sure* that all libraries need to be linted
 260  260  # with it.
 261  261  #
 262  262  LINTCHECKFLAGS = -m -erroff=E_NAME_DEF_NOT_USED2
 263  263  LINTCHECKFLAGS += -erroff=E_NAME_DECL_NOT_USED_DEF2 
 264  264  
  
    | 
      ↓ open down ↓ | 
    230 lines elided | 
    
      ↑ open up ↑ | 
  
 265  265  #
 266  266  # Target Architecture
 267  267  #
 268  268  TARGETMACH=     $(MACH)
 269  269  
 270  270  #
 271  271  # Allow people to define their own clobber rules.  Normal makefiles
 272  272  # shouldn't override this - they should override $(CLOBBERFILES) instead.
 273  273  #
 274  274  CLOBBERTARGFILES= $(LIBS) $(DYNLIB) $(CLOBBERFILES)
 275      -
 276      -#
 277      -# Define the default ctfdiff invocation used to check a list of types
 278      -# supplied by a user of a library. The goal is to validate that a given
 279      -# series of types is the same in both a 32-bit and 64-bit artifact. This
 280      -# is only defined if we have a 64-bit build to do.
 281      -#
 282      -TYPECHECK_LIB32 =               $(TYPECHECK_LIB:%=$(MACH)/%)
 283      -TYPECHECK_LIB64 =               $(TYPECHECK_LIB:%=$(MACH64)/%)
 284      -TYPECHECK_LIST=                 $(TYPELIST:%=-T %)
 285      -$(BUILD64)TYPECHECK.lib =       $(CTFDIFF) -t -I $(TYPECHECK_LIST) $(TYPECHECK_LIB32) $(TYPECHECK_LIB64)
 286      -TYPECHECK =                     $(TYPECHECK_LIB:%=%.typecheck)
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX