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 (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
  24 # Copyright 2017 Nexenta Systems, Inc.
  25 #
  26 
  27 LIBBASENAME=    libc
  28 LIBRARY=        $(LIBBASENAME:%=%.a)
  29 VERS=           .1
  30 
  31 # Note that we build libc_pic.a for the benefit of building
  32 # ld.so.1, but we do not install it.  Only ld.so.1 needs it
  33 # and it must be built in the same workspace as libc.
  34 LIB_PIC= libc_pic.a
  35 
  36 ROOTLIB=        $(ROOT)/usr/lib
  37 ROOTFS_LIB=     $(ROOT)/lib
  38 ROOTLIB64=      $(ROOTLIB)/$(MACH64)
  39 ROOTFS_LIB64=   $(ROOTFS_LIB)/$(MACH64)
  40 
  41 ROOTFS_LINTDIR=         $(ROOTFS_LIB)
  42 ROOTFS_LINTDIR64=       $(ROOTFS_LIB64)
  43 ROOTFS_LINTLIB=         $(ROOTFS_LINTDIR)/$(LINTLIB)
  44 ROOTFS_LINTLIB64=       $(ROOTFS_LINTDIR64)/$(LINTLIB)
  45 
  46 # include common library definitions
  47 include ../Makefile.lib
  48 
  49 i386_COMP=      capabilities
  50 sparc_COMP=     capabilities
  51 
  52 MACH_COMP=      $($(MACH)_COMP)
  53 
  54 i386_ETC=       $(MACH)/etc
  55 sparc_ETC=
  56 
  57 SUBDIRS=        $(MACH_CAP) $(MACH) $(MACH_ETC) $(BUILD64) $(MACH64)
  58 
  59 LIBS =          $(DYNLIB) $(LINTLIB)
  60 
  61 ROOTLIBS64=     $(ROOTLIBDIR64)/$(DYNLIB) $(ROOTLIBDIR64)/$(LINTLIB)
  62 MACHLIBS64=     $(MACH64)/$(DYNLIB) $(MACH64)/$(LINTLIB)
  63 
  64 # definitions for install_h target
  65 BASEHDRS=       getxby_door.h
  66 CHECKHDRS=      $(BASEHDRS:%.h=port/gen/%.check)
  67 HDRS=           $(BASEHDRS)
  68 
  69 CLOBBERFILES += THIRDPARTYLICENSE extract-copyright
  70 
  71 # install rules for install_h target
  72 $(ROOTHDRDIR)/%: port/gen/%
  73         $(INS.file)
  74 
  75 $(ROOTLIBDIR)/$(DYNLIB) :=      FILEMODE = 755
  76 $(ROOTLIBDIR64)/$(DYNLIB) :=    FILEMODE = 755
  77 $(ROOTFS_LIBDIR)/$(DYNLIB) :=   FILEMODE = 755
  78 $(ROOTFS_LIBDIR64)/$(DYNLIB) := FILEMODE = 755
  79 
  80 .KEEP_STATE:
  81 
  82 all:    all_h lib32 $(BUILD64) .WAIT lib64 .WAIT etc THIRDPARTYLICENSE
  83 
  84 THIRDPARTYLICENSE: extract-copyright
  85         $(RM) $@
  86         ./extract-copyright . > $@
  87 
  88 etc:    $($(MACH)_ETC)
  89 
  90 lib32:  $(MACH_COMP) $(MACHLIBS) $(MACH)/$(LIB_PIC)
  91         @if $(ELFDUMP) -r $(MACH)/$(DYNLIB) | $(GREP) -w environ ; then \
  92                 $(ECHO) "Error: Invalid reference to environ" ; \
  93                 $(ECHO) "Error: See comments in port/gen/env_data.c" ; \
  94                 exit 1; \
  95         fi
  96 
  97 lib64:  $(MACH_COMP) $(MACHLIBS64) $(MACH64)/$(LIB_PIC)
  98         @if $(ELFDUMP) -r $(MACH64)/$(DYNLIB) | $(GREP) -w environ ; then \
  99                 $(ECHO) "Error: Invalid reference to environ" ; \
 100                 $(ECHO) "Error: See comments in port/gen/env_data.c" ; \
 101                 exit 1; \
 102         fi
 103 
 104 $(MACH)/assym.h $(MACH64)/assym.h:
 105         @cd $(@D); $(MAKE) assym.h
 106 
 107 $($(MACH)_ETC): FRC
 108         @cd $(@); pwd; $(MAKE) $(TARGET)
 109 
 110 $($(MACH)_COMP): FRC
 111         @cd $(@); pwd; $(MAKE) $(TARGET)
 112 
 113 install:        all                     \
 114                 etc                     \
 115                 inslib32                \
 116                 $(BUILD64) inslib64
 117 
 118 inslib32:       $(ROOTFS_LIBS) $(ROOTFS_LINKS) $(ROOTFS_LINT) $(ROOTFS_LINTLIB)
 119 
 120 inslib64:       $(ROOTFS_LIBS64) $(ROOTFS_LINKS64) $(ROOTFS_LINTLIB64)
 121 
 122 install_h: all_h $(ROOTHDRS)
 123 
 124 all_h:  $(MACH)/assym.h $(MACH64)/assym.h
 125 
 126 check:  $(CHECKHDRS)
 127 
 128 $(ROOTFS_LIB)/%: $(MACH)/%
 129         $(INS.file)
 130 $(ROOTFS_LIBDIR)/$(LIBLINKS): $(ROOTFS_LIBDIR)/$(LIBLINKS)$(VERS)
 131         $(INS.liblink)
 132 $(ROOTFS_LIB64)/%: $(MACH64)/%
 133         $(INS.file)
 134 $(ROOTFS_LIBDIR64)/$(LIBLINKS): $(ROOTFS_LIBDIR64)/$(LIBLINKS)$(VERS)
 135         $(INS.liblink)
 136 
 137 # install rule for lint library target
 138 $(ROOTFS_LINTDIR)/%: port/%
 139         $(INS.file)
 140 $(ROOTFS_LINTDIR64)/%: port/%
 141         $(INS.file)
 142 $(ROOTFS_LINTDIR)/%: $(MACH)/%
 143         $(INS.file)
 144 $(ROOTFS_LINTDIR64)/%: $(MACH64)/%
 145         $(INS.file)
 146 
 147 $(LINTLIB):
 148         @cd $(MACH); pwd; VERSION='$(VERSION)' $(MAKE) $@
 149 $(LINTLIB64):
 150         @cd $(MACH64); pwd; VERSION='$(VERSION)' $(MAKE) $@
 151 
 152 $(MACH)/$(LIB_PIC): FRC
 153         @cd $(MACH); pwd; VERSION='$(VERSION)' $(MAKE) $(LIB_PIC)
 154 $(MACH64)/$(LIB_PIC): FRC
 155         @cd $(MACH64); pwd; VERSION='$(VERSION)' $(MAKE) $(LIB_PIC)
 156 
 157 all     :=      TARGET= all
 158 install :=      TARGET= install
 159 clean   :=      TARGET= clean
 160 clobber :=      TARGET= clobber
 161 lint    :=      TARGET= lint
 162 
 163 .PARALLEL:      $(SUBDIRS)
 164 
 165 $(SUBDIRS): FRC
 166         @cd $@; pwd; VERSION='$(VERSION)' $(MAKE) $(TARGET)
 167 
 168 clean: $(SUBDIRS)
 169 clobber: $(SUBDIRS) etc clobber_local
 170 clobber_local:
 171         $(RM) $(CLOBBERFILES)
 172 
 173 lint: $(SUBDIRS)
 174 
 175 _msg:   $(MSGDOMAIN) catalog
 176 
 177 catalog:
 178         sh ./makelibccatalog.sh $(MSGDOMAIN)
 179 
 180 $(MSGDOMAIN):
 181         $(INS.dir)
 182 
 183 cscope.out tags: FRC
 184         $(XREF) -x $@
 185 
 186 FRC:
 187 # include MACH-specific library targets
 188 include ../Makefile.mach