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) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
23 # 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 2011 Nexenta Systems, Inc. All rights reserved.
28 # Use is subject to license terms.
32 LIBCDIR
= $(SRC
)/lib
/libc
39 # objects are grouped by source directory
113 arc4random_uniform.o \
141 sync_instruction_memory.o
143 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
144 # This macro should ALWAYS be empty; native APIs are already 'large file'.
287 _lwp_mutex_unlock.o \
304 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
305 # This macro should ALWAYS be empty; native APIs are already 'large file'.
308 # objects from source under $(LIBCDIR)/port
345 ascii_strncasecmp.o \
607 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
608 # This macro should ALWAYS be empty; native APIs are already 'large file'.
858 pics
/unwind.o
:= COPTFLAG64
=
863 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
864 # This macro should ALWAYS be empty; native APIs are already 'large file'.
983 # NOTE: libc.so.1 must be linked with the minimal crti.o and crtn.o
984 # modules whose source is provided in the $(SRC)/lib/common directory.
985 # This must be done because otherwise the Sun C compiler would insert
986 # its own versions of these modules and those versions contain code
987 # to call out to C++ initialization functions. Such C++ initialization
988 # functions can call back into libc before thread initialization is
989 # complete and this leads to segmentation violations and other problems.
990 # Since libc contains no C++ code, linking with the minimal crti.o and
991 # crtn.o modules is safe and avoids the problems described above.
992 OBJECTS
= $(CRTI
) $(MOSTOBJS
) $(CRTN
)
993 CRTSRCS
= ..
/..
/common
/amd64
995 # include common library definitions
996 include ..
/..
/Makefile.lib
997 include ..
/..
/Makefile.lib
.64
999 CFLAGS64
+= $(CTF_FLAGS
)
1001 # This is necessary to avoid problems with calling _ex_unwind().
1002 # We probably don't want any inlining anyway.
1003 CFLAGS64
+= -xinline
=
1005 CERRWARN
+= -_gcc
=-Wno-parentheses
1006 CERRWARN
+= -_gcc
=-Wno-switch
1007 CERRWARN
+= -_gcc
=-Wno-uninitialized
1008 CERRWARN
+= -_gcc
=-Wno-unused-value
1009 CERRWARN
+= -_gcc
=-Wno-unused-label
1010 CERRWARN
+= -_gcc
=-Wno-unused-variable
1011 CERRWARN
+= -_gcc
=-Wno-type-limits
1012 CERRWARN
+= -_gcc
=-Wno-char-subscripts
1013 CERRWARN
+= -_gcc
=-Wno-clobbered
1014 CERRWARN
+= -_gcc
=-Wno-unused-function
1015 CERRWARN
+= -_gcc
=-Wno-address
1017 # Setting THREAD_DEBUG = -DTHREAD_DEBUG (make THREAD_DEBUG=-DTHREAD_DEBUG ...)
1018 # enables ASSERT() checking in the threads portion of the library.
1019 # This is automatically enabled for DEBUG builds, not for non-debug builds.
1021 $(NOT_RELEASE_BUILD
)THREAD_DEBUG
= -DTHREAD_DEBUG
1023 # Make string literals read-only to save memory
1024 CFLAGS64
+= $(XSTRCONST
)
1026 ALTPICS
= $(TRACEOBJS
:%=pics
/%)
1028 $(DYNLIB
) := BUILD.SO
= $(LD
) -o
$@
-G
$(DYNFLAGS
) $(PICS
) $(ALTPICS
) $(EXTPICS
)
1030 MAPFILES
= $(LIBCDIR
)/port
/mapfile-vers
1032 CPPFLAGS
= -D_REENTRANT
-D
$(MACH64
) -D__
$(MACH64
) $(THREAD_DEBUG
) \
1033 -I.
-I
$(LIBCBASE
)/inc
-I
$(LIBCDIR
)/inc
$(CPPFLAGS.master
)
1034 ASFLAGS
= $(AS_PICFLAGS
) -P
-D__STDC__
-D_ASM
$(CPPFLAGS
) \
1037 # As a favor to the dtrace syscall provider, libc still calls the
1038 # old syscall traps that have been obsoleted by the *at() interfaces.
1039 # Delete this to compile libc using only the new *at() system call traps
1040 CPPFLAGS
+= -D_RETAIN_OLD_SYSCALLS
1042 # proc64_id.o is built with defines in $(SRC)/uts/intel/sys/x86_archext.h
1043 pics
/proc64_id.o
:= CFLAGS64
+= -I
$(SRC
)/uts
/intel
1045 # Inform the run-time linker about libc specialized initialization
1046 RTLDINFO
= -z rtldinfo
=tls_rtldinfo
1047 DYNFLAGS
+= $(RTLDINFO
)
1049 # Force libc's internal references to be resolved immediately upon loading
1050 # in order to avoid critical region problems. Since almost all libc symbols
1051 # are marked 'protected' in the mapfiles, this is a minimal set (15 to 20).
1054 BUILD.s
= $(AS
) $(ASFLAGS
) $< -o
$@
1056 # Override this top level flag so the compiler builds in its native
1057 # C99 mode. This has been enabled to support the complex arithmetic
1059 C99MODE
= $(C99_ENABLE
)
1061 # libc method of building an archive
1062 # The "$(GREP) -v ' L '" part is necessary only until
1063 # lorder is fixed to ignore thread-local variables.
1064 BUILD.AR
= $(RM
) $@
; \
1065 $(AR
) q
$@
`$(LORDER) $(MOSTOBJS:%=$(DIR)/%) | $(GREP) -v ' L ' | $(TSORT)`
1067 # extra files for the clean target
1069 $(LIBCDIR
)/port
/gen
/errlst.c \
1070 $(LIBCDIR
)/port
/gen
/new_list.c \
1078 CLOBBERFILES
+= $(LIB_PIC
)
1080 # list of C source for lint
1082 $(ATOMICOBJS
:%.o
=$(SRC
)/common
/atomic
/%.c
) \
1083 $(XATTROBJS
:%.o
=$(SRC
)/common
/xattr
/%.c
) \
1084 $(COMOBJS
:%.o
=$(SRC
)/common
/util
/%.c
) \
1085 $(PORTFP
:%.o
=$(LIBCDIR
)/port
/fp
/%.c
) \
1086 $(PORTGEN
:%.o
=$(LIBCDIR
)/port
/gen
/%.c
) \
1087 $(PORTI18N
:%.o
=$(LIBCDIR
)/port
/i18n
/%.c
) \
1088 $(PORTLOCALE
:%.o
=$(LIBCDIR
)/port
/locale
/%.c
) \
1089 $(PORTPRINT
:%.o
=$(LIBCDIR
)/port
/print/%.c
) \
1090 $(PORTREGEX
:%.o
=$(LIBCDIR
)/port
/regex
/%.c
) \
1091 $(PORTSTDIO
:%.o
=$(LIBCDIR
)/port
/stdio
/%.c
) \
1092 $(PORTSYS
:%.o
=$(LIBCDIR
)/port
/sys
/%.c
) \
1093 $(AIOOBJS
:%.o
=$(LIBCDIR
)/port
/aio
/%.c
) \
1094 $(RTOBJS
:%.o
=$(LIBCDIR
)/port
/rt
/%.c
) \
1095 $(SECFLAGSOBJS
:%.o
=$(SRC
)/common
/secflags
/%.c
) \
1096 $(TPOOLOBJS
:%.o
=$(LIBCDIR
)/port
/tpool
/%.c
) \
1097 $(THREADSOBJS
:%.o
=$(LIBCDIR
)/port
/threads
/%.c
) \
1098 $(THREADSMACHOBJS
:%.o
=threads
/%.c
) \
1099 $(UNICODEOBJS
:%.o
=$(SRC
)/common
/unicode
/%.c
) \
1100 $(UNWINDMACHOBJS
:%.o
=unwind
/%.c
) \
1101 $(FPOBJS
:%.o
=fp
/%.c
) \
1102 $(I386FPOBJS
:%.o
=$(LIBCDIR
)/i386
/fp
/%.c
) \
1103 $(LIBCBASE
)/gen
/ecvt.c \
1104 $(LIBCBASE
)/gen
/makectxt.c \
1105 $(LIBCBASE
)/gen
/siginfolst.c \
1106 $(LIBCBASE
)/gen
/siglongjmp.c \
1107 $(LIBCBASE
)/gen
/sync_instruction_memory.c \
1108 $(LIBCBASE
)/sys
/uadmin.c
1110 # conditional assignments
1111 # $(DYNLIB) $(LIB_PIC) := DYNOBJS = _rtbootld.o
1112 $(DYNLIB
) := CRTI
= crti.o
1113 $(DYNLIB
) := CRTN
= crtn.o
1115 # Files which need the threads .il inline template
1148 thread_interface.o \
1155 $(TIL
:%=pics
/%) := CFLAGS64
+= $(LIBCBASE
)/threads
/amd64.il
1157 # pics/mul64.o := CFLAGS64 += crt/mul64.il
1159 # large-file-aware components that should be built large
1161 #$(COMSYSOBJS64:%=pics/%) := \
1162 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1164 #$(SYSOBJS64:%=pics/%) := \
1165 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1167 #$(PORTGEN64:%=pics/%) := \
1168 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1170 #$(PORTSTDIO64:%=pics/%) := \
1171 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1173 #$(PORTSYS64:%=pics/%) := \
1174 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1176 $(PORTSTDIO_W
:%=pics
/%) := \
1179 $(PORTPRINT_W
:%=pics
/%) := \
1182 $(PORTPRINT_C89
:%=pics
/%) := \
1183 CPPFLAGS
+= -D_C89_INTMAX32
1185 $(PORTSTDIO_C89
:%=pics
/%) := \
1186 CPPFLAGS
+= -D_C89_INTMAX32
1188 $(PORTI18N_COND
:%=pics
/%) := \
1189 CPPFLAGS
+= -D_WCS_LONGLONG
1191 pics
/arc4random.o
:= CPPFLAGS
+= -I
$(SRC
)/common
/crypto
/chacha
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
-erroff
=E_SUPPRESSION_DIRECTIVE_UNUSED
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
/amd64.il
1211 # pics/mul64.o: crt/mul64.il
1213 # include common libc targets
1214 include ..
/Makefile.targ
1216 # We need to strip out all CTF data from the static library
1217 $(LIB_PIC
) := DIR
= pics
1218 $(LIB_PIC
): pics
$$(PICS
)
1220 $(MCS
) -d
-n .SUNW_ctf
$@
> /dev
/null
2>&1
1221 $(AR
) -ts
$@
> /dev
/null
1225 _lwp_mutex_unlock.o \
1233 $(ASSYMDEP_OBJS
:%=pics
/%): assym.h
1235 # assym.h build rules
1237 GENASSYM_C
= genassym.c
1239 genassym
: $(GENASSYM_C
)
1240 $(NATIVECC
) $(NATIVE_CFLAGS
) -Iinc
-I
$(LIBCDIR
)/inc
$(CPPFLAGS.native
) \
1243 OFFSETS
= $(LIBCDIR
)/$(MACH
)/offsets.in
1245 assym.h
: $(OFFSETS
) genassym
1246 $(OFFSETS_CREATE
) <$(OFFSETS
) >$@
1249 # derived C source and related explicit dependencies
1250 $(LIBCDIR
)/port
/gen
/errlst.c
+ \
1251 $(LIBCDIR
)/port
/gen
/new_list.c
: $(LIBCDIR
)/port
/gen
/errlist
$(LIBCDIR
)/port
/gen
/errlist.awk
1252 cd
$(LIBCDIR
)/port
/gen
; pwd
; $(AWK
) -f errlist.awk
< errlist
1254 pics
/errlst.o
: $(LIBCDIR
)/port
/gen
/errlst.c
1256 pics
/new_list.o
: $(LIBCDIR
)/port
/gen
/new_list.c