xref: /illumos-gate/usr/src/lib/libc/Makefile (revision a7123019)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate# (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate# with the License.
87c478bd9Sstevel@tonic-gate#
97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate# and limitations under the License.
137c478bd9Sstevel@tonic-gate#
147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate#
207c478bd9Sstevel@tonic-gate# CDDL HEADER END
217c478bd9Sstevel@tonic-gate#
227c478bd9Sstevel@tonic-gate#
237c478bd9Sstevel@tonic-gate# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate# Use is subject to license terms.
257c478bd9Sstevel@tonic-gate#
267c478bd9Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
277c478bd9Sstevel@tonic-gate#
287c478bd9Sstevel@tonic-gate
297c478bd9Sstevel@tonic-gateLIBBASENAME=	libc
307c478bd9Sstevel@tonic-gateLIBRARY=	$(LIBBASENAME:%=%.a)
317c478bd9Sstevel@tonic-gateVERS=		.1
327c478bd9Sstevel@tonic-gate
337c478bd9Sstevel@tonic-gate# Note that we build libc_pic.a for the benefit of building
347c478bd9Sstevel@tonic-gate# ld.so.1, but we do not install it.  Only ld.so.1 needs it
357c478bd9Sstevel@tonic-gate# and it must be built in the same workspace as libc.
367c478bd9Sstevel@tonic-gateLIB_PIC= libc_pic.a
377c478bd9Sstevel@tonic-gate
387c478bd9Sstevel@tonic-gateROOTLIB=	$(ROOT)/usr/lib
397c478bd9Sstevel@tonic-gateROOTFS_LIB=	$(ROOT)/lib
407c478bd9Sstevel@tonic-gateROOTLIB64=	$(ROOTLIB)/$(MACH64)
417c478bd9Sstevel@tonic-gateROOTFS_LIB64=	$(ROOTFS_LIB)/$(MACH64)
427c478bd9Sstevel@tonic-gate
437c478bd9Sstevel@tonic-gateROOTVARIANTDIR=	$(ROOTLIB)/libc
447c478bd9Sstevel@tonic-gate
457c478bd9Sstevel@tonic-gateROOTFS_LINTDIR=		$(ROOTFS_LIB)
467c478bd9Sstevel@tonic-gateROOTFS_LINTDIR64=	$(ROOTFS_LIB64)
477c478bd9Sstevel@tonic-gateROOTFS_LINTLIB=		$(ROOTFS_LINTDIR)/$(LINTLIB)
487c478bd9Sstevel@tonic-gateROOTFS_LINTLIB64=	$(ROOTFS_LINTDIR64)/$(LINTLIB)
497c478bd9Sstevel@tonic-gate
507c478bd9Sstevel@tonic-gate# include common library definitions
517c478bd9Sstevel@tonic-gateinclude ../Makefile.lib
527c478bd9Sstevel@tonic-gate
537c478bd9Sstevel@tonic-gate#
547c478bd9Sstevel@tonic-gate# on some architectures, we build multiple libc variants
557c478bd9Sstevel@tonic-gate#
567c478bd9Sstevel@tonic-gateVAR1 =		hwcap1
577c478bd9Sstevel@tonic-gateVAR2 =		hwcap2
587c478bd9Sstevel@tonic-gate
597c478bd9Sstevel@tonic-gateVAR1_DYNLIB =	$(LIBRARY:%.a=%_$(VAR1).so$(VERS))
607c478bd9Sstevel@tonic-gateVAR1_BLDDIR =	$(MACH)_$(VAR1)
617c478bd9Sstevel@tonic-gateVAR2_DYNLIB =	$(LIBRARY:%.a=%_$(VAR2).so$(VERS))
627c478bd9Sstevel@tonic-gateVAR2_BLDDIR =	$(MACH)_$(VAR2)
637c478bd9Sstevel@tonic-gate
647c478bd9Sstevel@tonic-gatei386_VARIANTS=	$(VAR1) $(VAR2)
657c478bd9Sstevel@tonic-gatesparc_VARIANTS=
667c478bd9Sstevel@tonic-gate
67*a7123019Skucharski386_ETC=	$(MACH)/etc
68*a7123019Skucharsksparc_ETC=
69*a7123019Skucharsk
707c478bd9Sstevel@tonic-gateVARIANTS=	$($(MACH)_VARIANTS)
717c478bd9Sstevel@tonic-gateVARIANT_SUBDIRS	= $(VARIANTS:%=$(MACH)_%)
727c478bd9Sstevel@tonic-gate
73*a7123019SkucharskSUBDIRS=	$(MACH) $(MACH_ETC) $(VARIANT_SUBDIRS)
747c478bd9Sstevel@tonic-gate$(BUILD64)SUBDIRS += $(MACH64)
757c478bd9Sstevel@tonic-gate
767c478bd9Sstevel@tonic-gateLIBS =		$(DYNLIB) $(LINTLIB)
777c478bd9Sstevel@tonic-gate
787c478bd9Sstevel@tonic-gateROOTLIBS64=	$(ROOTLIBDIR64)/$(DYNLIB) $(ROOTLIBDIR64)/$(LINTLIB)
797c478bd9Sstevel@tonic-gateMACHLIBS64=	$(MACH64)/$(DYNLIB) $(MACH64)/$(LINTLIB)
807c478bd9Sstevel@tonic-gateVARIANTLIBS=	$(VARIANTS:%=$(MACH)_%/$(LIBBASENAME)_%.so.1)
817c478bd9Sstevel@tonic-gateROOTVARIANTLIBS= $(VARIANTS:%=$(ROOTVARIANTDIR)/$(LIBBASENAME)_%.so.1)
827c478bd9Sstevel@tonic-gate
837c478bd9Sstevel@tonic-gate# definitions for install_h target
847c478bd9Sstevel@tonic-gateBASEHDRS=	getxby_door.h
857c478bd9Sstevel@tonic-gateCHECKHDRS=	$(BASEHDRS:%.h=port/gen/%.check)
867c478bd9Sstevel@tonic-gateHDRS=		$(BASEHDRS)
877c478bd9Sstevel@tonic-gate
887c478bd9Sstevel@tonic-gate# install rules for install_h target
897c478bd9Sstevel@tonic-gate$(ROOTHDRDIR)/%: port/gen/%
907c478bd9Sstevel@tonic-gate	$(INS.file)
917c478bd9Sstevel@tonic-gate
927c478bd9Sstevel@tonic-gate$(ROOTLIBDIR)/$(DYNLIB)	:=	FILEMODE = 755
937c478bd9Sstevel@tonic-gate$(ROOTLIBDIR64)/$(DYNLIB) :=	FILEMODE = 755
947c478bd9Sstevel@tonic-gate$(ROOTFS_LIBDIR)/$(DYNLIB)	:=	FILEMODE = 755
957c478bd9Sstevel@tonic-gate$(ROOTFS_LIBDIR64)/$(DYNLIB)	:=	FILEMODE = 755
967c478bd9Sstevel@tonic-gate
977c478bd9Sstevel@tonic-gate$(ROOTVARIANTDIR)			:= FILEMODE= 755
987c478bd9Sstevel@tonic-gate$(ROOTVARIANTDIR)/$(VAR1_DYNLIB)	:= FILEMODE= 755
997c478bd9Sstevel@tonic-gate$(ROOTVARIANTDIR)/$(VAR2_DYNLIB)	:= FILEMODE= 755
1007c478bd9Sstevel@tonic-gate
1017c478bd9Sstevel@tonic-gate.KEEP_STATE:
1027c478bd9Sstevel@tonic-gate
103*a7123019Skucharskall:	spec .WAIT lib32 $(BUILD64) .WAIT lib64 .WAIT etc
104*a7123019Skucharsk
105*a7123019Skucharsketc:	$($(MACH)_ETC)
1067c478bd9Sstevel@tonic-gate
1077c478bd9Sstevel@tonic-gatelib32:	$(MACHLIBS) $(MACH)/$(LIB_PIC) $(VARIANTLIBS)
1087c478bd9Sstevel@tonic-gate
1097c478bd9Sstevel@tonic-gatelib64:	$(MACHLIBS64) $(MACH64)/$(LIB_PIC) $(VARIANTLIBS)
1107c478bd9Sstevel@tonic-gate
1117c478bd9Sstevel@tonic-gate$(VARIANTLIBS): FRC
1127c478bd9Sstevel@tonic-gate	@cd $(@D); pwd; VERSION='$(VERSION)' $(MAKE) $(@F)
1137c478bd9Sstevel@tonic-gate
114*a7123019Skucharsk$($(MACH)_ETC): FRC
115*a7123019Skucharsk	@cd $(@); pwd; $(MAKE) $(TARGET)
116*a7123019Skucharsk
1177c478bd9Sstevel@tonic-gateinstall:	all			\
118*a7123019Skucharsk		etc			\
1197c478bd9Sstevel@tonic-gate		spec			\
1207c478bd9Sstevel@tonic-gate		inslib32		\
1217c478bd9Sstevel@tonic-gate		$(BUILD64) inslib64
1227c478bd9Sstevel@tonic-gate
1237c478bd9Sstevel@tonic-gateinslib32:	$(ROOTFS_LIBS) $(ROOTFS_LINKS) $(ROOTFS_LINT) \
1247c478bd9Sstevel@tonic-gate		$(ROOTFS_LINTLIB) \
1257c478bd9Sstevel@tonic-gate		$(ROOTVARIANTLIBS)
1267c478bd9Sstevel@tonic-gate
1277c478bd9Sstevel@tonic-gateinslib64:	$(ROOTFS_LIBS64) $(ROOTFS_LINKS64) \
1287c478bd9Sstevel@tonic-gate		$(ROOTFS_LINTLIB64)
1297c478bd9Sstevel@tonic-gate
1307c478bd9Sstevel@tonic-gateinstall_h: $(ROOTHDRS)
1317c478bd9Sstevel@tonic-gate
1327c478bd9Sstevel@tonic-gatecheck:	$(CHECKHDRS)
1337c478bd9Sstevel@tonic-gate
1347c478bd9Sstevel@tonic-gate$(ROOTFS_LIB)/%: $(MACH)/%
1357c478bd9Sstevel@tonic-gate	$(INS.file)
1367c478bd9Sstevel@tonic-gate$(ROOTFS_LIBDIR)/$(LIBLINKS): $(ROOTFS_LIBDIR)/$(LIBLINKS)$(VERS)
1377c478bd9Sstevel@tonic-gate	$(INS.liblink)
1387c478bd9Sstevel@tonic-gate$(ROOTFS_LIB64)/%: $(MACH64)/%
1397c478bd9Sstevel@tonic-gate	$(INS.file)
1407c478bd9Sstevel@tonic-gate$(ROOTFS_LIBDIR64)/$(LIBLINKS): $(ROOTFS_LIBDIR64)/$(LIBLINKS)$(VERS)
1417c478bd9Sstevel@tonic-gate	$(INS.liblink)
1427c478bd9Sstevel@tonic-gate
1437c478bd9Sstevel@tonic-gate$(ROOTVARIANTDIR): $(ROOTLIB)
1447c478bd9Sstevel@tonic-gate	$(INS.dir)
1457c478bd9Sstevel@tonic-gate$(ROOTVARIANTDIR)/%: $(ROOTVARIANTDIR) $(VAR1_BLDDIR)/%
1467c478bd9Sstevel@tonic-gate	$(INS.file)
1477c478bd9Sstevel@tonic-gate$(ROOTVARIANTDIR)/%: $(ROOTVARIANTDIR) $(VAR2_BLDDIR)/%
1487c478bd9Sstevel@tonic-gate	$(INS.file)
1497c478bd9Sstevel@tonic-gate
1507c478bd9Sstevel@tonic-gate# install rule for lint library target
1517c478bd9Sstevel@tonic-gate$(ROOTFS_LINTDIR)/%: port/%
1527c478bd9Sstevel@tonic-gate	$(INS.file)
1537c478bd9Sstevel@tonic-gate$(ROOTFS_LINTDIR64)/%: port/%
1547c478bd9Sstevel@tonic-gate	$(INS.file)
1557c478bd9Sstevel@tonic-gate$(ROOTFS_LINTDIR)/%: $(MACH)/%
1567c478bd9Sstevel@tonic-gate	$(INS.file)
1577c478bd9Sstevel@tonic-gate$(ROOTFS_LINTDIR64)/%: $(MACH64)/%
1587c478bd9Sstevel@tonic-gate	$(INS.file)
1597c478bd9Sstevel@tonic-gate
1607c478bd9Sstevel@tonic-gate$(LINTLIB):
1617c478bd9Sstevel@tonic-gate	@cd $(MACH); pwd; VERSION='$(VERSION)' $(MAKE) $@
1627c478bd9Sstevel@tonic-gate$(LINTLIB64):
1637c478bd9Sstevel@tonic-gate	@cd $(MACH64); pwd; VERSION='$(VERSION)' $(MAKE) $@
1647c478bd9Sstevel@tonic-gate
1657c478bd9Sstevel@tonic-gate$(MACH)/$(LIB_PIC): FRC
1667c478bd9Sstevel@tonic-gate	@cd $(MACH); pwd; VERSION='$(VERSION)' $(MAKE) $(LIB_PIC)
1677c478bd9Sstevel@tonic-gate$(MACH64)/$(LIB_PIC): FRC
1687c478bd9Sstevel@tonic-gate	@cd $(MACH64); pwd; VERSION='$(VERSION)' $(MAKE) $(LIB_PIC)
1697c478bd9Sstevel@tonic-gate
1707c478bd9Sstevel@tonic-gateall	:=	TARGET= all
1717c478bd9Sstevel@tonic-gateinstall	:=	TARGET= install
1727c478bd9Sstevel@tonic-gateclean	:=	TARGET= clean
1737c478bd9Sstevel@tonic-gateclobber	:=	TARGET= clobber
1747c478bd9Sstevel@tonic-gatelint	:=	TARGET= lint
1757c478bd9Sstevel@tonic-gate
1767c478bd9Sstevel@tonic-gate.PARALLEL:	$(SUBDIRS)
1777c478bd9Sstevel@tonic-gate
1787c478bd9Sstevel@tonic-gatespec $(SUBDIRS): FRC
1797c478bd9Sstevel@tonic-gate	@cd $@; pwd; VERSION='$(VERSION)' $(MAKE) $(TARGET)
1807c478bd9Sstevel@tonic-gate
1817c478bd9Sstevel@tonic-gateclean clobber: spec .WAIT $(SUBDIRS)
1827c478bd9Sstevel@tonic-gate
1837c478bd9Sstevel@tonic-gatelint: $(SUBDIRS)
1847c478bd9Sstevel@tonic-gate
1857c478bd9Sstevel@tonic-gate_msg:	$(MSGDOMAIN) catalog
1867c478bd9Sstevel@tonic-gate
1877c478bd9Sstevel@tonic-gatecatalog:
1887c478bd9Sstevel@tonic-gate	sh ./makelibccatalog.sh $(MSGDOMAIN)
1897c478bd9Sstevel@tonic-gate
1907c478bd9Sstevel@tonic-gate$(MSGDOMAIN):
1917c478bd9Sstevel@tonic-gate	$(INS.dir)
1927c478bd9Sstevel@tonic-gate
1937c478bd9Sstevel@tonic-gateARCHITECTURES = $(MACH) $(BUILD64) $(MACH64)
1947c478bd9Sstevel@tonic-gate
1957c478bd9Sstevel@tonic-gatecscope.out tags: FRC
1967c478bd9Sstevel@tonic-gate	$(XREF) -x $@
1977c478bd9Sstevel@tonic-gate
1987c478bd9Sstevel@tonic-gateFRC:
1997c478bd9Sstevel@tonic-gate# include MACH-specific library targets
2007c478bd9Sstevel@tonic-gateinclude ../Makefile.mach
201