xref: /illumos-gate/usr/src/lib/libc/sparc/Makefile (revision fa9e4066f08beec538e775443c5be79dd423fcab)
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	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
104ATOMICOBJS=			\
105	atomic.o
106
107COMOBJS=			\
108	bcmp.o			\
109	bcopy.o			\
110	bzero.o			\
111	bsearch.o		\
112	memccpy.o		\
113	qsort.o			\
114	strtol.o		\
115	strtoul.o
116
117GENOBJS=			\
118	_getsp.o		\
119	_xregs_clrptr.o		\
120	abs.o			\
121	alloca.o		\
122	cuexit.o		\
123	ecvt.o			\
124	errlst.o		\
125	getctxt.o		\
126	ladd.o			\
127	lexp10.o		\
128	llog10.o		\
129	lmul.o			\
130	lock.o			\
131	lshiftl.o		\
132	lsign.o			\
133	lsub.o			\
134	makectxt.o		\
135	memchr.o		\
136	memcmp.o		\
137	memcpy.o		\
138	memmove.o		\
139	memset.o		\
140	new_list.o		\
141	setjmp.o		\
142	siginfolst.o		\
143	siglongjmp.o		\
144	sparc_data.o		\
145	strcasecmp.o		\
146	strchr.o		\
147	strcmp.o		\
148	strcpy.o		\
149	strlcpy.o		\
150	strlen.o		\
151	strncmp.o		\
152	strncpy.o		\
153	swapctxt.o		\
154	sync_instruction_memory.o
155
156# sysobjs that contain large-file interfaces
157COMSYSOBJS64=			\
158	creat64.o		\
159	fstat64.o		\
160	fstatvfs64.o		\
161	getdents64.o		\
162	getrlimit64.o		\
163	lseek64.o		\
164	lstat64.o		\
165	open64.o		\
166	pread64.o		\
167	pwrite64.o		\
168	setrlimit64.o		\
169	stat64.o		\
170	statvfs64.o
171
172SYSOBJS64=			\
173	mmap64.o
174
175COMSYSOBJS=			\
176	__clock_timer.o		\
177	__fcntl.o		\
178	__getloadavg.o		\
179	__rusagesys.o		\
180	__signotify.o		\
181	__sigrt.o		\
182	__time.o		\
183	_lgrp_home_fast.o	\
184	_lgrpsys.o		\
185	_nfssys.o		\
186	_portfs.o		\
187	_pset.o			\
188	_rename.o		\
189	_rpcsys.o		\
190	_sigaction.o		\
191	_so_accept.o		\
192	_so_bind.o		\
193	_so_connect.o		\
194	_so_getpeername.o	\
195	_so_getsockname.o	\
196	_so_getsockopt.o	\
197	_so_listen.o		\
198	_so_recv.o		\
199	_so_recvfrom.o		\
200	_so_recvmsg.o		\
201	_so_send.o		\
202	_so_sendmsg.o		\
203	_so_sendto.o		\
204	_so_setsockopt.o	\
205	_so_shutdown.o		\
206	_so_socket.o		\
207	_so_socketpair.o	\
208	_sockconfig.o		\
209	access.o		\
210	acct.o			\
211	acl.o			\
212	adjtime.o		\
213	alarm.o			\
214	brk.o			\
215	chdir.o			\
216	chmod.o			\
217	chown.o			\
218	chroot.o		\
219	cladm.o			\
220	close.o			\
221	creat.o			\
222	dup.o			\
223	execve.o		\
224	exit.o			\
225	facl.o			\
226	fchdir.o		\
227	fchmod.o		\
228	fchown.o		\
229	fchroot.o		\
230	fdsync.o		\
231	fpathconf.o		\
232	fstat.o			\
233	fstatfs.o		\
234	fstatvfs.o		\
235	getcpuid.o		\
236	getdents.o		\
237	getegid.o		\
238	geteuid.o		\
239	getgid.o		\
240	getgroups.o		\
241	gethrtime.o		\
242	getitimer.o		\
243	getmsg.o		\
244	getpagesizes.o		\
245	getpid.o		\
246	getpmsg.o		\
247	getppid.o		\
248	getrlimit.o		\
249	getuid.o		\
250	gtty.o			\
251	install_utrap.o		\
252	ioctl.o			\
253	kaio.o			\
254	kill.o			\
255	lchown.o		\
256	link.o			\
257	llseek.o		\
258	lseek.o			\
259	lstat.o			\
260	memcntl.o		\
261	mincore.o		\
262	mkdir.o			\
263	mknod.o			\
264	mmap.o			\
265	modctl.o		\
266	mount.o			\
267	mprotect.o		\
268	munmap.o		\
269	nice.o			\
270	ntp_adjtime.o		\
271	ntp_gettime.o		\
272	open.o			\
273	p_online.o		\
274	pathconf.o		\
275	pause.o			\
276	pcsample.o		\
277	pollsys.o		\
278	pread.o			\
279	priocntlset.o		\
280	processor_bind.o	\
281	processor_info.o	\
282	profil.o		\
283	putmsg.o		\
284	putpmsg.o		\
285	pwrite.o		\
286	read.o			\
287	readlink.o		\
288	readv.o			\
289	resolvepath.o		\
290	rmdir.o			\
291	seteguid.o		\
292	setgid.o		\
293	setgroups.o		\
294	setitimer.o		\
295	setreid.o		\
296	setrlimit.o		\
297	setuid.o		\
298	sigaltstk.o		\
299	sigprocmsk.o		\
300	sigsendset.o		\
301	sigsuspend.o		\
302	stat.o			\
303	statfs.o		\
304	statvfs.o		\
305	stty.o			\
306	symlink.o		\
307	sync.o			\
308	sysconfig.o		\
309	sysfs.o			\
310	sysinfo.o		\
311	syslwp.o		\
312	times.o			\
313	ulimit.o		\
314	umask.o			\
315	umount2.o		\
316	unlink.o		\
317	utime.o			\
318	utimes.o		\
319	utssys.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	ffs.o			\
446	fmtmsg.o		\
447	ftime.o			\
448	ftok.o			\
449	ftw.o			\
450	gcvt.o			\
451	getauxv.o		\
452	getcwd.o		\
453	getdate_err.o		\
454	getdtblsize.o		\
455	getenv.o		\
456	getexecname.o		\
457	getgrnam.o		\
458	getgrnam_r.o		\
459	gethostid.o		\
460	gethostname.o		\
461	gethz.o			\
462	getisax.o		\
463	getloadavg.o		\
464	getlogin.o		\
465	getmntent.o		\
466	getnetgrent.o		\
467	getopt.o		\
468	getopt_long.o		\
469	getpagesize.o		\
470	getpw.o			\
471	getpwnam.o		\
472	getpwnam_r.o		\
473	getrusage.o		\
474	getspent.o		\
475	getspent_r.o		\
476	getsubopt.o		\
477	gettxt.o		\
478	getusershell.o		\
479	getut.o			\
480	getutx.o		\
481	getvfsent.o		\
482	getwd.o			\
483	getwidth.o		\
484	getxby_door.o		\
485	gtxt.o			\
486	hsearch.o		\
487	iconv.o			\
488	imaxabs.o		\
489	imaxdiv.o		\
490	index.o			\
491	initgroups.o		\
492	insque.o		\
493	isaexec.o		\
494	isastream.o		\
495	isatty.o		\
496	killpg.o		\
497	l64a.o			\
498	lckpwdf.o		\
499	lconstants.o		\
500	ldivide.o		\
501	lfind.o			\
502	lfmt.o			\
503	lfmt_log.o		\
504	llabs.o			\
505	lldiv.o			\
506	lltostr.o		\
507	localtime.o		\
508	lsearch.o		\
509	madvise.o		\
510	malloc.o		\
511	memalign.o		\
512	mkdev.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
778THREADSOBJS=			\
779	alloc.o			\
780	assfail.o		\
781	cancel.o		\
782	door_calls.o		\
783	pthr_attr.o		\
784	pthr_barrier.o		\
785	pthr_cond.o		\
786	pthr_mutex.o		\
787	pthr_rwlock.o		\
788	pthread.o		\
789	rtsched.o		\
790	rwlock.o		\
791	scalls.o		\
792	sema.o			\
793	sigaction.o		\
794	spawn.o			\
795	synch.o			\
796	tdb_agent.o		\
797	thr.o			\
798	thread_interface.o	\
799	tls.o			\
800	tsd.o
801
802THREADSMACHOBJS=		\
803	machdep.o
804
805THREADSASMOBJS=			\
806	asm_subr.o
807
808UNWINDMACHOBJS=			\
809	unwind.o
810
811UNWINDASMOBJS=			\
812	unwind_frame.o
813
814# objects that implement the transitional large file API
815PORTSYS64=			\
816	fstatat64.o		\
817	lockf64.o		\
818	openat64.o
819
820PORTSYS=			\
821	_autofssys.o		\
822	acctctl.o		\
823	bsd_signal.o		\
824	corectl.o		\
825	exacctsys.o		\
826	execl.o			\
827	execle.o		\
828	execv.o			\
829	fcntl.o			\
830	fsmisc.o		\
831	fstatat.o		\
832	fsync.o			\
833	getpeerucred.o		\
834	inst_sync.o		\
835	issetugid.o		\
836	libc_link.o		\
837	libc_open.o		\
838	lockf.o			\
839	lwp.o			\
840	lwp_cond.o		\
841	lwp_rwlock.o		\
842	lwp_sigmask.o		\
843	meminfosys.o		\
844	msgsys.o		\
845	nfssys.o		\
846	openat.o		\
847	pgrpsys.o		\
848	posix_sigwait.o		\
849	ppriv.o			\
850	psetsys.o		\
851	rctlsys.o		\
852	sbrk.o			\
853	semsys.o		\
854	set_errno.o		\
855	shmsys.o		\
856	siginterrupt.o		\
857	signal.o		\
858	sigpending.o		\
859	sigstack.o		\
860	tasksys.o		\
861	time.o			\
862	time_util.o		\
863	ucontext.o		\
864	ustat.o			\
865	zone.o
866
867PORTREGEX=			\
868	glob.o			\
869	regcmp.o		\
870	regex.o			\
871	wordexp.o
872
873MOSTOBJS=			\
874	$(STRETS)		\
875	$(CRTOBJS)		\
876	$(DYNOBJS)		\
877	$(FPOBJS)		\
878	$(FPASMOBJS)		\
879	$(ATOMICOBJS)		\
880	$(COMOBJS)		\
881	$(GENOBJS)		\
882	$(PORTFP)		\
883	$(PORTGEN)		\
884	$(PORTGEN64)		\
885	$(PORTI18N)		\
886	$(PORTI18N_COND)	\
887	$(PORTPRINT)		\
888	$(PORTPRINT_C89)	\
889	$(PORTPRINT_W)		\
890	$(PORTREGEX)		\
891	$(PORTSTDIO)		\
892	$(PORTSTDIO64)		\
893	$(PORTSTDIO_C89)	\
894	$(PORTSTDIO_W)		\
895	$(PORTSYS)		\
896	$(PORTSYS64)		\
897	$(THREADSOBJS)		\
898	$(THREADSMACHOBJS)	\
899	$(THREADSASMOBJS)	\
900	$(UNWINDMACHOBJS)	\
901	$(UNWINDASMOBJS)	\
902	$(COMSYSOBJS)		\
903	$(SYSOBJS)		\
904	$(COMSYSOBJS64)		\
905	$(SYSOBJS64)
906
907TRACEOBJS=			\
908	plockstat.o
909
910# NOTE:	libc.so.1 must be linked with the minimal crti.o and crtn.o
911# modules whose source is provided in the $(SRC)/lib/common directory.
912# This must be done because otherwise the Sun C compiler would insert
913# its own versions of these modules and those versions contain code
914# to call out to C++ initialization functions.  Such C++ initialization
915# functions can call back into libc before thread initialization is
916# complete and this leads to segmentation violations and other problems.
917# Since libc contains no C++ code, linking with the minimal crti.o and
918# crtn.o modules is safe and avoids the problems described above.
919OBJECTS= $(CRTI) $(MOSTOBJS) $(CRTN)
920CRTSRCS= ../../common/sparc
921
922# include common library definitions
923include ../../Makefile.lib
924
925# NOTE: libc_i18n.a will be part of libc.so.1.  Therefore, the compilation
926# conditions such as the settings of CFLAGS and CPPFLAGS for the libc_i18n stuff
927# need to be compatible with the ones for the libc stuff.  Whenever the changes
928# that affect the compilation conditions of libc happened, those for libc_i18n
929# also need to be updated.
930
931CFLAGS += $(CCVERBOSE)
932
933# This is necessary to avoid problems with calling _ex_unwind().
934# We probably don't want any inlining anyway.
935CFLAGS += -xinline=
936
937# Setting THREAD_DEBUG = -DTHREAD_DEBUG (make THREAD_DEBUG=-DTHREAD_DEBUG ...)
938# enables ASSERT() checking in the threads portion of the library.
939# This is automatically enabled for DEBUG builds, not for non-debug builds.
940THREAD_DEBUG =
941$(NOT_RELEASE_BUILD)THREAD_DEBUG = -DTHREAD_DEBUG
942
943CFLAGS += $(THREAD_DEBUG)
944
945ALTPICS= $(TRACEOBJS:%=pics/%)
946
947$(DYNLIB) := PICS += $(ROOTFS_LIBDIR)/libc_i18n.a
948$(DYNLIB) := BUILD.SO = $(LD) -o $@ -G $(DYNFLAGS) $(PICS) $(ALTPICS)
949
950MAPDIR=		../spec/sparc
951MAPFILE=	$(MAPDIR)/mapfile
952
953CFLAGS +=	$(EXTN_CFLAGS)
954CPPFLAGS=	-D_REENTRANT -Dsparc $(EXTN_CPPFLAGS) \
955		-I$(LIBCBASE)/inc -I../inc $(CPPFLAGS.master)
956ASFLAGS=	-K pic -P -D__STDC__ -D_ASM $(CPPFLAGS) -xarch=v8plus
957
958# Inform the run-time linker about libc specialized initialization
959RTLDINFO =	-z rtldinfo=tls_rtldinfo
960
961DYNFLAGS +=	-e __rtboot -M $(MAPFILE) $(RTLDINFO)
962DYNFLAGS +=	$(EXTN_DYNFLAGS)
963
964BUILD.s=	$(AS) $(ASFLAGS) $< -o $@
965
966# Override this top level flag so the compiler builds in its native
967# C99 mode.  This has been enabled to support the complex arithmetic
968# added to libc.
969C99MODE=	$(C99_ENABLE)
970
971# libc method of building an archive
972BUILD.AR= $(RM) $@ ; \
973	$(AR) q $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%)| $(TSORT)`
974
975# extra files for the clean target
976CLEANFILES=			\
977	../port/gen/errlst.c	\
978	../port/gen/new_list.c	\
979	assym.h			\
980	genassym		\
981	crt/_rtld.s		\
982	crt/_rtbootld.s		\
983	pics/_rtbootld.o	\
984	pics/crti.o		\
985	pics/crtn.o		\
986	pics/values-Xa.o	\
987	$(ALTPICS)
988
989CLOBBERFILES +=	$(MAPFILE) $(LIB_PIC)
990
991# list of C source for lint
992SRCS=							\
993	$(ATOMICOBJS:%.o=$(SRC)/common/atomic/%.c)	\
994	$(COMOBJS:%.o=$(SRC)/common/util/%.c)		\
995	$(PORTFP:%.o=../port/fp/%.c)			\
996	$(PORTGEN:%.o=../port/gen/%.c)			\
997	$(PORTI18N:%.o=../port/i18n/%.c)		\
998	$(PORTPRINT:%.o=../port/print/%.c)		\
999	$(PORTREGEX:%.o=../port/regex/%.c)		\
1000	$(PORTSTDIO:%.o=../port/stdio/%.c)		\
1001	$(PORTSYS:%.o=../port/sys/%.c)			\
1002	$(THREADSOBJS:%.o=../port/threads/%.c)		\
1003	$(THREADSMACHOBJS:%.o=../$(MACH)/threads/%.c)	\
1004	$(UNWINDMACHOBJS:%.o=../port/unwind/%.c)	\
1005	$(FPOBJS:%.o=../$(MACH)/fp/%.c)			\
1006	$(LIBCBASE)/crt/_ftou.c				\
1007	$(LIBCBASE)/gen/_xregs_clrptr.c			\
1008	$(LIBCBASE)/gen/ecvt.c				\
1009	$(LIBCBASE)/gen/getctxt.c			\
1010	$(LIBCBASE)/gen/lexp10.c			\
1011	$(LIBCBASE)/gen/llog10.c			\
1012	$(LIBCBASE)/gen/lmul.c				\
1013	$(LIBCBASE)/gen/makectxt.c			\
1014	$(LIBCBASE)/gen/siginfolst.c			\
1015	$(LIBCBASE)/gen/siglongjmp.c			\
1016	$(LIBCBASE)/gen/swapctxt.c			\
1017	$(LIBCBASE)/sys/ptrace.c
1018
1019# conditional assignments
1020$(DYNLIB) $(LIB_PIC) := DYNOBJS = _rtbootld.o
1021$(DYNLIB) := CRTI = crti.o values-Xa.o
1022$(DYNLIB) := CRTN = crtn.o
1023
1024$(DYNLIB):	$(MAPFILE)
1025
1026$(MAPFILE):
1027	@cd $(MAPDIR); $(MAKE) mapfile
1028
1029# Files which need the threads .il inline template
1030TIL=				\
1031	alloc.o			\
1032	assfail.o		\
1033	atexit.o		\
1034	atfork.o		\
1035	cancel.o		\
1036	door_calls.o		\
1037	errno.o			\
1038	getctxt.o		\
1039	lwp.o			\
1040	machdep.o		\
1041	pthr_attr.o		\
1042	pthr_barrier.o		\
1043	pthr_cond.o		\
1044	pthr_mutex.o		\
1045	pthr_rwlock.o		\
1046	pthread.o		\
1047	rand.o			\
1048	rtsched.o		\
1049	rwlock.o		\
1050	scalls.o		\
1051	sema.o			\
1052	sigaction.o		\
1053	spawn.o			\
1054	stack.o			\
1055	swapctxt.o		\
1056	synch.o			\
1057	tdb_agent.o		\
1058	thr.o			\
1059	thread_interface.o	\
1060	tls.o			\
1061	tsd.o			\
1062	unwind.o
1063
1064$(TIL:%=pics/%) := CFLAGS += $(LIBCBASE)/threads/sparc.il
1065
1066# Files in port/fp subdirectory that need base.il inline template
1067IL=				\
1068	__flt_decim.o		\
1069	decimal_bin.o
1070
1071$(IL:%=pics/%) := CFLAGS += $(LIBCBASE)/fp/base.il
1072
1073# Files in fp subdirectory which need __quad.il inline template
1074QIL=				\
1075	_Q_add.o		\
1076	_Q_cmp.o		\
1077	_Q_cmpe.o		\
1078	_Q_div.o		\
1079	_Q_dtoq.o		\
1080	_Q_fcc.o		\
1081	_Q_mul.o		\
1082	_Q_qtod.o		\
1083	_Q_qtoi.o		\
1084	_Q_qtos.o		\
1085	_Q_qtou.o		\
1086	_Q_sqrt.o		\
1087	_Q_stoq.o		\
1088	_Q_sub.o
1089
1090$(QIL:%=pics/%) := CFLAGS += ../$(MACH)/fp/__quad.il
1091pics/_Q%.o := sparc_COPTFLAG = -xO4 -dalign
1092pics/__quad%.o := sparc_COPTFLAG = -xO4 -dalign
1093
1094# large-file-aware components that should be built large
1095
1096$(COMSYSOBJS64:%=pics/%) := \
1097	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1098
1099$(SYSOBJS64:%=pics/%) := \
1100	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1101
1102$(PORTGEN64:%=pics/%) := \
1103	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1104
1105$(PORTSTDIO64:%=pics/%) := \
1106	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1107
1108$(PORTSYS64:%=pics/%) := \
1109	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1110
1111$(PORTSTDIO_W:%=pics/%) := \
1112	CPPFLAGS += -D_WIDE
1113
1114$(PORTPRINT_W:%=pics/%) := \
1115	CPPFLAGS += -D_WIDE
1116
1117# printf/scanf functions to support c89-sized intmax_t variables
1118$(PORTPRINT_C89:%=pics/%) := \
1119	CPPFLAGS += -D_C89_INTMAX32
1120
1121$(PORTSTDIO_C89:%=pics/%) := \
1122	CPPFLAGS += -D_C89_INTMAX32
1123
1124$(PORTI18N_COND:%=pics/%) := \
1125	CPPFLAGS += -D_WCS_LONGLONG
1126
1127# Files which need extra optimization
1128pics/getenv.o := sparc_COPTFLAG = -xO4
1129
1130.KEEP_STATE:
1131
1132all: $(LIBS) $(LIB_PIC)
1133
1134lint	:=	CPPFLAGS += -I../$(MACH)/fp
1135lint	:=	CPPFLAGS += -D_MSE_INT_H -D_LCONV_C99
1136lint	:=	LINTFLAGS += -mn
1137
1138lint:
1139	@echo $(LINT.c) ... $(LDLIBS)
1140	@$(LINT.c) $(SRCS) $(LDLIBS)
1141
1142# these aren't listed as $(PICS), so we need to force CTF
1143pics/values-Xa.o := CFLAGS += $(CTF_FLAGS)
1144pics/values-Xa.o := CTFCONVERT_POST = $(CTFCONVERT_O)
1145
1146$(LINTLIB):= SRCS=../port/llib-lc
1147$(LINTLIB):= CPPFLAGS += -D_MSE_INT_H
1148$(LINTLIB):= LINTFLAGS=-nvx
1149
1150# object files that depend on inline template
1151$(TIL:%=pics/%): $(LIBCBASE)/threads/sparc.il
1152$(IL:%=pics/%): $(LIBCBASE)/fp/base.il
1153$(QIL:%=pics/%): ../$(MACH)/fp/__quad.il
1154
1155# include common libc targets
1156include ../Makefile.targ
1157
1158pics/getxby_door.o := CCMODE =
1159
1160# We need to strip out all CTF and DOF data from the static library
1161$(LIB_PIC) := DIR = pics
1162$(LIB_PIC): pics $$(PICS)
1163	$(BUILD.AR)
1164	$(MCS) -d -n .SUNW_ctf $@ > /dev/null 2>&1
1165	$(MCS) -d -n .SUNW_dof $@ > /dev/null 2>&1
1166	$(AR) -ts $@ > /dev/null
1167	$(POST_PROCESS_A)
1168
1169# special cases
1170$(STRETS:%=pics/%): crt/stret.s
1171	$(AS) $(ASFLAGS) -DSTRET$(@F:stret%.o=%) crt/stret.s -o $@
1172	$(POST_PROCESS_O)
1173
1174crt/_rtbootld.s:	crt/_rtboot.s crt/_rtld.c
1175	$(CC) $(CPPFLAGS) $(CTF_FLAGS) -O -S -K pic \
1176	    crt/_rtld.c -o crt/_rtld.s
1177	$(CAT) crt/_rtboot.s crt/_rtld.s > $@
1178	$(RM) crt/_rtld.s
1179
1180# partially built from C source
1181pics/_rtbootld.o: crt/_rtbootld.s
1182	$(AS) $(ASFLAGS) crt/_rtbootld.s -o $@
1183	$(CTFCONVERT_O)
1184
1185ASSYMDEP_OBJS=			\
1186	_lwp_mutex_unlock.o	\
1187	_stack_grow.o		\
1188	asm_subr.o		\
1189	tls_get_addr.o		\
1190	unwind_frame.o		\
1191	vfork.o
1192
1193$(ASSYMDEP_OBJS:%=pics/%)	:=	CPPFLAGS += -I.
1194
1195$(ASSYMDEP_OBJS:%=pics/%): assym.h
1196
1197# assym.h build rules
1198
1199GENASSYM_C = ../$(MACH)/genassym.c
1200
1201# XXX	A hack.  Perhaps this should be 'CPPFLAGS.native' and
1202#	live in Makefile.master
1203
1204CPPFLAGS.genassym = \
1205	$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
1206
1207genassym: $(GENASSYM_C)
1208	$(NATIVECC) -I$(LIBCBASE)/inc -I../inc \
1209		$(CPPFLAGS.genassym) -o $@ $(GENASSYM_C)
1210
1211OFFSETS = ../$(MACH)/offsets.in
1212
1213assym.h: $(OFFSETS) genassym
1214	$(OFFSETS_CREATE) <$(OFFSETS) >$@
1215	./genassym >>$@
1216
1217# derived C source and related explicit dependencies
1218../port/gen/errlst.c + \
1219../port/gen/new_list.c: ../port/gen/errlist ../port/gen/errlist.awk
1220	cd ../port/gen; pwd; $(AWK) -f errlist.awk < errlist
1221
1222pics/errlst.o: ../port/gen/errlst.c
1223
1224pics/new_list.o: ../port/gen/new_list.c
1225