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
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 \
148 sync_instruction_memory.o\
152 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
153 # This macro should ALWAYS be empty; native APIs are already 'large file'.
294 __clock_gettime_sys.o \
297 _lwp_mutex_unlock.o \
312 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
313 # This macro should ALWAYS be empty; native APIs are already 'large file'.
316 # objects from source under $(LIBCDIR)/port
353 ascii_strncasecmp.o \
614 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
615 # This macro should ALWAYS be empty; native APIs are already 'large file'.
728 PORTINET
= bindresvport.o bootparams_getbyname.o ether_addr.o \
729 getaddrinfo.o getnameinfo.o getnetent.o getnetent_r.o \
730 getprotoent.o getprotoent_r.o getservbyname_r.o getservent.o \
731 getservent_r.o inet_lnaof.o inet_mkaddr.o inet_network.o \
732 inet6_opt.o inet6_rthdr.o interface_id.o link_addr.o \
733 netmasks.o rcmd.o rexec.o ruserpass.o sourcefilter.o \
812 PORTNSL
= _conn_util.o _data2.o _errlst.o _utility.o algs.o auth_des.o \
813 auth_none.o auth_sys.o auth_time.o authdes_prot.o authsys_prot.o \
814 can_use_af.o checkver.o clnt_bcast.o clnt_dg.o clnt_door.o \
815 clnt_generic.o clnt_perror.o clnt_raw.o clnt_simple.o clnt_vc.o \
816 daemon_utils.o dbm.o des_crypt.o des_soft.o doconfig.o getauthattr.o \
817 getauuser.o getdname.o getexecattr.o gethostby_door.o \
818 gethostbyname_r.o gethostent.o gethostent6.o gethostent_r.o \
819 getipnodeby.o getipnodeby_door.o getprofattr.o getrpcent.o \
820 getrpcent_r.o getuserattr.o inet_matchaddr.o inet_ntoa.o inet_ntop.o \
821 inet_pton.o key_call.o key_prot.o mt_misc.o netdir.o netdir_inet.o \
822 netdir_inet_sundry.o netname.o netnamer.o netselect.o nis_misc.o \
823 nis_misc_proc.o nis_sec_mechs.o nis_subr.o nis_xdr.o parse.o \
824 pmap_clnt.o pmap_prot.o publickey.o rpc_callmsg.o rpc_comdata.o \
825 rpc_fdsync.o rpc_generic.o rpc_prot.o rpc_sel2poll.o \
826 rpc_soc.o rpc_td.o rpcb_clnt.o rpcb_prot.o rpcb_st_xdr.o rpcdname.o \
827 rpcsec_gss_if.o rtime_tli.o svc.o svc_auth.o svc_auth_loopb.o \
828 svc_auth_sys.o svc_dg.o svc_door.o svc_generic.o svc_raw.o svc_run.o \
829 svc_simple.o svc_vc.o svcauth_des.o svid_funcs.o t_accept.o \
830 t_alloc.o t_bind.o t_close.o t_connect.o t_error.o t_free.o \
831 t_getinfo.o t_getname.o t_getstate.o t_listen.o t_look.o t_open.o \
832 t_optmgmt.o t_rcv.o t_rcvconnect.o t_rcvdis.o t_rcvrel.o \
833 t_rcvreldata.o t_rcvudata.o t_rcvuderr.o t_rcvv.o t_rcvvudata.o \
834 t_snd.o t_snddis.o t_sndrel.o t_sndreldata.o t_sndudata.o t_sndv.o \
835 t_sndvudata.o t_strerror.o t_sync.o t_sysconf.o t_unbind.o \
836 thr_get_storage.o ti_opts.o tli_wrappers.o xdr.o xdr_array.o \
837 xdr_float.o xdr_mem.o xdr_rec.o xdr_refer.o xdr_sizeof.o xdr_stdio.o \
838 xti_wrappers.o yp_all.o yp_b_clnt.o yp_b_xdr.o yp_bind.o yp_enum.o \
839 yp_master.o yp_match.o yp_order.o yp_rsvd.o yp_update.o yp_xdr.o \
840 yperr_string.o yppasswd_xdr.o ypprot_err.o ypupd.o
903 pics
/unwind.o
:= COPTFLAG64
=
908 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
909 # This macro should ALWAYS be empty; native APIs are already 'large file'.
979 PORTSOCKET
= _soutil.o sockatmark.o socket.o socketpair.o weaks.o
1018 $(THREADSMACHOBJS
) \
1032 # NOTE: libc.so.1 must be linked with the minimal crti.o and crtn.o
1033 # modules whose source is provided in the $(SRC)/lib/crt directory.
1034 # This must be done because otherwise the Sun C compiler would insert
1035 # its own versions of these modules and those versions contain code
1036 # to call out to C++ initialization functions. Such C++ initialization
1037 # functions can call back into libc before thread initialization is
1038 # complete and this leads to segmentation violations and other problems.
1039 # Since libc contains no C++ code, linking with the minimal crti.o and
1040 # crtn.o modules is safe and avoids the problems described above.
1041 OBJECTS
= $(CRTI
) $(MOSTOBJS
) $(CRTN
)
1042 CRTSRCS
= ..
/..
/crt
/amd64
1044 # include common library definitions
1045 include ..
/..
/Makefile.lib
1046 include ..
/..
/Makefile.lib
.64
1048 CFLAGS64
+= $(CTF_FLAGS
)
1050 CERRWARN
+= -Wno-parentheses
1051 CERRWARN
+= -Wno-switch
1052 CERRWARN
+= -Wno-uninitialized
1053 CERRWARN
+= -Wno-unused-value
1054 CERRWARN
+= -Wno-unused-label
1055 CERRWARN
+= -Wno-unused-variable
1056 CERRWARN
+= -Wno-type-limits
1057 CERRWARN
+= -Wno-char-subscripts
1058 CERRWARN
+= -Wno-clobbered
1059 CERRWARN
+= -Wno-unused-function
1060 CERRWARN
+= -Wno-address
1062 # Setting THREAD_DEBUG = -DTHREAD_DEBUG (make THREAD_DEBUG=-DTHREAD_DEBUG ...)
1063 # enables ASSERT() checking in the threads portion of the library.
1064 # This is automatically enabled for DEBUG builds, not for non-debug builds.
1066 $(NOT_RELEASE_BUILD
)THREAD_DEBUG
= -DTHREAD_DEBUG
1068 ALTPICS
= $(TRACEOBJS
:%=pics
/%)
1070 # The use of sed is a gross hack needed because the current build system
1071 # assumed that the compiler accepted linker flags (-Bfoo -zfoo and -Mfoo)
1072 # directly. Here, since we're calling the linker directly, we have to
1073 # discard the prefixes. Ideally, we would be using the LD_Z* and LD_B*
1074 # variables instead, but that would require a lot of mucking with makefiles.
1075 # So for now, we do this.
1076 REMOVE_GCC_PREFIX
=echo
$(DYNFLAGS
) |
$(SED
) -e
's/-Wl,//g'
1077 $(DYNLIB
) := BUILD.SO
= $(LD
) -o
$@
-G
$(REMOVE_GCC_PREFIX
:sh
) $(PICS
) $(ALTPICS
) $(EXTPICS
)
1079 MAPFILES
= $(LIBCDIR
)/port
/mapfile-vers
1081 CPPFLAGS
= -D
$(MACH64
) -D__
$(MACH64
) $(THREAD_DEBUG
) \
1082 -I.
-I
$(LIBCBASE
)/inc
-I
$(LIBCDIR
)/inc
$(CPPFLAGS.master
)
1083 ASFLAGS
= $(AS_PICFLAGS
) -D_ASM
$(CPPFLAGS
) \
1086 # proc64_id.o is built with defines in $(CODEMGR_WS)/arch/x86/include/sys/x86_archext.h
1087 pics
/proc64_id.o
:= CFLAGS64
+= -I
$(CODEMGR_WS
)/arch
/x86
/include
1089 # Inform the run-time linker about libc specialized initialization
1090 RTLDINFO
= -z rtldinfo
=tls_rtldinfo
1091 DYNFLAGS
+= $(RTLDINFO
)
1093 # Force libc's internal references to be resolved immediately upon loading
1094 # in order to avoid critical region problems. Since almost all libc symbols
1095 # are marked 'protected' in the mapfiles, this is a minimal set (15 to 20).
1098 BUILD.s
= $(AS
) $(ASFLAGS
) $< -o
$@
1100 # Override this top level flag so the compiler builds in its native
1101 # C99 mode. This has been enabled to support the complex arithmetic
1103 C99MODE
= $(C99_ENABLE
)
1105 # libc method of building an archive
1106 # The "$(GREP) -v ' L '" part is necessary only until
1107 # lorder is fixed to ignore thread-local variables.
1108 BUILD.AR
= $(RM
) $@
; \
1109 $(AR
) qc
$@
`$(LORDER) $(MOSTOBJS:%=$(DIR)/%) | $(GREP) -v ' L ' | $(TSORT)`
1111 # extra files for the clean target
1113 $(LIBCDIR
)/port
/gen
/errlst.c \
1114 $(LIBCDIR
)/port
/gen
/new_list.c \
1122 CLOBBERFILES
+= $(LIB_PIC
)
1124 # list of C source formerly for lint
1126 $(ATOMICOBJS
:%.o
=$(SRC
)/common
/atomic
/%.c
) \
1127 $(XATTROBJS
:%.o
=$(SRC
)/common
/xattr
/%.c
) \
1128 $(COMOBJS
:%.o
=$(SRC
)/common
/util
/%.c
) \
1129 $(PORTFP
:%.o
=$(LIBCDIR
)/port
/fp
/%.c
) \
1130 $(PORTGEN
:%.o
=$(LIBCDIR
)/port
/gen
/%.c
) \
1131 $(PORTI18N
:%.o
=$(LIBCDIR
)/port
/i18n
/%.c
) \
1132 $(PORTLOCALE
:%.o
=$(LIBCDIR
)/port
/locale
/%.c
) \
1133 $(PORTPRINT
:%.o
=$(LIBCDIR
)/port
/print/%.c
) \
1134 $(PORTREGEX
:%.o
=$(LIBCDIR
)/port
/regex
/%.c
) \
1135 $(PORTSTDIO
:%.o
=$(LIBCDIR
)/port
/stdio
/%.c
) \
1136 $(PORTSYS
:%.o
=$(LIBCDIR
)/port
/sys
/%.c
) \
1137 $(AIOOBJS
:%.o
=$(LIBCDIR
)/port
/aio
/%.c
) \
1138 $(RTOBJS
:%.o
=$(LIBCDIR
)/port
/rt
/%.c
) \
1139 $(SECFLAGSOBJS
:%.o
=$(SRC
)/common
/secflags
/%.c
) \
1140 $(TPOOLOBJS
:%.o
=$(LIBCDIR
)/port
/tpool
/%.c
) \
1141 $(THREADSOBJS
:%.o
=$(LIBCDIR
)/port
/threads
/%.c
) \
1142 $(THREADSMACHOBJS
:%.o
=threads
/%.c
) \
1143 $(UNICODEOBJS
:%.o
=$(SRC
)/common
/unicode
/%.c
) \
1144 $(UNWINDMACHOBJS
:%.o
=unwind
/%.c
) \
1145 $(FPOBJS
:%.o
=fp
/%.c
) \
1146 $(I386FPOBJS
:%.o
=$(LIBCDIR
)/i386
/fp
/%.c
) \
1147 $(LIBCBASE
)/gen
/ecvt.c \
1148 $(LIBCBASE
)/gen
/makectxt.c \
1149 $(LIBCBASE
)/gen
/siginfolst.c \
1150 $(LIBCBASE
)/gen
/siglongjmp.c \
1151 $(LIBCBASE
)/gen
/sync_instruction_memory.c \
1152 $(LIBCBASE
)/sys
/uadmin.c
1154 # conditional assignments
1155 # $(DYNLIB) $(LIB_PIC) := DYNOBJS = _rtbootld.o
1156 $(DYNLIB
) := CRTI
= crti.o
1157 $(DYNLIB
) := CRTN
= crtn.o
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
1193 pics
/__clock_gettime.o
:= CPPFLAGS
+= $(COMMPAGE_CPPFLAGS
)
1197 all: $(LIBS
) $(LIB_PIC
)
1199 # include common libc targets
1200 include ..
/Makefile.targ
1202 # We need to strip out all CTF data from the static library
1203 $(LIB_PIC
) := DIR
= pics
1204 $(LIB_PIC
): pics
$$(PICS
)
1206 $(MCS
) -d
-n .SUNW_ctf
$@
> /dev
/null
2>&1
1207 $(AR
) -ts
$@
> /dev
/null
1211 _lwp_mutex_unlock.o \
1219 $(ASSYMDEP_OBJS
:%=pics
/%): assym.h
1221 # assym.h build rules
1223 GENASSYM_C
= genassym.c
1225 genassym
: $(GENASSYM_C
)
1226 $(NATIVECC
) $(NATIVE_CFLAGS
) -Iinc
-I
$(LIBCDIR
)/inc
$(CPPFLAGS.native
) \
1229 OFFSETS
= $(LIBCDIR
)/$(MACH
)/offsets.in
1231 assym.h
: $(OFFSETS
) genassym
1232 $(OFFSETS_CREATE
) <$(OFFSETS
) >$@
1235 # derived C source and related explicit dependencies
1236 $(LIBCDIR
)/port
/gen
/errlst.c
+ \
1237 $(LIBCDIR
)/port
/gen
/new_list.c
: $(LIBCDIR
)/port
/gen
/errlist
$(LIBCDIR
)/port
/gen
/errlist.awk
1238 cd
$(LIBCDIR
)/port
/gen
; pwd
; $(AWK
) -f errlist.awk
< errlist
1240 pics
/errlst.o
: $(LIBCDIR
)/port
/gen
/errlst.c
1242 pics
/new_list.o
: $(LIBCDIR
)/port
/gen
/new_list.c