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