Merge branch 'merges' of git://repo.or.cz/unleashed into merges
[unleashed.git] / usr / src / lib / libc / Makefile
blobf3b8966ff86c19c58150cc2d0a4fcf2385501c4e
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 # 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 CLOBBERFILES += THIRDPARTYLICENSE extract-copyright
70 # install rules for install_h target
71 $(ROOTHDRDIR)/%: port/gen/%
72 $(INS.file)
74 $(ROOTLIBDIR)/$(DYNLIB) := FILEMODE = 755
75 $(ROOTLIBDIR64)/$(DYNLIB) := FILEMODE = 755
76 $(ROOTFS_LIBDIR)/$(DYNLIB) := FILEMODE = 755
77 $(ROOTFS_LIBDIR64)/$(DYNLIB) := FILEMODE = 755
79 .KEEP_STATE:
81 all: all_h lib32 $(BUILD64) .WAIT lib64 .WAIT etc THIRDPARTYLICENSE
83 THIRDPARTYLICENSE: extract-copyright
84 $(RM) $@
85 ./extract-copyright . > $@
87 etc: $($(MACH)_ETC)
89 lib32: $(MACH_COMP) $(MACHLIBS) $(MACH)/$(LIB_PIC)
90 @if $(ELFDUMP) -r $(MACH)/$(DYNLIB) | $(GREP) -w environ ; then \
91 $(ECHO) "Error: Invalid reference to environ" ; \
92 $(ECHO) "Error: See comments in port/gen/env_data.c" ; \
93 exit 1; \
96 lib64: $(MACH_COMP) $(MACHLIBS64) $(MACH64)/$(LIB_PIC)
97 @if $(ELFDUMP) -r $(MACH64)/$(DYNLIB) | $(GREP) -w environ ; then \
98 $(ECHO) "Error: Invalid reference to environ" ; \
99 $(ECHO) "Error: See comments in port/gen/env_data.c" ; \
100 exit 1; \
103 $(MACH)/assym.h $(MACH64)/assym.h:
104 @cd $(@D); $(MAKE) assym.h
106 $($(MACH)_ETC): FRC
107 @cd $(@); pwd; $(MAKE) $(TARGET)
109 $($(MACH)_COMP): FRC
110 @cd $(@); pwd; $(MAKE) $(TARGET)
112 install: all \
113 etc \
114 inslib32 \
115 $(BUILD64) inslib64
117 inslib32: $(ROOTFS_LIBS) $(ROOTFS_LINKS)
119 inslib64: $(ROOTFS_LIBS64) $(ROOTFS_LINKS64)
121 install_h: all_h $(ROOTHDRS)
123 all_h: $(MACH)/assym.h $(MACH64)/assym.h
125 check: $(CHECKHDRS)
127 $(ROOTFS_LIB)/%: $(MACH)/%
128 $(INS.file)
129 $(ROOTFS_LIBDIR)/$(LIBLINKS): $(ROOTFS_LIBDIR)/$(LIBLINKS)$(VERS)
130 $(INS.liblink)
131 $(ROOTFS_LIB64)/%: $(MACH64)/%
132 $(INS.file)
133 $(ROOTFS_LIBDIR64)/$(LIBLINKS): $(ROOTFS_LIBDIR64)/$(LIBLINKS)$(VERS)
134 $(INS.liblink)
136 $(MACH)/$(LIB_PIC): FRC
137 @cd $(MACH); pwd; VERSION='$(VERSION)' $(MAKE) $(LIB_PIC)
138 $(MACH64)/$(LIB_PIC): FRC
139 @cd $(MACH64); pwd; VERSION='$(VERSION)' $(MAKE) $(LIB_PIC)
141 all := TARGET= all
142 install := TARGET= install
143 clean := TARGET= clean
144 clobber := TARGET= clobber
146 .PARALLEL: $(SUBDIRS)
148 $(SUBDIRS): FRC
149 @cd $@; pwd; VERSION='$(VERSION)' $(MAKE) $(TARGET)
151 clean: $(SUBDIRS)
152 clobber: $(SUBDIRS) etc clobber_local
153 clobber_local:
154 $(RM) $(CLOBBERFILES)
156 _msg: $(MSGDOMAIN) catalog
158 catalog:
159 sh ./makelibccatalog.sh $(MSGDOMAIN)
161 $(MSGDOMAIN):
162 $(INS.dir)
164 FRC:
165 # include MACH-specific library targets
166 include ../Makefile.mach