xref: /titanic_52/usr/src/lib/libc/sparc/Makefile (revision c6f76c3487b0d7e374ba5897fabad436f221c46e)
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	swapctxt.o		\
153	sync_instruction_memory.o
154
155# sysobjs that contain large-file interfaces
156COMSYSOBJS64=			\
157	creat64.o		\
158	fstat64.o		\
159	fstatvfs64.o		\
160	getdents64.o		\
161	getrlimit64.o		\
162	lseek64.o		\
163	lstat64.o		\
164	open64.o		\
165	pread64.o		\
166	pwrite64.o		\
167	setrlimit64.o		\
168	stat64.o		\
169	statvfs64.o
170
171SYSOBJS64=			\
172	mmap64.o
173
174COMSYSOBJS=			\
175	__clock_timer.o		\
176	__fcntl.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	_rename.o		\
188	_rpcsys.o		\
189	_sigaction.o		\
190	_so_accept.o		\
191	_so_bind.o		\
192	_so_connect.o		\
193	_so_getpeername.o	\
194	_so_getsockname.o	\
195	_so_getsockopt.o	\
196	_so_listen.o		\
197	_so_recv.o		\
198	_so_recvfrom.o		\
199	_so_recvmsg.o		\
200	_so_send.o		\
201	_so_sendmsg.o		\
202	_so_sendto.o		\
203	_so_setsockopt.o	\
204	_so_shutdown.o		\
205	_so_socket.o		\
206	_so_socketpair.o	\
207	_sockconfig.o		\
208	access.o		\
209	acct.o			\
210	acl.o			\
211	adjtime.o		\
212	alarm.o			\
213	brk.o			\
214	chdir.o			\
215	chmod.o			\
216	chown.o			\
217	chroot.o		\
218	cladm.o			\
219	close.o			\
220	creat.o			\
221	dup.o			\
222	execve.o		\
223	exit.o			\
224	facl.o			\
225	fchdir.o		\
226	fchmod.o		\
227	fchown.o		\
228	fchroot.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	getpagesizes.o		\
244	getpid.o		\
245	getpmsg.o		\
246	getppid.o		\
247	getrlimit.o		\
248	getuid.o		\
249	gtty.o			\
250	install_utrap.o		\
251	ioctl.o			\
252	kaio.o			\
253	kill.o			\
254	lchown.o		\
255	link.o			\
256	llseek.o		\
257	lseek.o			\
258	lstat.o			\
259	memcntl.o		\
260	mincore.o		\
261	mkdir.o			\
262	mknod.o			\
263	mmap.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	resolvepath.o		\
289	rmdir.o			\
290	seteguid.o		\
291	setgid.o		\
292	setgroups.o		\
293	setitimer.o		\
294	setreid.o		\
295	setrlimit.o		\
296	setuid.o		\
297	sigaltstk.o		\
298	sigprocmsk.o		\
299	sigsendset.o		\
300	sigsuspend.o		\
301	stat.o			\
302	statfs.o		\
303	statvfs.o		\
304	stty.o			\
305	symlink.o		\
306	sync.o			\
307	sysconfig.o		\
308	sysfs.o			\
309	sysinfo.o		\
310	syslwp.o		\
311	times.o			\
312	ulimit.o		\
313	umask.o			\
314	umount2.o		\
315	unlink.o		\
316	utime.o			\
317	utimes.o		\
318	utssys.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	door.o			\
331	fork1.o			\
332	forkall.o		\
333	gettimeofday.o		\
334	pipe.o			\
335	ptrace.o		\
336	syscall.o		\
337	syssun.o		\
338	tls_get_addr.o		\
339	uadmin.o		\
340	umount.o		\
341	uname.o			\
342	vfork.o
343
344# objects under ../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 ../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	attropen.o		\
411	atexit.o		\
412	atfork.o		\
413	basename.o		\
414	calloc.o		\
415	catgets.o		\
416	catopen.o		\
417	cfgetispeed.o		\
418	cfgetospeed.o		\
419	cfree.o			\
420	cfsetispeed.o		\
421	cfsetospeed.o		\
422	cftime.o		\
423	clock.o			\
424	closedir.o		\
425	closefrom.o		\
426	confstr.o		\
427	crypt.o			\
428	csetlen.o		\
429	ctime.o			\
430	ctime_r.o		\
431	directio.o		\
432	dirname.o		\
433	div.o			\
434	drand48.o		\
435	dup2.o			\
436	env_data.o		\
437	errno.o			\
438	euclen.o		\
439	event_port.o		\
440	execvp.o		\
441	fattach.o		\
442	fdetach.o		\
443	fdopendir.o		\
444	fmtmsg.o		\
445	ftime.o			\
446	ftok.o			\
447	ftw.o			\
448	gcvt.o			\
449	getauxv.o		\
450	getcwd.o		\
451	getdate_err.o		\
452	getdtblsize.o		\
453	getenv.o		\
454	getexecname.o		\
455	getgrnam.o		\
456	getgrnam_r.o		\
457	gethostid.o		\
458	gethostname.o		\
459	gethz.o			\
460	getisax.o		\
461	getloadavg.o		\
462	getlogin.o		\
463	getmntent.o		\
464	getnetgrent.o		\
465	getopt.o		\
466	getopt_long.o		\
467	getpagesize.o		\
468	getpw.o			\
469	getpwnam.o		\
470	getpwnam_r.o		\
471	getrusage.o		\
472	getspent.o		\
473	getspent_r.o		\
474	getsubopt.o		\
475	gettxt.o		\
476	getusershell.o		\
477	getut.o			\
478	getutx.o		\
479	getvfsent.o		\
480	getwd.o			\
481	getwidth.o		\
482	getxby_door.o		\
483	gtxt.o			\
484	hsearch.o		\
485	iconv.o			\
486	imaxabs.o		\
487	imaxdiv.o		\
488	index.o			\
489	initgroups.o		\
490	insque.o		\
491	isaexec.o		\
492	isastream.o		\
493	isatty.o		\
494	killpg.o		\
495	l64a.o			\
496	lckpwdf.o		\
497	lconstants.o		\
498	ldivide.o		\
499	lfind.o			\
500	lfmt.o			\
501	lfmt_log.o		\
502	llabs.o			\
503	lldiv.o			\
504	lltostr.o		\
505	localtime.o		\
506	lsearch.o		\
507	madvise.o		\
508	malloc.o		\
509	memalign.o		\
510	mkdev.o			\
511	mkdtemp.o		\
512	mkfifo.o		\
513	mkstemp.o		\
514	mktemp.o		\
515	mlock.o			\
516	mlockall.o		\
517	mon.o			\
518	msync.o			\
519	munlock.o		\
520	munlockall.o		\
521	ndbm.o			\
522	nftw.o			\
523	nlspath_checks.o	\
524	nsparse.o		\
525	nss_common.o		\
526	nss_dbdefs.o		\
527	nss_deffinder.o		\
528	opendir.o		\
529	opt_data.o		\
530	perror.o		\
531	pfmt.o			\
532	pfmt_data.o		\
533	pfmt_print.o		\
534	plock.o			\
535	poll.o			\
536	priocntl.o		\
537	privlib.o		\
538	priv_str_xlate.o	\
539	psiginfo.o		\
540	psignal.o		\
541	pt.o			\
542	putpwent.o		\
543	putspent.o		\
544	raise.o			\
545	rand.o			\
546	random.o		\
547	rctlops.o		\
548	readdir.o		\
549	readdir_r.o		\
550	realpath.o		\
551	reboot.o		\
552	regexpr.o		\
553	rename.o		\
554	rewinddir.o		\
555	rindex.o		\
556	scandir.o		\
557	seekdir.o		\
558	select.o		\
559	select_large_fdset.o	\
560	setlabel.o		\
561	setpriority.o		\
562	settimeofday.o		\
563	sh_locks.o		\
564	sigflag.o		\
565	siglist.o		\
566	sigsend.o		\
567	sigsetops.o		\
568	ssignal.o		\
569	stack.o			\
570	str2sig.o		\
571	strcase_charmap.o	\
572	strcat.o		\
573	strcspn.o		\
574	strdup.o		\
575	strerror.o		\
576	strncat.o		\
577	strlcat.o		\
578	strncasecmp.o		\
579	strpbrk.o		\
580	strrchr.o		\
581	strsignal.o		\
582	strspn.o		\
583	strstr.o		\
584	strtod.o		\
585	strtoimax.o		\
586	strtok.o		\
587	strtok_r.o		\
588	strtoll.o		\
589	strtoull.o		\
590	strtoumax.o		\
591	swab.o			\
592	swapctl.o		\
593	sysconf.o		\
594	syslog.o		\
595	tcdrain.o		\
596	tcflow.o		\
597	tcflush.o		\
598	tcgetattr.o		\
599	tcgetpgrp.o		\
600	tcgetsid.o		\
601	tcsendbreak.o		\
602	tcsetattr.o		\
603	tcsetpgrp.o		\
604	tell.o			\
605	telldir.o		\
606	tfind.o			\
607	time_data.o		\
608	time_gdata.o		\
609	truncate.o		\
610	tsdalloc.o		\
611	tsearch.o		\
612	ttyname.o		\
613	ttyslot.o		\
614	ualarm.o		\
615	ucred.o			\
616	valloc.o		\
617	vlfmt.o			\
618	vpfmt.o			\
619	wait3.o			\
620	wait4.o			\
621	waitpid.o		\
622	walkstack.o		\
623	wdata.o			\
624	xgetwidth.o		\
625	xpg4.o			\
626	xpg6.o
627
628PORTPRINT_W=			\
629	doprnt_w.o
630
631PORTPRINT=			\
632	doprnt.o		\
633	fprintf.o		\
634	printf.o		\
635	snprintf.o		\
636	sprintf.o		\
637	vfprintf.o		\
638	vprintf.o		\
639	vsnprintf.o		\
640	vsprintf.o		\
641	vwprintf.o		\
642	wprintf.o
643
644# c89 variants to support 32-bit size of c89 u/intmax_t (32-bit libc only)
645PORTPRINT_C89=			\
646	vfprintf_c89.o		\
647	vprintf_c89.o		\
648	vsnprintf_c89.o		\
649	vsprintf_c89.o		\
650	vwprintf_c89.o
651
652PORTSTDIO_C89=			\
653	vscanf_c89.o		\
654	vwscanf_c89.o
655
656# portable stdio objects that contain large file interfaces.
657# Note: fopen64 is a special case, as we build it small.
658PORTSTDIO64=			\
659	fopen64.o		\
660	fpos64.o
661
662PORTSTDIO_W=			\
663	doscan_w.o
664
665PORTSTDIO=			\
666	__extensions.o		\
667	_endopen.o		\
668	_filbuf.o		\
669	_findbuf.o		\
670	_flsbuf.o		\
671	_wrtchk.o		\
672	clearerr.o		\
673	ctermid.o		\
674	ctermid_r.o		\
675	cuserid.o		\
676	data.o			\
677	doscan.o		\
678	fdopen.o		\
679	feof.o			\
680	ferror.o		\
681	fgetc.o			\
682	fgets.o			\
683	fileno.o		\
684	flockf.o		\
685	flush.o			\
686	fopen.o			\
687	fpos.o			\
688	fputc.o			\
689	fputs.o			\
690	fread.o			\
691	fseek.o			\
692	fseeko.o		\
693	ftell.o			\
694	ftello.o		\
695	fwrite.o		\
696	getc.o			\
697	getchar.o		\
698	getpass.o		\
699	gets.o			\
700	getw.o			\
701	popen.o			\
702	putc.o			\
703	putchar.o		\
704	puts.o			\
705	putw.o			\
706	rewind.o		\
707	scanf.o			\
708	setbuf.o		\
709	setbuffer.o		\
710	setvbuf.o		\
711	system.o		\
712	tempnam.o		\
713	tmpfile.o		\
714	tmpnam_r.o		\
715	ungetc.o		\
716	mse.o			\
717	vscanf.o		\
718	vwscanf.o		\
719	wscanf.o
720
721PORTI18N=			\
722	__fgetwc_xpg5.o		\
723	__fgetws_xpg5.o		\
724	__fputwc_xpg5.o		\
725	__fputws_xpg5.o		\
726	__ungetwc_xpg5.o	\
727	getwchar.o		\
728	putwchar.o		\
729	putws.o			\
730	strtows.o		\
731	wcstoimax.o		\
732	wcstol.o		\
733	wcstoul.o		\
734	wcswcs.o		\
735	wscasecmp.o		\
736	wscat.o			\
737	wschr.o			\
738	wscmp.o			\
739	wscpy.o			\
740	wscspn.o		\
741	wsdup.o			\
742	wslen.o			\
743	wsncasecmp.o		\
744	wsncat.o		\
745	wsncmp.o		\
746	wsncpy.o		\
747	wspbrk.o		\
748	wsprintf.o		\
749	wsrchr.o		\
750	wsscanf.o		\
751	wsspn.o			\
752	wstod.o			\
753	wstok.o			\
754	wstol.o			\
755	wstoll.o		\
756	wsxfrm.o		\
757	wmemchr.o		\
758	wmemcmp.o		\
759	wmemcpy.o		\
760	wmemmove.o		\
761	wmemset.o		\
762	wcsstr.o		\
763	gettext.o		\
764	gettext_real.o		\
765	gettext_util.o		\
766	gettext_gnu.o		\
767	plural_parser.o		\
768	wdresolve.o		\
769	_ctype.o		\
770	isascii.o		\
771	toascii.o
772
773PORTI18N_COND=			\
774	wcstol_longlong.o	\
775	wcstoul_longlong.o
776
777AIOOBJS=			\
778	aio.o			\
779	aio_alloc.o		\
780	posix_aio.o
781
782RTOBJS=				\
783	clock_timer.o		\
784	fallocate.o		\
785	mqueue.o		\
786	pos4obj.o		\
787	sched.o			\
788	sem.o			\
789	shm.o			\
790	sigev_thread.o
791
792TPOOLOBJS=			\
793	thread_pool.o
794
795THREADSOBJS=			\
796	alloc.o			\
797	assfail.o		\
798	cancel.o		\
799	door_calls.o		\
800	pthr_attr.o		\
801	pthr_barrier.o		\
802	pthr_cond.o		\
803	pthr_mutex.o		\
804	pthr_rwlock.o		\
805	pthread.o		\
806	rtsched.o		\
807	rwlock.o		\
808	scalls.o		\
809	sema.o			\
810	sigaction.o		\
811	spawn.o			\
812	synch.o			\
813	tdb_agent.o		\
814	thr.o			\
815	thread_interface.o	\
816	tls.o			\
817	tsd.o
818
819THREADSMACHOBJS=		\
820	machdep.o
821
822THREADSASMOBJS=			\
823	asm_subr.o
824
825UNWINDMACHOBJS=			\
826	unwind.o
827
828UNWINDASMOBJS=			\
829	unwind_frame.o
830
831# objects that implement the transitional large file API
832PORTSYS64=			\
833	fstatat64.o		\
834	lockf64.o		\
835	openat64.o
836
837PORTSYS=			\
838	_autofssys.o		\
839	acctctl.o		\
840	bsd_signal.o		\
841	corectl.o		\
842	exacctsys.o		\
843	execl.o			\
844	execle.o		\
845	execv.o			\
846	fcntl.o			\
847	fsmisc.o		\
848	fstatat.o		\
849	fsync.o			\
850	getpeerucred.o		\
851	inst_sync.o		\
852	issetugid.o		\
853	label.o			\
854	libc_link.o		\
855	libc_open.o		\
856	lockf.o			\
857	lwp.o			\
858	lwp_cond.o		\
859	lwp_rwlock.o		\
860	lwp_sigmask.o		\
861	meminfosys.o		\
862	msgsys.o		\
863	nfssys.o		\
864	openat.o		\
865	pgrpsys.o		\
866	posix_sigwait.o		\
867	ppriv.o			\
868	psetsys.o		\
869	rctlsys.o		\
870	sbrk.o			\
871	semsys.o		\
872	set_errno.o		\
873	shmsys.o		\
874	siginterrupt.o		\
875	signal.o		\
876	sigpending.o		\
877	sigstack.o		\
878	tasksys.o		\
879	time.o			\
880	time_util.o		\
881	ucontext.o		\
882	ustat.o			\
883	zone.o
884
885PORTREGEX=			\
886	glob.o			\
887	regcmp.o		\
888	regex.o			\
889	wordexp.o
890
891VALUES=	values-Xa.o
892
893MOSTOBJS=			\
894	$(STRETS)		\
895	$(CRTOBJS)		\
896	$(DYNOBJS)		\
897	$(FPOBJS)		\
898	$(FPASMOBJS)		\
899	$(ATOMICOBJS)		\
900	$(COMOBJS)		\
901	$(GENOBJS)		\
902	$(PORTFP)		\
903	$(PORTGEN)		\
904	$(PORTGEN64)		\
905	$(PORTI18N)		\
906	$(PORTI18N_COND)	\
907	$(PORTPRINT)		\
908	$(PORTPRINT_C89)	\
909	$(PORTPRINT_W)		\
910	$(PORTREGEX)		\
911	$(PORTSTDIO)		\
912	$(PORTSTDIO64)		\
913	$(PORTSTDIO_C89)	\
914	$(PORTSTDIO_W)		\
915	$(PORTSYS)		\
916	$(PORTSYS64)		\
917	$(AIOOBJS)		\
918	$(RTOBJS)		\
919	$(TPOOLOBJS)		\
920	$(THREADSOBJS)		\
921	$(THREADSMACHOBJS)	\
922	$(THREADSASMOBJS)	\
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 ../../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
955CFLAGS += $(CCVERBOSE)
956
957# This is necessary to avoid problems with calling _ex_unwind().
958# We probably don't want any inlining anyway.
959CFLAGS += -xinline=
960
961# Setting THREAD_DEBUG = -DTHREAD_DEBUG (make THREAD_DEBUG=-DTHREAD_DEBUG ...)
962# enables ASSERT() checking in the threads portion of the library.
963# This is automatically enabled for DEBUG builds, not for non-debug builds.
964THREAD_DEBUG =
965$(NOT_RELEASE_BUILD)THREAD_DEBUG = -DTHREAD_DEBUG
966
967CFLAGS += $(THREAD_DEBUG)
968
969ALTPICS= $(TRACEOBJS:%=pics/%)
970
971$(DYNLIB) := PICS += $(ROOTFS_LIBDIR)/libc_i18n.a
972$(DYNLIB) := BUILD.SO = $(LD) -o $@ -G $(DYNFLAGS) $(PICS) $(ALTPICS)
973
974MAPFILES =	../port/mapfile-vers mapfile-vers
975
976CFLAGS +=	$(EXTN_CFLAGS)
977CPPFLAGS=	-D_REENTRANT -Dsparc $(EXTN_CPPFLAGS) \
978		-I$(LIBCBASE)/inc -I../inc $(CPPFLAGS.master)
979ASFLAGS=	-K pic -P -D__STDC__ -D_ASM $(CPPFLAGS) $(sparc_AS_XARCH)
980
981# Inform the run-time linker about libc specialized initialization
982RTLDINFO =	-z rtldinfo=tls_rtldinfo
983DYNFLAGS +=	$(RTLDINFO)
984
985DYNFLAGS +=	-e __rtboot
986DYNFLAGS +=	$(EXTN_DYNFLAGS)
987
988BUILD.s=	$(AS) $(ASFLAGS) $< -o $@
989
990# Override this top level flag so the compiler builds in its native
991# C99 mode.  This has been enabled to support the complex arithmetic
992# added to libc.
993C99MODE=	$(C99_ENABLE)
994
995# libc method of building an archive
996BUILD.AR= $(RM) $@ ; \
997	$(AR) q $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%)| $(TSORT)`
998
999# extra files for the clean target
1000CLEANFILES=			\
1001	../port/gen/errlst.c	\
1002	../port/gen/new_list.c	\
1003	assym.h			\
1004	genassym		\
1005	crt/_rtld.s		\
1006	crt/_rtbootld.s		\
1007	pics/_rtbootld.o	\
1008	pics/crti.o		\
1009	pics/crtn.o		\
1010	$(ALTPICS)
1011
1012CLOBBERFILES +=	$(LIB_PIC)
1013
1014# list of C source for lint
1015SRCS=							\
1016	$(ATOMICOBJS:%.o=$(SRC)/common/atomic/%.c)	\
1017	$(COMOBJS:%.o=$(SRC)/common/util/%.c)		\
1018	$(PORTFP:%.o=../port/fp/%.c)			\
1019	$(PORTGEN:%.o=../port/gen/%.c)			\
1020	$(PORTI18N:%.o=../port/i18n/%.c)		\
1021	$(PORTPRINT:%.o=../port/print/%.c)		\
1022	$(PORTREGEX:%.o=../port/regex/%.c)		\
1023	$(PORTSTDIO:%.o=../port/stdio/%.c)		\
1024	$(PORTSYS:%.o=../port/sys/%.c)			\
1025	$(AIOOBJS:%.o=../port/aio/%.c)			\
1026	$(RTOBJS:%.o=../port/rt/%.c)			\
1027	$(TPOOLOBJS:%.o=../port/tpool/%.c)		\
1028	$(THREADSOBJS:%.o=../port/threads/%.c)		\
1029	$(THREADSMACHOBJS:%.o=../$(MACH)/threads/%.c)	\
1030	$(UNWINDMACHOBJS:%.o=../port/unwind/%.c)	\
1031	$(FPOBJS:%.o=../$(MACH)/fp/%.c)			\
1032	$(LIBCBASE)/crt/_ftou.c				\
1033	$(LIBCBASE)/gen/_xregs_clrptr.c			\
1034	$(LIBCBASE)/gen/ecvt.c				\
1035	$(LIBCBASE)/gen/getctxt.c			\
1036	$(LIBCBASE)/gen/lexp10.c			\
1037	$(LIBCBASE)/gen/llog10.c			\
1038	$(LIBCBASE)/gen/lmul.c				\
1039	$(LIBCBASE)/gen/makectxt.c			\
1040	$(LIBCBASE)/gen/siginfolst.c			\
1041	$(LIBCBASE)/gen/siglongjmp.c			\
1042	$(LIBCBASE)/gen/swapctxt.c			\
1043	$(LIBCBASE)/sys/ptrace.c
1044
1045# conditional assignments
1046$(DYNLIB) $(LIB_PIC) := DYNOBJS = _rtbootld.o
1047$(DYNLIB) := CRTI = crti.o
1048$(DYNLIB) := CRTN = crtn.o
1049
1050# Files which need the threads .il inline template
1051TIL=				\
1052	aio.o			\
1053	alloc.o			\
1054	assfail.o		\
1055	atexit.o		\
1056	atfork.o		\
1057	cancel.o		\
1058	door_calls.o		\
1059	errno.o			\
1060	getctxt.o		\
1061	lwp.o			\
1062	ma.o			\
1063	machdep.o		\
1064	posix_aio.o		\
1065	pthr_attr.o		\
1066	pthr_barrier.o		\
1067	pthr_cond.o		\
1068	pthr_mutex.o		\
1069	pthr_rwlock.o		\
1070	pthread.o		\
1071	rand.o			\
1072	rtsched.o		\
1073	rwlock.o		\
1074	scalls.o		\
1075	sema.o			\
1076	sigaction.o		\
1077	sigev_thread.o		\
1078	spawn.o			\
1079	stack.o			\
1080	swapctxt.o		\
1081	synch.o			\
1082	tdb_agent.o		\
1083	thr.o			\
1084	thread_interface.o	\
1085	thread_pool.o		\
1086	tls.o			\
1087	tsd.o			\
1088	unwind.o
1089
1090$(TIL:%=pics/%) := CFLAGS += $(LIBCBASE)/threads/sparc.il
1091
1092# special kludge for inlines with 'cas':
1093pics/synch.o pics/lwp.o := sparc_CFLAGS += -_gcc=-Wa,-xarch=v8plus
1094
1095# Files in port/fp subdirectory that need base.il inline template
1096IL=				\
1097	__flt_decim.o		\
1098	decimal_bin.o
1099
1100$(IL:%=pics/%) := CFLAGS += $(LIBCBASE)/fp/base.il
1101
1102# Files in fp subdirectory which need __quad.il inline template
1103QIL=				\
1104	_Q_add.o		\
1105	_Q_cmp.o		\
1106	_Q_cmpe.o		\
1107	_Q_div.o		\
1108	_Q_dtoq.o		\
1109	_Q_fcc.o		\
1110	_Q_mul.o		\
1111	_Q_qtod.o		\
1112	_Q_qtoi.o		\
1113	_Q_qtos.o		\
1114	_Q_qtou.o		\
1115	_Q_sqrt.o		\
1116	_Q_stoq.o		\
1117	_Q_sub.o
1118
1119$(QIL:%=pics/%) := CFLAGS += ../$(MACH)/fp/__quad.il
1120pics/_Q%.o := sparc_COPTFLAG = -xO4 -dalign
1121pics/__quad%.o := sparc_COPTFLAG = -xO4 -dalign
1122
1123# large-file-aware components that should be built large
1124
1125$(COMSYSOBJS64:%=pics/%) := \
1126	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1127
1128$(SYSOBJS64:%=pics/%) := \
1129	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1130
1131$(PORTGEN64:%=pics/%) := \
1132	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1133
1134$(PORTSTDIO64:%=pics/%) := \
1135	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1136
1137$(PORTSYS64:%=pics/%) := \
1138	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1139
1140$(PORTSTDIO_W:%=pics/%) := \
1141	CPPFLAGS += -D_WIDE
1142
1143$(PORTPRINT_W:%=pics/%) := \
1144	CPPFLAGS += -D_WIDE
1145
1146# printf/scanf functions to support c89-sized intmax_t variables
1147$(PORTPRINT_C89:%=pics/%) := \
1148	CPPFLAGS += -D_C89_INTMAX32
1149
1150$(PORTSTDIO_C89:%=pics/%) := \
1151	CPPFLAGS += -D_C89_INTMAX32
1152
1153$(PORTI18N_COND:%=pics/%) := \
1154	CPPFLAGS += -D_WCS_LONGLONG
1155
1156# Files which need extra optimization
1157pics/getenv.o := sparc_COPTFLAG = -xO4
1158
1159.KEEP_STATE:
1160
1161all: $(LIBS) $(LIB_PIC)
1162
1163lint	:=	CPPFLAGS += -I../$(MACH)/fp
1164lint	:=	CPPFLAGS += -D_MSE_INT_H -D_LCONV_C99
1165lint	:=	LINTFLAGS += -mn
1166
1167lint:
1168	@echo $(LINT.c) ... $(LDLIBS)
1169	@$(LINT.c) $(SRCS) $(LDLIBS)
1170
1171$(LINTLIB):= SRCS=../port/llib-lc
1172$(LINTLIB):= CPPFLAGS += -D_MSE_INT_H
1173$(LINTLIB):= LINTFLAGS=-nvx
1174
1175# object files that depend on inline template
1176$(TIL:%=pics/%): $(LIBCBASE)/threads/sparc.il
1177$(IL:%=pics/%): $(LIBCBASE)/fp/base.il
1178$(QIL:%=pics/%): ../$(MACH)/fp/__quad.il
1179
1180# include common libc targets
1181include ../Makefile.targ
1182
1183# We need to strip out all CTF and DOF data from the static library
1184$(LIB_PIC) := DIR = pics
1185$(LIB_PIC): pics $$(PICS)
1186	$(BUILD.AR)
1187	$(MCS) -d -n .SUNW_ctf $@ > /dev/null 2>&1
1188	$(MCS) -d -n .SUNW_dof $@ > /dev/null 2>&1
1189	$(AR) -ts $@ > /dev/null
1190	$(POST_PROCESS_A)
1191
1192# special cases
1193$(STRETS:%=pics/%): crt/stret.s
1194	$(AS) $(ASFLAGS) -DSTRET$(@F:stret%.o=%) crt/stret.s -o $@
1195	$(POST_PROCESS_O)
1196
1197crt/_rtbootld.s:	crt/_rtboot.s crt/_rtld.c
1198	$(CC) $(CPPFLAGS) $(CTF_FLAGS) -O -S -K pic \
1199	    crt/_rtld.c -o crt/_rtld.s
1200	$(CAT) crt/_rtboot.s crt/_rtld.s > $@
1201	$(RM) crt/_rtld.s
1202
1203# partially built from C source
1204pics/_rtbootld.o: crt/_rtbootld.s
1205	$(AS) $(ASFLAGS) crt/_rtbootld.s -o $@
1206	$(CTFCONVERT_O)
1207
1208ASSYMDEP_OBJS=			\
1209	_lwp_mutex_unlock.o	\
1210	_stack_grow.o		\
1211	asm_subr.o		\
1212	tls_get_addr.o		\
1213	unwind_frame.o		\
1214	vfork.o
1215
1216$(ASSYMDEP_OBJS:%=pics/%)	:=	CPPFLAGS += -I.
1217
1218$(ASSYMDEP_OBJS:%=pics/%): assym.h
1219
1220# assym.h build rules
1221
1222GENASSYM_C = ../$(MACH)/genassym.c
1223
1224# XXX	A hack.  Perhaps this should be 'CPPFLAGS.native' and
1225#	live in Makefile.master
1226
1227CPPFLAGS.genassym = \
1228	$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
1229
1230genassym: $(GENASSYM_C)
1231	$(NATIVECC) -I$(LIBCBASE)/inc -I../inc \
1232		$(CPPFLAGS.genassym) -o $@ $(GENASSYM_C)
1233
1234OFFSETS = ../$(MACH)/offsets.in
1235
1236assym.h: $(OFFSETS) genassym
1237	$(OFFSETS_CREATE) <$(OFFSETS) >$@
1238	./genassym >>$@
1239
1240# derived C source and related explicit dependencies
1241../port/gen/errlst.c + \
1242../port/gen/new_list.c: ../port/gen/errlist ../port/gen/errlist.awk
1243	cd ../port/gen; pwd; $(AWK) -f errlist.awk < errlist
1244
1245pics/errlst.o: ../port/gen/errlst.c
1246
1247pics/new_list.o: ../port/gen/new_list.c
1248