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