xref: /illumos-gate/usr/src/lib/libc/Makefile (revision 7c478bd9)
1*7c478bd9Sstevel@tonic-gate#
2*7c478bd9Sstevel@tonic-gate# CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate#
4*7c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate# (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate# with the License.
8*7c478bd9Sstevel@tonic-gate#
9*7c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate# and limitations under the License.
13*7c478bd9Sstevel@tonic-gate#
14*7c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate#
20*7c478bd9Sstevel@tonic-gate# CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate#
22*7c478bd9Sstevel@tonic-gate#
23*7c478bd9Sstevel@tonic-gate# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate# Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate#
26*7c478bd9Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
27*7c478bd9Sstevel@tonic-gate#
28*7c478bd9Sstevel@tonic-gate
29*7c478bd9Sstevel@tonic-gateLIBBASENAME=	libc
30*7c478bd9Sstevel@tonic-gateLIBRARY=	$(LIBBASENAME:%=%.a)
31*7c478bd9Sstevel@tonic-gateVERS=		.1
32*7c478bd9Sstevel@tonic-gate
33*7c478bd9Sstevel@tonic-gate# Note that we build libc_pic.a for the benefit of building
34*7c478bd9Sstevel@tonic-gate# ld.so.1, but we do not install it.  Only ld.so.1 needs it
35*7c478bd9Sstevel@tonic-gate# and it must be built in the same workspace as libc.
36*7c478bd9Sstevel@tonic-gateLIB_PIC= libc_pic.a
37*7c478bd9Sstevel@tonic-gate
38*7c478bd9Sstevel@tonic-gateROOTLIB=	$(ROOT)/usr/lib
39*7c478bd9Sstevel@tonic-gateROOTFS_LIB=	$(ROOT)/lib
40*7c478bd9Sstevel@tonic-gateROOTLIB64=	$(ROOTLIB)/$(MACH64)
41*7c478bd9Sstevel@tonic-gateROOTFS_LIB64=	$(ROOTFS_LIB)/$(MACH64)
42*7c478bd9Sstevel@tonic-gate
43*7c478bd9Sstevel@tonic-gateROOTVARIANTDIR=	$(ROOTLIB)/libc
44*7c478bd9Sstevel@tonic-gate
45*7c478bd9Sstevel@tonic-gateROOTFS_LINTDIR=		$(ROOTFS_LIB)
46*7c478bd9Sstevel@tonic-gateROOTFS_LINTDIR64=	$(ROOTFS_LIB64)
47*7c478bd9Sstevel@tonic-gateROOTFS_LINTLIB=		$(ROOTFS_LINTDIR)/$(LINTLIB)
48*7c478bd9Sstevel@tonic-gateROOTFS_LINTLIB64=	$(ROOTFS_LINTDIR64)/$(LINTLIB)
49*7c478bd9Sstevel@tonic-gate
50*7c478bd9Sstevel@tonic-gate# include common library definitions
51*7c478bd9Sstevel@tonic-gateinclude ../Makefile.lib
52*7c478bd9Sstevel@tonic-gate
53*7c478bd9Sstevel@tonic-gate#
54*7c478bd9Sstevel@tonic-gate# on some architectures, we build multiple libc variants
55*7c478bd9Sstevel@tonic-gate#
56*7c478bd9Sstevel@tonic-gateVAR1 =		hwcap1
57*7c478bd9Sstevel@tonic-gateVAR2 =		hwcap2
58*7c478bd9Sstevel@tonic-gate
59*7c478bd9Sstevel@tonic-gateVAR1_DYNLIB =	$(LIBRARY:%.a=%_$(VAR1).so$(VERS))
60*7c478bd9Sstevel@tonic-gateVAR1_BLDDIR =	$(MACH)_$(VAR1)
61*7c478bd9Sstevel@tonic-gateVAR2_DYNLIB =	$(LIBRARY:%.a=%_$(VAR2).so$(VERS))
62*7c478bd9Sstevel@tonic-gateVAR2_BLDDIR =	$(MACH)_$(VAR2)
63*7c478bd9Sstevel@tonic-gate
64*7c478bd9Sstevel@tonic-gatei386_VARIANTS=	$(VAR1) $(VAR2)
65*7c478bd9Sstevel@tonic-gatesparc_VARIANTS=
66*7c478bd9Sstevel@tonic-gate
67*7c478bd9Sstevel@tonic-gateVARIANTS=	$($(MACH)_VARIANTS)
68*7c478bd9Sstevel@tonic-gateVARIANT_SUBDIRS	= $(VARIANTS:%=$(MACH)_%)
69*7c478bd9Sstevel@tonic-gate
70*7c478bd9Sstevel@tonic-gateSUBDIRS=	$(MACH) $(VARIANT_SUBDIRS)
71*7c478bd9Sstevel@tonic-gate$(BUILD64)SUBDIRS += $(MACH64)
72*7c478bd9Sstevel@tonic-gate
73*7c478bd9Sstevel@tonic-gateLIBS =		$(DYNLIB) $(LINTLIB)
74*7c478bd9Sstevel@tonic-gate
75*7c478bd9Sstevel@tonic-gateROOTLIBS64=	$(ROOTLIBDIR64)/$(DYNLIB) $(ROOTLIBDIR64)/$(LINTLIB)
76*7c478bd9Sstevel@tonic-gateMACHLIBS64=	$(MACH64)/$(DYNLIB) $(MACH64)/$(LINTLIB)
77*7c478bd9Sstevel@tonic-gateVARIANTLIBS=	$(VARIANTS:%=$(MACH)_%/$(LIBBASENAME)_%.so.1)
78*7c478bd9Sstevel@tonic-gateROOTVARIANTLIBS= $(VARIANTS:%=$(ROOTVARIANTDIR)/$(LIBBASENAME)_%.so.1)
79*7c478bd9Sstevel@tonic-gate
80*7c478bd9Sstevel@tonic-gate# definitions for install_h target
81*7c478bd9Sstevel@tonic-gateBASEHDRS=	getxby_door.h
82*7c478bd9Sstevel@tonic-gateCHECKHDRS=	$(BASEHDRS:%.h=port/gen/%.check)
83*7c478bd9Sstevel@tonic-gateHDRS=		$(BASEHDRS)
84*7c478bd9Sstevel@tonic-gate
85*7c478bd9Sstevel@tonic-gate# install rules for install_h target
86*7c478bd9Sstevel@tonic-gate$(ROOTHDRDIR)/%: port/gen/%
87*7c478bd9Sstevel@tonic-gate	$(INS.file)
88*7c478bd9Sstevel@tonic-gate
89*7c478bd9Sstevel@tonic-gate$(ROOTLIBDIR)/$(DYNLIB)	:=	FILEMODE = 755
90*7c478bd9Sstevel@tonic-gate$(ROOTLIBDIR64)/$(DYNLIB) :=	FILEMODE = 755
91*7c478bd9Sstevel@tonic-gate$(ROOTFS_LIBDIR)/$(DYNLIB)	:=	FILEMODE = 755
92*7c478bd9Sstevel@tonic-gate$(ROOTFS_LIBDIR64)/$(DYNLIB)	:=	FILEMODE = 755
93*7c478bd9Sstevel@tonic-gate
94*7c478bd9Sstevel@tonic-gate$(ROOTVARIANTDIR)			:= FILEMODE= 755
95*7c478bd9Sstevel@tonic-gate$(ROOTVARIANTDIR)/$(VAR1_DYNLIB)	:= FILEMODE= 755
96*7c478bd9Sstevel@tonic-gate$(ROOTVARIANTDIR)/$(VAR2_DYNLIB)	:= FILEMODE= 755
97*7c478bd9Sstevel@tonic-gate
98*7c478bd9Sstevel@tonic-gate.KEEP_STATE:
99*7c478bd9Sstevel@tonic-gate
100*7c478bd9Sstevel@tonic-gateall:	spec .WAIT lib32 $(BUILD64) .WAIT lib64
101*7c478bd9Sstevel@tonic-gate
102*7c478bd9Sstevel@tonic-gatelib32:	$(MACHLIBS) $(MACH)/$(LIB_PIC) $(VARIANTLIBS)
103*7c478bd9Sstevel@tonic-gate
104*7c478bd9Sstevel@tonic-gatelib64:	$(MACHLIBS64) $(MACH64)/$(LIB_PIC) $(VARIANTLIBS)
105*7c478bd9Sstevel@tonic-gate
106*7c478bd9Sstevel@tonic-gate$(VARIANTLIBS): FRC
107*7c478bd9Sstevel@tonic-gate	@cd $(@D); pwd; VERSION='$(VERSION)' $(MAKE) $(@F)
108*7c478bd9Sstevel@tonic-gate
109*7c478bd9Sstevel@tonic-gateinstall:	all			\
110*7c478bd9Sstevel@tonic-gate		spec			\
111*7c478bd9Sstevel@tonic-gate		inslib32		\
112*7c478bd9Sstevel@tonic-gate		$(BUILD64) inslib64
113*7c478bd9Sstevel@tonic-gate
114*7c478bd9Sstevel@tonic-gateinslib32:	$(ROOTFS_LIBS) $(ROOTFS_LINKS) $(ROOTFS_LINT) \
115*7c478bd9Sstevel@tonic-gate		$(ROOTFS_LINTLIB) \
116*7c478bd9Sstevel@tonic-gate		$(ROOTVARIANTLIBS)
117*7c478bd9Sstevel@tonic-gate
118*7c478bd9Sstevel@tonic-gateinslib64:	$(ROOTFS_LIBS64) $(ROOTFS_LINKS64) \
119*7c478bd9Sstevel@tonic-gate		$(ROOTFS_LINTLIB64)
120*7c478bd9Sstevel@tonic-gate
121*7c478bd9Sstevel@tonic-gateinstall_h: $(ROOTHDRS)
122*7c478bd9Sstevel@tonic-gate
123*7c478bd9Sstevel@tonic-gatecheck:	$(CHECKHDRS)
124*7c478bd9Sstevel@tonic-gate
125*7c478bd9Sstevel@tonic-gate$(ROOTFS_LIB)/%: $(MACH)/%
126*7c478bd9Sstevel@tonic-gate	$(INS.file)
127*7c478bd9Sstevel@tonic-gate$(ROOTFS_LIBDIR)/$(LIBLINKS): $(ROOTFS_LIBDIR)/$(LIBLINKS)$(VERS)
128*7c478bd9Sstevel@tonic-gate	$(INS.liblink)
129*7c478bd9Sstevel@tonic-gate$(ROOTFS_LIB64)/%: $(MACH64)/%
130*7c478bd9Sstevel@tonic-gate	$(INS.file)
131*7c478bd9Sstevel@tonic-gate$(ROOTFS_LIBDIR64)/$(LIBLINKS): $(ROOTFS_LIBDIR64)/$(LIBLINKS)$(VERS)
132*7c478bd9Sstevel@tonic-gate	$(INS.liblink)
133*7c478bd9Sstevel@tonic-gate
134*7c478bd9Sstevel@tonic-gate$(ROOTVARIANTDIR): $(ROOTLIB)
135*7c478bd9Sstevel@tonic-gate	$(INS.dir)
136*7c478bd9Sstevel@tonic-gate$(ROOTVARIANTDIR)/%: $(ROOTVARIANTDIR) $(VAR1_BLDDIR)/%
137*7c478bd9Sstevel@tonic-gate	$(INS.file)
138*7c478bd9Sstevel@tonic-gate$(ROOTVARIANTDIR)/%: $(ROOTVARIANTDIR) $(VAR2_BLDDIR)/%
139*7c478bd9Sstevel@tonic-gate	$(INS.file)
140*7c478bd9Sstevel@tonic-gate
141*7c478bd9Sstevel@tonic-gate# install rule for lint library target
142*7c478bd9Sstevel@tonic-gate$(ROOTFS_LINTDIR)/%: port/%
143*7c478bd9Sstevel@tonic-gate	$(INS.file)
144*7c478bd9Sstevel@tonic-gate$(ROOTFS_LINTDIR64)/%: port/%
145*7c478bd9Sstevel@tonic-gate	$(INS.file)
146*7c478bd9Sstevel@tonic-gate$(ROOTFS_LINTDIR)/%: $(MACH)/%
147*7c478bd9Sstevel@tonic-gate	$(INS.file)
148*7c478bd9Sstevel@tonic-gate$(ROOTFS_LINTDIR64)/%: $(MACH64)/%
149*7c478bd9Sstevel@tonic-gate	$(INS.file)
150*7c478bd9Sstevel@tonic-gate
151*7c478bd9Sstevel@tonic-gate$(LINTLIB):
152*7c478bd9Sstevel@tonic-gate	@cd $(MACH); pwd; VERSION='$(VERSION)' $(MAKE) $@
153*7c478bd9Sstevel@tonic-gate$(LINTLIB64):
154*7c478bd9Sstevel@tonic-gate	@cd $(MACH64); pwd; VERSION='$(VERSION)' $(MAKE) $@
155*7c478bd9Sstevel@tonic-gate
156*7c478bd9Sstevel@tonic-gate$(MACH)/$(LIB_PIC): FRC
157*7c478bd9Sstevel@tonic-gate	@cd $(MACH); pwd; VERSION='$(VERSION)' $(MAKE) $(LIB_PIC)
158*7c478bd9Sstevel@tonic-gate$(MACH64)/$(LIB_PIC): FRC
159*7c478bd9Sstevel@tonic-gate	@cd $(MACH64); pwd; VERSION='$(VERSION)' $(MAKE) $(LIB_PIC)
160*7c478bd9Sstevel@tonic-gate
161*7c478bd9Sstevel@tonic-gateall	:=	TARGET= all
162*7c478bd9Sstevel@tonic-gateinstall	:=	TARGET= install
163*7c478bd9Sstevel@tonic-gateclean	:=	TARGET= clean
164*7c478bd9Sstevel@tonic-gateclobber	:=	TARGET= clobber
165*7c478bd9Sstevel@tonic-gatelint	:=	TARGET= lint
166*7c478bd9Sstevel@tonic-gate
167*7c478bd9Sstevel@tonic-gate.PARALLEL:	$(SUBDIRS)
168*7c478bd9Sstevel@tonic-gate
169*7c478bd9Sstevel@tonic-gatespec $(SUBDIRS): FRC
170*7c478bd9Sstevel@tonic-gate	@cd $@; pwd; VERSION='$(VERSION)' $(MAKE) $(TARGET)
171*7c478bd9Sstevel@tonic-gate
172*7c478bd9Sstevel@tonic-gateclean clobber: spec .WAIT $(SUBDIRS)
173*7c478bd9Sstevel@tonic-gate
174*7c478bd9Sstevel@tonic-gatelint: $(SUBDIRS)
175*7c478bd9Sstevel@tonic-gate
176*7c478bd9Sstevel@tonic-gate_msg:	$(MSGDOMAIN) catalog
177*7c478bd9Sstevel@tonic-gate
178*7c478bd9Sstevel@tonic-gatecatalog:
179*7c478bd9Sstevel@tonic-gate	sh ./makelibccatalog.sh $(MSGDOMAIN)
180*7c478bd9Sstevel@tonic-gate
181*7c478bd9Sstevel@tonic-gate$(MSGDOMAIN):
182*7c478bd9Sstevel@tonic-gate	$(INS.dir)
183*7c478bd9Sstevel@tonic-gate
184*7c478bd9Sstevel@tonic-gateARCHITECTURES = $(MACH) $(BUILD64) $(MACH64)
185*7c478bd9Sstevel@tonic-gate
186*7c478bd9Sstevel@tonic-gatecscope.out tags: FRC
187*7c478bd9Sstevel@tonic-gate	$(XREF) -x $@
188*7c478bd9Sstevel@tonic-gate
189*7c478bd9Sstevel@tonic-gateFRC:
190*7c478bd9Sstevel@tonic-gate# include MACH-specific library targets
191*7c478bd9Sstevel@tonic-gateinclude ../Makefile.mach
192