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