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]
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.
29 LIBRARY
= $(LIBBASENAME
:%=%.a
)
32 # Note that we build libc_pic.a for the benefit of building
33 # ld.so.1, but we do not install it. Only ld.so.1 needs it
34 # and it must be built in the same workspace as libc.
37 ROOTLIB
= $(ROOT
)/usr
/lib
38 ROOTFS_LIB
= $(ROOT
)/lib
39 ROOTLIB64
= $(ROOTLIB
)/$(MACH64
)
40 ROOTFS_LIB64
= $(ROOTFS_LIB
)/$(MACH64
)
42 ROOTVARIANTDIR
= $(ROOTLIB
)/libc
43 ROOTVARIANTDIR64
= $(ROOTLIB64
)/libc
45 ROOTFS_LINTDIR
= $(ROOTFS_LIB
)
46 ROOTFS_LINTDIR64
= $(ROOTFS_LIB64
)
47 ROOTFS_LINTLIB
= $(ROOTFS_LINTDIR
)/$(LINTLIB
)
48 ROOTFS_LINTLIB64
= $(ROOTFS_LINTDIR64
)/$(LINTLIB
)
50 # include common library definitions
51 include ..
/Makefile.lib
54 # on some architectures, we build multiple libc variants
60 VARBLD_1
= $(MACH
:sparc
=sparc
)
61 VARBLD
= $(VARBLD_1
:i386
=)
63 VARBLD64_1
= $(MACH
:sparc
=sparcv9
)
64 VARBLD64
= $(VARBLD64_1
:i386
=)
66 VAR1_DYNLIB
= $(LIBRARY
:%.a
=%_
$(VAR1
).so
$(VERS
))
67 VAR1_BLDDIR
= $(MACH
)_
$(VAR1
)/$(VARBLD
)
68 VAR2_DYNLIB
= $(LIBRARY
:%.a
=%_
$(VAR2
).so
$(VERS
))
69 VAR2_BLDDIR
= $(MACH
)_
$(VAR2
)/$(VARBLD
)
70 VAR3_DYNLIB
= $(LIBRARY
:%.a
=%_
$(VAR3
).so
$(VERS
))
71 VAR3_BLDDIR
= $(MACH
)_
$(VAR3
)/$(VARBLD
)
73 VAR1_DYNLIB64
= $(LIBRARY
:%.a
=%_
$(VAR1
).so
$(VERS
))
74 VAR1_BLDDIR64
= $(MACH
)_
$(VAR1
)/$(VARBLD64
)
76 i386_VARIANTS
= $(VAR1
) $(VAR2
) $(VAR3
)
81 sparc_COMP
= capabilities
83 MACH_COMP
= $($(MACH
)_COMP
)
88 VARIANTS
= $($(MACH
)_VARIANTS
)
89 VARIANT_SUBDIRS
= $(VARIANTS
:%=$(MACH
)_
%/$(VARBLD
))
91 VARIANTS64
= $($(MACH64
)_VARIANTS
)
92 VARIANT_SUBDIRS64
= $(VARIANTS64
:%=$(MACH
)_
%/$(VARBLD64
))
94 SUBDIRS
= $(MACH_CAP
) $(MACH
) $(MACH_ETC
) $(VARIANT_SUBDIRS
)
95 $(BUILD64
)SUBDIRS
+= $(MACH64
) $(VARIANT_SUBDIRS64
)
97 LIBS
= $(DYNLIB
) $(LINTLIB
)
99 ROOTLIBS64
= $(ROOTLIBDIR64
)/$(DYNLIB
) $(ROOTLIBDIR64
)/$(LINTLIB
)
100 MACHLIBS64
= $(MACH64
)/$(DYNLIB
) $(MACH64
)/$(LINTLIB
)
101 VARIANTLIBS
= $(VARIANTS
:%=$(MACH
)_
%/$(VARBLD
)/$(LIBBASENAME
)_
%.so
.1)
102 VARIANTLIBS64
= $(VARIANTS64
:%=$(MACH
)_
%/$(VARBLD64
)/$(LIBBASENAME
)_
%.so
.1)
103 ROOTVARIANTLIBS
= $(VARIANTS
:%=$(ROOTVARIANTDIR
)/$(LIBBASENAME
)_
%.so
.1)
104 ROOTVARIANTLIBS64
= $(VARIANTS64
:%=$(ROOTVARIANTDIR64
)/$(LIBBASENAME
)_
%.so
.1)
106 # definitions for install_h target
107 BASEHDRS
= getxby_door.h
108 CHECKHDRS
= $(BASEHDRS
:%.h
=port
/gen
/%.
check)
111 CLOBBERFILES
+= THIRDPARTYLICENSE extract-copyright
113 # install rules for install_h target
114 $(ROOTHDRDIR
)/%: port
/gen
/%
117 $(ROOTLIBDIR
)/$(DYNLIB
) := FILEMODE
= 755
118 $(ROOTLIBDIR64
)/$(DYNLIB
) := FILEMODE
= 755
119 $(ROOTFS_LIBDIR
)/$(DYNLIB
) := FILEMODE
= 755
120 $(ROOTFS_LIBDIR64
)/$(DYNLIB
) := FILEMODE
= 755
122 $(ROOTVARIANTDIR
) := FILEMODE
= 755
123 $(ROOTVARIANTDIR
)/$(VAR1_DYNLIB
) := FILEMODE
= 755
124 $(ROOTVARIANTDIR
)/$(VAR2_DYNLIB
) := FILEMODE
= 755
125 $(ROOTVARIANTDIR
)/$(VAR3_DYNLIB
) := FILEMODE
= 755
127 $(ROOTVARIANTDIR64
) := FILEMODE
= 755
128 $(ROOTVARIANTDIR64
)/$(VAR1_DYNLIB64
) := FILEMODE
= 755
132 all: all_h lib32
$(BUILD64
) .WAIT lib64 .WAIT etc THIRDPARTYLICENSE
134 THIRDPARTYLICENSE
: extract-copyright
136 .
/extract-copyright .
> $@
140 lib32
: $(MACH_COMP
) $(MACHLIBS
) $(MACH
)/$(LIB_PIC
) $(VARIANTLIBS
)
141 @if
$(ELFDUMP
) -r
$(MACH
)/$(DYNLIB
) |
$(GREP
) -w environ
; then \
142 $(ECHO
) "Error: Invalid reference to environ" ; \
143 $(ECHO
) "Error: See comments in port/gen/env_data.c" ; \
147 lib64
: $(MACH_COMP
) $(MACHLIBS64
) $(MACH64
)/$(LIB_PIC
) $(VARIANTLIBS64
)
148 @if
$(ELFDUMP
) -r
$(MACH64
)/$(DYNLIB
) |
$(GREP
) -w environ
; then \
149 $(ECHO
) "Error: Invalid reference to environ" ; \
150 $(ECHO
) "Error: See comments in port/gen/env_data.c" ; \
154 $(MACH
)/assym.h
$(MACH64
)/assym.h
:
155 @cd
$(@D
); $(MAKE
) assym.h
158 @cd
$(@D
); pwd
; VERSION
='$(VERSION)' $(MAKE
) $(@F
)
160 $(VARIANTLIBS64
): FRC
161 @cd
$(@D
); pwd
; VERSION
='$(VERSION)' $(MAKE
) $(@F
)
164 @cd
$(@
); pwd
; $(MAKE
) $(TARGET
)
167 @cd
$(@
); pwd
; $(MAKE
) $(TARGET
)
174 inslib32
: $(ROOTFS_LIBS
) $(ROOTFS_LINKS
) $(ROOTFS_LINT
) \
178 inslib64
: $(ROOTFS_LIBS64
) $(ROOTFS_LINKS64
) \
179 $(ROOTFS_LINTLIB64
) \
182 install_h
: all_h
$(ROOTHDRS
)
184 all_h
: $(MACH
)/assym.h
$(MACH64
)/assym.h
188 $(ROOTFS_LIB
)/%: $(MACH
)/%
190 $(ROOTFS_LIBDIR
)/$(LIBLINKS
): $(ROOTFS_LIBDIR
)/$(LIBLINKS
)$(VERS
)
192 $(ROOTFS_LIB64
)/%: $(MACH64
)/%
194 $(ROOTFS_LIBDIR64
)/$(LIBLINKS
): $(ROOTFS_LIBDIR64
)/$(LIBLINKS
)$(VERS
)
197 $(ROOTVARIANTDIR
): $(ROOTLIB
)
199 $(ROOTVARIANTDIR
)/%: $(ROOTVARIANTDIR
) $(VAR1_BLDDIR
)/%
201 $(ROOTVARIANTDIR
)/%: $(ROOTVARIANTDIR
) $(VAR2_BLDDIR
)/%
203 $(ROOTVARIANTDIR
)/%: $(ROOTVARIANTDIR
) $(VAR3_BLDDIR
)/%
206 $(ROOTVARIANTDIR64
): $(ROOTLIB64
)
208 $(ROOTVARIANTDIR64
)/%: $(ROOTVARIANTDIR64
) $(VAR1_BLDDIR64
)/%
211 # install rule for lint library target
212 $(ROOTFS_LINTDIR
)/%: port
/%
214 $(ROOTFS_LINTDIR64
)/%: port
/%
216 $(ROOTFS_LINTDIR
)/%: $(MACH
)/%
218 $(ROOTFS_LINTDIR64
)/%: $(MACH64
)/%
222 @cd
$(MACH
); pwd
; VERSION
='$(VERSION)' $(MAKE
) $@
224 @cd
$(MACH64
); pwd
; VERSION
='$(VERSION)' $(MAKE
) $@
226 $(MACH
)/$(LIB_PIC
): FRC
227 @cd
$(MACH
); pwd
; VERSION
='$(VERSION)' $(MAKE
) $(LIB_PIC
)
228 $(MACH64
)/$(LIB_PIC
): FRC
229 @cd
$(MACH64
); pwd
; VERSION
='$(VERSION)' $(MAKE
) $(LIB_PIC
)
232 install := TARGET
= install
233 clean := TARGET
= clean
234 clobber := TARGET
= clobber
237 .PARALLEL
: $(SUBDIRS
)
240 @cd
$@
; pwd
; VERSION
='$(VERSION)' $(MAKE
) $(TARGET
)
243 clobber: $(SUBDIRS
) etc clobber_local
245 $(RM
) $(CLOBBERFILES
)
249 _msg
: $(MSGDOMAIN
) catalog
252 sh .
/makelibccatalog.sh
$(MSGDOMAIN
)
261 # include MACH-specific library targets
262 include ..
/Makefile.mach