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