1#
2# CDDL HEADER START
3#
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.
7#
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.
12#
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]
18#
19# CDDL HEADER END
20#
21
22#
23# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
24# Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
25# Copyright 2013 Garrett D'Amore <garrett@damore.org>
26# Copyright 2018 Nexenta Systems, Inc.
27# Copyright 2019 Joyent, Inc.
28# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
29#
30
31LIBCBASE=	.
32LIBCDIR=	$(SRC)/lib/libc
33LIBRARY=	libc.a
34LIB_PIC=	libc_pic.a
35VERS=		.1
36CPP=		/usr/lib/cpp
37TARGET_ARCH=	amd64
38
39# include comm page definitions
40include $(SRC)/lib/commpage/Makefile.shared.com
41include $(SRC)/lib/commpage/Makefile.shared.targ
42
43# objects are grouped by source directory
44
45# local objects
46STRETS=
47
48CRTOBJS=			\
49	cerror.o
50
51DYNOBJS=
52
53FPOBJS=				\
54	fpgetmask.o		\
55	fpgetround.o		\
56	fpsetmask.o		\
57	fpsetround.o		\
58	fpstart.o		\
59	ieee.o
60
61I386FPOBJS=			\
62	_D_cplx_div.o		\
63	_D_cplx_div_ix.o	\
64	_D_cplx_div_rx.o	\
65	_D_cplx_lr_div.o	\
66	_D_cplx_lr_div_ix.o	\
67	_D_cplx_lr_div_rx.o	\
68	_D_cplx_mul.o		\
69	_F_cplx_div.o		\
70	_F_cplx_div_ix.o	\
71	_F_cplx_div_rx.o	\
72	_F_cplx_lr_div.o	\
73	_F_cplx_lr_div_ix.o	\
74	_F_cplx_lr_div_rx.o	\
75	_F_cplx_mul.o		\
76	_X_cplx_div.o		\
77	_X_cplx_div_ix.o	\
78	_X_cplx_div_rx.o	\
79	_X_cplx_lr_div.o	\
80	_X_cplx_lr_div_ix.o	\
81	_X_cplx_lr_div_rx.o	\
82	_X_cplx_mul.o
83
84FPASMOBJS=			\
85	__xgetRD.o		\
86	_xtoll.o		\
87	_xtoull.o		\
88	_base_il.o		\
89	fpcw.o			\
90	fpgetsticky.o		\
91	fpsetsticky.o
92
93ATOMICOBJS=			\
94	atomic.o
95
96CHACHAOBJS=			\
97	chacha.o
98
99XATTROBJS=			\
100	xattr_common.o
101COMOBJS=			\
102	bcmp.o			\
103	bcopy.o			\
104	bsearch.o		\
105	bzero.o			\
106	explicit_bzero.o	\
107	memmem.o		\
108	qsort.o			\
109	strtol.o		\
110	strtoul.o		\
111	strtoll.o		\
112	strtoull.o
113
114GENOBJS=			\
115	$(COMMPAGE_OBJS)	\
116	_getsp.o		\
117	abs.o			\
118	alloca.o		\
119	arc4random.o		\
120	arc4random_uniform.o	\
121	attrat.o		\
122	byteorder.o		\
123	cuexit.o		\
124	ecvt.o			\
125	endian.o		\
126	errlst.o		\
127	amd64_data.o		\
128	ldivide.o		\
129	lock.o			\
130	makectxt.o		\
131	memccpy.o		\
132	memchr.o		\
133	memcmp.o		\
134	memcpy.o		\
135	memset.o		\
136	new_list.o		\
137	proc64_id.o		\
138	proc64_support.o	\
139	setjmp.o		\
140	siginfolst.o		\
141	siglongjmp.o		\
142	strcmp.o		\
143	strcpy.o		\
144	strlen.o		\
145	strncmp.o		\
146	strncpy.o		\
147	strnlen.o		\
148	sync_instruction_memory.o
149
150# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
151# This macro should ALWAYS be empty; native APIs are already 'large file'.
152COMSYSOBJS64=
153
154SYSOBJS64=
155
156COMSYSOBJS=			\
157	__clock_timer.o		\
158	__getloadavg.o		\
159	__rusagesys.o		\
160	__signotify.o		\
161	__sigrt.o		\
162	__time.o		\
163	_lgrp_home_fast.o	\
164	_lgrpsys.o		\
165	_nfssys.o		\
166	_portfs.o		\
167	_pset.o			\
168	_rpcsys.o		\
169	_sigaction.o		\
170	_so_accept.o		\
171	_so_bind.o		\
172	_so_connect.o		\
173	_so_getpeername.o	\
174	_so_getsockname.o	\
175	_so_getsockopt.o	\
176	_so_listen.o		\
177	_so_recv.o		\
178	_so_recvfrom.o		\
179	_so_recvmsg.o		\
180	_so_send.o		\
181	_so_sendmsg.o		\
182	_so_sendto.o		\
183	_so_setsockopt.o	\
184	_so_shutdown.o		\
185	_so_socket.o		\
186	_so_socketpair.o	\
187	_sockconfig.o		\
188	acct.o			\
189	acl.o			\
190	adjtime.o		\
191	alarm.o			\
192	brk.o			\
193	chdir.o			\
194	chroot.o		\
195	cladm.o			\
196	close.o			\
197	execve.o		\
198	exit.o			\
199	facl.o			\
200	fchdir.o		\
201	fchroot.o		\
202	fdsync.o		\
203	fpathconf.o		\
204	fstatfs.o		\
205	fstatvfs.o		\
206	getcpuid.o		\
207	getdents.o		\
208	getegid.o		\
209	geteuid.o		\
210	getgid.o		\
211	getgroups.o		\
212	gethrtime.o		\
213	getitimer.o		\
214	getmsg.o		\
215	getpid.o		\
216	getpmsg.o		\
217	getppid.o		\
218	getrandom.o		\
219	getrlimit.o		\
220	getuid.o		\
221	gtty.o			\
222	install_utrap.o		\
223	ioctl.o			\
224	kaio.o			\
225	kill.o			\
226	llseek.o		\
227	lseek.o			\
228	mmapobjsys.o		\
229	memcntl.o		\
230	mincore.o		\
231	mmap.o			\
232	modctl.o		\
233	mount.o			\
234	mprotect.o		\
235	munmap.o		\
236	nice.o			\
237	ntp_adjtime.o		\
238	ntp_gettime.o		\
239	p_online.o		\
240	pathconf.o		\
241	pause.o			\
242	pcsample.o		\
243	pipe2.o			\
244	pollsys.o		\
245	pread.o			\
246	preadv.o		\
247	priocntlset.o		\
248	processor_bind.o	\
249	processor_info.o	\
250	profil.o		\
251	psecflagsset.o		\
252	putmsg.o		\
253	putpmsg.o		\
254	pwrite.o		\
255	pwritev.o		\
256	read.o			\
257	readv.o			\
258	resolvepath.o		\
259	seteguid.o		\
260	setgid.o		\
261	setgroups.o		\
262	setitimer.o		\
263	setreid.o		\
264	setrlimit.o		\
265	setuid.o		\
266	sigaltstk.o		\
267	sigprocmsk.o		\
268	sigsendset.o		\
269	sigsuspend.o		\
270	statfs.o		\
271	statvfs.o		\
272	stty.o			\
273	sync.o			\
274	sysconfig.o		\
275	sysfs.o			\
276	sysinfo.o		\
277	syslwp.o		\
278	times.o			\
279	ulimit.o		\
280	umask.o			\
281	umount2.o		\
282	utssys.o		\
283	uucopy.o		\
284	vhangup.o		\
285	waitid.o		\
286	write.o			\
287	writev.o		\
288	yield.o
289
290SYSOBJS=			\
291	__clock_gettime.o	\
292	__clock_gettime_sys.o	\
293	__getcontext.o		\
294	__uadmin.o		\
295	_lwp_mutex_unlock.o	\
296	_stack_grow.o		\
297	door.o			\
298	forkx.o			\
299	forkallx.o		\
300	getcontext.o		\
301	gettimeofday.o		\
302	lwp_private.o		\
303	nuname.o		\
304	syscall.o		\
305	sysi86.o		\
306	tls_get_addr.o		\
307	uadmin.o		\
308	umount.o		\
309	uname.o			\
310	vforkx.o
311
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'.
314PORTGEN64=
315
316# objects from source under $(LIBCDIR)/port
317PORTFP=				\
318	__flt_decim.o		\
319	__flt_rounds.o		\
320	__tbl_10_b.o		\
321	__tbl_10_h.o		\
322	__tbl_10_s.o		\
323	__tbl_2_b.o		\
324	__tbl_2_h.o		\
325	__tbl_2_s.o		\
326	__tbl_fdq.o		\
327	__tbl_tens.o		\
328	__x_power.o		\
329	_base_sup.o		\
330	aconvert.o		\
331	decimal_bin.o		\
332	double_decim.o		\
333	econvert.o		\
334	fconvert.o		\
335	file_decim.o		\
336	finite.o		\
337	fp_data.o		\
338	func_decim.o		\
339	gconvert.o		\
340	hex_bin.o		\
341	ieee_globals.o		\
342	pack_float.o		\
343	sigfpe.o		\
344	string_decim.o
345
346PORTGEN=			\
347	_env_data.o		\
348	_xftw.o			\
349	a64l.o			\
350	abort.o			\
351	addsev.o		\
352	ascii_strcasecmp.o	\
353	ascii_strncasecmp.o	\
354	assert.o		\
355	atexit.o		\
356	atfork.o		\
357	atof.o			\
358	atoi.o			\
359	atol.o			\
360	atoll.o			\
361	attropen.o		\
362	basename.o		\
363	calloc.o		\
364	catgets.o		\
365	catopen.o		\
366	cfgetispeed.o		\
367	cfgetospeed.o		\
368	cfree.o			\
369	cfsetispeed.o		\
370	cfsetospeed.o		\
371	cftime.o		\
372	clock.o			\
373	closedir.o		\
374	closefrom.o		\
375	confstr.o		\
376	crypt.o			\
377	csetlen.o		\
378	ctime.o			\
379	ctime_r.o		\
380	daemon.o		\
381	deflt.o			\
382	directio.o		\
383	dirname.o		\
384	div.o			\
385	drand48.o		\
386	dup.o			\
387	env_data.o		\
388	err.o			\
389	errno.o			\
390	euclen.o		\
391	event_port.o		\
392	execvp.o		\
393	fattach.o		\
394	fdetach.o		\
395	fdopendir.o		\
396	ffs.o			\
397	flock.o			\
398	fls.o			\
399	fmtmsg.o		\
400	freezero.o		\
401	ftime.o			\
402	ftok.o			\
403	fts.o			\
404	ftw.o			\
405	gcvt.o			\
406	get_nprocs.o		\
407	getauxv.o		\
408	getcwd.o		\
409	getdate_err.o		\
410	getdtblsize.o		\
411	getentropy.o		\
412	getenv.o		\
413	getexecname.o		\
414	getgrnam.o		\
415	getgrnam_r.o		\
416	gethostid.o		\
417	gethostname.o		\
418	gethz.o			\
419	getisax.o		\
420	getloadavg.o		\
421	getlogin.o		\
422	getmntent.o		\
423	getnetgrent.o		\
424	getopt.o		\
425	getopt_long.o		\
426	getpagesize.o		\
427	getpw.o			\
428	getpwnam.o		\
429	getpwnam_r.o		\
430	getrusage.o		\
431	getspent.o		\
432	getspent_r.o		\
433	getsubopt.o		\
434	gettxt.o		\
435	getusershell.o		\
436	getut.o			\
437	getutx.o		\
438	getvfsent.o		\
439	getwd.o			\
440	getwidth.o		\
441	getxby_door.o		\
442	gtxt.o			\
443	hsearch.o		\
444	iconv.o			\
445	imaxabs.o		\
446	imaxdiv.o		\
447	index.o			\
448	initgroups.o		\
449	insque.o		\
450	isaexec.o		\
451	isastream.o		\
452	isatty.o		\
453	killpg.o		\
454	klpdlib.o		\
455	l64a.o			\
456	lckpwdf.o		\
457	lconstants.o		\
458	lexp10.o		\
459	lfind.o			\
460	lfmt.o			\
461	lfmt_log.o		\
462	lldiv.o			\
463	llog10.o		\
464	lltostr.o		\
465	lmath.o			\
466	localtime.o		\
467	lsearch.o		\
468	madvise.o		\
469	malloc.o		\
470	memalign.o		\
471	memset_s.o		\
472	mkdev.o			\
473	mkdtemp.o		\
474	mkfifo.o		\
475	mkstemp.o		\
476	mktemp.o		\
477	mlock.o			\
478	mlockall.o		\
479	mon.o			\
480	msync.o			\
481	munlock.o		\
482	munlockall.o		\
483	ndbm.o			\
484	nftw.o			\
485	nlspath_checks.o	\
486	nsparse.o		\
487	nss_common.o		\
488	nss_dbdefs.o		\
489	nss_deffinder.o		\
490	opendir.o		\
491	opt_data.o		\
492	perror.o		\
493	pfmt.o			\
494	pfmt_data.o		\
495	pfmt_print.o		\
496	pipe.o			\
497	plock.o			\
498	poll.o			\
499	posix_fadvise.o		\
500	posix_fallocate.o	\
501	posix_madvise.o		\
502	posix_memalign.o	\
503	priocntl.o		\
504	priv_str_xlate.o	\
505	privlib.o		\
506	psecflags.o		\
507	psiginfo.o		\
508	psignal.o		\
509	pt.o			\
510	putpwent.o		\
511	putspent.o		\
512	raise.o			\
513	rand.o			\
514	random.o		\
515	rctlops.o		\
516	readdir.o		\
517	readdir_r.o		\
518	reallocarray.o		\
519	reallocf.o		\
520	recallocarray.o		\
521	realpath.o		\
522	reboot.o		\
523	regexpr.o		\
524	remove.o		\
525	rewinddir.o		\
526	rindex.o		\
527	scandir.o		\
528	seekdir.o		\
529	select.o		\
530	set_constraint_handler_s.o \
531	setlabel.o		\
532	setpriority.o		\
533	settimeofday.o		\
534	sh_locks.o		\
535	sigflag.o		\
536	siglist.o		\
537	sigsend.o		\
538	sigsetops.o		\
539	ssignal.o		\
540	stack.o			\
541	stpcpy.o		\
542	stpncpy.o		\
543	str2sig.o		\
544	strcase_charmap.o	\
545	strcat.o		\
546	strchr.o		\
547	strchrnul.o		\
548	strcspn.o		\
549	strdup.o		\
550	strerror.o		\
551	strlcat.o		\
552	strlcpy.o		\
553	strncat.o		\
554	strndup.o		\
555	strpbrk.o		\
556	strrchr.o		\
557	strsep.o		\
558	strsignal.o		\
559	strspn.o		\
560	strstr.o		\
561	strtod.o		\
562	strtoimax.o		\
563	strtok.o		\
564	strtok_r.o		\
565	strtonum.o		\
566	strtoumax.o		\
567	swab.o			\
568	swapctl.o		\
569	sysconf.o		\
570	syslog.o		\
571	tcdrain.o		\
572	tcflow.o		\
573	tcflush.o		\
574	tcgetattr.o		\
575	tcgetpgrp.o		\
576	tcgetsid.o		\
577	tcsendbreak.o		\
578	tcsetattr.o		\
579	tcsetpgrp.o		\
580	tell.o			\
581	telldir.o		\
582	tfind.o			\
583	time_data.o		\
584	time_gdata.o		\
585	timespec_get.o		\
586	tls_data.o		\
587	truncate.o		\
588	tsdalloc.o		\
589	tsearch.o		\
590	ttyname.o		\
591	ttyslot.o		\
592	ualarm.o		\
593	ucred.o			\
594	valloc.o		\
595	vlfmt.o			\
596	vpfmt.o			\
597	waitpid.o		\
598	walkstack.o		\
599	wdata.o			\
600	xgetwidth.o		\
601	xpg4.o			\
602	xpg6.o
603
604PORTINET=			\
605	inet_lnaof.o		\
606	inet_makeaddr.o		\
607	inet_network.o		\
608	inet_ntoa.o		\
609	inet_ntop.o		\
610	inet_pton.o
611
612PORTPRINT_W=			\
613	doprnt_w.o
614
615PORTPRINT=			\
616	asprintf.o		\
617	doprnt.o		\
618	fprintf.o		\
619	printf.o		\
620	snprintf.o		\
621	sprintf.o		\
622	vfprintf.o		\
623	vprintf.o		\
624	vsnprintf.o		\
625	vsprintf.o		\
626	vwprintf.o		\
627	wprintf.o
628
629# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
630# This macro should ALWAYS be empty; native APIs are already 'large file'.
631PORTSTDIO64=
632
633PORTSTDIO_W=			\
634	doscan_w.o
635
636PORTSTDIO=			\
637	__extensions.o		\
638	_endopen.o		\
639	_filbuf.o		\
640	_findbuf.o		\
641	_flsbuf.o		\
642	_stdio_flags.o		\
643	_wrtchk.o		\
644	clearerr.o		\
645	ctermid.o		\
646	ctermid_r.o		\
647	cuserid.o		\
648	data.o			\
649	doscan.o		\
650	fdopen.o		\
651	feof.o			\
652	ferror.o		\
653	fgetc.o			\
654	fgets.o			\
655	fileno.o		\
656	flockf.o		\
657	flush.o			\
658	fmemopen.o		\
659	fopen.o			\
660	fpos.o			\
661	fputc.o			\
662	fputs.o			\
663	fread.o			\
664	fseek.o			\
665	fseeko.o		\
666	ftell.o			\
667	ftello.o		\
668	fwrite.o		\
669	getc.o			\
670	getchar.o		\
671	getline.o		\
672	getpass.o		\
673	gets.o			\
674	getw.o			\
675	mse.o			\
676	open_memstream.o	\
677	open_wmemstream.o	\
678	popen.o			\
679	putc.o			\
680	putchar.o		\
681	puts.o			\
682	putw.o			\
683	rewind.o		\
684	scanf.o			\
685	setbuf.o		\
686	setbuffer.o		\
687	setvbuf.o		\
688	system.o		\
689	tempnam.o		\
690	tmpfile.o		\
691	tmpnam_r.o		\
692	ungetc.o		\
693	vscanf.o		\
694	vwscanf.o		\
695	wscanf.o
696
697PORTI18N=			\
698	getwchar.o		\
699	putwchar.o		\
700	putws.o			\
701	strtows.o		\
702	wcsnlen.o		\
703	wcsstr.o		\
704	wcstoimax.o		\
705	wcstol.o		\
706	wcstoul.o		\
707	wcswcs.o		\
708	wmemchr.o		\
709	wmemcmp.o		\
710	wmemcpy.o		\
711	wmemmove.o		\
712	wmemset.o		\
713	wscat.o			\
714	wschr.o			\
715	wscmp.o			\
716	wscpy.o			\
717	wscspn.o		\
718	wsdup.o			\
719	wslen.o			\
720	wsncat.o		\
721	wsncmp.o		\
722	wsncpy.o		\
723	wspbrk.o		\
724	wsprintf.o		\
725	wsrchr.o		\
726	wsscanf.o		\
727	wsspn.o			\
728	wstod.o			\
729	wstok.o			\
730	wstol.o			\
731	wstoll.o		\
732	wsxfrm.o		\
733	gettext.o		\
734	gettext_gnu.o		\
735	gettext_real.o		\
736	gettext_util.o		\
737	plural_parser.o		\
738	wdresolve.o		\
739	_ctype.o		\
740	isascii.o		\
741	toascii.o
742
743PORTI18N_COND=			\
744	wcstol_longlong.o	\
745	wcstoul_longlong.o
746
747PORTLOCALE=			\
748	big5.o			\
749	btowc.o			\
750	c16rtomb.o		\
751	c32rtomb.o		\
752	collate.o		\
753	collcmp.o		\
754	euc.o			\
755	fnmatch.o		\
756	fgetwc.o		\
757	fgetws.o		\
758	fix_grouping.o		\
759	fputwc.o		\
760	fputws.o		\
761	fwide.o			\
762	gb18030.o		\
763	gb2312.o		\
764	gbk.o			\
765	getdate.o		\
766	isdigit.o		\
767	iswctype.o		\
768	ldpart.o		\
769	lmessages.o		\
770	lnumeric.o		\
771	lmonetary.o		\
772	localeconv.o		\
773	localeimpl.o		\
774	mbftowc.o		\
775	mblen.o			\
776	mbrlen.o		\
777	mbrtoc16.o		\
778	mbrtoc32.o		\
779	mbrtowc.o		\
780	mbsinit.o		\
781	mbsnrtowcs.o		\
782	mbsrtowcs.o		\
783	mbstowcs.o		\
784	mbtowc.o		\
785	mskanji.o		\
786	nextwctype.o		\
787	nl_langinfo.o		\
788	none.o			\
789	rune.o			\
790	runetype.o		\
791	setlocale.o		\
792	setrunelocale.o		\
793	strcasecmp.o		\
794	strcasestr.o		\
795	strcoll.o		\
796	strfmon.o		\
797	strftime.o		\
798	strncasecmp.o		\
799	strptime.o		\
800	strxfrm.o		\
801	table.o			\
802	timelocal.o		\
803	tolower.o		\
804	towlower.o		\
805	ungetwc.o		\
806	utf8.o			\
807	wcrtomb.o		\
808	wcscasecmp.o		\
809	wcscoll.o		\
810	wcsftime.o		\
811	wcsnrtombs.o		\
812	wcsrtombs.o		\
813	wcswidth.o		\
814	wcstombs.o		\
815	wcsxfrm.o		\
816	wctob.o			\
817	wctomb.o		\
818	wctrans.o		\
819	wctype.o		\
820	wcwidth.o		\
821	wscol.o
822
823AIOOBJS=			\
824	aio.o			\
825	aio_alloc.o		\
826	posix_aio.o
827
828RTOBJS=				\
829	clock_timer.o		\
830	mqueue.o		\
831	pos4obj.o		\
832	sched.o			\
833	sem.o			\
834	shm.o			\
835	sigev_thread.o
836
837SECFLAGSOBJS=			\
838	secflags.o
839
840TPOOLOBJS=			\
841	thread_pool.o
842
843THREADSOBJS=			\
844	alloc.o			\
845	assfail.o		\
846	c11_thr.o		\
847	cancel.o		\
848	door_calls.o		\
849	tmem.o			\
850	pthr_attr.o		\
851	pthr_barrier.o		\
852	pthr_cond.o		\
853	pthr_mutex.o		\
854	pthr_rwlock.o		\
855	pthread.o		\
856	rwlock.o		\
857	scalls.o		\
858	sema.o			\
859	sigaction.o		\
860	spawn.o			\
861	synch.o			\
862	tdb_agent.o		\
863	thr.o			\
864	thread_interface.o	\
865	tls.o			\
866	tsd.o
867
868THREADSMACHOBJS=		\
869	machdep.o
870
871THREADSASMOBJS=			\
872	asm_subr.o
873
874UNICODEOBJS=			\
875	u8_textprep.o		\
876	uconv.o
877
878UNWINDMACHOBJS=			\
879	call_frame_inst.o	\
880	eh_frame.o		\
881	thrp_unwind.o		\
882	unwind.o
883
884pics/unwind.o:= COPTFLAG64 =
885
886UNWINDASMOBJS=			\
887	unwind_frame.o
888
889# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
890# This macro should ALWAYS be empty; native APIs are already 'large file'.
891PORTSYS64=
892
893PORTSYS=			\
894	_autofssys.o		\
895	access.o		\
896	acctctl.o		\
897	bsd_signal.o		\
898	chmod.o			\
899	chown.o			\
900	corectl.o		\
901	epoll.o			\
902	exacctsys.o		\
903	execl.o			\
904	execle.o		\
905	execv.o			\
906	eventfd.o		\
907	fcntl.o			\
908	getpagesizes.o		\
909	getpeerucred.o		\
910	inst_sync.o		\
911	issetugid.o		\
912	label.o			\
913	link.o			\
914	lockf.o			\
915	lwp.o			\
916	lwp_cond.o		\
917	lwp_rwlock.o		\
918	lwp_sigmask.o		\
919	meminfosys.o		\
920	mkdir.o			\
921	mknod.o			\
922	msgsys.o		\
923	nfssys.o		\
924	open.o			\
925	pgrpsys.o		\
926	posix_sigwait.o		\
927	ppriv.o			\
928	psetsys.o		\
929	rctlsys.o		\
930	readlink.o		\
931	rename.o		\
932	sbrk.o			\
933	semsys.o		\
934	set_errno.o		\
935	sharefs.o		\
936	shmsys.o		\
937	sidsys.o		\
938	siginterrupt.o		\
939	signal.o		\
940	signalfd.o		\
941	sigpending.o		\
942	sigstack.o		\
943	stat.o			\
944	symlink.o		\
945	tasksys.o		\
946	time.o			\
947	time_util.o		\
948	timerfd.o		\
949	ucontext.o		\
950	unlink.o		\
951	ustat.o			\
952	utimesys.o		\
953	zone.o
954
955PORTREGEX=			\
956	glob.o			\
957	regcmp.o		\
958	regcomp.o		\
959	regerror.o		\
960	regex.o			\
961	regexec.o		\
962	regfree.o		\
963	wordexp.o
964
965VALUES=				\
966	values-Xa.o
967
968MOSTOBJS=			\
969	$(STRETS)		\
970	$(CRTOBJS)		\
971	$(DYNOBJS)		\
972	$(FPOBJS)		\
973	$(I386FPOBJS)		\
974	$(FPASMOBJS)		\
975	$(ATOMICOBJS)		\
976	$(CHACHAOBJS)		\
977	$(XATTROBJS)		\
978	$(COMOBJS)		\
979	$(GENOBJS)		\
980	$(PORTFP)		\
981	$(PORTGEN)		\
982	$(PORTGEN64)		\
983	$(PORTI18N)		\
984	$(PORTI18N_COND)	\
985	$(PORTINET)		\
986	$(PORTLOCALE)		\
987	$(PORTPRINT)		\
988	$(PORTPRINT_W)		\
989	$(PORTREGEX)		\
990	$(PORTSTDIO)		\
991	$(PORTSTDIO64)		\
992	$(PORTSTDIO_W)		\
993	$(PORTSYS)		\
994	$(PORTSYS64)		\
995	$(AIOOBJS)		\
996	$(RTOBJS)		\
997	$(SECFLAGSOBJS)		\
998	$(TPOOLOBJS)		\
999	$(THREADSOBJS)		\
1000	$(THREADSMACHOBJS)	\
1001	$(THREADSASMOBJS)	\
1002	$(UNICODEOBJS)		\
1003	$(UNWINDMACHOBJS)	\
1004	$(UNWINDASMOBJS)	\
1005	$(COMSYSOBJS)		\
1006	$(SYSOBJS)		\
1007	$(COMSYSOBJS64)		\
1008	$(SYSOBJS64)		\
1009	$(VALUES)
1010
1011TRACEOBJS=			\
1012	plockstat.o
1013
1014# NOTE:	libc.so.1 must be linked with the minimal crti.o and crtn.o
1015# modules whose source is provided in the $(SRC)/lib/crt directory.
1016# This must be done because otherwise the Sun C compiler would insert
1017# its own versions of these modules and those versions contain code
1018# to call out to C++ initialization functions.  Such C++ initialization
1019# functions can call back into libc before thread initialization is
1020# complete and this leads to segmentation violations and other problems.
1021# Since libc contains no C++ code, linking with the minimal crti.o and
1022# crtn.o modules is safe and avoids the problems described above.
1023OBJECTS= $(CRTI) $(MOSTOBJS) $(CRTN)
1024CRTSRCS= ../../crt/amd64
1025
1026# include common library definitions
1027include ../../Makefile.lib
1028include ../../Makefile.lib.64
1029
1030CFLAGS64 += $(CTF_FLAGS)
1031
1032# This is necessary to avoid problems with calling _ex_unwind().
1033# We probably don't want any inlining anyway.
1034CFLAGS64 += -xinline=
1035
1036CERRWARN += -_gcc=-Wno-parentheses
1037CERRWARN += -_gcc=-Wno-switch
1038CERRWARN += $(CNOWARN_UNINIT)
1039CERRWARN += -_gcc=-Wno-unused-value
1040CERRWARN += -_gcc=-Wno-unused-label
1041CERRWARN += -_gcc=-Wno-unused-variable
1042CERRWARN += -_gcc=-Wno-type-limits
1043CERRWARN += -_gcc=-Wno-char-subscripts
1044CERRWARN += -_gcc=-Wno-clobbered
1045CERRWARN += -_gcc=-Wno-unused-function
1046CERRWARN += -_gcc=-Wno-address
1047
1048$(RELEASE_BUILD)CERRWARN += -_gcc=-Wno-unused
1049
1050# not linted
1051SMATCH=off
1052
1053# Setting THREAD_DEBUG = -DTHREAD_DEBUG (make THREAD_DEBUG=-DTHREAD_DEBUG ...)
1054# enables ASSERT() checking in the threads portion of the library.
1055# This is automatically enabled for DEBUG builds, not for non-debug builds.
1056THREAD_DEBUG =
1057$(NOT_RELEASE_BUILD)THREAD_DEBUG = -DTHREAD_DEBUG
1058
1059# Make string literals read-only to save memory
1060CFLAGS64 += $(XSTRCONST)
1061
1062ALTPICS= $(TRACEOBJS:%=pics/%)
1063
1064$(DYNLIB) := BUILD.SO = $(LD) -o $@ -G $(DYNFLAGS) $(PICS) $(ALTPICS) $(EXTPICS)
1065
1066MAPFILES =	$(LIBCDIR)/port/mapfile-vers
1067
1068CPPFLAGS=	-D_REENTRANT -D$(MACH64) -D__$(MACH64) $(THREAD_DEBUG) \
1069		-I. -I$(LIBCBASE)/inc -I$(LIBCDIR)/inc $(CPPFLAGS.master)
1070ASFLAGS=	$(AS_PICFLAGS) -P -D__STDC__ -D_ASM $(CPPFLAGS) \
1071		$(amd64_AS_XARCH)
1072
1073# As a favor to the dtrace syscall provider, libc still calls the
1074# old syscall traps that have been obsoleted by the *at() interfaces.
1075# Delete this to compile libc using only the new *at() system call traps
1076CPPFLAGS += -D_RETAIN_OLD_SYSCALLS
1077
1078# proc64_id.o is built with defines in $(SRC)/uts/intel/sys/x86_archext.h
1079pics/proc64_id.o	:= CFLAGS64 += -I$(SRC)/uts/intel
1080
1081# Inform the run-time linker about libc specialized initialization
1082RTLDINFO =	-z rtldinfo=tls_rtldinfo
1083DYNFLAGS +=	$(RTLDINFO)
1084
1085# Force libc's internal references to be resolved immediately upon loading
1086# in order to avoid critical region problems.  Since almost all libc symbols
1087# are marked 'protected' in the mapfiles, this is a minimal set (15 to 20).
1088DYNFLAGS +=	-znow
1089
1090BUILD.s=	$(AS) $(ASFLAGS) $< -o $@
1091
1092# Override this top level flag so the compiler builds in its native
1093# C99 mode.  This has been enabled to support the complex arithmetic
1094# added to libc.
1095CSTD=	$(CSTD_GNU99)
1096
1097# libc method of building an archive
1098# The "$(GREP) -v ' L '" part is necessary only until
1099# lorder is fixed to ignore thread-local variables.
1100BUILD.AR= $(RM) $@ ; \
1101	$(AR) q $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%) | $(GREP) -v ' L ' | $(TSORT)`
1102
1103# extra files for the clean target
1104CLEANFILES +=			\
1105	$(LIBCDIR)/port/gen/errlst.c	\
1106	$(LIBCDIR)/port/gen/new_list.c	\
1107	assym.h			\
1108	genassym		\
1109	crt/_rtld.s		\
1110	pics/crti.o		\
1111	pics/crtn.o		\
1112	$(ALTPICS)
1113
1114CLOBBERFILES +=	$(LIB_PIC)
1115
1116# conditional assignments
1117# $(DYNLIB) $(LIB_PIC) := DYNOBJS = _rtbootld.o
1118$(DYNLIB) := CRTI = crti.o
1119$(DYNLIB) := CRTN = crtn.o
1120
1121# Files which need the threads .il inline template
1122TIL=				\
1123	aio.o			\
1124	alloc.o			\
1125	assfail.o		\
1126	atexit.o		\
1127	atfork.o		\
1128	cancel.o		\
1129	door_calls.o		\
1130	err.o			\
1131	errno.o			\
1132	lwp.o			\
1133	ma.o			\
1134	machdep.o		\
1135	posix_aio.o		\
1136	pthr_attr.o		\
1137	pthr_barrier.o		\
1138	pthr_cond.o		\
1139	pthr_mutex.o		\
1140	pthr_rwlock.o		\
1141	pthread.o		\
1142	rand.o			\
1143	rwlock.o		\
1144	scalls.o		\
1145	sched.o			\
1146	sema.o			\
1147	sigaction.o		\
1148	sigev_thread.o		\
1149	spawn.o			\
1150	stack.o			\
1151	synch.o			\
1152	tdb_agent.o		\
1153	thr.o			\
1154	thread_interface.o	\
1155	thread_pool.o		\
1156	thrp_unwind.o		\
1157	tls.o			\
1158	tmem.o			\
1159	tsd.o
1160
1161$(TIL:%=pics/%) := CFLAGS64 += $(LIBCBASE)/threads/amd64.il
1162
1163# pics/mul64.o := CFLAGS64 += crt/mul64.il
1164
1165# large-file-aware components that should be built large
1166
1167#$(COMSYSOBJS64:%=pics/%) := \
1168#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1169
1170#$(SYSOBJS64:%=pics/%) := \
1171#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1172
1173#$(PORTGEN64:%=pics/%) := \
1174#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1175
1176#$(PORTSTDIO64:%=pics/%) := \
1177#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1178
1179#$(PORTSYS64:%=pics/%) := \
1180#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1181
1182$(PORTSTDIO_W:%=pics/%) := \
1183	CPPFLAGS += -D_WIDE
1184
1185$(PORTPRINT_W:%=pics/%) := \
1186	CPPFLAGS += -D_WIDE
1187
1188$(PORTPRINT_C89:%=pics/%) := \
1189	CPPFLAGS += -D_C89_INTMAX32
1190
1191$(PORTSTDIO_C89:%=pics/%) := \
1192	CPPFLAGS += -D_C89_INTMAX32
1193
1194$(PORTI18N_COND:%=pics/%) := \
1195	CPPFLAGS += -D_WCS_LONGLONG
1196
1197pics/arc4random.o :=	CPPFLAGS += -I$(SRC)/common/crypto/chacha
1198
1199pics/__clock_gettime.o := CPPFLAGS += $(COMMPAGE_CPPFLAGS)
1200pics/gettimeofday.o := CPPFLAGS += $(COMMPAGE_CPPFLAGS)
1201
1202.KEEP_STATE:
1203
1204all: $(LIBS) $(LIB_PIC)
1205
1206# object files that depend on inline template
1207$(TIL:%=pics/%): $(LIBCBASE)/threads/amd64.il
1208# pics/mul64.o: crt/mul64.il
1209
1210# include common libc targets
1211include ../Makefile.targ
1212
1213# We need to strip out all CTF data from the static library
1214$(LIB_PIC) := DIR = pics
1215$(LIB_PIC): pics $$(PICS)
1216	$(BUILD.AR)
1217	$(MCS) -d -n .SUNW_ctf $@ > /dev/null 2>&1
1218	$(AR) -ts $@ > /dev/null
1219	$(POST_PROCESS_A)
1220
1221ASSYMDEP_OBJS=			\
1222	_lwp_mutex_unlock.o	\
1223	_stack_grow.o		\
1224	asm_subr.o		\
1225	getcontext.o		\
1226	setjmp.o		\
1227	tls_get_addr.o		\
1228	vforkx.o
1229
1230$(ASSYMDEP_OBJS:%=pics/%): assym.h
1231
1232# assym.h build rules
1233
1234GENASSYM_C = genassym.c
1235LDFLAGS.native = $(LDASSERTS) $(ZASSERTDEFLIB)=libc.so $(BDIRECT)
1236
1237genassym: $(GENASSYM_C)
1238	$(NATIVECC) $(NATIVE_CFLAGS) -Iinc -I$(LIBCDIR)/inc $(CPPFLAGS.native) \
1239		$(LDFLAGS.native) -o $@ $(GENASSYM_C)
1240
1241OFFSETS = $(LIBCDIR)/$(MACH)/offsets.in
1242
1243assym.h: $(OFFSETS) genassym
1244	$(OFFSETS_CREATE) <$(OFFSETS) >$@
1245	./genassym >>$@
1246
1247# derived C source and related explicit dependencies
1248$(LIBCDIR)/port/gen/errlst.c + \
1249$(LIBCDIR)/port/gen/new_list.c: $(LIBCDIR)/port/gen/errlist $(LIBCDIR)/port/gen/errlist.awk
1250	cd $(LIBCDIR)/port/gen; pwd; $(AWK) -f errlist.awk < errlist
1251
1252pics/errlst.o: $(LIBCDIR)/port/gen/errlst.c
1253
1254pics/new_list.o: $(LIBCDIR)/port/gen/new_list.c
1255