xref: /illumos-gate/usr/src/lib/libc/Makefile (revision a7123019ed2e4decef929dc2e426f3f310788fa1)
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
67i386_ETC=	$(MACH)/etc
68sparc_ETC=
69
70VARIANTS=	$($(MACH)_VARIANTS)
71VARIANT_SUBDIRS	= $(VARIANTS:%=$(MACH)_%)
72
73SUBDIRS=	$(MACH) $(MACH_ETC) $(VARIANT_SUBDIRS)
74$(BUILD64)SUBDIRS += $(MACH64)
75
76LIBS =		$(DYNLIB) $(LINTLIB)
77
78ROOTLIBS64=	$(ROOTLIBDIR64)/$(DYNLIB) $(ROOTLIBDIR64)/$(LINTLIB)
79MACHLIBS64=	$(MACH64)/$(DYNLIB) $(MACH64)/$(LINTLIB)
80VARIANTLIBS=	$(VARIANTS:%=$(MACH)_%/$(LIBBASENAME)_%.so.1)
81ROOTVARIANTLIBS= $(VARIANTS:%=$(ROOTVARIANTDIR)/$(LIBBASENAME)_%.so.1)
82
83# definitions for install_h target
84BASEHDRS=	getxby_door.h
85CHECKHDRS=	$(BASEHDRS:%.h=port/gen/%.check)
86HDRS=		$(BASEHDRS)
87
88# install rules for install_h target
89$(ROOTHDRDIR)/%: port/gen/%
90	$(INS.file)
91
92$(ROOTLIBDIR)/$(DYNLIB)	:=	FILEMODE = 755
93$(ROOTLIBDIR64)/$(DYNLIB) :=	FILEMODE = 755
94$(ROOTFS_LIBDIR)/$(DYNLIB)	:=	FILEMODE = 755
95$(ROOTFS_LIBDIR64)/$(DYNLIB)	:=	FILEMODE = 755
96
97$(ROOTVARIANTDIR)			:= FILEMODE= 755
98$(ROOTVARIANTDIR)/$(VAR1_DYNLIB)	:= FILEMODE= 755
99$(ROOTVARIANTDIR)/$(VAR2_DYNLIB)	:= FILEMODE= 755
100
101.KEEP_STATE:
102
103all:	spec .WAIT lib32 $(BUILD64) .WAIT lib64 .WAIT etc
104
105etc:	$($(MACH)_ETC)
106
107lib32:	$(MACHLIBS) $(MACH)/$(LIB_PIC) $(VARIANTLIBS)
108
109lib64:	$(MACHLIBS64) $(MACH64)/$(LIB_PIC) $(VARIANTLIBS)
110
111$(VARIANTLIBS): FRC
112	@cd $(@D); pwd; VERSION='$(VERSION)' $(MAKE) $(@F)
113
114$($(MACH)_ETC): FRC
115	@cd $(@); pwd; $(MAKE) $(TARGET)
116
117install:	all			\
118		etc			\
119		spec			\
120		inslib32		\
121		$(BUILD64) inslib64
122
123inslib32:	$(ROOTFS_LIBS) $(ROOTFS_LINKS) $(ROOTFS_LINT) \
124		$(ROOTFS_LINTLIB) \
125		$(ROOTVARIANTLIBS)
126
127inslib64:	$(ROOTFS_LIBS64) $(ROOTFS_LINKS64) \
128		$(ROOTFS_LINTLIB64)
129
130install_h: $(ROOTHDRS)
131
132check:	$(CHECKHDRS)
133
134$(ROOTFS_LIB)/%: $(MACH)/%
135	$(INS.file)
136$(ROOTFS_LIBDIR)/$(LIBLINKS): $(ROOTFS_LIBDIR)/$(LIBLINKS)$(VERS)
137	$(INS.liblink)
138$(ROOTFS_LIB64)/%: $(MACH64)/%
139	$(INS.file)
140$(ROOTFS_LIBDIR64)/$(LIBLINKS): $(ROOTFS_LIBDIR64)/$(LIBLINKS)$(VERS)
141	$(INS.liblink)
142
143$(ROOTVARIANTDIR): $(ROOTLIB)
144	$(INS.dir)
145$(ROOTVARIANTDIR)/%: $(ROOTVARIANTDIR) $(VAR1_BLDDIR)/%
146	$(INS.file)
147$(ROOTVARIANTDIR)/%: $(ROOTVARIANTDIR) $(VAR2_BLDDIR)/%
148	$(INS.file)
149
150# install rule for lint library target
151$(ROOTFS_LINTDIR)/%: port/%
152	$(INS.file)
153$(ROOTFS_LINTDIR64)/%: port/%
154	$(INS.file)
155$(ROOTFS_LINTDIR)/%: $(MACH)/%
156	$(INS.file)
157$(ROOTFS_LINTDIR64)/%: $(MACH64)/%
158	$(INS.file)
159
160$(LINTLIB):
161	@cd $(MACH); pwd; VERSION='$(VERSION)' $(MAKE) $@
162$(LINTLIB64):
163	@cd $(MACH64); pwd; VERSION='$(VERSION)' $(MAKE) $@
164
165$(MACH)/$(LIB_PIC): FRC
166	@cd $(MACH); pwd; VERSION='$(VERSION)' $(MAKE) $(LIB_PIC)
167$(MACH64)/$(LIB_PIC): FRC
168	@cd $(MACH64); pwd; VERSION='$(VERSION)' $(MAKE) $(LIB_PIC)
169
170all	:=	TARGET= all
171install	:=	TARGET= install
172clean	:=	TARGET= clean
173clobber	:=	TARGET= clobber
174lint	:=	TARGET= lint
175
176.PARALLEL:	$(SUBDIRS)
177
178spec $(SUBDIRS): FRC
179	@cd $@; pwd; VERSION='$(VERSION)' $(MAKE) $(TARGET)
180
181clean clobber: spec .WAIT $(SUBDIRS)
182
183lint: $(SUBDIRS)
184
185_msg:	$(MSGDOMAIN) catalog
186
187catalog:
188	sh ./makelibccatalog.sh $(MSGDOMAIN)
189
190$(MSGDOMAIN):
191	$(INS.dir)
192
193ARCHITECTURES = $(MACH) $(BUILD64) $(MACH64)
194
195cscope.out tags: FRC
196	$(XREF) -x $@
197
198FRC:
199# include MACH-specific library targets
200include ../Makefile.mach
201