xref: /titanic_51/usr/src/lib/libc/sparc/Makefile.com (revision 7a92e70fb4f00cd79ef310c87c0daca81976ce9e)
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 (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
23#
24
25LIBCDIR=	$(SRC)/lib/libc
26LIB_PIC=	libc_pic.a
27VERS=		.1
28CPP=		/usr/lib/cpp
29TARGET_ARCH=	sparc
30
31# objects are grouped by source directory
32
33# Symbol capabilities objects.
34EXTPICS=			\
35	$(LIBCDIR)/capabilities/sun4u/sparc/pics/symcap.o \
36	$(LIBCDIR)/capabilities/sun4u-opl/sparc/pics/symcap.o \
37	$(LIBCDIR)/capabilities/sun4u-us3-hwcap1/sparc/pics/symcap.o \
38	$(LIBCDIR)/capabilities/sun4u-us3-hwcap2/sparc/pics/symcap.o \
39	$(LIBCDIR)/capabilities/sun4v-hwcap1/sparc/pics/symcap.o \
40	$(LIBCDIR)/capabilities/sun4v-hwcap2/sparc/pics/symcap.o
41
42# local objects
43STRETS=				\
44	stret1.o		\
45	stret2.o		\
46	stret4.o
47
48CRTOBJS=			\
49	_ftou.o			\
50	cerror.o		\
51	cerror64.o		\
52	hwmuldiv.o
53
54DYNOBJS=			\
55	_rtbootld.o
56
57FPOBJS=				\
58	_D_cplx_div.o		\
59	_D_cplx_div_ix.o	\
60	_D_cplx_div_rx.o	\
61	_D_cplx_mul.o		\
62	_F_cplx_div.o		\
63	_F_cplx_div_ix.o	\
64	_F_cplx_div_rx.o	\
65	_F_cplx_mul.o		\
66	_Q_add.o		\
67	_Q_cmp.o		\
68	_Q_cmpe.o		\
69	_Q_cplx_div.o		\
70	_Q_cplx_div_ix.o	\
71	_Q_cplx_div_rx.o	\
72	_Q_cplx_lr_div.o	\
73	_Q_cplx_lr_div_ix.o	\
74	_Q_cplx_lr_div_rx.o	\
75	_Q_cplx_lr_mul.o	\
76	_Q_cplx_mul.o		\
77	_Q_div.o		\
78	_Q_dtoq.o		\
79	_Q_fcc.o		\
80	_Q_itoq.o		\
81	_Q_lltoq.o		\
82	_Q_mul.o		\
83	_Q_neg.o		\
84	_Q_qtod.o		\
85	_Q_qtoi.o		\
86	_Q_qtos.o		\
87	_Q_qtou.o		\
88	_Q_scl.o		\
89	_Q_set_except.o		\
90	_Q_sqrt.o		\
91	_Q_stoq.o		\
92	_Q_sub.o		\
93	_Q_ulltoq.o		\
94	_Q_utoq.o		\
95	__quad_mag.o
96
97FPASMOBJS=			\
98	_Q_get_rp_rd.o		\
99	fpgetmask.o		\
100	fpgetrnd.o		\
101	fpgetsticky.o		\
102	fpsetmask.o		\
103	fpsetrnd.o		\
104	fpsetsticky.o		\
105	__quad.o
106
107ATOMICOBJS=			\
108	atomic.o
109
110XATTROBJS=			\
111	xattr_common.o
112
113COMOBJS=			\
114	bcmp.o			\
115	bcopy.o			\
116	bzero.o			\
117	bsearch.o		\
118	ffs.o			\
119	memccpy.o		\
120	qsort.o			\
121	strtol.o		\
122	strtoul.o		\
123	strtoll.o		\
124	strtoull.o
125
126DTRACEOBJS=			\
127	dtrace_data.o
128
129GENOBJS=			\
130	_getsp.o		\
131	_xregs_clrptr.o		\
132	abs.o			\
133	alloca.o		\
134	byteorder.o		\
135	cuexit.o		\
136	ecvt.o			\
137	errlst.o		\
138	getctxt.o		\
139	ladd.o			\
140	lmul.o			\
141	lock.o			\
142	lshiftl.o		\
143	lsign.o			\
144	lsub.o			\
145	makectxt.o		\
146	memchr.o		\
147	memcmp.o		\
148	new_list.o		\
149	setjmp.o		\
150	siginfolst.o		\
151	siglongjmp.o		\
152	sparc_data.o		\
153	strcasecmp.o		\
154	strchr.o		\
155	strcmp.o		\
156	strlcpy.o		\
157	strncmp.o		\
158	strncpy.o		\
159	strnlen.o		\
160	swapctxt.o		\
161	sync_instruction_memory.o
162
163# sysobjs that contain large-file interfaces
164COMSYSOBJS64=			\
165	fstatvfs64.o		\
166	getdents64.o		\
167	getrlimit64.o		\
168	lseek64.o		\
169	mmap64.o		\
170	pread64.o		\
171	pwrite64.o		\
172	setrlimit64.o		\
173	statvfs64.o
174
175SYSOBJS64=
176
177COMSYSOBJS=			\
178	__clock_timer.o		\
179	__getloadavg.o		\
180	__rusagesys.o		\
181	__signotify.o		\
182	__sigrt.o		\
183	__time.o		\
184	_lgrp_home_fast.o	\
185	_lgrpsys.o		\
186	_nfssys.o		\
187	_portfs.o		\
188	_pset.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	acct.o			\
210	acl.o			\
211	adjtime.o		\
212	alarm.o			\
213	brk.o			\
214	chdir.o			\
215	chroot.o		\
216	cladm.o			\
217	close.o			\
218	execve.o		\
219	exit.o			\
220	facl.o			\
221	fchdir.o		\
222	fchroot.o		\
223	fdsync.o		\
224	fpathconf.o		\
225	fstatfs.o		\
226	fstatvfs.o		\
227	getcpuid.o		\
228	getdents.o		\
229	getegid.o		\
230	geteuid.o		\
231	getgid.o		\
232	getgroups.o		\
233	gethrtime.o		\
234	getitimer.o		\
235	getmsg.o		\
236	getpid.o		\
237	getpmsg.o		\
238	getppid.o		\
239	getrlimit.o		\
240	getuid.o		\
241	gtty.o			\
242	install_utrap.o		\
243	ioctl.o			\
244	kaio.o			\
245	kill.o			\
246	llseek.o		\
247	lseek.o			\
248	memcntl.o		\
249	mincore.o		\
250	mmap.o			\
251	mmapobjsys.o		\
252	modctl.o		\
253	mount.o			\
254	mprotect.o		\
255	munmap.o		\
256	nice.o			\
257	ntp_adjtime.o		\
258	ntp_gettime.o		\
259	p_online.o		\
260	pathconf.o		\
261	pause.o			\
262	pcsample.o		\
263	pollsys.o		\
264	pread.o			\
265	priocntlset.o		\
266	processor_bind.o	\
267	processor_info.o	\
268	profil.o		\
269	putmsg.o		\
270	putpmsg.o		\
271	pwrite.o		\
272	read.o			\
273	readv.o			\
274	resolvepath.o		\
275	seteguid.o		\
276	setgid.o		\
277	setgroups.o		\
278	setitimer.o		\
279	setreid.o		\
280	setrlimit.o		\
281	setuid.o		\
282	sigaltstk.o		\
283	sigprocmsk.o		\
284	sigsendset.o		\
285	sigsuspend.o		\
286	statfs.o		\
287	statvfs.o		\
288	stty.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	chmod.o			\
834	chown.o			\
835	corectl.o		\
836	exacctsys.o		\
837	execl.o			\
838	execle.o		\
839	execv.o			\
840	fcntl.o			\
841	getpagesizes.o		\
842	getpeerucred.o		\
843	inst_sync.o		\
844	issetugid.o		\
845	label.o			\
846	link.o			\
847	lockf.o			\
848	lwp.o			\
849	lwp_cond.o		\
850	lwp_rwlock.o		\
851	lwp_sigmask.o		\
852	meminfosys.o		\
853	mkdir.o			\
854	mknod.o			\
855	msgsys.o		\
856	nfssys.o		\
857	open.o			\
858	pgrpsys.o		\
859	posix_sigwait.o		\
860	ppriv.o			\
861	psetsys.o		\
862	rctlsys.o		\
863	readlink.o		\
864	rename.o		\
865	sbrk.o			\
866	semsys.o		\
867	set_errno.o		\
868	sharefs.o		\
869	shmsys.o		\
870	sidsys.o		\
871	siginterrupt.o		\
872	signal.o		\
873	sigpending.o		\
874	sigstack.o		\
875	stat.o			\
876	symlink.o		\
877	tasksys.o		\
878	time.o			\
879	time_util.o		\
880	ucontext.o		\
881	unlink.o		\
882	ustat.o			\
883	utimesys.o		\
884	zone.o
885
886PORTREGEX=			\
887	glob.o			\
888	regcmp.o		\
889	regex.o			\
890	wordexp.o
891
892VALUES=	values-Xa.o
893
894MOSTOBJS=			\
895	$(STRETS)		\
896	$(CRTOBJS)		\
897	$(DYNOBJS)		\
898	$(FPOBJS)		\
899	$(FPASMOBJS)		\
900	$(ATOMICOBJS)		\
901	$(XATTROBJS)		\
902	$(COMOBJS)		\
903	$(DTRACEOBJS)		\
904	$(GENOBJS)		\
905	$(PRFOBJS)		\
906	$(PORTFP)		\
907	$(PORTGEN)		\
908	$(PORTGEN64)		\
909	$(PORTI18N)		\
910	$(PORTI18N_COND)	\
911	$(PORTPRINT)		\
912	$(PORTPRINT_C89)	\
913	$(PORTPRINT_W)		\
914	$(PORTREGEX)		\
915	$(PORTSTDIO)		\
916	$(PORTSTDIO64)		\
917	$(PORTSTDIO_C89)	\
918	$(PORTSTDIO_W)		\
919	$(PORTSYS)		\
920	$(PORTSYS64)		\
921	$(AIOOBJS)		\
922	$(RTOBJS)		\
923	$(TPOOLOBJS)		\
924	$(THREADSOBJS)		\
925	$(THREADSMACHOBJS)	\
926	$(THREADSASMOBJS)	\
927	$(UNICODEOBJS)		\
928	$(UNWINDMACHOBJS)	\
929	$(UNWINDASMOBJS)	\
930	$(COMSYSOBJS)		\
931	$(SYSOBJS)		\
932	$(COMSYSOBJS64)		\
933	$(SYSOBJS64)		\
934	$(VALUES)
935
936TRACEOBJS=			\
937	plockstat.o
938
939# NOTE:	libc.so.1 must be linked with the minimal crti.o and crtn.o
940# modules whose source is provided in the $(SRC)/lib/common directory.
941# This must be done because otherwise the Sun C compiler would insert
942# its own versions of these modules and those versions contain code
943# to call out to C++ initialization functions.  Such C++ initialization
944# functions can call back into libc before thread initialization is
945# complete and this leads to segmentation violations and other problems.
946# Since libc contains no C++ code, linking with the minimal crti.o and
947# crtn.o modules is safe and avoids the problems described above.
948OBJECTS= $(CRTI) $(MOSTOBJS) $(CRTN)
949CRTSRCS= ../../common/sparc
950
951# include common library definitions
952include $(SRC)/lib/Makefile.lib
953
954# NOTE: libc_i18n.a will be part of libc.so.1.  Therefore, the compilation
955# conditions such as the settings of CFLAGS and CPPFLAGS for the libc_i18n stuff
956# need to be compatible with the ones for the libc stuff.  Whenever the changes
957# that affect the compilation conditions of libc happened, those for libc_i18n
958# also need to be updated.
959
960# we need to override the default SONAME here because we might
961# be building a variant object (still libc.so.1, but different filename)
962SONAME = libc.so.1
963
964CFLAGS += $(CCVERBOSE)
965
966# This is necessary to avoid problems with calling _ex_unwind().
967# We probably don't want any inlining anyway.
968CFLAGS += -xinline=
969
970# Setting THREAD_DEBUG = -DTHREAD_DEBUG (make THREAD_DEBUG=-DTHREAD_DEBUG ...)
971# enables ASSERT() checking in the threads portion of the library.
972# This is automatically enabled for DEBUG builds, not for non-debug builds.
973THREAD_DEBUG =
974$(NOT_RELEASE_BUILD)THREAD_DEBUG = -DTHREAD_DEBUG
975
976# Make string literals read-only to save memory.
977CFLAGS += $(XSTRCONST)
978
979ALTPICS= $(TRACEOBJS:%=pics/%)
980
981$(DYNLIB) := PICS += $(ROOTFS_LIBDIR)/libc_i18n.a
982$(DYNLIB) := BUILD.SO = $(LD) -o $@ -G $(DYNFLAGS) $(PICS) $(ALTPICS) $(EXTPICS)
983
984MAPFILES =	$(LIBCDIR)/port/mapfile-vers
985
986CFLAGS +=	$(EXTN_CFLAGS)
987CPPFLAGS=	-D_REENTRANT -Dsparc $(EXTN_CPPFLAGS) $(THREAD_DEBUG) \
988		-I$(LIBCBASE)/inc -I$(LIBCDIR)/inc $(CPPFLAGS.master)
989ASFLAGS=	$(EXTN_ASFLAGS) -K pic -P -D__STDC__ -D_ASM $(CPPFLAGS) $(sparc_AS_XARCH)
990
991# As a favor to the dtrace syscall provider, libc still calls the
992# old syscall traps that have been obsoleted by the *at() interfaces.
993# Delete this to compile libc using only the new *at() system call traps
994CPPFLAGS += -D_RETAIN_OLD_SYSCALLS
995
996# Inform the run-time linker about libc specialized initialization
997RTLDINFO =	-z rtldinfo=tls_rtldinfo
998DYNFLAGS +=	$(RTLDINFO)
999
1000# Force libc's internal references to be resolved immediately upon loading
1001# in order to avoid critical region problems.  Since almost all libc symbols
1002# are marked 'protected' in the mapfiles, this is a minimal set (15 to 20).
1003DYNFLAGS +=	-znow
1004
1005DYNFLAGS +=	-e __rtboot
1006DYNFLAGS +=	$(EXTN_DYNFLAGS)
1007
1008# Inform the kernel about the initial DTrace area (in case
1009# libc is being used as the interpreter / runtime linker).
1010DTRACE_DATA =	-zdtrace=dtrace_data
1011DYNFLAGS +=	$(DTRACE_DATA)
1012
1013# DTrace needs an executable data segment.
1014MAPFILE.NED=
1015
1016BUILD.s=	$(AS) $(ASFLAGS) $< -o $@
1017
1018# Override this top level flag so the compiler builds in its native
1019# C99 mode.  This has been enabled to support the complex arithmetic
1020# added to libc.
1021C99MODE=	$(C99_ENABLE)
1022
1023# libc method of building an archive
1024BUILD.AR= $(RM) $@ ; \
1025	$(AR) q $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%)| $(TSORT)`
1026
1027# extra files for the clean target
1028CLEANFILES=			\
1029	$(LIBCDIR)/port/gen/errlst.c	\
1030	$(LIBCDIR)/port/gen/new_list.c	\
1031	assym.h			\
1032	genassym		\
1033	$(LIBCBASE)/crt/_rtld.s		\
1034	$(LIBCBASE)/crt/_rtbootld.s		\
1035	pics/_rtbootld.o	\
1036	pics/crti.o		\
1037	pics/crtn.o		\
1038	$(ALTPICS)
1039
1040CLOBBERFILES +=	$(LIB_PIC)
1041
1042# list of C source for lint
1043SRCS=							\
1044	$(ATOMICOBJS:%.o=$(SRC)/common/atomic/%.c)	\
1045	$(XATTROBJS:%.o=$(SRC)/common/xattr/%.c)	\
1046	$(COMOBJS:%.o=$(SRC)/common/util/%.c)		\
1047	$(DTRACEOBJS:%.o=$(SRC)/common/dtrace/%.c)	\
1048	$(PORTFP:%.o=$(LIBCDIR)/port/fp/%.c)			\
1049	$(PORTGEN:%.o=$(LIBCDIR)/port/gen/%.c)			\
1050	$(PORTI18N:%.o=$(LIBCDIR)/port/i18n/%.c)		\
1051	$(PORTPRINT:%.o=$(LIBCDIR)/port/print/%.c)		\
1052	$(PORTREGEX:%.o=$(LIBCDIR)/port/regex/%.c)		\
1053	$(PORTSTDIO:%.o=$(LIBCDIR)/port/stdio/%.c)		\
1054	$(PORTSYS:%.o=$(LIBCDIR)/port/sys/%.c)			\
1055	$(AIOOBJS:%.o=$(LIBCDIR)/port/aio/%.c)			\
1056	$(RTOBJS:%.o=$(LIBCDIR)/port/rt/%.c)			\
1057	$(TPOOLOBJS:%.o=$(LIBCDIR)/port/tpool/%.c)		\
1058	$(THREADSOBJS:%.o=$(LIBCDIR)/port/threads/%.c)		\
1059	$(THREADSMACHOBJS:%.o=$(LIBCDIR)/$(MACH)/threads/%.c)	\
1060	$(UNICODEOBJS:%.o=$(SRC)/common/unicode/%.c)	\
1061	$(UNWINDMACHOBJS:%.o=$(LIBCDIR)/port/unwind/%.c)	\
1062	$(FPOBJS:%.o=$(LIBCDIR)/$(MACH)/fp/%.c)			\
1063	$(LIBCBASE)/crt/_ftou.c				\
1064	$(LIBCBASE)/gen/_xregs_clrptr.c			\
1065	$(LIBCBASE)/gen/byteorder.c			\
1066	$(LIBCBASE)/gen/ecvt.c				\
1067	$(LIBCBASE)/gen/getctxt.c			\
1068	$(LIBCBASE)/gen/lmul.c				\
1069	$(LIBCBASE)/gen/makectxt.c			\
1070	$(LIBCBASE)/gen/siginfolst.c			\
1071	$(LIBCBASE)/gen/siglongjmp.c			\
1072	$(LIBCBASE)/gen/swapctxt.c			\
1073	$(LIBCBASE)/sys/ptrace.c			\
1074	$(LIBCBASE)/sys/uadmin.c
1075
1076# conditional assignments
1077$(DYNLIB) := CRTI = crti.o
1078$(DYNLIB) := CRTN = crtn.o
1079
1080# Files which need the threads .il inline template
1081TIL=				\
1082	aio.o			\
1083	alloc.o			\
1084	assfail.o		\
1085	atexit.o		\
1086	atfork.o		\
1087	cancel.o		\
1088	door_calls.o		\
1089	errno.o			\
1090	getctxt.o		\
1091	lwp.o			\
1092	ma.o			\
1093	machdep.o		\
1094	posix_aio.o		\
1095	pthr_attr.o		\
1096	pthr_barrier.o		\
1097	pthr_cond.o		\
1098	pthr_mutex.o		\
1099	pthr_rwlock.o		\
1100	pthread.o		\
1101	rand.o			\
1102	rwlock.o		\
1103	scalls.o		\
1104	sched.o			\
1105	sema.o			\
1106	sigaction.o		\
1107	sigev_thread.o		\
1108	spawn.o			\
1109	stack.o			\
1110	swapctxt.o		\
1111	synch.o			\
1112	tdb_agent.o		\
1113	thr.o			\
1114	thread_interface.o	\
1115	thread_pool.o		\
1116	tls.o			\
1117	tsd.o			\
1118	unwind.o
1119
1120$(TIL:%=pics/%) := CFLAGS += $(LIBCBASE)/threads/sparc.il
1121
1122# special kludge for inlines with 'cas':
1123pics/rwlock.o pics/synch.o pics/lwp.o pics/door_calls.o := \
1124	sparc_CFLAGS += -_gcc=-Wa,-xarch=v8plus
1125
1126# Files in port/fp subdirectory that need base.il inline template
1127IL=				\
1128	__flt_decim.o		\
1129	decimal_bin.o
1130
1131$(IL:%=pics/%) := CFLAGS += $(LIBCBASE)/fp/base.il
1132
1133# Files in fp subdirectory which need __quad.il inline template
1134QIL=				\
1135	_Q_add.o		\
1136	_Q_cmp.o		\
1137	_Q_cmpe.o		\
1138	_Q_div.o		\
1139	_Q_dtoq.o		\
1140	_Q_fcc.o		\
1141	_Q_mul.o		\
1142	_Q_qtod.o		\
1143	_Q_qtoi.o		\
1144	_Q_qtos.o		\
1145	_Q_qtou.o		\
1146	_Q_sqrt.o		\
1147	_Q_stoq.o		\
1148	_Q_sub.o
1149
1150$(QIL:%=pics/%) := CFLAGS += $(LIBCDIR)/$(MACH)/fp/__quad.il
1151pics/_Q%.o := sparc_COPTFLAG = -xO4 -dalign
1152pics/__quad%.o := sparc_COPTFLAG = -xO4 -dalign
1153
1154# large-file-aware components that should be built large
1155
1156$(COMSYSOBJS64:%=pics/%) := \
1157	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1158
1159$(SYSOBJS64:%=pics/%) := \
1160	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1161
1162$(PORTGEN64:%=pics/%) := \
1163	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1164
1165$(PORTSTDIO64:%=pics/%) := \
1166	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1167
1168$(PORTSYS64:%=pics/%) := \
1169	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1170
1171$(PORTSTDIO_W:%=pics/%) := \
1172	CPPFLAGS += -D_WIDE
1173
1174$(PORTPRINT_W:%=pics/%) := \
1175	CPPFLAGS += -D_WIDE
1176
1177# printf/scanf functions to support c89-sized intmax_t variables
1178$(PORTPRINT_C89:%=pics/%) := \
1179	CPPFLAGS += -D_C89_INTMAX32
1180
1181$(PORTSTDIO_C89:%=pics/%) := \
1182	CPPFLAGS += -D_C89_INTMAX32
1183
1184$(PORTI18N_COND:%=pics/%) := \
1185	CPPFLAGS += -D_WCS_LONGLONG
1186
1187# Files which need extra optimization
1188pics/getenv.o := sparc_COPTFLAG = -xO4
1189
1190.KEEP_STATE:
1191
1192all: $(LIBS) $(LIB_PIC)
1193
1194lint	:=	CPPFLAGS += -I$(LIBCDIR)/$(MACH)/fp
1195lint	:=	CPPFLAGS += -D_MSE_INT_H -D_LCONV_C99
1196lint	:=	LINTFLAGS += -mn
1197
1198lint:
1199	@echo $(LINT.c) ... $(LDLIBS)
1200	@$(LINT.c) $(SRCS) $(LDLIBS)
1201
1202$(LINTLIB):= SRCS=$(LIBCDIR)/port/llib-lc
1203$(LINTLIB):= CPPFLAGS += -D_MSE_INT_H
1204$(LINTLIB):= LINTFLAGS=-nvx
1205
1206# object files that depend on inline template
1207$(TIL:%=pics/%): $(LIBCBASE)/threads/sparc.il
1208$(IL:%=pics/%): $(LIBCBASE)/fp/base.il
1209$(QIL:%=pics/%): $(LIBCDIR)/$(MACH)/fp/__quad.il
1210
1211# include common libc targets
1212include $(LIBCDIR)/Makefile.targ
1213
1214# We need to strip out all CTF and DOF data from the static library
1215$(LIB_PIC) := DIR = pics
1216$(LIB_PIC): pics $$(PICS)
1217	$(BUILD.AR)
1218	$(MCS) -d -n .SUNW_ctf $@ > /dev/null 2>&1
1219	$(MCS) -d -n .SUNW_dof $@ > /dev/null 2>&1
1220	$(AR) -ts $@ > /dev/null
1221	$(POST_PROCESS_A)
1222
1223# special cases
1224$(STRETS:%=pics/%): $(LIBCBASE)/crt/stret.s
1225	$(AS) $(ASFLAGS) -DSTRET$(@F:stret%.o=%) $(LIBCBASE)/crt/stret.s -o $@
1226	$(POST_PROCESS_O)
1227
1228$(LIBCBASE)/crt/_rtbootld.s:	$(LIBCBASE)/crt/_rtboot.s $(LIBCBASE)/crt/_rtld.c
1229	$(CC) $(CPPFLAGS) $(CTF_FLAGS) -O -S -K pic \
1230	    $(LIBCBASE)/crt/_rtld.c -o $(LIBCBASE)/crt/_rtld.s
1231	$(CAT) $(LIBCBASE)/crt/_rtboot.s $(LIBCBASE)/crt/_rtld.s > $@
1232	$(RM) $(LIBCBASE)/crt/_rtld.s
1233
1234# partially built from C source
1235pics/_rtbootld.o: $(LIBCBASE)/crt/_rtbootld.s
1236	$(AS) $(ASFLAGS) $(LIBCBASE)/crt/_rtbootld.s -o $@
1237	$(CTFCONVERT_O)
1238
1239ASSYMDEP_OBJS=			\
1240	_lwp_mutex_unlock.o	\
1241	_stack_grow.o		\
1242	asm_subr.o		\
1243	setjmp.o		\
1244	tls_get_addr.o		\
1245	unwind_frame.o		\
1246	vforkx.o
1247
1248$(ASSYMDEP_OBJS:%=pics/%)	:=	CPPFLAGS += -I.
1249
1250$(ASSYMDEP_OBJS:%=pics/%): assym.h
1251
1252# assym.h build rules
1253
1254GENASSYM_C = $(LIBCDIR)/$(MACH)/genassym.c
1255
1256# XXX	A hack.  Perhaps this should be 'CPPFLAGS.native' and
1257#	live in Makefile.master
1258
1259CPPFLAGS.genassym = \
1260	$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
1261
1262genassym: $(GENASSYM_C)
1263	$(NATIVECC) -I$(LIBCBASE)/inc -I$(LIBCDIR)/inc \
1264		$(CPPFLAGS.genassym) -o $@ $(GENASSYM_C)
1265
1266OFFSETS = $(LIBCDIR)/$(MACH)/offsets.in
1267
1268assym.h: $(OFFSETS) genassym
1269	$(OFFSETS_CREATE) <$(OFFSETS) >$@
1270	./genassym >>$@
1271
1272# derived C source and related explicit dependencies
1273$(LIBCDIR)/port/gen/errlst.c + \
1274$(LIBCDIR)/port/gen/new_list.c: $(LIBCDIR)/port/gen/errlist $(LIBCDIR)/port/gen/errlist.awk
1275	cd $(LIBCDIR)/port/gen; pwd; $(AWK) -f errlist.awk < errlist
1276
1277pics/errlst.o: $(LIBCDIR)/port/gen/errlst.c
1278
1279pics/new_list.o: $(LIBCDIR)/port/gen/new_list.c
1280