xref: /titanic_50/usr/src/lib/libc/sparc/Makefile.com (revision bbe876c07ed632b8f85e195d41e7948382064a95)
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	exacctsys.o		\
941	execl.o			\
942	execle.o		\
943	execv.o			\
944	fcntl.o			\
945	getpagesizes.o		\
946	getpeerucred.o		\
947	inst_sync.o		\
948	issetugid.o		\
949	label.o			\
950	link.o			\
951	lockf.o			\
952	lwp.o			\
953	lwp_cond.o		\
954	lwp_rwlock.o		\
955	lwp_sigmask.o		\
956	meminfosys.o		\
957	mkdir.o			\
958	mknod.o			\
959	msgsys.o		\
960	nfssys.o		\
961	open.o			\
962	pgrpsys.o		\
963	posix_sigwait.o		\
964	ppriv.o			\
965	psetsys.o		\
966	rctlsys.o		\
967	readlink.o		\
968	rename.o		\
969	sbrk.o			\
970	semsys.o		\
971	set_errno.o		\
972	sharefs.o		\
973	shmsys.o		\
974	sidsys.o		\
975	siginterrupt.o		\
976	signal.o		\
977	sigpending.o		\
978	sigstack.o		\
979	stat.o			\
980	symlink.o		\
981	tasksys.o		\
982	time.o			\
983	time_util.o		\
984	ucontext.o		\
985	unlink.o		\
986	ustat.o			\
987	utimesys.o		\
988	zone.o
989
990PORTREGEX=			\
991	glob.o			\
992	regcmp.o		\
993	regex.o			\
994	wordexp.o
995
996VALUES=	values-Xa.o
997
998MOSTOBJS=			\
999	$(STRETS)		\
1000	$(CRTOBJS)		\
1001	$(DYNOBJS)		\
1002	$(FPOBJS)		\
1003	$(FPASMOBJS)		\
1004	$(ATOMICOBJS)		\
1005	$(CHACHAOBJS)		\
1006	$(XATTROBJS)		\
1007	$(COMOBJS)		\
1008	$(DTRACEOBJS)		\
1009	$(GENOBJS)		\
1010	$(PRFOBJS)		\
1011	$(PORTFP)		\
1012	$(PORTGEN)		\
1013	$(PORTGEN64)		\
1014	$(PORTI18N)		\
1015	$(PORTI18N_COND)	\
1016	$(PORTLOCALE)		\
1017	$(PORTPRINT)		\
1018	$(PORTPRINT_C89)	\
1019	$(PORTPRINT_W)		\
1020	$(PORTREGEX)		\
1021	$(PORTSTDIO)		\
1022	$(PORTSTDIO64)		\
1023	$(PORTSTDIO_C89)	\
1024	$(PORTSTDIO_W)		\
1025	$(PORTSYS)		\
1026	$(PORTSYS64)		\
1027	$(AIOOBJS)		\
1028	$(RTOBJS)		\
1029	$(TPOOLOBJS)		\
1030	$(THREADSOBJS)		\
1031	$(THREADSMACHOBJS)	\
1032	$(THREADSASMOBJS)	\
1033	$(UNICODEOBJS)		\
1034	$(UNWINDMACHOBJS)	\
1035	$(UNWINDASMOBJS)	\
1036	$(COMSYSOBJS)		\
1037	$(SYSOBJS)		\
1038	$(COMSYSOBJS64)		\
1039	$(SYSOBJS64)		\
1040	$(VALUES)
1041
1042TRACEOBJS=			\
1043	plockstat.o
1044
1045# NOTE:	libc.so.1 must be linked with the minimal crti.o and crtn.o
1046# modules whose source is provided in the $(SRC)/lib/common directory.
1047# This must be done because otherwise the Sun C compiler would insert
1048# its own versions of these modules and those versions contain code
1049# to call out to C++ initialization functions.  Such C++ initialization
1050# functions can call back into libc before thread initialization is
1051# complete and this leads to segmentation violations and other problems.
1052# Since libc contains no C++ code, linking with the minimal crti.o and
1053# crtn.o modules is safe and avoids the problems described above.
1054OBJECTS= $(CRTI) $(MOSTOBJS) $(CRTN)
1055CRTSRCS= ../../common/sparc
1056
1057# include common library definitions
1058include $(SRC)/lib/Makefile.lib
1059
1060# we need to override the default SONAME here because we might
1061# be building a variant object (still libc.so.1, but different filename)
1062SONAME = libc.so.1
1063
1064CFLAGS += $(CCVERBOSE)
1065
1066# This is necessary to avoid problems with calling _ex_unwind().
1067# We probably don't want any inlining anyway.
1068CFLAGS += -xinline=
1069
1070CERRWARN += -_gcc=-Wno-parentheses
1071CERRWARN += -_gcc=-Wno-switch
1072CERRWARN += -_gcc=-Wno-uninitialized
1073CERRWARN += -_gcc=-Wno-unused-value
1074CERRWARN += -_gcc=-Wno-unused-label
1075CERRWARN += -_gcc=-Wno-unused-variable
1076CERRWARN += -_gcc=-Wno-type-limits
1077CERRWARN += -_gcc=-Wno-char-subscripts
1078CERRWARN += -_gcc=-Wno-clobbered
1079CERRWARN += -_gcc=-Wno-unused-function
1080CERRWARN += -_gcc=-Wno-address
1081
1082# Setting THREAD_DEBUG = -DTHREAD_DEBUG (make THREAD_DEBUG=-DTHREAD_DEBUG ...)
1083# enables ASSERT() checking in the threads portion of the library.
1084# This is automatically enabled for DEBUG builds, not for non-debug builds.
1085THREAD_DEBUG =
1086$(NOT_RELEASE_BUILD)THREAD_DEBUG = -DTHREAD_DEBUG
1087
1088# Make string literals read-only to save memory.
1089CFLAGS += $(XSTRCONST)
1090
1091ALTPICS= $(TRACEOBJS:%=pics/%)
1092
1093$(DYNLIB) := BUILD.SO = $(LD) -o $@ -G $(DYNFLAGS) $(PICS) $(ALTPICS) $(EXTPICS)
1094
1095MAPFILES =	$(LIBCDIR)/port/mapfile-vers
1096
1097CFLAGS +=	$(EXTN_CFLAGS)
1098CPPFLAGS=	-D_REENTRANT -Dsparc $(EXTN_CPPFLAGS) $(THREAD_DEBUG) \
1099		-I$(LIBCBASE)/inc -I$(LIBCDIR)/inc $(CPPFLAGS.master)
1100ASFLAGS=	$(EXTN_ASFLAGS) -K pic -P -D__STDC__ -D_ASM $(CPPFLAGS) $(sparc_AS_XARCH)
1101
1102# As a favor to the dtrace syscall provider, libc still calls the
1103# old syscall traps that have been obsoleted by the *at() interfaces.
1104# Delete this to compile libc using only the new *at() system call traps
1105CPPFLAGS += -D_RETAIN_OLD_SYSCALLS
1106
1107# Inform the run-time linker about libc specialized initialization
1108RTLDINFO =	-z rtldinfo=tls_rtldinfo
1109DYNFLAGS +=	$(RTLDINFO)
1110
1111# Force libc's internal references to be resolved immediately upon loading
1112# in order to avoid critical region problems.  Since almost all libc symbols
1113# are marked 'protected' in the mapfiles, this is a minimal set (15 to 20).
1114DYNFLAGS +=	-znow
1115
1116DYNFLAGS +=	-e __rtboot
1117DYNFLAGS +=	$(EXTN_DYNFLAGS)
1118
1119# Inform the kernel about the initial DTrace area (in case
1120# libc is being used as the interpreter / runtime linker).
1121DTRACE_DATA =	-zdtrace=dtrace_data
1122DYNFLAGS +=	$(DTRACE_DATA)
1123
1124# DTrace needs an executable data segment.
1125MAPFILE.NED=
1126
1127BUILD.s=	$(AS) $(ASFLAGS) $< -o $@
1128
1129# Override this top level flag so the compiler builds in its native
1130# C99 mode.  This has been enabled to support the complex arithmetic
1131# added to libc.
1132C99MODE=	$(C99_ENABLE)
1133
1134# libc method of building an archive
1135# The "$(GREP) -v ' L '" part is necessary only until
1136# lorder is fixed to ignore thread-local variables.
1137BUILD.AR= $(RM) $@ ; \
1138	$(AR) q $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%) | $(GREP) -v ' L ' | $(TSORT)`
1139
1140# extra files for the clean target
1141CLEANFILES=			\
1142	$(LIBCDIR)/port/gen/errlst.c	\
1143	$(LIBCDIR)/port/gen/new_list.c	\
1144	assym.h			\
1145	genassym		\
1146	$(LIBCBASE)/crt/_rtld.s		\
1147	$(LIBCBASE)/crt/_rtbootld.s		\
1148	pics/_rtbootld.o	\
1149	pics/crti.o		\
1150	pics/crtn.o		\
1151	$(ALTPICS)
1152
1153CLOBBERFILES +=	$(LIB_PIC)
1154
1155# list of C source for lint
1156SRCS=							\
1157	$(ATOMICOBJS:%.o=$(SRC)/common/atomic/%.c)	\
1158	$(XATTROBJS:%.o=$(SRC)/common/xattr/%.c)	\
1159	$(COMOBJS:%.o=$(SRC)/common/util/%.c)		\
1160	$(DTRACEOBJS:%.o=$(SRC)/common/dtrace/%.c)	\
1161	$(PORTFP:%.o=$(LIBCDIR)/port/fp/%.c)			\
1162	$(PORTGEN:%.o=$(LIBCDIR)/port/gen/%.c)			\
1163	$(PORTI18N:%.o=$(LIBCDIR)/port/i18n/%.c)		\
1164	$(PORTLOCALE:%.o=$(LIBCDIR)/port/locale/%.c)		\
1165	$(PORTPRINT:%.o=$(LIBCDIR)/port/print/%.c)		\
1166	$(PORTREGEX:%.o=$(LIBCDIR)/port/regex/%.c)		\
1167	$(PORTSTDIO:%.o=$(LIBCDIR)/port/stdio/%.c)		\
1168	$(PORTSYS:%.o=$(LIBCDIR)/port/sys/%.c)			\
1169	$(AIOOBJS:%.o=$(LIBCDIR)/port/aio/%.c)			\
1170	$(RTOBJS:%.o=$(LIBCDIR)/port/rt/%.c)			\
1171	$(TPOOLOBJS:%.o=$(LIBCDIR)/port/tpool/%.c)		\
1172	$(THREADSOBJS:%.o=$(LIBCDIR)/port/threads/%.c)		\
1173	$(THREADSMACHOBJS:%.o=$(LIBCDIR)/$(MACH)/threads/%.c)	\
1174	$(UNICODEOBJS:%.o=$(SRC)/common/unicode/%.c)	\
1175	$(UNWINDMACHOBJS:%.o=$(LIBCDIR)/port/unwind/%.c)	\
1176	$(FPOBJS:%.o=$(LIBCDIR)/$(MACH)/fp/%.c)			\
1177	$(LIBCBASE)/crt/_ftou.c				\
1178	$(LIBCBASE)/gen/_xregs_clrptr.c			\
1179	$(LIBCBASE)/gen/byteorder.c			\
1180	$(LIBCBASE)/gen/ecvt.c				\
1181	$(LIBCBASE)/gen/getctxt.c			\
1182	$(LIBCBASE)/gen/lmul.c				\
1183	$(LIBCBASE)/gen/makectxt.c			\
1184	$(LIBCBASE)/gen/siginfolst.c			\
1185	$(LIBCBASE)/gen/siglongjmp.c			\
1186	$(LIBCBASE)/gen/swapctxt.c			\
1187	$(LIBCBASE)/sys/ptrace.c			\
1188	$(LIBCBASE)/sys/uadmin.c
1189
1190# conditional assignments
1191$(DYNLIB) := CRTI = crti.o
1192$(DYNLIB) := CRTN = crtn.o
1193
1194# Files which need the threads .il inline template
1195TIL=				\
1196	aio.o			\
1197	alloc.o			\
1198	assfail.o		\
1199	atexit.o		\
1200	atfork.o		\
1201	cancel.o		\
1202	door_calls.o		\
1203	err.o			\
1204	errno.o			\
1205	getctxt.o		\
1206	lwp.o			\
1207	ma.o			\
1208	machdep.o		\
1209	posix_aio.o		\
1210	pthr_attr.o		\
1211	pthr_barrier.o		\
1212	pthr_cond.o		\
1213	pthr_mutex.o		\
1214	pthr_rwlock.o		\
1215	pthread.o		\
1216	rand.o			\
1217	rwlock.o		\
1218	scalls.o		\
1219	sched.o			\
1220	sema.o			\
1221	sigaction.o		\
1222	sigev_thread.o		\
1223	spawn.o			\
1224	stack.o			\
1225	swapctxt.o		\
1226	synch.o			\
1227	tdb_agent.o		\
1228	thr.o			\
1229	thread_interface.o	\
1230	thread_pool.o		\
1231	tls.o			\
1232	tsd.o			\
1233	unwind.o
1234
1235$(TIL:%=pics/%) := CFLAGS += $(LIBCBASE)/threads/sparc.il
1236
1237# special kludge for inlines with 'cas':
1238pics/rwlock.o pics/synch.o pics/lwp.o pics/door_calls.o := \
1239	sparc_CFLAGS += -_gcc=-Wa,-xarch=v8plus
1240
1241# Files in port/fp subdirectory that need base.il inline template
1242IL=				\
1243	__flt_decim.o		\
1244	decimal_bin.o
1245
1246$(IL:%=pics/%) := CFLAGS += $(LIBCBASE)/fp/base.il
1247
1248# Files in fp subdirectory which need __quad.il inline template
1249QIL=				\
1250	_Q_add.o		\
1251	_Q_cmp.o		\
1252	_Q_cmpe.o		\
1253	_Q_div.o		\
1254	_Q_dtoq.o		\
1255	_Q_fcc.o		\
1256	_Q_mul.o		\
1257	_Q_qtod.o		\
1258	_Q_qtoi.o		\
1259	_Q_qtos.o		\
1260	_Q_qtou.o		\
1261	_Q_sqrt.o		\
1262	_Q_stoq.o		\
1263	_Q_sub.o
1264
1265$(QIL:%=pics/%) := CFLAGS += $(LIBCDIR)/$(MACH)/fp/__quad.il
1266pics/_Q%.o := sparc_COPTFLAG = -xO4 -dalign
1267pics/__quad%.o := sparc_COPTFLAG = -xO4 -dalign
1268
1269# large-file-aware components that should be built large
1270
1271$(COMSYSOBJS64:%=pics/%) := \
1272	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1273
1274$(SYSOBJS64:%=pics/%) := \
1275	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1276
1277$(PORTGEN64:%=pics/%) := \
1278	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1279
1280$(PORTSTDIO64:%=pics/%) := \
1281	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1282
1283$(PORTSYS64:%=pics/%) := \
1284	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1285
1286$(PORTSTDIO_W:%=pics/%) := \
1287	CPPFLAGS += -D_WIDE
1288
1289$(PORTPRINT_W:%=pics/%) := \
1290	CPPFLAGS += -D_WIDE
1291
1292# printf/scanf functions to support c89-sized intmax_t variables
1293$(PORTPRINT_C89:%=pics/%) := \
1294	CPPFLAGS += -D_C89_INTMAX32
1295
1296$(PORTSTDIO_C89:%=pics/%) := \
1297	CPPFLAGS += -D_C89_INTMAX32
1298
1299$(PORTI18N_COND:%=pics/%) := \
1300	CPPFLAGS += -D_WCS_LONGLONG
1301
1302pics/arc4random.o :=	CPPFLAGS += -I$(SRC)/common/crypto/chacha
1303
1304# Files which need extra optimization
1305pics/getenv.o := sparc_COPTFLAG = -xO4
1306
1307.KEEP_STATE:
1308
1309all: $(LIBS) $(LIB_PIC)
1310
1311lint	:=	CPPFLAGS += -I$(LIBCDIR)/$(MACH)/fp
1312lint	:=	CPPFLAGS += -D_MSE_INT_H -D_LCONV_C99
1313lint	:=	LINTFLAGS += -mn
1314
1315lint:
1316	@echo $(LINT.c) ... $(LDLIBS)
1317	@$(LINT.c) $(SRCS) $(LDLIBS)
1318
1319$(LINTLIB):= SRCS=$(LIBCDIR)/port/llib-lc
1320$(LINTLIB):= CPPFLAGS += -D_MSE_INT_H
1321$(LINTLIB):= LINTFLAGS=-nvx
1322
1323# object files that depend on inline template
1324$(TIL:%=pics/%): $(LIBCBASE)/threads/sparc.il
1325$(IL:%=pics/%): $(LIBCBASE)/fp/base.il
1326$(QIL:%=pics/%): $(LIBCDIR)/$(MACH)/fp/__quad.il
1327
1328# include common libc targets
1329include $(LIBCDIR)/Makefile.targ
1330
1331# We need to strip out all CTF and DOF data from the static library
1332$(LIB_PIC) := DIR = pics
1333$(LIB_PIC): pics $$(PICS)
1334	$(BUILD.AR)
1335	$(MCS) -d -n .SUNW_ctf $@ > /dev/null 2>&1
1336	$(MCS) -d -n .SUNW_dof $@ > /dev/null 2>&1
1337	$(AR) -ts $@ > /dev/null
1338	$(POST_PROCESS_A)
1339
1340# special cases
1341$(STRETS:%=pics/%): $(LIBCBASE)/crt/stret.s
1342	$(AS) $(ASFLAGS) -DSTRET$(@F:stret%.o=%) $(LIBCBASE)/crt/stret.s -o $@
1343	$(POST_PROCESS_O)
1344
1345$(LIBCBASE)/crt/_rtbootld.s:	$(LIBCBASE)/crt/_rtboot.s $(LIBCBASE)/crt/_rtld.c
1346	$(CC) $(CPPFLAGS) $(CTF_FLAGS) -O -S -K pic \
1347	    $(LIBCBASE)/crt/_rtld.c -o $(LIBCBASE)/crt/_rtld.s
1348	$(CAT) $(LIBCBASE)/crt/_rtboot.s $(LIBCBASE)/crt/_rtld.s > $@
1349	$(RM) $(LIBCBASE)/crt/_rtld.s
1350
1351# partially built from C source
1352pics/_rtbootld.o: $(LIBCBASE)/crt/_rtbootld.s
1353	$(AS) $(ASFLAGS) $(LIBCBASE)/crt/_rtbootld.s -o $@
1354	$(CTFCONVERT_O)
1355
1356ASSYMDEP_OBJS=			\
1357	_lwp_mutex_unlock.o	\
1358	_stack_grow.o		\
1359	asm_subr.o		\
1360	setjmp.o		\
1361	smt_pause.o		\
1362	tls_get_addr.o		\
1363	unwind_frame.o		\
1364	vforkx.o
1365
1366$(ASSYMDEP_OBJS:%=pics/%)	:=	CPPFLAGS += -I.
1367
1368$(ASSYMDEP_OBJS:%=pics/%): assym.h
1369
1370# assym.h build rules
1371
1372assym.h := CFLAGS += -g
1373
1374GENASSYM_C = $(LIBCDIR)/$(MACH)/genassym.c
1375
1376genassym: $(GENASSYM_C)
1377	$(NATIVECC) -I$(LIBCBASE)/inc -I$(LIBCDIR)/inc \
1378		$(CPPFLAGS.native) -o $@ $(GENASSYM_C)
1379
1380OFFSETS = $(LIBCDIR)/$(MACH)/offsets.in
1381
1382assym.h: $(OFFSETS) genassym
1383	$(OFFSETS_CREATE) <$(OFFSETS) >$@
1384	./genassym >>$@
1385
1386# derived C source and related explicit dependencies
1387$(LIBCDIR)/port/gen/errlst.c + \
1388$(LIBCDIR)/port/gen/new_list.c: $(LIBCDIR)/port/gen/errlist $(LIBCDIR)/port/gen/errlist.awk
1389	cd $(LIBCDIR)/port/gen; pwd; $(AWK) -f errlist.awk < errlist
1390
1391pics/errlst.o: $(LIBCDIR)/port/gen/errlst.c
1392
1393pics/new_list.o: $(LIBCDIR)/port/gen/new_list.c
1394