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