xref: /titanic_41/usr/src/lib/libc/sparcv9/Makefile (revision f4da9be01648d6afa604495d9b9956dddeb92a8c)
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 2007 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	faccessat.o		\
798	fcntl.o			\
799	fsmisc.o		\
800	fstatat.o		\
801	fsync.o			\
802	getpeerucred.o		\
803	inst_sync.o		\
804	issetugid.o		\
805	label.o			\
806	libc_link.o		\
807	libc_open.o		\
808	lockf.o			\
809	lwp.o			\
810	lwp_cond.o		\
811	lwp_rwlock.o		\
812	lwp_sigmask.o		\
813	meminfosys.o		\
814	msgsys.o		\
815	nfssys.o		\
816	openat.o		\
817	pgrpsys.o		\
818	posix_sigwait.o		\
819	ppriv.o			\
820	psetsys.o		\
821	rctlsys.o		\
822	sbrk.o			\
823	semsys.o		\
824	set_errno.o		\
825	sharefs.o		\
826	shmsys.o		\
827	siginterrupt.o		\
828	signal.o		\
829	sigpending.o		\
830	sigstack.o		\
831	tasksys.o		\
832	time.o			\
833	time_util.o		\
834	ucontext.o		\
835	ustat.o			\
836	zone.o
837
838PORTREGEX=			\
839	glob.o			\
840	regcmp.o		\
841	regex.o			\
842	wordexp.o
843
844VALUES=	values-Xa.o
845
846MOSTOBJS=			\
847	$(STRETS)		\
848	$(CRTOBJS)		\
849	$(DYNOBJS)		\
850	$(FPOBJS)		\
851	$(FPOBJS64)		\
852	$(FPASMOBJS)		\
853	$(ATOMICOBJS)		\
854	$(COMOBJS)		\
855	$(GENOBJS)		\
856	$(PORTFP)		\
857	$(PORTGEN)		\
858	$(PORTGEN64)		\
859	$(PORTI18N)		\
860	$(PORTI18N_COND)	\
861	$(PORTPRINT)		\
862	$(PORTPRINT_W)		\
863	$(PORTREGEX)		\
864	$(PORTSTDIO)		\
865	$(PORTSTDIO64)		\
866	$(PORTSTDIO_W)		\
867	$(PORTSYS)		\
868	$(PORTSYS64)		\
869	$(AIOOBJS)		\
870	$(RTOBJS)		\
871	$(TPOOLOBJS)		\
872	$(THREADSOBJS)		\
873	$(THREADSMACHOBJS)	\
874	$(THREADSASMOBJS)	\
875	$(UNWINDMACHOBJS)	\
876	$(UNWINDASMOBJS)	\
877	$(COMSYSOBJS)		\
878	$(SYSOBJS)		\
879	$(COMSYSOBJS64)		\
880	$(SYSOBJS64)		\
881	$(VALUES)
882
883TRACEOBJS=			\
884	plockstat.o
885
886# NOTE:	libc.so.1 must be linked with the minimal crti.o and crtn.o
887# modules whose source is provided in the $(SRC)/lib/common directory.
888# This must be done because otherwise the Sun C compiler would insert
889# its own versions of these modules and those versions contain code
890# to call out to C++ initialization functions.  Such C++ initialization
891# functions can call back into libc before thread initialization is
892# complete and this leads to segmentation violations and other problems.
893# Since libc contains no C++ code, linking with the minimal crti.o and
894# crtn.o modules is safe and avoids the problems described above.
895OBJECTS= $(CRTI) $(MOSTOBJS) $(CRTN)
896CRTSRCS= ../../common/sparcv9
897
898# include common library definitions
899include ../../Makefile.lib
900include ../../Makefile.lib.64
901
902# NOTE: libc_i18n.a will be part of libc.so.1.  Therefore, the compilation
903# conditions such as the settings of CFLAGS and CPPFLAGS for the libc_i18n stuff
904# need to be compatible with the ones for the libc stuff.  Whenever the changes
905# that affect the compilation conditions of libc happened, those for libc_i18n
906# also need to be updated.
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
920CFLAGS64 += $(THREAD_DEBUG)
921
922ALTPICS= $(TRACEOBJS:%=pics/%)
923
924$(DYNLIB) := PICS += $(ROOTFS_LIBDIR64)/libc_i18n.a
925$(DYNLIB) := BUILD.SO = $(LD) -o $@ -G $(DYNFLAGS) $(PICS) $(ALTPICS)
926
927MAPFILES =	../port/mapfile-vers mapfile-vers
928
929sparcv9_C_PICFLAGS= -K PIC
930CFLAGS64 +=	$(EXTN_CFLAGS)
931CPPFLAGS=	-D_REENTRANT -Dsparc $(EXTN_CPPFLAGS) \
932		-I$(LIBCBASE)/inc -I../inc $(CPPFLAGS.master)
933ASFLAGS=	-K PIC -P -D__STDC__ -D_ASM -D__sparcv9 $(CPPFLAGS) \
934		$(sparcv9_AS_XARCH)
935
936# Inform the run-time linker about libc specialized initialization
937RTLDINFO =	-z rtldinfo=tls_rtldinfo
938DYNFLAGS +=	$(RTLDINFO)
939
940DYNFLAGS +=	$(EXTN_DYNFLAGS)
941
942BUILD.s=	$(AS) $(ASFLAGS) $< -o $@
943
944# Override this top level flag so the compiler builds in its native
945# C99 mode.  This has been enabled to support the complex arithmetic
946# added to libc.
947C99MODE=	$(C99_ENABLE)
948
949# libc method of building an archive
950BUILD.AR= $(RM) $@ ; \
951	$(AR) q $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%)| $(TSORT)`
952
953# extra files for the clean target
954CLEANFILES=			\
955	../port/gen/errlst.c	\
956	../port/gen/new_list.c	\
957	assym.h			\
958	genassym		\
959	pics/crti.o		\
960	pics/crtn.o		\
961	$(ALTPICS)
962
963CLOBBERFILES +=	$(LIB_PIC)
964
965# list of C source for lint
966SRCS=							\
967	$(ATOMICOBJS:%.o=$(SRC)/common/atomic/%.c)	\
968	$(COMOBJS:%.o=$(SRC)/common/util/%.c)		\
969	$(PORTFP:%.o=../port/fp/%.c)			\
970	$(PORTGEN:%.o=../port/gen/%.c)			\
971	$(PORTI18N:%.o=../port/i18n/%.c)		\
972	$(PORTPRINT:%.o=../port/print/%.c)		\
973	$(PORTREGEX:%.o=../port/regex/%.c)		\
974	$(PORTSTDIO:%.o=../port/stdio/%.c)		\
975	$(PORTSYS:%.o=../port/sys/%.c)			\
976	$(AIOOBJS:%.o=../port/aio/%.c)			\
977	$(RTOBJS:%.o=../port/rt/%.c)			\
978	$(TPOOLOBJS:%.o=../port/tpool/%.c)		\
979	$(THREADSOBJS:%.o=../port/threads/%.c)		\
980	$(THREADSMACHOBJS:%.o=../$(MACH)/threads/%.c)	\
981	$(UNWINDMACHOBJS:%.o=../port/unwind/%.c)	\
982	$(FPOBJS:%.o=../$(MACH)/fp/%.c)			\
983	$(FPOBJS64:%.o=$(LIBCBASE)/fp/%.c)		\
984	$(LIBCBASE)/crt/_ftou.c				\
985	$(LIBCBASE)/gen/_xregs_clrptr.c			\
986	$(LIBCBASE)/gen/ecvt.c				\
987	$(LIBCBASE)/gen/getctxt.c			\
988	$(LIBCBASE)/gen/lexp10.c			\
989	$(LIBCBASE)/gen/llog10.c			\
990	$(LIBCBASE)/gen/makectxt.c			\
991	$(LIBCBASE)/gen/siginfolst.c			\
992	$(LIBCBASE)/gen/siglongjmp.c			\
993	$(LIBCBASE)/gen/swapctxt.c
994
995# conditional assignments
996# $(DYNLIB) $(LIB_PIC) := DYNOBJS = _rtbootld.o
997$(DYNLIB) := CRTI = crti.o
998$(DYNLIB) := CRTN = crtn.o
999
1000# Files which need the threads .il inline template
1001TIL=				\
1002	aio.o			\
1003	alloc.o			\
1004	assfail.o		\
1005	atexit.o		\
1006	atfork.o		\
1007	cancel.o		\
1008	door_calls.o		\
1009	errno.o			\
1010	getctxt.o		\
1011	lwp.o			\
1012	ma.o			\
1013	machdep.o		\
1014	posix_aio.o		\
1015	pthr_attr.o		\
1016	pthr_barrier.o		\
1017	pthr_cond.o		\
1018	pthr_mutex.o		\
1019	pthr_rwlock.o		\
1020	pthread.o		\
1021	rand.o			\
1022	rtsched.o		\
1023	rwlock.o		\
1024	scalls.o		\
1025	sema.o			\
1026	sigaction.o		\
1027	sigev_thread.o		\
1028	spawn.o			\
1029	stack.o			\
1030	swapctxt.o		\
1031	synch.o			\
1032	tdb_agent.o		\
1033	thr.o			\
1034	thread_interface.o	\
1035	thread_pool.o		\
1036	tls.o			\
1037	tsd.o			\
1038	unwind.o
1039
1040$(TIL:%=pics/%) := CFLAGS64 += $(LIBCBASE)/threads/sparcv9.il
1041
1042# Files in fp, port/fp subdirectories that need base.il inline template
1043IL=				\
1044	__flt_decim.o		\
1045	decimal_bin.o
1046
1047$(IL:%=pics/%) := CFLAGS64 += $(LIBCBASE)/fp/base.il
1048
1049# Files in fp subdirectory which need __quad.il inline template
1050QIL=				\
1051	_Q_add.o		\
1052	_Q_cmp.o		\
1053	_Q_cmpe.o		\
1054	_Q_div.o		\
1055	_Q_dtoq.o		\
1056	_Q_fcc.o		\
1057	_Q_mul.o		\
1058	_Q_qtod.o		\
1059	_Q_qtoi.o		\
1060	_Q_qtos.o		\
1061	_Q_qtou.o		\
1062	_Q_sqrt.o		\
1063	_Q_stoq.o		\
1064	_Q_sub.o		\
1065	_Qp_qtox.o		\
1066	_Qp_qtoux.o
1067
1068$(QIL:%=pics/%) := CFLAGS64 += ../$(MACH)/fp/__quad.il
1069pics/_Qp%.o := CFLAGS64 += -I../$(MACH)/fp
1070pics/_Q%.o := sparcv9_COPTFLAG = -xO4 -xchip=ultra
1071
1072# Files in crt subdirectory which need muldiv64.il inline template
1073#CIL=	mul64.o divrem64.o
1074#$(CIL:%=pics/%) := CFLAGS += $(LIBCBASE)/crt/mul64.il
1075
1076# large-file-aware components that should be built large
1077
1078#$(COMSYSOBJS64:%=pics/%) := \
1079#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1080
1081#$(SYSOBJS64:%=pics/%) := \
1082#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1083
1084#$(PORTGEN64:%=pics/%) := \
1085#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1086
1087#$(PORTSTDIO64:%=pics/%) := \
1088#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1089
1090#$(PORTSYS64:%=pics/%) := \
1091#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1092
1093$(PORTSTDIO_W:%=pics/%) := \
1094	CPPFLAGS += -D_WIDE
1095
1096$(PORTPRINT_W:%=pics/%) := \
1097	CPPFLAGS += -D_WIDE
1098
1099$(PORTI18N_COND:%=pics/%) := \
1100	CPPFLAGS += -D_WCS_LONGLONG
1101
1102# Files which need extra optimization
1103pics/getenv.o := sparcv9_COPTFLAG = -xO4
1104
1105.KEEP_STATE:
1106
1107all: $(LIBS) $(LIB_PIC)
1108
1109lint	:=	CPPFLAGS += -I../$(MACH)/fp
1110lint	:=	CPPFLAGS += -D_MSE_INT_H -D_LCONV_C99
1111lint	:=	LINTFLAGS64 += -mn
1112
1113lint:
1114	@echo $(LINT.c) ... $(LDLIBS)
1115	@$(LINT.c) $(SRCS) $(LDLIBS)
1116
1117$(LINTLIB):= SRCS=../port/llib-lc
1118$(LINTLIB):= CPPFLAGS += -D_MSE_INT_H
1119$(LINTLIB):= LINTFLAGS64=-nvx -Xarch=v9
1120
1121# object files that depend on inline template
1122$(TIL:%=pics/%): $(LIBCBASE)/threads/sparcv9.il
1123$(IL:%=pics/%): $(LIBCBASE)/fp/base.il
1124$(QIL:%=pics/%): ../$(MACH)/fp/__quad.il
1125#$(CIL:%=pics/%): $(LIBCBASE)/crt/muldiv64.il
1126
1127# include common libc targets
1128include ../Makefile.targ
1129
1130# We need to strip out all CTF and DOF data from the static library
1131$(LIB_PIC) := DIR = pics
1132$(LIB_PIC): pics $$(PICS)
1133	$(BUILD.AR)
1134	$(MCS) -d -n .SUNW_ctf $@ > /dev/null 2>&1
1135	$(MCS) -d -n .SUNW_dof $@ > /dev/null 2>&1
1136	$(AR) -ts $@ > /dev/null
1137	$(POST_PROCESS_A)
1138
1139# special cases
1140#$(STRETS:%=pics/%): crt/stret.s
1141#	$(AS) $(ASFLAGS) -DSTRET$(@F:stret%.o=%) crt/stret.s -o $@
1142#	$(POST_PROCESS_O)
1143
1144#crt/_rtbootld.s:	crt/_rtboot.s crt/_rtld.c
1145#	$(CC) $(CPPFLAGS) -O -S -K pic crt/_rtld.c -o crt/_rtld.s
1146#	$(CAT) crt/_rtboot.s crt/_rtld.s > $@
1147#	$(RM) crt/_rtld.s
1148
1149ASSYMDEP_OBJS=			\
1150	_lwp_mutex_unlock.o	\
1151	_stack_grow.o		\
1152	asm_subr.o		\
1153	tls_get_addr.o		\
1154	unwind_frame.o		\
1155	vforkx.o
1156
1157$(ASSYMDEP_OBJS:%=pics/%)	:=	CPPFLAGS += -I.
1158
1159$(ASSYMDEP_OBJS:%=pics/%): assym.h
1160
1161# assym.h build rules
1162
1163GENASSYM_C = ../$(MACH)/genassym.c
1164
1165# XXX	A hack.  Perhaps this should be 'CPPFLAGS.native' and
1166#	live in Makefile.master
1167
1168CPPFLAGS.genassym = \
1169	$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
1170
1171genassym: $(GENASSYM_C)
1172	$(NATIVECC) -I$(LIBCBASE)/inc -I../inc \
1173		$(CPPFLAGS.genassym) -o $@ $(GENASSYM_C)
1174
1175OFFSETS = ../$(MACH)/offsets.in
1176
1177assym.h: $(OFFSETS) genassym
1178	$(OFFSETS_CREATE) <$(OFFSETS) >$@
1179	./genassym >>$@
1180
1181# derived C source and related explicit dependencies
1182../port/gen/new_list.c: ../port/gen/errlist ../port/gen/errlist.awk
1183	cd ../port/gen; pwd; $(AWK) -f errlist.awk < errlist
1184
1185pics/new_list.o: ../port/gen/new_list.c
1186