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