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