xref: /titanic_52/usr/src/lib/libc/sparc/Makefile (revision bdfc6d18da790deeec2e0eb09c625902defe2498)
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, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2005 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	divrem64.o		\
52	hwmuldiv.o		\
53	mul64.o
54
55DYNOBJS=
56
57FPOBJS=				\
58	_D_cplx_div.o		\
59	_D_cplx_div_ix.o	\
60	_D_cplx_div_rx.o	\
61	_D_cplx_mul.o		\
62	_F_cplx_div.o		\
63	_F_cplx_div_ix.o	\
64	_F_cplx_div_rx.o	\
65	_F_cplx_mul.o		\
66	_Q_add.o		\
67	_Q_cmp.o		\
68	_Q_cmpe.o		\
69	_Q_cplx_div.o		\
70	_Q_cplx_div_ix.o	\
71	_Q_cplx_div_rx.o	\
72	_Q_cplx_lr_div.o	\
73	_Q_cplx_lr_div_ix.o	\
74	_Q_cplx_lr_div_rx.o	\
75	_Q_cplx_lr_mul.o	\
76	_Q_cplx_mul.o		\
77	_Q_div.o		\
78	_Q_dtoq.o		\
79	_Q_fcc.o		\
80	_Q_itoq.o		\
81	_Q_lltoq.o		\
82	_Q_mul.o		\
83	_Q_neg.o		\
84	_Q_qtod.o		\
85	_Q_qtoi.o		\
86	_Q_qtos.o		\
87	_Q_qtou.o		\
88	_Q_scl.o		\
89	_Q_set_except.o		\
90	_Q_sqrt.o		\
91	_Q_stoq.o		\
92	_Q_sub.o		\
93	_Q_ulltoq.o		\
94	_Q_utoq.o		\
95	__quad_mag.o
96
97FPASMOBJS=			\
98	_Q_get_rp_rd.o		\
99	fpgetmask.o		\
100	fpgetrnd.o		\
101	fpgetsticky.o		\
102	fpsetmask.o		\
103	fpsetrnd.o		\
104	fpsetsticky.o
105
106ATOMICOBJS=			\
107	atomic.o
108
109COMOBJS=			\
110	bcmp.o			\
111	bcopy.o			\
112	bzero.o			\
113	bsearch.o		\
114	memccpy.o		\
115	qsort.o			\
116	strtol.o		\
117	strtoul.o
118
119GENOBJS=			\
120	_getsp.o		\
121	_xregs_clrptr.o		\
122	abs.o			\
123	alloca.o		\
124	cuexit.o		\
125	ecvt.o			\
126	errlst.o		\
127	getctxt.o		\
128	ladd.o			\
129	lexp10.o		\
130	llog10.o		\
131	lmul.o			\
132	lock.o			\
133	lshiftl.o		\
134	lsign.o			\
135	lsub.o			\
136	makectxt.o		\
137	memchr.o		\
138	memcmp.o		\
139	memcpy.o		\
140	memmove.o		\
141	memset.o		\
142	new_list.o		\
143	setjmp.o		\
144	siginfolst.o		\
145	siglongjmp.o		\
146	sparc_data.o		\
147	strcasecmp.o		\
148	strchr.o		\
149	strcmp.o		\
150	strcpy.o		\
151	strlcpy.o		\
152	strlen.o		\
153	strncmp.o		\
154	strncpy.o		\
155	swapctxt.o		\
156	sync_instruction_memory.o
157
158# sysobjs that contain large-file interfaces
159COMSYSOBJS64=			\
160	creat64.o		\
161	fstat64.o		\
162	fstatvfs64.o		\
163	getdents64.o		\
164	getrlimit64.o		\
165	lseek64.o		\
166	lstat64.o		\
167	open64.o		\
168	pread64.o		\
169	pwrite64.o		\
170	setrlimit64.o		\
171	stat64.o		\
172	statvfs64.o
173
174SYSOBJS64=			\
175	mmap64.o
176
177COMSYSOBJS=			\
178	__clock_timer.o		\
179	__fcntl.o		\
180	__getloadavg.o		\
181	__rusagesys.o		\
182	__signotify.o		\
183	__sigrt.o		\
184	__time.o		\
185	_lgrp_home_fast.o	\
186	_lgrpsys.o		\
187	_nfssys.o		\
188	_portfs.o		\
189	_pset.o			\
190	_rename.o		\
191	_rpcsys.o		\
192	_sigaction.o		\
193	_so_accept.o		\
194	_so_bind.o		\
195	_so_connect.o		\
196	_so_getpeername.o	\
197	_so_getsockname.o	\
198	_so_getsockopt.o	\
199	_so_listen.o		\
200	_so_recv.o		\
201	_so_recvfrom.o		\
202	_so_recvmsg.o		\
203	_so_send.o		\
204	_so_sendmsg.o		\
205	_so_sendto.o		\
206	_so_setsockopt.o	\
207	_so_shutdown.o		\
208	_so_socket.o		\
209	_so_socketpair.o	\
210	_sockconfig.o		\
211	access.o		\
212	acct.o			\
213	acl.o			\
214	adjtime.o		\
215	alarm.o			\
216	brk.o			\
217	chdir.o			\
218	chmod.o			\
219	chown.o			\
220	chroot.o		\
221	cladm.o			\
222	close.o			\
223	creat.o			\
224	dup.o			\
225	execve.o		\
226	exit.o			\
227	facl.o			\
228	fchdir.o		\
229	fchmod.o		\
230	fchown.o		\
231	fchroot.o		\
232	fdsync.o		\
233	fpathconf.o		\
234	fstat.o			\
235	fstatfs.o		\
236	fstatvfs.o		\
237	getcpuid.o		\
238	getdents.o		\
239	getegid.o		\
240	geteuid.o		\
241	getgid.o		\
242	getgroups.o		\
243	gethrtime.o		\
244	getitimer.o		\
245	getmsg.o		\
246	getpagesizes.o		\
247	getpid.o		\
248	getpmsg.o		\
249	getppid.o		\
250	getrlimit.o		\
251	getuid.o		\
252	gtty.o			\
253	install_utrap.o		\
254	ioctl.o			\
255	kaio.o			\
256	kill.o			\
257	lchown.o		\
258	link.o			\
259	llseek.o		\
260	lseek.o			\
261	lstat.o			\
262	memcntl.o		\
263	mincore.o		\
264	mkdir.o			\
265	mknod.o			\
266	mmap.o			\
267	modctl.o		\
268	mount.o			\
269	mprotect.o		\
270	munmap.o		\
271	nice.o			\
272	ntp_adjtime.o		\
273	ntp_gettime.o		\
274	open.o			\
275	p_online.o		\
276	pathconf.o		\
277	pause.o			\
278	pcsample.o		\
279	pollsys.o		\
280	pread.o			\
281	priocntlset.o		\
282	processor_bind.o	\
283	processor_info.o	\
284	profil.o		\
285	putmsg.o		\
286	putpmsg.o		\
287	pwrite.o		\
288	read.o			\
289	readlink.o		\
290	readv.o			\
291	resolvepath.o		\
292	rmdir.o			\
293	seteguid.o		\
294	setgid.o		\
295	setgroups.o		\
296	setitimer.o		\
297	setreid.o		\
298	setrlimit.o		\
299	setuid.o		\
300	sigaltstk.o		\
301	sigprocmsk.o		\
302	sigsendset.o		\
303	sigsuspend.o		\
304	stat.o			\
305	statfs.o		\
306	statvfs.o		\
307	stty.o			\
308	symlink.o		\
309	sync.o			\
310	sysconfig.o		\
311	sysfs.o			\
312	sysinfo.o		\
313	syslwp.o		\
314	times.o			\
315	ulimit.o		\
316	umask.o			\
317	umount2.o		\
318	unlink.o		\
319	utime.o			\
320	utimes.o		\
321	utssys.o		\
322	vhangup.o		\
323	waitid.o		\
324	write.o			\
325	writev.o		\
326	yield.o
327
328SYSOBJS=			\
329	__clock_gettime.o	\
330	__getcontext.o		\
331	_lwp_mutex_unlock.o	\
332	_stack_grow.o		\
333	door.o			\
334	fork1.o			\
335	forkall.o		\
336	gettimeofday.o		\
337	pipe.o			\
338	ptrace.o		\
339	syscall.o		\
340	syssun.o		\
341	tls_get_addr.o		\
342	uadmin.o		\
343	umount.o		\
344	uname.o			\
345	vfork.o
346
347# objects under ../port which contain transitional large file interfaces
348PORTGEN64=			\
349	_xftw64.o		\
350	attropen64.o		\
351	ftw64.o			\
352	mkstemp64.o		\
353	nftw64.o		\
354	tell64.o		\
355	truncate64.o
356
357# objects from source under ../port
358PORTFP=				\
359	__flt_decim.o		\
360	__flt_rounds.o		\
361	__tbl_10_b.o		\
362	__tbl_10_h.o		\
363	__tbl_10_s.o		\
364	__tbl_2_b.o		\
365	__tbl_2_h.o		\
366	__tbl_2_s.o		\
367	__tbl_fdq.o		\
368	__tbl_tens.o		\
369	__x_power.o		\
370	_base_sup.o		\
371	aconvert.o		\
372	decimal_bin.o		\
373	double_decim.o		\
374	econvert.o		\
375	fconvert.o		\
376	file_decim.o		\
377	finite.o		\
378	fp_data.o		\
379	func_decim.o		\
380	gconvert.o		\
381	hex_bin.o		\
382	ieee_globals.o		\
383	pack_float.o		\
384	sigfpe.o		\
385	string_decim.o		\
386	ashldi3.o		\
387	ashrdi3.o		\
388	cmpdi2.o		\
389	divdi3.o		\
390	floatdidf.o		\
391	floatdisf.o		\
392	lshrdi3.o		\
393	moddi3.o		\
394	muldi3.o		\
395	qdivrem.o		\
396	ucmpdi2.o  		\
397	udivdi3.o		\
398	umoddi3.o
399
400PORTGEN=			\
401	_env_data.o		\
402	_ftoll.o		\
403	_ftoull.o		\
404	_xftw.o			\
405	a64l.o			\
406	abort.o			\
407	addsev.o		\
408	assert.o		\
409	atof.o			\
410	atoi.o			\
411	atol.o			\
412	atoll.o			\
413	attropen.o		\
414	atexit.o		\
415	atfork.o		\
416	basename.o		\
417	calloc.o		\
418	catgets.o		\
419	catopen.o		\
420	cfgetispeed.o		\
421	cfgetospeed.o		\
422	cfree.o			\
423	cfsetispeed.o		\
424	cfsetospeed.o		\
425	cftime.o		\
426	clock.o			\
427	closedir.o		\
428	closefrom.o		\
429	confstr.o		\
430	crypt.o			\
431	csetlen.o		\
432	ctime.o			\
433	ctime_r.o		\
434	directio.o		\
435	dirname.o		\
436	div.o			\
437	drand48.o		\
438	dup2.o			\
439	env_data.o		\
440	errno.o			\
441	euclen.o		\
442	event_port.o		\
443	execvp.o		\
444	fattach.o		\
445	fdetach.o		\
446	fdopendir.o		\
447	ffs.o			\
448	fmtmsg.o		\
449	ftime.o			\
450	ftok.o			\
451	ftw.o			\
452	gcvt.o			\
453	getauxv.o		\
454	getcwd.o		\
455	getdate_err.o		\
456	getdtblsize.o		\
457	getenv.o		\
458	getexecname.o		\
459	getgrnam.o		\
460	getgrnam_r.o		\
461	gethostid.o		\
462	gethostname.o		\
463	gethz.o			\
464	getisax.o		\
465	getloadavg.o		\
466	getlogin.o		\
467	getmntent.o		\
468	getnetgrent.o		\
469	getopt.o		\
470	getopt_long.o		\
471	getpagesize.o		\
472	getpw.o			\
473	getpwnam.o		\
474	getpwnam_r.o		\
475	getrusage.o		\
476	getspent.o		\
477	getspent_r.o		\
478	getsubopt.o		\
479	gettxt.o		\
480	getusershell.o		\
481	getut.o			\
482	getutx.o		\
483	getvfsent.o		\
484	getwd.o			\
485	getwidth.o		\
486	getxby_door.o		\
487	gtxt.o			\
488	hsearch.o		\
489	iconv.o			\
490	imaxabs.o		\
491	imaxdiv.o		\
492	index.o			\
493	initgroups.o		\
494	insque.o		\
495	isaexec.o		\
496	isastream.o		\
497	isatty.o		\
498	killpg.o		\
499	l64a.o			\
500	lckpwdf.o		\
501	lconstants.o		\
502	ldivide.o		\
503	lfind.o			\
504	lfmt.o			\
505	lfmt_log.o		\
506	llabs.o			\
507	lldiv.o			\
508	lltostr.o		\
509	localtime.o		\
510	lsearch.o		\
511	madvise.o		\
512	malloc.o		\
513	memalign.o		\
514	mkdev.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
780THREADSOBJS=			\
781	alloc.o			\
782	assfail.o		\
783	cancel.o		\
784	door_calls.o		\
785	pthr_attr.o		\
786	pthr_barrier.o		\
787	pthr_cond.o		\
788	pthr_mutex.o		\
789	pthr_rwlock.o		\
790	pthread.o		\
791	rtsched.o		\
792	rwlock.o		\
793	scalls.o		\
794	sema.o			\
795	sigaction.o		\
796	spawn.o			\
797	synch.o			\
798	tdb_agent.o		\
799	thr.o			\
800	thread_interface.o	\
801	tls.o			\
802	tsd.o
803
804THREADSMACHOBJS=		\
805	machdep.o
806
807THREADSASMOBJS=			\
808	asm_subr.o
809
810UNWINDMACHOBJS=			\
811	unwind.o
812
813UNWINDASMOBJS=			\
814	unwind_frame.o
815
816# objects that implement the transitional large file API
817PORTSYS64=			\
818	fstatat64.o		\
819	lockf64.o		\
820	openat64.o
821
822PORTSYS=			\
823	_autofssys.o		\
824	acctctl.o		\
825	bsd_signal.o		\
826	corectl.o		\
827	exacctsys.o		\
828	execl.o			\
829	execle.o		\
830	execv.o			\
831	fcntl.o			\
832	fsmisc.o		\
833	fstatat.o		\
834	fsync.o			\
835	getpeerucred.o		\
836	inst_sync.o		\
837	issetugid.o		\
838	libc_link.o		\
839	libc_open.o		\
840	lockf.o			\
841	lwp.o			\
842	lwp_cond.o		\
843	lwp_rwlock.o		\
844	lwp_sigmask.o		\
845	meminfosys.o		\
846	msgsys.o		\
847	nfssys.o		\
848	openat.o		\
849	pgrpsys.o		\
850	posix_sigwait.o		\
851	ppriv.o			\
852	psetsys.o		\
853	rctlsys.o		\
854	sbrk.o			\
855	semsys.o		\
856	set_errno.o		\
857	shmsys.o		\
858	siginterrupt.o		\
859	signal.o		\
860	sigpending.o		\
861	sigstack.o		\
862	tasksys.o		\
863	time.o			\
864	time_util.o		\
865	ucontext.o		\
866	ustat.o			\
867	zone.o
868
869PORTREGEX=			\
870	glob.o			\
871	regcmp.o		\
872	regex.o			\
873	wordexp.o
874
875MOSTOBJS=			\
876	$(STRETS)		\
877	$(CRTOBJS)		\
878	$(DYNOBJS)		\
879	$(FPOBJS)		\
880	$(FPASMOBJS)		\
881	$(ATOMICOBJS)		\
882	$(COMOBJS)		\
883	$(GENOBJS)		\
884	$(PORTFP)		\
885	$(PORTGEN)		\
886	$(PORTGEN64)		\
887	$(PORTI18N)		\
888	$(PORTI18N_COND)	\
889	$(PORTPRINT)		\
890	$(PORTPRINT_C89)	\
891	$(PORTPRINT_W)		\
892	$(PORTREGEX)		\
893	$(PORTSTDIO)		\
894	$(PORTSTDIO64)		\
895	$(PORTSTDIO_C89)	\
896	$(PORTSTDIO_W)		\
897	$(PORTSYS)		\
898	$(PORTSYS64)		\
899	$(THREADSOBJS)		\
900	$(THREADSMACHOBJS)	\
901	$(THREADSASMOBJS)	\
902	$(UNWINDMACHOBJS)	\
903	$(UNWINDASMOBJS)	\
904	$(COMSYSOBJS)		\
905	$(SYSOBJS)		\
906	$(COMSYSOBJS64)		\
907	$(SYSOBJS64)
908
909TRACEOBJS=			\
910	plockstat.o
911
912# NOTE:	libc.so.1 must be linked with the minimal crti.o and crtn.o
913# modules whose source is provided in the $(SRC)/lib/common directory.
914# This must be done because otherwise the Sun C compiler would insert
915# its own versions of these modules and those versions contain code
916# to call out to C++ initialization functions.  Such C++ initialization
917# functions can call back into libc before thread initialization is
918# complete and this leads to segmentation violations and other problems.
919# Since libc contains no C++ code, linking with the minimal crti.o and
920# crtn.o modules is safe and avoids the problems described above.
921OBJECTS= $(CRTI) $(MOSTOBJS) $(CRTN)
922CRTSRCS= ../../common/sparc
923
924# include common library definitions
925include ../../Makefile.lib
926
927# NOTE: libc_i18n.a will be part of libc.so.1.  Therefore, the compilation
928# conditions such as the settings of CFLAGS and CPPFLAGS for the libc_i18n stuff
929# need to be compatible with the ones for the libc stuff.  Whenever the changes
930# that affect the compilation conditions of libc happened, those for libc_i18n
931# also need to be updated.
932
933CFLAGS += $(CCVERBOSE)
934
935# This is necessary to avoid problems with calling _ex_unwind().
936# We probably don't want any inlining anyway.
937CFLAGS += -xinline=
938
939# Setting THREAD_DEBUG = -DTHREAD_DEBUG (make THREAD_DEBUG=-DTHREAD_DEBUG ...)
940# enables ASSERT() checking in the threads portion of the library.
941# This is automatically enabled for DEBUG builds, not for non-debug builds.
942THREAD_DEBUG =
943$(NOT_RELEASE_BUILD)THREAD_DEBUG = -DTHREAD_DEBUG
944
945CFLAGS += $(THREAD_DEBUG)
946
947ALTPICS= $(TRACEOBJS:%=pics/%)
948
949$(DYNLIB) := PICS += $(ROOTFS_LIBDIR)/libc_i18n.a
950$(DYNLIB) := BUILD.SO = $(LD) -o $@ -G $(DYNFLAGS) $(PICS) $(ALTPICS)
951
952MAPDIR=		../spec/sparc
953MAPFILE=	$(MAPDIR)/mapfile
954
955CFLAGS +=	$(EXTN_CFLAGS)
956CPPFLAGS=	-D_REENTRANT -Dsparc $(EXTN_CPPFLAGS) \
957		-I$(LIBCBASE)/inc -I../inc $(CPPFLAGS.master)
958ASFLAGS=	-K pic -P -D__STDC__ -D_ASM $(CPPFLAGS) -xarch=v8plus
959
960# Inform the run-time linker about libc specialized initialization
961RTLDINFO =	-z rtldinfo=tls_rtldinfo
962
963DYNFLAGS +=	-e __rtboot -M $(MAPFILE) $(RTLDINFO)
964DYNFLAGS +=	$(EXTN_DYNFLAGS)
965
966BUILD.s=	$(AS) $(ASFLAGS) $< -o $@
967
968# Override this top level flag so the compiler builds in its native
969# C99 mode.  This has been enabled to support the complex arithmetic
970# added to libc.
971C99MODE=	$(C99_ENABLE)
972
973# libc method of building an archive
974BUILD.AR= $(RM) $@ ; \
975	$(AR) q $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%)| $(TSORT)`
976
977# extra files for the clean target
978CLEANFILES=			\
979	../port/gen/errlst.c	\
980	../port/gen/new_list.c	\
981	assym.h			\
982	genassym		\
983	crt/_rtld.s		\
984	crt/_rtbootld.s		\
985	pics/_rtbootld.o	\
986	pics/crti.o		\
987	pics/crtn.o		\
988	pics/values-Xa.o	\
989	$(ALTPICS)
990
991CLOBBERFILES +=	$(MAPFILE) $(LIB_PIC)
992
993# list of C source for lint
994SRCS=							\
995	$(ATOMICOBJS:%.o=$(SRC)/common/atomic/%.c)	\
996	$(COMOBJS:%.o=$(SRC)/common/util/%.c)		\
997	$(PORTFP:%.o=../port/fp/%.c)			\
998	$(PORTGEN:%.o=../port/gen/%.c)			\
999	$(PORTI18N:%.o=../port/i18n/%.c)		\
1000	$(PORTPRINT:%.o=../port/print/%.c)		\
1001	$(PORTREGEX:%.o=../port/regex/%.c)		\
1002	$(PORTSTDIO:%.o=../port/stdio/%.c)		\
1003	$(PORTSYS:%.o=../port/sys/%.c)			\
1004	$(THREADSOBJS:%.o=../port/threads/%.c)		\
1005	$(THREADSMACHOBJS:%.o=../$(MACH)/threads/%.c)	\
1006	$(UNWINDMACHOBJS:%.o=../port/unwind/%.c)	\
1007	$(FPOBJS:%.o=../$(MACH)/fp/%.c)			\
1008	$(LIBCBASE)/crt/_ftou.c				\
1009	$(LIBCBASE)/crt/divrem64.c			\
1010	$(LIBCBASE)/crt/mul64.c				\
1011	$(LIBCBASE)/gen/_xregs_clrptr.c			\
1012	$(LIBCBASE)/gen/ecvt.c				\
1013	$(LIBCBASE)/gen/getctxt.c			\
1014	$(LIBCBASE)/gen/lexp10.c			\
1015	$(LIBCBASE)/gen/llog10.c			\
1016	$(LIBCBASE)/gen/lmul.c				\
1017	$(LIBCBASE)/gen/makectxt.c			\
1018	$(LIBCBASE)/gen/siginfolst.c			\
1019	$(LIBCBASE)/gen/siglongjmp.c			\
1020	$(LIBCBASE)/gen/swapctxt.c			\
1021	$(LIBCBASE)/sys/ptrace.c
1022
1023# conditional assignments
1024$(DYNLIB) $(LIB_PIC) := DYNOBJS = _rtbootld.o
1025$(DYNLIB) := CRTI = crti.o values-Xa.o
1026$(DYNLIB) := CRTN = crtn.o
1027
1028$(DYNLIB):	$(MAPFILE)
1029
1030$(MAPFILE):
1031	@cd $(MAPDIR); $(MAKE) mapfile
1032
1033# Files which need the threads .il inline template
1034TIL=				\
1035	alloc.o			\
1036	assfail.o		\
1037	atexit.o		\
1038	atfork.o		\
1039	cancel.o		\
1040	door_calls.o		\
1041	errno.o			\
1042	getctxt.o		\
1043	lwp.o			\
1044	machdep.o		\
1045	pthr_attr.o		\
1046	pthr_barrier.o		\
1047	pthr_cond.o		\
1048	pthr_mutex.o		\
1049	pthr_rwlock.o		\
1050	pthread.o		\
1051	rand.o			\
1052	rtsched.o		\
1053	rwlock.o		\
1054	scalls.o		\
1055	sema.o			\
1056	sigaction.o		\
1057	spawn.o			\
1058	stack.o			\
1059	swapctxt.o		\
1060	synch.o			\
1061	tdb_agent.o		\
1062	thr.o			\
1063	thread_interface.o	\
1064	tls.o			\
1065	tsd.o			\
1066	unwind.o
1067
1068$(TIL:%=pics/%) := CFLAGS += $(LIBCBASE)/threads/sparc.il
1069
1070# Files in port/fp subdirectory that need base.il inline template
1071IL=				\
1072	__flt_decim.o		\
1073	decimal_bin.o
1074
1075$(IL:%=pics/%) := CFLAGS += $(LIBCBASE)/fp/base.il
1076
1077# Files in fp subdirectory which need __quad.il inline template
1078QIL=				\
1079	_Q_add.o		\
1080	_Q_cmp.o		\
1081	_Q_cmpe.o		\
1082	_Q_div.o		\
1083	_Q_dtoq.o		\
1084	_Q_fcc.o		\
1085	_Q_mul.o		\
1086	_Q_qtod.o		\
1087	_Q_qtoi.o		\
1088	_Q_qtos.o		\
1089	_Q_qtou.o		\
1090	_Q_sqrt.o		\
1091	_Q_stoq.o		\
1092	_Q_sub.o
1093
1094$(QIL:%=pics/%) := CFLAGS += ../$(MACH)/fp/__quad.il
1095pics/_Q%.o := sparc_COPTFLAG = -xO4 -dalign
1096pics/__quad%.o := sparc_COPTFLAG = -xO4 -dalign
1097
1098# Files in crt subdirectory which need muldiv64.il inline template
1099CIL=	mul64.o divrem64.o
1100$(CIL:%=pics/%) := CFLAGS += $(LIBCBASE)/crt/muldiv64.il
1101
1102# large-file-aware components that should be built large
1103
1104$(COMSYSOBJS64:%=pics/%) := \
1105	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1106
1107$(SYSOBJS64:%=pics/%) := \
1108	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1109
1110$(PORTGEN64:%=pics/%) := \
1111	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1112
1113$(PORTSTDIO64:%=pics/%) := \
1114	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1115
1116$(PORTSYS64:%=pics/%) := \
1117	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1118
1119$(PORTSTDIO_W:%=pics/%) := \
1120	CPPFLAGS += -D_WIDE
1121
1122$(PORTPRINT_W:%=pics/%) := \
1123	CPPFLAGS += -D_WIDE
1124
1125# printf/scanf functions to support c89-sized intmax_t variables
1126$(PORTPRINT_C89:%=pics/%) := \
1127	CPPFLAGS += -D_C89_INTMAX32
1128
1129$(PORTSTDIO_C89:%=pics/%) := \
1130	CPPFLAGS += -D_C89_INTMAX32
1131
1132$(PORTI18N_COND:%=pics/%) := \
1133	CPPFLAGS += -D_WCS_LONGLONG
1134
1135# Files which need extra optimization
1136pics/getenv.o := sparc_COPTFLAG = -xO4
1137
1138.KEEP_STATE:
1139
1140all: $(LIBS) $(LIB_PIC)
1141
1142lint	:=	CPPFLAGS += -I../$(MACH)/fp
1143lint	:=	CPPFLAGS += -D_MSE_INT_H -D_LCONV_C99
1144lint	:=	LINTFLAGS += -mn
1145
1146lint:
1147	@echo $(LINT.c) ... $(LDLIBS)
1148	@$(LINT.c) $(SRCS) $(LDLIBS)
1149
1150# these aren't listed as $(PICS), so we need to force CTF
1151pics/values-Xa.o := CFLAGS += $(CTF_FLAGS)
1152pics/values-Xa.o := CTFCONVERT_POST = $(CTFCONVERT_O)
1153
1154$(LINTLIB):= SRCS=../port/llib-lc
1155$(LINTLIB):= CPPFLAGS += -D_MSE_INT_H
1156$(LINTLIB):= LINTFLAGS=-nvx
1157
1158# object files that depend on inline template
1159$(TIL:%=pics/%): $(LIBCBASE)/threads/sparc.il
1160$(IL:%=pics/%): $(LIBCBASE)/fp/base.il
1161$(QIL:%=pics/%): ../$(MACH)/fp/__quad.il
1162$(CIL:%=pics/%): $(LIBCBASE)/crt/muldiv64.il
1163
1164# include common libc targets
1165include ../Makefile.targ
1166
1167pics/getxby_door.o := CCMODE =
1168
1169# We need to strip out all CTF and DOF data from the static library
1170$(LIB_PIC) := DIR = pics
1171$(LIB_PIC): pics $$(PICS)
1172	$(BUILD.AR)
1173	$(MCS) -d -n .SUNW_ctf $@ > /dev/null 2>&1
1174	$(MCS) -d -n .SUNW_dof $@ > /dev/null 2>&1
1175	$(AR) -ts $@ > /dev/null
1176	$(POST_PROCESS_A)
1177
1178# special cases
1179$(STRETS:%=pics/%): crt/stret.s
1180	$(AS) $(ASFLAGS) -DSTRET$(@F:stret%.o=%) crt/stret.s -o $@
1181	$(POST_PROCESS_O)
1182
1183crt/_rtbootld.s:	crt/_rtboot.s crt/_rtld.c
1184	$(CC) $(CPPFLAGS) $(CTF_FLAGS) -O -S -K pic \
1185	    crt/_rtld.c -o crt/_rtld.s
1186	$(CAT) crt/_rtboot.s crt/_rtld.s > $@
1187	$(RM) crt/_rtld.s
1188
1189# partially built from C source
1190pics/_rtbootld.o: crt/_rtbootld.s
1191	$(AS) $(ASFLAGS) crt/_rtbootld.s -o $@
1192	$(CTFCONVERT_O)
1193
1194ASSYMDEP_OBJS=			\
1195	_lwp_mutex_unlock.o	\
1196	_stack_grow.o		\
1197	asm_subr.o		\
1198	tls_get_addr.o		\
1199	unwind_frame.o		\
1200	vfork.o
1201
1202$(ASSYMDEP_OBJS:%=pics/%)	:=	CPPFLAGS += -I.
1203
1204$(ASSYMDEP_OBJS:%=pics/%): assym.h
1205
1206# assym.h build rules
1207
1208GENASSYM_C = ../$(MACH)/genassym.c
1209
1210# XXX	A hack.  Perhaps this should be 'CPPFLAGS.native' and
1211#	live in Makefile.master
1212
1213CPPFLAGS.genassym = \
1214	$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
1215
1216genassym: $(GENASSYM_C)
1217	$(NATIVECC) -I$(LIBCBASE)/inc -I../inc \
1218		$(CPPFLAGS.genassym) -o $@ $(GENASSYM_C)
1219
1220OFFSETS = ../$(MACH)/offsets.in
1221
1222assym.h: $(OFFSETS) genassym
1223	$(OFFSETS_CREATE) <$(OFFSETS) >$@
1224	./genassym >>$@
1225
1226# derived C source and related explicit dependencies
1227../port/gen/errlst.c + \
1228../port/gen/new_list.c: ../port/gen/errlist ../port/gen/errlist.awk
1229	cd ../port/gen; pwd; $(AWK) -f errlist.awk < errlist
1230
1231pics/errlst.o: ../port/gen/errlst.c
1232
1233pics/new_list.o: ../port/gen/new_list.c
1234