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