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