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