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