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# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. 23# 24# 25 26LIBBASENAME= libc 27LIBRARY= $(LIBBASENAME:%=%.a) 28VERS= .1 29 30# Note that we build libc_pic.a for the benefit of building 31# ld.so.1, but we do not install it. Only ld.so.1 needs it 32# and it must be built in the same workspace as libc. 33LIB_PIC= libc_pic.a 34 35ROOTLIB= $(ROOT)/usr/lib 36ROOTFS_LIB= $(ROOT)/lib 37ROOTLIB64= $(ROOTLIB)/$(MACH64) 38ROOTFS_LIB64= $(ROOTFS_LIB)/$(MACH64) 39 40ROOTVARIANTDIR= $(ROOTLIB)/libc 41ROOTVARIANTDIR64= $(ROOTLIB64)/libc 42 43ROOTFS_LINTDIR= $(ROOTFS_LIB) 44ROOTFS_LINTDIR64= $(ROOTFS_LIB64) 45ROOTFS_LINTLIB= $(ROOTFS_LINTDIR)/$(LINTLIB) 46ROOTFS_LINTLIB64= $(ROOTFS_LINTDIR64)/$(LINTLIB) 47 48# include common library definitions 49include ../Makefile.lib 50 51# 52# on some architectures, we build multiple libc variants 53# 54VAR1 = hwcap1 55VAR2 = hwcap2 56VAR3 = hwcap3 57 58VARBLD_1= $(MACH:sparc=sparc) 59VARBLD= $(VARBLD_1:i386=) 60 61VARBLD64_1= $(MACH:sparc=sparcv9) 62VARBLD64= $(VARBLD64_1:i386=) 63 64VAR1_DYNLIB = $(LIBRARY:%.a=%_$(VAR1).so$(VERS)) 65VAR1_BLDDIR = $(MACH)_$(VAR1)/$(VARBLD) 66VAR2_DYNLIB = $(LIBRARY:%.a=%_$(VAR2).so$(VERS)) 67VAR2_BLDDIR = $(MACH)_$(VAR2)/$(VARBLD) 68VAR3_DYNLIB = $(LIBRARY:%.a=%_$(VAR3).so$(VERS)) 69VAR3_BLDDIR = $(MACH)_$(VAR3)/$(VARBLD) 70 71VAR1_DYNLIB64 = $(LIBRARY:%.a=%_$(VAR1).so$(VERS)) 72VAR1_BLDDIR64 = $(MACH)_$(VAR1)/$(VARBLD64) 73 74i386_VARIANTS= $(VAR1) $(VAR2) $(VAR3) 75sparc_VARIANTS= 76sparcv9_VARIANTS= 77 78i386_COMP= 79sparc_COMP= capabilities 80 81MACH_COMP= $($(MACH)_COMP) 82 83i386_ETC= $(MACH)/etc 84sparc_ETC= 85 86VARIANTS= $($(MACH)_VARIANTS) 87VARIANT_SUBDIRS = $(VARIANTS:%=$(MACH)_%/$(VARBLD)) 88 89VARIANTS64= $($(MACH64)_VARIANTS) 90VARIANT_SUBDIRS64 = $(VARIANTS64:%=$(MACH)_%/$(VARBLD64)) 91 92SUBDIRS= $(MACH_CAP) $(MACH) $(MACH_ETC) $(VARIANT_SUBDIRS) 93$(BUILD64)SUBDIRS += $(MACH64) $(VARIANT_SUBDIRS64) 94 95LIBS = $(DYNLIB) $(LINTLIB) 96 97ROOTLIBS64= $(ROOTLIBDIR64)/$(DYNLIB) $(ROOTLIBDIR64)/$(LINTLIB) 98MACHLIBS64= $(MACH64)/$(DYNLIB) $(MACH64)/$(LINTLIB) 99VARIANTLIBS= $(VARIANTS:%=$(MACH)_%/$(VARBLD)/$(LIBBASENAME)_%.so.1) 100VARIANTLIBS64= $(VARIANTS64:%=$(MACH)_%/$(VARBLD64)/$(LIBBASENAME)_%.so.1) 101ROOTVARIANTLIBS= $(VARIANTS:%=$(ROOTVARIANTDIR)/$(LIBBASENAME)_%.so.1) 102ROOTVARIANTLIBS64= $(VARIANTS64:%=$(ROOTVARIANTDIR64)/$(LIBBASENAME)_%.so.1) 103 104# definitions for install_h target 105BASEHDRS= getxby_door.h 106CHECKHDRS= $(BASEHDRS:%.h=port/gen/%.check) 107HDRS= $(BASEHDRS) 108 109# install rules for install_h target 110$(ROOTHDRDIR)/%: port/gen/% 111 $(INS.file) 112 113$(ROOTLIBDIR)/$(DYNLIB) := FILEMODE = 755 114$(ROOTLIBDIR64)/$(DYNLIB) := FILEMODE = 755 115$(ROOTFS_LIBDIR)/$(DYNLIB) := FILEMODE = 755 116$(ROOTFS_LIBDIR64)/$(DYNLIB) := FILEMODE = 755 117 118$(ROOTVARIANTDIR) := FILEMODE= 755 119$(ROOTVARIANTDIR)/$(VAR1_DYNLIB) := FILEMODE= 755 120$(ROOTVARIANTDIR)/$(VAR2_DYNLIB) := FILEMODE= 755 121$(ROOTVARIANTDIR)/$(VAR3_DYNLIB) := FILEMODE= 755 122 123$(ROOTVARIANTDIR64) := FILEMODE= 755 124$(ROOTVARIANTDIR64)/$(VAR1_DYNLIB64) := FILEMODE= 755 125 126.KEEP_STATE: 127 128all: check_i18n .WAIT lib32 $(BUILD64) .WAIT lib64 .WAIT etc 129 130check_i18n: 131 @if [ ! -f $(ROOTFS_LIBDIR)/libc_i18n.a -o \ 132 ! -f $(ROOTFS_LIBDIR64)/libc_i18n.a ]; then \ 133 if [ "$$CLOSED_IS_PRESENT" = no ]; then \ 134 $(ECHO) "Warning: closed binaries not" \ 135 "properly unpacked." >&2;\ 136 $(ECHO) "Missing libc_i18n.a" >&2; \ 137 exit 1; \ 138 else \ 139 $(ECHO) "Warning: libc_i18n.a must be built" \ 140 "before libc can be built." >&2; \ 141 exit 1; \ 142 fi \ 143 fi 144 145etc: $($(MACH)_ETC) 146 147lib32: $(MACH_COMP) $(MACHLIBS) $(MACH)/$(LIB_PIC) $(VARIANTLIBS) 148 mkdir -p $(MACH)/i18n_pics 149 cd $(MACH)/i18n_pics ; $(AR) -x $(ROOTFS_LIBDIR)/libc_i18n.a 150 @if $(ELFDUMP) -r $(MACH)/$(DYNLIB) | $(GREP) -w environ ; then \ 151 $(ECHO) "Error: Invalid reference to environ" ; \ 152 $(ECHO) "Error: See comments in port/gen/env_data.c" ; \ 153 exit 1; \ 154 fi 155 156lib64: $(MACH_COMP) $(MACHLIBS64) $(MACH64)/$(LIB_PIC) $(VARIANTLIBS64) 157 mkdir -p $(MACH64)/i18n_pics 158 cd $(MACH64)/i18n_pics ; $(AR) -x $(ROOTFS_LIBDIR64)/libc_i18n.a 159 @if $(ELFDUMP) -r $(MACH64)/$(DYNLIB) | $(GREP) -w environ ; then \ 160 $(ECHO) "Error: Invalid reference to environ" ; \ 161 $(ECHO) "Error: See comments in port/gen/env_data.c" ; \ 162 exit 1; \ 163 fi 164 165$(VARIANTLIBS): FRC 166 @cd $(@D); pwd; VERSION='$(VERSION)' $(MAKE) $(@F) 167 168$(VARIANTLIBS64): FRC 169 @cd $(@D); pwd; VERSION='$(VERSION)' $(MAKE) $(@F) 170 171$($(MACH)_ETC): FRC 172 @cd $(@); pwd; $(MAKE) $(TARGET) 173 174$($(MACH)_COMP): FRC 175 @cd $(@); pwd; $(MAKE) $(TARGET) 176 177install: all \ 178 etc \ 179 inslib32 \ 180 $(BUILD64) inslib64 181 182inslib32: $(ROOTFS_LIBS) $(ROOTFS_LINKS) $(ROOTFS_LINT) \ 183 $(ROOTFS_LINTLIB) \ 184 $(ROOTVARIANTLIBS) 185 186inslib64: $(ROOTFS_LIBS64) $(ROOTFS_LINKS64) \ 187 $(ROOTFS_LINTLIB64) \ 188 $(ROOTVARIANTLIBS64) 189 190install_h: $(ROOTHDRS) 191 192check: $(CHECKHDRS) 193 194$(ROOTFS_LIB)/%: $(MACH)/% 195 $(INS.file) 196$(ROOTFS_LIBDIR)/$(LIBLINKS): $(ROOTFS_LIBDIR)/$(LIBLINKS)$(VERS) 197 $(INS.liblink) 198$(ROOTFS_LIB64)/%: $(MACH64)/% 199 $(INS.file) 200$(ROOTFS_LIBDIR64)/$(LIBLINKS): $(ROOTFS_LIBDIR64)/$(LIBLINKS)$(VERS) 201 $(INS.liblink) 202 203$(ROOTVARIANTDIR): $(ROOTLIB) 204 $(INS.dir) 205$(ROOTVARIANTDIR)/%: $(ROOTVARIANTDIR) $(VAR1_BLDDIR)/% 206 $(INS.file) 207$(ROOTVARIANTDIR)/%: $(ROOTVARIANTDIR) $(VAR2_BLDDIR)/% 208 $(INS.file) 209$(ROOTVARIANTDIR)/%: $(ROOTVARIANTDIR) $(VAR3_BLDDIR)/% 210 $(INS.file) 211 212$(ROOTVARIANTDIR64): $(ROOTLIB64) 213 $(INS.dir) 214$(ROOTVARIANTDIR64)/%: $(ROOTVARIANTDIR64) $(VAR1_BLDDIR64)/% 215 $(INS.file) 216 217# install rule for lint library target 218$(ROOTFS_LINTDIR)/%: port/% 219 $(INS.file) 220$(ROOTFS_LINTDIR64)/%: port/% 221 $(INS.file) 222$(ROOTFS_LINTDIR)/%: $(MACH)/% 223 $(INS.file) 224$(ROOTFS_LINTDIR64)/%: $(MACH64)/% 225 $(INS.file) 226 227$(LINTLIB): 228 @cd $(MACH); pwd; VERSION='$(VERSION)' $(MAKE) $@ 229$(LINTLIB64): 230 @cd $(MACH64); pwd; VERSION='$(VERSION)' $(MAKE) $@ 231 232$(MACH)/$(LIB_PIC): FRC 233 @cd $(MACH); pwd; VERSION='$(VERSION)' $(MAKE) $(LIB_PIC) 234$(MACH64)/$(LIB_PIC): FRC 235 @cd $(MACH64); pwd; VERSION='$(VERSION)' $(MAKE) $(LIB_PIC) 236 237all := TARGET= all 238install := TARGET= install 239clean := TARGET= clean 240clobber := TARGET= clobber 241lint := TARGET= lint 242 243.PARALLEL: $(SUBDIRS) 244 245$(SUBDIRS): FRC 246 @cd $@; pwd; VERSION='$(VERSION)' $(MAKE) $(TARGET) 247 248clean clobber: $(SUBDIRS) 249 $(RM) -r $(MACH)/i18n_pics 250 $(BUILD64)$(RM) -r $(MACH64)/i18n_pics 251 252lint: $(SUBDIRS) 253 254_msg: $(MSGDOMAIN) catalog 255 256catalog: 257 sh ./makelibccatalog.sh $(MSGDOMAIN) 258 259$(MSGDOMAIN): 260 $(INS.dir) 261 262cscope.out tags: FRC 263 $(XREF) -x $@ 264 265FRC: 266# include MACH-specific library targets 267include ../Makefile.mach 268