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