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) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
24 # Copyright 2016 Joyent, Inc.
25 # Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
26 # Copyright 2013 Garrett D'Amore <garrett@damore.org>
27 # Copyright 2017 Nexenta Systems, Inc.
31 LIBCDIR
= $(SRC
)/lib
/libc
38 # include comm page definitions
39 include $(SRC
)/lib
/commpage
/Makefile.shared.com
40 include $(SRC
)/lib
/commpage
/Makefile.shared.targ
42 # objects are grouped by source directory
117 arc4random_uniform.o \
145 sync_instruction_memory.o
147 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
148 # This macro should ALWAYS be empty; native APIs are already 'large file'.
289 __clock_gettime_sys.o \
292 _lwp_mutex_unlock.o \
309 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
310 # This macro should ALWAYS be empty; native APIs are already 'large file'.
313 # objects from source under $(LIBCDIR)/port
350 ascii_strncasecmp.o \
615 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
616 # This macro should ALWAYS be empty; native APIs are already 'large file'.
862 pics
/unwind.o
:= COPTFLAG64
=
867 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
868 # This macro should ALWAYS be empty; native APIs are already 'large file'.
991 # NOTE: libc.so.1 must be linked with the minimal crti.o and crtn.o
992 # modules whose source is provided in the $(SRC)/lib/common directory.
993 # This must be done because otherwise the Sun C compiler would insert
994 # its own versions of these modules and those versions contain code
995 # to call out to C++ initialization functions. Such C++ initialization
996 # functions can call back into libc before thread initialization is
997 # complete and this leads to segmentation violations and other problems.
998 # Since libc contains no C++ code, linking with the minimal crti.o and
999 # crtn.o modules is safe and avoids the problems described above.
1000 OBJECTS
= $(CRTI
) $(MOSTOBJS
) $(CRTN
)
1001 CRTSRCS
= ..
/..
/common
/amd64
1003 # include common library definitions
1004 include ..
/..
/Makefile.lib
1005 include ..
/..
/Makefile.lib
.64
1007 CFLAGS64
+= $(CTF_FLAGS
)
1009 # This is necessary to avoid problems with calling _ex_unwind().
1010 # We probably don't want any inlining anyway.
1011 CFLAGS64
+= -xinline
=
1013 CERRWARN
+= -_gcc
=-Wno-parentheses
1014 CERRWARN
+= -_gcc
=-Wno-switch
1015 CERRWARN
+= -_gcc
=-Wno-uninitialized
1016 CERRWARN
+= -_gcc
=-Wno-unused-value
1017 CERRWARN
+= -_gcc
=-Wno-unused-label
1018 CERRWARN
+= -_gcc
=-Wno-unused-variable
1019 CERRWARN
+= -_gcc
=-Wno-type-limits
1020 CERRWARN
+= -_gcc
=-Wno-char-subscripts
1021 CERRWARN
+= -_gcc
=-Wno-clobbered
1022 CERRWARN
+= -_gcc
=-Wno-unused-function
1023 CERRWARN
+= -_gcc
=-Wno-address
1025 # Setting THREAD_DEBUG = -DTHREAD_DEBUG (make THREAD_DEBUG=-DTHREAD_DEBUG ...)
1026 # enables ASSERT() checking in the threads portion of the library.
1027 # This is automatically enabled for DEBUG builds, not for non-debug builds.
1029 $(NOT_RELEASE_BUILD
)THREAD_DEBUG
= -DTHREAD_DEBUG
1031 # Make string literals read-only to save memory
1032 CFLAGS64
+= $(XSTRCONST
)
1034 ALTPICS
= $(TRACEOBJS
:%=pics
/%)
1036 $(DYNLIB
) := BUILD.SO
= $(LD
) -o
$@
-G
$(DYNFLAGS
) $(PICS
) $(ALTPICS
) $(EXTPICS
)
1038 MAPFILES
= $(LIBCDIR
)/port
/mapfile-vers
1040 CPPFLAGS
= -D_REENTRANT
-D
$(MACH64
) -D__
$(MACH64
) $(THREAD_DEBUG
) \
1041 -I.
-I
$(LIBCBASE
)/inc
-I
$(LIBCDIR
)/inc
$(CPPFLAGS.master
)
1042 ASFLAGS
= $(AS_PICFLAGS
) -P
-D__STDC__
-D_ASM
$(CPPFLAGS
) \
1045 # As a favor to the dtrace syscall provider, libc still calls the
1046 # old syscall traps that have been obsoleted by the *at() interfaces.
1047 # Delete this to compile libc using only the new *at() system call traps
1048 CPPFLAGS
+= -D_RETAIN_OLD_SYSCALLS
1050 # proc64_id.o is built with defines in $(SRC)/uts/intel/sys/x86_archext.h
1051 pics
/proc64_id.o
:= CFLAGS64
+= -I
$(SRC
)/uts
/intel
1053 # Inform the run-time linker about libc specialized initialization
1054 RTLDINFO
= -z rtldinfo
=tls_rtldinfo
1055 DYNFLAGS
+= $(RTLDINFO
)
1057 # Force libc's internal references to be resolved immediately upon loading
1058 # in order to avoid critical region problems. Since almost all libc symbols
1059 # are marked 'protected' in the mapfiles, this is a minimal set (15 to 20).
1062 BUILD.s
= $(AS
) $(ASFLAGS
) $< -o
$@
1064 # Override this top level flag so the compiler builds in its native
1065 # C99 mode. This has been enabled to support the complex arithmetic
1067 C99MODE
= $(C99_ENABLE
)
1069 # libc method of building an archive
1070 # The "$(GREP) -v ' L '" part is necessary only until
1071 # lorder is fixed to ignore thread-local variables.
1072 BUILD.AR
= $(RM
) $@
; \
1073 $(AR
) q
$@
`$(LORDER) $(MOSTOBJS:%=$(DIR)/%) | $(GREP) -v ' L ' | $(TSORT)`
1075 # extra files for the clean target
1077 $(LIBCDIR
)/port
/gen
/errlst.c \
1078 $(LIBCDIR
)/port
/gen
/new_list.c \
1086 CLOBBERFILES
+= $(LIB_PIC
)
1088 # list of C source for lint
1090 $(ATOMICOBJS
:%.o
=$(SRC
)/common
/atomic
/%.c
) \
1091 $(XATTROBJS
:%.o
=$(SRC
)/common
/xattr
/%.c
) \
1092 $(COMOBJS
:%.o
=$(SRC
)/common
/util
/%.c
) \
1093 $(PORTFP
:%.o
=$(LIBCDIR
)/port
/fp
/%.c
) \
1094 $(PORTGEN
:%.o
=$(LIBCDIR
)/port
/gen
/%.c
) \
1095 $(PORTI18N
:%.o
=$(LIBCDIR
)/port
/i18n
/%.c
) \
1096 $(PORTLOCALE
:%.o
=$(LIBCDIR
)/port
/locale
/%.c
) \
1097 $(PORTPRINT
:%.o
=$(LIBCDIR
)/port
/print/%.c
) \
1098 $(PORTREGEX
:%.o
=$(LIBCDIR
)/port
/regex
/%.c
) \
1099 $(PORTSTDIO
:%.o
=$(LIBCDIR
)/port
/stdio
/%.c
) \
1100 $(PORTSYS
:%.o
=$(LIBCDIR
)/port
/sys
/%.c
) \
1101 $(AIOOBJS
:%.o
=$(LIBCDIR
)/port
/aio
/%.c
) \
1102 $(RTOBJS
:%.o
=$(LIBCDIR
)/port
/rt
/%.c
) \
1103 $(SECFLAGSOBJS
:%.o
=$(SRC
)/common
/secflags
/%.c
) \
1104 $(TPOOLOBJS
:%.o
=$(LIBCDIR
)/port
/tpool
/%.c
) \
1105 $(THREADSOBJS
:%.o
=$(LIBCDIR
)/port
/threads
/%.c
) \
1106 $(THREADSMACHOBJS
:%.o
=threads
/%.c
) \
1107 $(UNICODEOBJS
:%.o
=$(SRC
)/common
/unicode
/%.c
) \
1108 $(UNWINDMACHOBJS
:%.o
=unwind
/%.c
) \
1109 $(FPOBJS
:%.o
=fp
/%.c
) \
1110 $(I386FPOBJS
:%.o
=$(LIBCDIR
)/i386
/fp
/%.c
) \
1111 $(LIBCBASE
)/gen
/ecvt.c \
1112 $(LIBCBASE
)/gen
/makectxt.c \
1113 $(LIBCBASE
)/gen
/siginfolst.c \
1114 $(LIBCBASE
)/gen
/siglongjmp.c \
1115 $(LIBCBASE
)/gen
/sync_instruction_memory.c \
1116 $(LIBCBASE
)/sys
/uadmin.c
1118 # conditional assignments
1119 # $(DYNLIB) $(LIB_PIC) := DYNOBJS = _rtbootld.o
1120 $(DYNLIB
) := CRTI
= crti.o
1121 $(DYNLIB
) := CRTN
= crtn.o
1123 # Files which need the threads .il inline template
1156 thread_interface.o \
1163 $(TIL
:%=pics
/%) := CFLAGS64
+= $(LIBCBASE
)/threads
/amd64.il
1165 # pics/mul64.o := CFLAGS64 += crt/mul64.il
1167 # large-file-aware components that should be built large
1169 #$(COMSYSOBJS64:%=pics/%) := \
1170 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1172 #$(SYSOBJS64:%=pics/%) := \
1173 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1175 #$(PORTGEN64:%=pics/%) := \
1176 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1178 #$(PORTSTDIO64:%=pics/%) := \
1179 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1181 #$(PORTSYS64:%=pics/%) := \
1182 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1184 $(PORTSTDIO_W
:%=pics
/%) := \
1187 $(PORTPRINT_W
:%=pics
/%) := \
1190 $(PORTPRINT_C89
:%=pics
/%) := \
1191 CPPFLAGS
+= -D_C89_INTMAX32
1193 $(PORTSTDIO_C89
:%=pics
/%) := \
1194 CPPFLAGS
+= -D_C89_INTMAX32
1196 $(PORTI18N_COND
:%=pics
/%) := \
1197 CPPFLAGS
+= -D_WCS_LONGLONG
1199 pics
/arc4random.o
:= CPPFLAGS
+= -I
$(SRC
)/common
/crypto
/chacha
1201 pics
/__clock_gettime.o
:= CPPFLAGS
+= $(COMMPAGE_CPPFLAGS
)
1205 all: $(LIBS
) $(LIB_PIC
)
1207 lint
:= CPPFLAGS
+= -I
$(LIBCDIR
)/$(MACH
)/fp
1208 lint
:= CPPFLAGS
+= -D_MSE_INT_H
-D_LCONV_C99
1209 lint
:= LINTFLAGS64
+= -mn
-erroff
=E_SUPPRESSION_DIRECTIVE_UNUSED
1212 @echo
$(LINT.c
) ...
$(LDLIBS
)
1213 @
$(LINT.c
) $(SRCS
) $(LDLIBS
)
1215 $(LINTLIB
):= SRCS
=$(LIBCDIR
)/port
/llib-lc
1216 $(LINTLIB
):= CPPFLAGS
+= -D_MSE_INT_H
1217 $(LINTLIB
):= LINTFLAGS64
=-nvx
-m64
1219 # object files that depend on inline template
1220 $(TIL
:%=pics
/%): $(LIBCBASE
)/threads
/amd64.il
1221 # pics/mul64.o: crt/mul64.il
1223 # include common libc targets
1224 include ..
/Makefile.targ
1226 # We need to strip out all CTF data from the static library
1227 $(LIB_PIC
) := DIR
= pics
1228 $(LIB_PIC
): pics
$$(PICS
)
1230 $(MCS
) -d
-n .SUNW_ctf
$@
> /dev
/null
2>&1
1231 $(AR
) -ts
$@
> /dev
/null
1235 _lwp_mutex_unlock.o \
1243 $(ASSYMDEP_OBJS
:%=pics
/%): assym.h
1245 # assym.h build rules
1247 GENASSYM_C
= genassym.c
1249 genassym
: $(GENASSYM_C
)
1250 $(NATIVECC
) $(NATIVE_CFLAGS
) -Iinc
-I
$(LIBCDIR
)/inc
$(CPPFLAGS.native
) \
1253 OFFSETS
= $(LIBCDIR
)/$(MACH
)/offsets.in
1255 assym.h
: $(OFFSETS
) genassym
1256 $(OFFSETS_CREATE
) <$(OFFSETS
) >$@
1259 # derived C source and related explicit dependencies
1260 $(LIBCDIR
)/port
/gen
/errlst.c
+ \
1261 $(LIBCDIR
)/port
/gen
/new_list.c
: $(LIBCDIR
)/port
/gen
/errlist
$(LIBCDIR
)/port
/gen
/errlist.awk
1262 cd
$(LIBCDIR
)/port
/gen
; pwd
; $(AWK
) -f errlist.awk
< errlist
1264 pics
/errlst.o
: $(LIBCDIR
)/port
/gen
/errlst.c
1266 pics
/new_list.o
: $(LIBCDIR
)/port
/gen
/new_list.c