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.
27 # Copyright 2014 Garrett D'Amore <garrett@damore.org>
31 LIBRARY
= $(LIBBASENAME
:%=%.a
)
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.
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
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
)
74 i386_COMP
= capabilities
75 sparc_COMP
= capabilities
77 MACH_COMP
= $($(MACH
)_COMP
)
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
)
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)
105 CLOBBERFILES
+= THIRDPARTYLICENSE extract-copyright
107 # install rules for install_h target
108 $(ROOTHDRDIR
)/%: port
/gen
/%
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
125 all: all_h lib32
$(BUILD64
) .WAIT lib64 .WAIT etc THIRDPARTYLICENSE
127 THIRDPARTYLICENSE
: extract-copyright
129 .
/extract-copyright .
> $@
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" ; \
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" ; \
147 $(MACH
)/assym.h
$(MACH64
)/assym.h
:
148 @cd
$(@D
); $(MAKE
) assym.h
151 @cd
$(@D
); pwd
; VERSION
='$(VERSION)' $(MAKE
) $(@F
)
153 $(VARIANTLIBS64
): FRC
154 @cd
$(@D
); pwd
; VERSION
='$(VERSION)' $(MAKE
) $(@F
)
157 @cd
$(@
); pwd
; $(MAKE
) $(TARGET
)
160 @cd
$(@
); pwd
; $(MAKE
) $(TARGET
)
167 inslib32
: $(ROOTFS_LIBS
) $(ROOTFS_LINKS
) $(ROOTVARIANTLIBS
)
169 inslib64
: $(ROOTFS_LIBS64
) $(ROOTFS_LINKS64
) \
172 install_h
: all_h
$(ROOTHDRS
)
174 all_h
: $(MACH
)/assym.h
$(MACH64
)/assym.h
178 $(ROOTFS_LIB
)/%: $(MACH
)/%
180 $(ROOTFS_LIBDIR
)/$(LIBLINKS
): $(ROOTFS_LIBDIR
)/$(LIBLINKS
)$(VERS
)
182 $(ROOTFS_LIB64
)/%: $(MACH64
)/%
184 $(ROOTFS_LIBDIR64
)/$(LIBLINKS
): $(ROOTFS_LIBDIR64
)/$(LIBLINKS
)$(VERS
)
187 $(ROOTVARIANTDIR
): $(ROOTLIB
)
189 $(ROOTVARIANTDIR
)/%: $(ROOTVARIANTDIR
) $(VAR1_BLDDIR
)/%
191 $(ROOTVARIANTDIR
)/%: $(ROOTVARIANTDIR
) $(VAR2_BLDDIR
)/%
194 $(ROOTVARIANTDIR64
): $(ROOTLIB64
)
196 $(ROOTVARIANTDIR64
)/%: $(ROOTVARIANTDIR64
) $(VAR1_BLDDIR64
)/%
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
)
205 install := TARGET
= install
206 clean := TARGET
= clean
207 clobber := TARGET
= clobber
209 .PARALLEL
: $(SUBDIRS
)
212 @cd
$@
; pwd
; VERSION
='$(VERSION)' $(MAKE
) $(TARGET
)
215 clobber: $(SUBDIRS
) etc clobber_local
217 $(RM
) $(CLOBBERFILES
)
219 _msg
: $(MSGDOMAIN
) catalog
222 sh .
/makelibccatalog.sh
$(MSGDOMAIN
)
228 # include MACH-specific library targets
229 include ..
/Makefile.mach