#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright (c) 1989, 2011, Oracle and/or its affiliates. All rights reserved.
#
#
LIBBASENAME= libc
LIBRARY= $(LIBBASENAME:%=%.a)
VERS= .1
# Note that we build libc_pic.a for the benefit of building ld.so.1. Only
# ld.so.1 needs it and it must be built in the same workspace as libc.
# Since we do not deliver it, we install it in the stub proto rather than
# the real one.
LIB_PIC= libc_pic.a
ROOTLIB= $(ROOT)/usr/lib
ROOTFS_LIB= $(ROOT)/lib
ROOTLIB64= $(ROOTLIB)/$(MACH64)
ROOTFS_LIB64= $(ROOTFS_LIB)/$(MACH64)
STUBROOTLIB= $(STUBROOT)/usr/lib
STUBROOTFS_LIB= $(STUBROOT)/lib
STUBROOTLIB64= $(STUBROOTLIB)/$(MACH64)
STUBROOTFS_LIB64= $(STUBROOTFS_LIB)/$(MACH64)
LROOTLIB= $(LROOT)/usr/lib
LROOTFS_LIB= $(LROOT)/lib
LROOTLIB64= $(LROOTLIB)/$(MACH64)
LROOTFS_LIB64= $(LROOTFS_LIB)/$(MACH64)
ROOTVARIANTDIR= $(ROOTLIB)/libc
ROOTVARIANTDIR64= $(ROOTLIB64)/libc
ROOTFS_LINTDIR= $(ROOTFS_LIB)
ROOTFS_LINTDIR64= $(ROOTFS_LIB64)
ROOTFS_LINTLIB= $(ROOTFS_LINTDIR)/$(LINTLIB)
ROOTFS_LINTLIB64= $(ROOTFS_LINTDIR64)/$(LINTLIB)
# include common library definitions
include ../Makefile.lib
LIBC_I18N=$(ROOTFS_LIBDIR)/libc_i18n.a
$(CLOSED_BUILD)LIBC_I18N=$(CLOSED)/lib/libc_i18n/$(MACH)/libc_i18n.a
LIBC_I18N64=$(ROOTFS_LIBDIR64)/libc_i18n.a
$(CLOSED_BUILD)LIBC_I18N64=$(CLOSED)/lib/libc_i18n/$(MACH64)/libc_i18n.a
#
# on some architectures, we build multiple libc variants
#
VAR1 = hwcap1
VAR2 = hwcap2
VAR3 = hwcap3
VARBLD_1= $(MACH:sparc=sparc)
VARBLD= $(VARBLD_1:i386=)
VARBLD64_1= $(MACH:sparc=sparcv9)
VARBLD64= $(VARBLD64_1:i386=)
VAR1_DYNLIB = $(LIBRARY:%.a=%_$(VAR1).so$(VERS))
VAR1_BLDDIR = $(MACH)_$(VAR1)/$(VARBLD)
VAR2_DYNLIB = $(LIBRARY:%.a=%_$(VAR2).so$(VERS))
VAR2_BLDDIR = $(MACH)_$(VAR2)/$(VARBLD)
VAR3_DYNLIB = $(LIBRARY:%.a=%_$(VAR3).so$(VERS))
VAR3_BLDDIR = $(MACH)_$(VAR3)/$(VARBLD)
VAR1_DYNLIB64 = $(LIBRARY:%.a=%_$(VAR1).so$(VERS))
VAR1_BLDDIR64 = $(MACH)_$(VAR1)/$(VARBLD64)
i386_VARIANTS= $(VAR1) $(VAR2) $(VAR3)
sparc_VARIANTS=
sparcv9_VARIANTS=
i386_COMP= capabilities
sparc_COMP= capabilities
MACH_COMP= $($(MACH)_COMP)
i386_ETC= $(MACH)/etc
sparc_ETC=
VARIANTS= $($(MACH)_VARIANTS)
VARIANT_SUBDIRS = $(VARIANTS:%=$(MACH)_%/$(VARBLD))
VARIANTS64= $($(MACH64)_VARIANTS)
VARIANT_SUBDIRS64 = $(VARIANTS64:%=$(MACH)_%/$(VARBLD64))
SUBDIRS= $(MACH_CAP) $(MACH) $(MACH_ETC) $(VARIANT_SUBDIRS)
$(BUILD64)SUBDIRS += $(MACH64) $(VARIANT_SUBDIRS64)
LIBS = $(DYNLIB) $(LINTLIB)
ROOTLIBS64= $(ROOTLIBDIR64)/$(DYNLIB) $(ROOTLIBDIR64)/$(LINTLIB)
MACHLIBS64= $(MACH64)/$(DYNLIB) $(MACH64)/$(LINTLIB)
VARIANTLIBS= $(VARIANTS:%=$(MACH)_%/$(VARBLD)/$(LIBBASENAME)_%.so.1)
VARIANTLIBS64= $(VARIANTS64:%=$(MACH)_%/$(VARBLD64)/$(LIBBASENAME)_%.so.1)
ROOTVARIANTLIBS= $(VARIANTS:%=$(ROOTVARIANTDIR)/$(LIBBASENAME)_%.so.1)
ROOTVARIANTLIBS64= $(VARIANTS64:%=$(ROOTVARIANTDIR64)/$(LIBBASENAME)_%.so.1)
# definitions for install_h target
BASEHDRS= getxby_door.h
CHECKHDRS= $(BASEHDRS:%.h=port/gen/%.check)
HDRS= $(BASEHDRS)
# install rules for install_h target
$(ROOTHDRDIR)/%: port/gen/%
$(INS.file)
$(ROOTLIBDIR)/$(DYNLIB) := FILEMODE = 755
$(ROOTLIBDIR64)/$(DYNLIB) := FILEMODE = 755
$(ROOTFS_LIBDIR)/$(DYNLIB) := FILEMODE = 755
$(ROOTFS_LIBDIR64)/$(DYNLIB) := FILEMODE = 755
$(ROOTVARIANTDIR) := FILEMODE= 755
$(ROOTVARIANTDIR)/$(VAR1_DYNLIB) := FILEMODE= 755
$(ROOTVARIANTDIR)/$(VAR2_DYNLIB) := FILEMODE= 755
$(ROOTVARIANTDIR)/$(VAR3_DYNLIB) := FILEMODE= 755
$(ROOTVARIANTDIR64) := FILEMODE= 755
$(ROOTVARIANTDIR64)/$(VAR1_DYNLIB64) := FILEMODE= 755
.KEEP_STATE:
all: check_i18n .WAIT lib32 $(BUILD64) .WAIT lib64 .WAIT etc
check_i18n:
@if [ ! -f $(LIBC_I18N) -o \
! -f $(LIBC_I18N64) ]; then \
if [ "$$CLOSED_IS_PRESENT" = no ]; then \
$(ECHO) "Warning: closed binaries not" \
"properly unpacked." >&2;\
$(ECHO) "Missing libc_i18n.a" >&2; \
exit 1; \
else \
$(ECHO) "Warning: libc_i18n.a must be built" \
"before libc can be built." >&2; \
exit 1; \
fi \
fi
$(MACH)/assym.h $(MACH64)/assym.h:
@cd $(@D); $(MAKE) assym.h
etc: $($(MACH)_ETC)
lib32: $(MACH_COMP) $(MACHLIBS) $(MACH)/$(LIB_PIC) $(VARIANTLIBS)
mkdir -p $(MACH)/i18n_pics
cd $(MACH)/i18n_pics ; $(AR) -x $(LIBC_I18N)
@if $(ELFDUMP) -r $(MACH)/$(DYNLIB) | $(GREP) -w environ ; then \
$(ECHO) "Error: Invalid reference to environ" ; \
$(ECHO) "Error: See comments in port/gen/env_data.c" ; \
exit 1; \
fi
$(MACH_COMP) $(MACHLIBS) $(MACH)/$(LIB_PIC): $(MACH)/assym.h
$(MACH)/$(LIB_PIC): $(MACH_COMP)
lib64: $(MACH_COMP) $(MACHLIBS64) $(MACH64)/$(LIB_PIC) $(VARIANTLIBS64)
mkdir -p $(MACH64)/i18n_pics
cd $(MACH64)/i18n_pics ; $(AR) -x $(LIBC_I18N64)
@if $(ELFDUMP) -r $(MACH64)/$(DYNLIB) | $(GREP) -w environ ; then \
$(ECHO) "Error: Invalid reference to environ" ; \
$(ECHO) "Error: See comments in port/gen/env_data.c" ; \
exit 1; \
fi
$(MACH_COMP) $(MACHLIBS64) $(MACH64)/$(LIB_PIC): $(MACH64)/assym.h
$(MACH64)/$(LIB_PIC): $(MACH_COMP)
$(VARIANTLIBS): FRC
@cd $(@D); pwd; VERSION='$(VERSION)' $(MAKE) $(@F)
$(VARIANTLIBS64): FRC
@cd $(@D); pwd; VERSION='$(VERSION)' $(MAKE) $(@F)
$($(MACH)_ETC): FRC
@cd $(@); pwd; $(MAKE) $(TARGET)
$($(MACH)_COMP): FRC
@cd $(@); pwd; $(MAKE) $(TARGET)
install: stubinstall \
all \
etc \
inslib32 \
$(BUILD64) inslib64
inslib32: $(ROOTFS_LIBS) $(ROOTFS_LINKS) $(ROOTFS_LINT) \
$(ROOTFS_LINTLIB) \
$(ROOTVARIANTLIBS) \
$(STUBROOTFS_LIB)/$(LIB_PIC)
inslib64: $(ROOTFS_LIBS64) $(ROOTFS_LINKS64) \
$(ROOTFS_LINTLIB64) \
$(ROOTVARIANTLIBS64) \
$(STUBROOTFS_LIB64)/$(LIB_PIC)
install_h: $(ROOTHDRS)
check: $(CHECKHDRS)
$(ROOTFS_LIB)/%: $(MACH)/%
$(INS.file)
$(ROOTFS_LIBDIR)/$(LIBLINKS): $(ROOTFS_LIBDIR)/$(LIBLINKS)$(VERS)
$(INS.liblink)
$(ROOTFS_LIB64)/%: $(MACH64)/%
$(INS.file)
$(ROOTFS_LIBDIR64)/$(LIBLINKS): $(ROOTFS_LIBDIR64)/$(LIBLINKS)$(VERS)
$(INS.liblink)
$(STUBROOTFS_LIB)/%: $(MACH)/%
$(INS.file)
$(STUBROOTFS_LIB64)/%: $(MACH64)/%
$(INS.file)
$(ROOTVARIANTDIR): $(ROOTLIB)
$(INS.dir)
$(ROOTVARIANTDIR)/%: $(ROOTVARIANTDIR) $(VAR1_BLDDIR)/%
$(INS.file)
$(ROOTVARIANTDIR)/%: $(ROOTVARIANTDIR) $(VAR2_BLDDIR)/%
$(INS.file)
$(ROOTVARIANTDIR)/%: $(ROOTVARIANTDIR) $(VAR3_BLDDIR)/%
$(INS.file)
$(ROOTVARIANTDIR64): $(ROOTLIB64)
$(INS.dir)
$(ROOTVARIANTDIR64)/%: $(ROOTVARIANTDIR64) $(VAR1_BLDDIR64)/%
$(INS.file)
# install rule for lint library target
$(ROOTFS_LINTDIR)/%: port/%
$(INS.file)
$(ROOTFS_LINTDIR64)/%: port/%
$(INS.file)
$(ROOTFS_LINTDIR)/%: $(MACH)/%
$(INS.file)
$(ROOTFS_LINTDIR64)/%: $(MACH64)/%
$(INS.file)
$(LINTLIB):
@cd $(MACH); pwd; VERSION='$(VERSION)' $(MAKE) $@
$(LINTLIB64):
@cd $(MACH64); pwd; VERSION='$(VERSION)' $(MAKE) $@
$(MACH)/$(LIB_PIC): FRC
@cd $(MACH); pwd; VERSION='$(VERSION)' $(MAKE) $(LIB_PIC)
$(MACH64)/$(LIB_PIC): FRC
@cd $(MACH64); pwd; VERSION='$(VERSION)' $(MAKE) $(LIB_PIC)
all := TARGET= all
install := TARGET= install
stub := TARGET= stub
stubinstall:= TARGET= stubinstall
clean := TARGET= clean
clobber := TARGET= clobber
lint := TARGET= lint
.PARALLEL: $(SUBDIRS)
$(SUBDIRS): FRC
@cd $@; pwd; VERSION='$(VERSION)' $(MAKE) $(TARGET)
clean clobber: $(SUBDIRS)
$(RM) -r $(MACH)/i18n_pics
$(BUILD64)$(RM) -r $(MACH64)/i18n_pics
# Only build stubs for the generic variants
stub stubinstall: $(MACH) $(MACH64)
lint: $(SUBDIRS)
_msg: $(MSGDOMAIN) catalog
catalog:
sh ./makelibccatalog.sh $(MSGDOMAIN)
$(MSGDOMAIN):
$(INS.dir)
cscope.out tags: FRC
$(XREF) -x $@
FRC:
# include MACH-specific library targets
include ../Makefile.mach