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]
23 # Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
25 # Copyright 2010 Nexenta Systems, Inc. All rights reserved.
26 # Use is subject to license terms.
29 LIBCDIR= $(SRC)/lib/libc
35 # objects are grouped by source directory
37 # Symbol capabilities objects.
39 $(LIBCDIR)/capabilities/sun4u/sparcv9/pics/symcap.o \
40 $(LIBCDIR)/capabilities/sun4u-opl/sparcv9/pics/symcap.o \
41 $(LIBCDIR)/capabilities/sun4u-us3-hwcap1/sparcv9/pics/symcap.o \
42 $(LIBCDIR)/capabilities/sun4u-us3-hwcap2/sparcv9/pics/symcap.o \
43 $(LIBCDIR)/capabilities/sun4v-hwcap1/sparcv9/pics/symcap.o \
44 $(LIBCDIR)/capabilities/sun4v-hwcap2/sparcv9/pics/symcap.o
112 $(__GNUC)FPASMOBJS += \
160 sync_instruction_memory.o
162 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
163 # This macro should ALWAYS be empty; native APIs are already 'large file'.
308 _lwp_mutex_unlock.o \
315 sparc_utrap_install.o \
323 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
324 # This macro should ALWAYS be empty; native APIs are already 'large file'.
327 # objects from source under $(LIBCDIR)/port
610 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
611 # This macro should ALWAYS be empty; native APIs are already 'large file'.
849 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
850 # This macro should ALWAYS be empty; native APIs are already 'large file'.
958 # NOTE: libc.so.1 must be linked with the minimal crti.o and crtn.o
959 # modules whose source is provided in the $(SRC)/lib/common directory.
960 # This must be done because otherwise the Sun C compiler would insert
961 # its own versions of these modules and those versions contain code
962 # to call out to C++ initialization functions. Such C++ initialization
963 # functions can call back into libc before thread initialization is
964 # complete and this leads to segmentation violations and other problems.
965 # Since libc contains no C++ code, linking with the minimal crti.o and
966 # crtn.o modules is safe and avoids the problems described above.
967 OBJECTS= $(CRTI) $(MOSTOBJS) $(CRTN)
968 CRTSRCS= ../../common/sparcv9
970 # include common library definitions
971 include $(SRC)/lib/Makefile.lib
972 include $(SRC)/lib/Makefile.lib.64
974 # NOTE: libc_i18n.a will be part of libc.so.1. Therefore, the compilation
975 # conditions such as the settings of CFLAGS and CPPFLAGS for the libc_i18n stuff
976 # need to be compatible with the ones for the libc stuff. Whenever the changes
977 # that affect the compilation conditions of libc happened, those for libc_i18n
978 # also need to be updated.
980 # we need to override the default SONAME here because we might
981 # be building a variant object (still libc.so.1, but different filename)
984 CFLAGS64 += $(CCVERBOSE)
986 # This is necessary to avoid problems with calling _ex_unwind().
987 # We probably don't want any inlining anyway.
988 CFLAGS64 += -xinline=
990 # Setting THREAD_DEBUG = -DTHREAD_DEBUG (make THREAD_DEBUG=-DTHREAD_DEBUG ...)
991 # enables ASSERT() checking in the threads portion of the library.
992 # This is automatically enabled for DEBUG builds, not for non-debug builds.
994 $(NOT_RELEASE_BUILD)THREAD_DEBUG = -DTHREAD_DEBUG
996 # Make string literals read-only to save memory.
997 CFLAGS64 += $(XSTRCONST)
999 ALTPICS= $(TRACEOBJS:%=pics/%)
1001 $(DYNLIB) := PICS += $(ROOTFS_LIBDIR64)/libc_i18n.a
1002 $(DYNLIB) := BUILD.SO = $(LD) -o $@ -G $(DYNFLAGS) $(PICS) $(ALTPICS) $(EXTPICS)
1004 MAPFILES = $(LIBCDIR)/port/mapfile-vers
1006 sparcv9_C_PICFLAGS= -K PIC
1007 CFLAGS64 += $(EXTN_CFLAGS)
1008 CPPFLAGS= -D_REENTRANT -Dsparc $(EXTN_CPPFLAGS) $(THREAD_DEBUG) \
1009 -I$(LIBCBASE)/inc -I$(LIBCDIR)/inc $(CPPFLAGS.master)
1010 ASFLAGS= $(EXTN_ASFLAGS) -K PIC -P -D__STDC__ -D_ASM -D__sparcv9 $(CPPFLAGS) \
1013 # As a favor to the dtrace syscall provider, libc still calls the
1014 # old syscall traps that have been obsoleted by the *at() interfaces.
1015 # Delete this to compile libc using only the new *at() system call traps
1016 CPPFLAGS += -D_RETAIN_OLD_SYSCALLS
1018 # Inform the run-time linker about libc specialized initialization
1019 RTLDINFO = -z rtldinfo=tls_rtldinfo
1020 DYNFLAGS += $(RTLDINFO)
1022 # Force libc's internal references to be resolved immediately upon loading
1023 # in order to avoid critical region problems. Since almost all libc symbols
1024 # are marked 'protected' in the mapfiles, this is a minimal set (15 to 20).
1027 DYNFLAGS += $(EXTN_DYNFLAGS)
1029 BUILD.s= $(AS) $(ASFLAGS) $< -o $@
1031 # Override this top level flag so the compiler builds in its native
1032 # C99 mode. This has been enabled to support the complex arithmetic
1034 C99MODE= $(C99_ENABLE)
1036 # libc method of building an archive
1037 BUILD.AR= $(RM) $@ ; \
1038 $(AR) q $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%)| $(TSORT)`
1040 # extra files for the clean target
1042 $(LIBCDIR)/port/gen/errlst.c \
1043 $(LIBCDIR)/port/gen/new_list.c \
1050 CLOBBERFILES += $(LIB_PIC)
1052 # list of C source for lint
1054 $(ATOMICOBJS:%.o=$(SRC)/common/atomic/%.c) \
1055 $(XATTROBJS:%.o=$(SRC)/common/xattr/%.c) \
1056 $(COMOBJS:%.o=$(SRC)/common/util/%.c) \
1057 $(PORTFP:%.o=$(LIBCDIR)/port/fp/%.c) \
1058 $(PORTGEN:%.o=$(LIBCDIR)/port/gen/%.c) \
1059 $(PORTI18N:%.o=$(LIBCDIR)/port/i18n/%.c) \
1060 $(PORTLOCALE:%.o=$(LIBCDIR)/port/locale/%.c) \
1061 $(PORTPRINT:%.o=$(LIBCDIR)/port/print/%.c) \
1062 $(PORTREGEX:%.o=$(LIBCDIR)/port/regex/%.c) \
1063 $(PORTSTDIO:%.o=$(LIBCDIR)/port/stdio/%.c) \
1064 $(PORTSYS:%.o=$(LIBCDIR)/port/sys/%.c) \
1065 $(AIOOBJS:%.o=$(LIBCDIR)/port/aio/%.c) \
1066 $(RTOBJS:%.o=$(LIBCDIR)/port/rt/%.c) \
1067 $(TPOOLOBJS:%.o=$(LIBCDIR)/port/tpool/%.c) \
1068 $(THREADSOBJS:%.o=$(LIBCDIR)/port/threads/%.c) \
1069 $(THREADSMACHOBJS:%.o=$(LIBCDIR)/$(MACH)/threads/%.c) \
1070 $(UNICODEOBJS:%.o=$(SRC)/common/unicode/%.c) \
1071 $(UNWINDMACHOBJS:%.o=$(LIBCDIR)/port/unwind/%.c) \
1072 $(FPOBJS:%.o=$(LIBCDIR)/$(MACH)/fp/%.c) \
1073 $(FPOBJS64:%.o=$(LIBCBASE)/fp/%.c) \
1074 $(LIBCBASE)/crt/_ftou.c \
1075 $(LIBCBASE)/gen/_xregs_clrptr.c \
1076 $(LIBCBASE)/gen/byteorder.c \
1077 $(LIBCBASE)/gen/ecvt.c \
1078 $(LIBCBASE)/gen/getctxt.c \
1079 $(LIBCBASE)/gen/makectxt.c \
1080 $(LIBCBASE)/gen/siginfolst.c \
1081 $(LIBCBASE)/gen/siglongjmp.c \
1082 $(LIBCBASE)/gen/swapctxt.c
1084 # conditional assignments
1085 $(DYNLIB) := CRTI = crti.o
1086 $(DYNLIB) := CRTN = crtn.o
1088 # Files which need the threads .il inline template
1122 thread_interface.o \
1128 $(TIL:%=pics/%) := CFLAGS64 += $(LIBCBASE)/threads/sparcv9.il
1130 # Files in fp, port/fp subdirectories that need base.il inline template
1135 $(IL:%=pics/%) := CFLAGS64 += $(LIBCBASE)/fp/base.il
1137 # Files in fp subdirectory which need __quad.il inline template
1156 $(QIL:%=pics/%) := CFLAGS64 += $(LIBCDIR)/$(MACH)/fp/__quad.il
1157 pics/_Qp%.o := CFLAGS64 += -I$(LIBCDIR)/$(MACH)/fp
1158 pics/_Q%.o := sparcv9_COPTFLAG = -xO4 -xchip=ultra
1160 # Files in crt subdirectory which need muldiv64.il inline template
1161 #CIL= mul64.o divrem64.o
1162 #$(CIL:%=pics/%) := CFLAGS += $(LIBCBASE)/crt/mul64.il
1164 # large-file-aware components that should be built large
1166 #$(COMSYSOBJS64:%=pics/%) := \
1167 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1169 #$(SYSOBJS64:%=pics/%) := \
1170 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1172 #$(PORTGEN64:%=pics/%) := \
1173 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1175 #$(PORTSTDIO64:%=pics/%) := \
1176 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1178 #$(PORTSYS64:%=pics/%) := \
1179 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1181 $(PORTSTDIO_W:%=pics/%) := \
1184 $(PORTPRINT_W:%=pics/%) := \
1187 $(PORTI18N_COND:%=pics/%) := \
1188 CPPFLAGS += -D_WCS_LONGLONG
1190 # Files which need extra optimization
1191 pics/getenv.o := sparcv9_COPTFLAG = -xO4
1195 all: $(LIBS) $(LIB_PIC)
1197 lint := CPPFLAGS += -I$(LIBCDIR)/$(MACH)/fp
1198 lint := CPPFLAGS += -D_MSE_INT_H -D_LCONV_C99
1199 lint := LINTFLAGS64 += -mn
1202 @echo $(LINT.c) ... $(LDLIBS)
1203 @$(LINT.c) $(SRCS) $(LDLIBS)
1205 $(LINTLIB):= SRCS=$(LIBCDIR)/port/llib-lc
1206 $(LINTLIB):= CPPFLAGS += -D_MSE_INT_H
1207 $(LINTLIB):= LINTFLAGS64=-nvx -m64
1209 # object files that depend on inline template
1210 $(TIL:%=pics/%): $(LIBCBASE)/threads/sparcv9.il
1211 $(IL:%=pics/%): $(LIBCBASE)/fp/base.il
1212 $(QIL:%=pics/%): $(LIBCDIR)/$(MACH)/fp/__quad.il
1213 #$(CIL:%=pics/%): $(LIBCBASE)/crt/muldiv64.il
1215 # include common libc targets
1216 include $(LIBCDIR)/Makefile.targ
1218 # We need to strip out all CTF and DOF data from the static library
1219 $(LIB_PIC) := DIR = pics
1220 $(LIB_PIC): pics $$(PICS)
1222 $(MCS) -d -n .SUNW_ctf $@ > /dev/null 2>&1
1223 $(MCS) -d -n .SUNW_dof $@ > /dev/null 2>&1
1224 $(AR) -ts $@ > /dev/null
1228 #$(STRETS:%=pics/%): crt/stret.s
1229 # $(AS) $(ASFLAGS) -DSTRET$(@F:stret%.o=%) crt/stret.s -o $@
1232 #crt/_rtbootld.s: crt/_rtboot.s crt/_rtld.c
1233 # $(CC) $(CPPFLAGS) -O -S -K pic crt/_rtld.c -o crt/_rtld.s
1234 # $(CAT) crt/_rtboot.s crt/_rtld.s > $@
1238 _lwp_mutex_unlock.o \
1246 $(ASSYMDEP_OBJS:%=pics/%) := CPPFLAGS += -I.
1248 $(ASSYMDEP_OBJS:%=pics/%): assym.h
1250 # assym.h build rules
1252 GENASSYM_C = $(LIBCDIR)/$(MACH)/genassym.c
1254 # XXX A hack. Perhaps this should be 'CPPFLAGS.native' and
1255 # live in Makefile.master
1257 CPPFLAGS.genassym = \
1258 $(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
1260 genassym: $(GENASSYM_C)
1261 $(NATIVECC) -I$(LIBCBASE)/inc -I$(LIBCDIR)/inc \
1262 $(CPPFLAGS.genassym) -o $@ $(GENASSYM_C)
1264 OFFSETS = $(LIBCDIR)/$(MACH)/offsets.in
1266 assym.h: $(OFFSETS) genassym
1267 $(OFFSETS_CREATE) <$(OFFSETS) >$@
1270 # derived C source and related explicit dependencies
1271 $(LIBCDIR)/port/gen/new_list.c: $(LIBCDIR)/port/gen/errlist $(LIBCDIR)/port/gen/errlist.awk
1272 cd $(LIBCDIR)/port/gen; pwd; $(AWK) -f errlist.awk < errlist
1274 pics/new_list.o: $(LIBCDIR)/port/gen/new_list.c