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