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