move 32-bit libs to lib/i386 subdirs & 64-bit libs to lib/
[unleashed.git] / usr / src / lib / libc / Makefile
blob31885e18c75d7a97e58cb166d0bcb48e6ad54a46
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/$(MACH32)
40 ROOTFS_LIB= $(ROOT)/lib/$(MACH32)
41 ROOTLIB64= $(ROOT)/usr/lib
42 ROOTFS_LIB64= $(ROOT)/lib
44 # include common library definitions
45 include ../Makefile.lib
47 i386_COMP= capabilities
48 sparc_COMP= capabilities
50 MACH_COMP= $($(MACH)_COMP)
52 i386_ETC= $(MACH)/etc
53 sparc_ETC=
55 SUBDIRS= $(MACH_CAP) $(MACH) $(MACH_ETC)
56 $(BUILD64)SUBDIRS += $(MACH64)
58 LIBS = $(DYNLIB)
60 ROOTLIBS64= $(ROOTLIBDIR64)/$(DYNLIB)
61 MACHLIBS64= $(MACH64)/$(DYNLIB)
63 # definitions for install_h target
64 BASEHDRS= getxby_door.h
65 CHECKHDRS= $(BASEHDRS:%.h=port/gen/%.check)
66 HDRS= $(BASEHDRS)
68 # install rules for install_h target
69 $(ROOTHDRDIR)/%: port/gen/%
70 $(INS.file)
72 $(ROOTLIBDIR)/$(DYNLIB) := FILEMODE = 755
73 $(ROOTLIBDIR64)/$(DYNLIB) := FILEMODE = 755
74 $(ROOTFS_LIBDIR)/$(DYNLIB) := FILEMODE = 755
75 $(ROOTFS_LIBDIR64)/$(DYNLIB) := FILEMODE = 755
77 .KEEP_STATE:
79 all: all_h lib32 $(BUILD64) .WAIT lib64 .WAIT etc
81 etc: $($(MACH)_ETC)
83 lib32: $(MACH_COMP) $(MACHLIBS) $(MACH)/$(LIB_PIC)
84 @if $(ELFDUMP) -r $(MACH)/$(DYNLIB) | $(GREP) -w environ ; then \
85 $(ECHO) "Error: Invalid reference to environ" ; \
86 $(ECHO) "Error: See comments in port/gen/env_data.c" ; \
87 exit 1; \
90 lib64: $(MACH_COMP) $(MACHLIBS64) $(MACH64)/$(LIB_PIC)
91 @if $(ELFDUMP) -r $(MACH64)/$(DYNLIB) | $(GREP) -w environ ; then \
92 $(ECHO) "Error: Invalid reference to environ" ; \
93 $(ECHO) "Error: See comments in port/gen/env_data.c" ; \
94 exit 1; \
97 $(MACH)/assym.h $(MACH64)/assym.h:
98 @cd $(@D); $(MAKE) assym.h
100 $($(MACH)_ETC): FRC
101 @cd $(@); pwd; $(MAKE) $(TARGET)
103 $($(MACH)_COMP): FRC
104 @cd $(@); pwd; $(MAKE) $(TARGET)
106 install: all \
107 etc \
108 inslib32 \
109 $(BUILD64) inslib64
111 inslib32: $(ROOTFS_LIBS) $(ROOTFS_LINKS)
113 inslib64: $(ROOTFS_LIBS64) $(ROOTFS_LINKS64)
115 install_h: all_h $(ROOTHDRS)
117 all_h: $(MACH)/assym.h $(MACH64)/assym.h
119 check: $(CHECKHDRS)
121 $(ROOTFS_LIB)/%: $(MACH)/%
122 $(INS.file)
123 $(ROOTFS_LIBDIR)/$(LIBLINKS): $(ROOTFS_LIBDIR)/$(LIBLINKS)$(VERS)
124 $(INS.liblink)
125 $(ROOTFS_LIB64)/%: $(MACH64)/%
126 $(INS.file)
127 $(ROOTFS_LIBDIR64)/$(LIBLINKS): $(ROOTFS_LIBDIR64)/$(LIBLINKS)$(VERS)
128 $(INS.liblink)
130 $(MACH)/$(LIB_PIC): FRC
131 @cd $(MACH); pwd; VERSION='$(VERSION)' $(MAKE) $(LIB_PIC)
132 $(MACH64)/$(LIB_PIC): FRC
133 @cd $(MACH64); pwd; VERSION='$(VERSION)' $(MAKE) $(LIB_PIC)
135 all := TARGET= all
136 install := TARGET= install
137 clean := TARGET= clean
138 clobber := TARGET= clobber
140 .PARALLEL: $(SUBDIRS)
142 $(SUBDIRS): FRC
143 @cd $@; pwd; VERSION='$(VERSION)' $(MAKE) $(TARGET)
145 clean: $(SUBDIRS)
146 clobber: $(SUBDIRS) etc clobber_local
147 clobber_local:
148 $(RM) $(CLOBBERFILES)
150 _msg: $(MSGDOMAIN) catalog
152 catalog:
153 sh ./makelibccatalog.sh $(MSGDOMAIN)
155 $(MSGDOMAIN):
156 $(INS.dir)
158 FRC:
159 # include MACH-specific library targets
160 include ../Makefile.mach