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