build: remove map.noexstk and map.noexdata (now default)
[unleashed.git] / usr / src / lib / libc / Makefile
blob62c700c64e85eb3378f33700509a6741d0902adc
2 # CDDL HEADER START
4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
19 # CDDL HEADER END
22 # Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24 # Copyright 2010 Nexenta Systems, Inc. All rights reserved.
25 # Use is subject to license terms.
27 # Copyright 2014 Garrett D'Amore <garrett@damore.org>
30 LIBBASENAME= libc
31 LIBRARY= $(LIBBASENAME:%=%.a)
32 VERS= .1
34 # Note that we build libc_pic.a for the benefit of building
35 # ld.so.1, but we do not install it. Only ld.so.1 needs it
36 # and it must be built in the same workspace as libc.
37 LIB_PIC= libc_pic.a
39 ROOTLIB= $(ROOT)/usr/lib
40 ROOTFS_LIB= $(ROOT)/lib
41 ROOTLIB64= $(ROOTLIB)/$(MACH64)
42 ROOTFS_LIB64= $(ROOTFS_LIB)/$(MACH64)
44 ROOTVARIANTDIR= $(ROOTLIB)/libc
45 ROOTVARIANTDIR64= $(ROOTLIB64)/libc
47 # include common library definitions
48 include ../Makefile.lib
51 # on some architectures, we build multiple libc variants
53 VAR1 = hwcap1
54 VAR2 = hwcap2
56 VARBLD_1= $(MACH:sparc=sparc)
57 VARBLD= $(VARBLD_1:i386=)
59 VARBLD64_1= $(MACH:sparc=sparcv9)
60 VARBLD64= $(VARBLD64_1:i386=)
62 VAR1_DYNLIB = $(LIBRARY:%.a=%_$(VAR1).so$(VERS))
63 VAR1_BLDDIR = $(MACH)_$(VAR1)/$(VARBLD)
64 VAR2_DYNLIB = $(LIBRARY:%.a=%_$(VAR2).so$(VERS))
65 VAR2_BLDDIR = $(MACH)_$(VAR2)/$(VARBLD)
67 VAR1_DYNLIB64 = $(LIBRARY:%.a=%_$(VAR1).so$(VERS))
68 VAR1_BLDDIR64 = $(MACH)_$(VAR1)/$(VARBLD64)
70 i386_VARIANTS= $(VAR1) $(VAR2)
71 sparc_VARIANTS=
72 sparcv9_VARIANTS=
74 i386_COMP= capabilities
75 sparc_COMP= capabilities
77 MACH_COMP= $($(MACH)_COMP)
79 i386_ETC= $(MACH)/etc
80 sparc_ETC=
82 VARIANTS= $($(MACH)_VARIANTS)
83 VARIANT_SUBDIRS = $(VARIANTS:%=$(MACH)_%/$(VARBLD))
85 VARIANTS64= $($(MACH64)_VARIANTS)
86 VARIANT_SUBDIRS64 = $(VARIANTS64:%=$(MACH)_%/$(VARBLD64))
88 SUBDIRS= $(MACH_CAP) $(MACH) $(MACH_ETC) $(VARIANT_SUBDIRS)
89 $(BUILD64)SUBDIRS += $(MACH64) $(VARIANT_SUBDIRS64)
91 LIBS = $(DYNLIB)
93 ROOTLIBS64= $(ROOTLIBDIR64)/$(DYNLIB)
94 MACHLIBS64= $(MACH64)/$(DYNLIB)
95 VARIANTLIBS= $(VARIANTS:%=$(MACH)_%/$(VARBLD)/$(LIBBASENAME)_%.so.1)
96 VARIANTLIBS64= $(VARIANTS64:%=$(MACH)_%/$(VARBLD64)/$(LIBBASENAME)_%.so.1)
97 ROOTVARIANTLIBS= $(VARIANTS:%=$(ROOTVARIANTDIR)/$(LIBBASENAME)_%.so.1)
98 ROOTVARIANTLIBS64= $(VARIANTS64:%=$(ROOTVARIANTDIR64)/$(LIBBASENAME)_%.so.1)
100 # definitions for install_h target
101 BASEHDRS= getxby_door.h
102 CHECKHDRS= $(BASEHDRS:%.h=port/gen/%.check)
103 HDRS= $(BASEHDRS)
105 CLOBBERFILES += THIRDPARTYLICENSE extract-copyright
107 # install rules for install_h target
108 $(ROOTHDRDIR)/%: port/gen/%
109 $(INS.file)
111 $(ROOTLIBDIR)/$(DYNLIB) := FILEMODE = 755
112 $(ROOTLIBDIR64)/$(DYNLIB) := FILEMODE = 755
113 $(ROOTFS_LIBDIR)/$(DYNLIB) := FILEMODE = 755
114 $(ROOTFS_LIBDIR64)/$(DYNLIB) := FILEMODE = 755
116 $(ROOTVARIANTDIR) := FILEMODE= 755
117 $(ROOTVARIANTDIR)/$(VAR1_DYNLIB) := FILEMODE= 755
118 $(ROOTVARIANTDIR)/$(VAR2_DYNLIB) := FILEMODE= 755
120 $(ROOTVARIANTDIR64) := FILEMODE= 755
121 $(ROOTVARIANTDIR64)/$(VAR1_DYNLIB64) := FILEMODE= 755
123 .KEEP_STATE:
125 all: all_h lib32 $(BUILD64) .WAIT lib64 .WAIT etc THIRDPARTYLICENSE
127 THIRDPARTYLICENSE: extract-copyright
128 $(RM) $@
129 ./extract-copyright . > $@
131 etc: $($(MACH)_ETC)
133 lib32: $(MACH_COMP) $(MACHLIBS) $(MACH)/$(LIB_PIC) $(VARIANTLIBS)
134 @if $(ELFDUMP) -r $(MACH)/$(DYNLIB) | $(GREP) -w environ ; then \
135 $(ECHO) "Error: Invalid reference to environ" ; \
136 $(ECHO) "Error: See comments in port/gen/env_data.c" ; \
137 exit 1; \
140 lib64: $(MACH_COMP) $(MACHLIBS64) $(MACH64)/$(LIB_PIC) $(VARIANTLIBS64)
141 @if $(ELFDUMP) -r $(MACH64)/$(DYNLIB) | $(GREP) -w environ ; then \
142 $(ECHO) "Error: Invalid reference to environ" ; \
143 $(ECHO) "Error: See comments in port/gen/env_data.c" ; \
144 exit 1; \
147 $(MACH)/assym.h $(MACH64)/assym.h:
148 @cd $(@D); $(MAKE) assym.h
150 $(VARIANTLIBS): FRC
151 @cd $(@D); pwd; VERSION='$(VERSION)' $(MAKE) $(@F)
153 $(VARIANTLIBS64): FRC
154 @cd $(@D); pwd; VERSION='$(VERSION)' $(MAKE) $(@F)
156 $($(MACH)_ETC): FRC
157 @cd $(@); pwd; $(MAKE) $(TARGET)
159 $($(MACH)_COMP): FRC
160 @cd $(@); pwd; $(MAKE) $(TARGET)
162 install: all \
163 etc \
164 inslib32 \
165 $(BUILD64) inslib64
167 inslib32: $(ROOTFS_LIBS) $(ROOTFS_LINKS) $(ROOTVARIANTLIBS)
169 inslib64: $(ROOTFS_LIBS64) $(ROOTFS_LINKS64) \
170 $(ROOTVARIANTLIBS64)
172 install_h: all_h $(ROOTHDRS)
174 all_h: $(MACH)/assym.h $(MACH64)/assym.h
176 check: $(CHECKHDRS)
178 $(ROOTFS_LIB)/%: $(MACH)/%
179 $(INS.file)
180 $(ROOTFS_LIBDIR)/$(LIBLINKS): $(ROOTFS_LIBDIR)/$(LIBLINKS)$(VERS)
181 $(INS.liblink)
182 $(ROOTFS_LIB64)/%: $(MACH64)/%
183 $(INS.file)
184 $(ROOTFS_LIBDIR64)/$(LIBLINKS): $(ROOTFS_LIBDIR64)/$(LIBLINKS)$(VERS)
185 $(INS.liblink)
187 $(ROOTVARIANTDIR): $(ROOTLIB)
188 $(INS.dir)
189 $(ROOTVARIANTDIR)/%: $(ROOTVARIANTDIR) $(VAR1_BLDDIR)/%
190 $(INS.file)
191 $(ROOTVARIANTDIR)/%: $(ROOTVARIANTDIR) $(VAR2_BLDDIR)/%
192 $(INS.file)
194 $(ROOTVARIANTDIR64): $(ROOTLIB64)
195 $(INS.dir)
196 $(ROOTVARIANTDIR64)/%: $(ROOTVARIANTDIR64) $(VAR1_BLDDIR64)/%
197 $(INS.file)
199 $(MACH)/$(LIB_PIC): FRC
200 @cd $(MACH); pwd; VERSION='$(VERSION)' $(MAKE) $(LIB_PIC)
201 $(MACH64)/$(LIB_PIC): FRC
202 @cd $(MACH64); pwd; VERSION='$(VERSION)' $(MAKE) $(LIB_PIC)
204 all := TARGET= all
205 install := TARGET= install
206 clean := TARGET= clean
207 clobber := TARGET= clobber
209 .PARALLEL: $(SUBDIRS)
211 $(SUBDIRS): FRC
212 @cd $@; pwd; VERSION='$(VERSION)' $(MAKE) $(TARGET)
214 clean: $(SUBDIRS)
215 clobber: $(SUBDIRS) etc clobber_local
216 clobber_local:
217 $(RM) $(CLOBBERFILES)
219 _msg: $(MSGDOMAIN) catalog
221 catalog:
222 sh ./makelibccatalog.sh $(MSGDOMAIN)
224 $(MSGDOMAIN):
225 $(INS.dir)
227 FRC:
228 # include MACH-specific library targets
229 include ../Makefile.mach