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